diff --git a/.gitignore b/.gitignore index dacec54a5..35e3dd14b 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ _Deparsed_XSubs.pm porymap.project.cfg .vscode/*.* *.js +*.sym diff --git a/asm/macros/event.inc b/asm/macros/event.inc index ef1b077de..55c6469a8 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,26 +1533,27 @@ .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 - @ Sets the color of the text in standard message boxes. 0x00 produces blue (male) text, 0x01 produces red (female) text, 0xFF resets the color to the default for the current OW's gender, and all other values produce black text. + @ Sets the color of the text in standard message boxes. color is any NPC_TEXT_COLOR_* constant. + @ The color will be reset to NPC_TEXT_COLOR_DEFAULT whenever ProcessPlayerFieldInput is called. .macro textcolor color:req .byte 0xc7 .byte \color .endm - @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened. - .macro loadhelp pointer:req + @ Displays the help menu with the given text. + .macro loadhelp msg:req .byte 0xc8 - .4byte \pointer + .4byte \msg .endm - @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened. + @ Erases the help menu .macro unloadhelp .byte 0xc9 .endm @@ -1387,28 +1568,30 @@ .byte 0xcb .endm - @ Compares the value of a hidden variable to a dword. - .macro comparehiddenvar a:req, value:req + @ Reads the value of the specified game stat and compares it to the specified value. + @ Sets the script comparisonResult to 0 if stat < value, 1 if stat == value, and 2 if stat > value. + .macro comparestat statId:req, value:req .byte 0xcc - .byte \a + .byte \statId .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 +1601,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. @@ -1434,14 +1617,18 @@ .byte \location .endm - .macro getbraillestringwidth pointer:req + @ Gets the width of the specified message in the Braille font and sets the result to VAR_0x8004. + .macro getbraillestringwidth msg:req .byte 0xd3 - .4byte \pointer + .4byte \msg .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 +1646,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 +1700,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,51 +1771,42 @@ 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 callstd STD_FIND_ITEM .endm + @ Prints the message "{PLAYER} put the {ITEM} in the {POCKET}." The item name is pluralized, if applicable. .macro putitemaway item:req, amount=1 setorcopyvar VAR_0x8000, \item setorcopyvar VAR_0x8001, \amount callstd STD_PUT_ITEM_AWAY .endm - .macro giveitem_msg msg:req, item:req, amount=1, fanfare=MUS_LEVEL_UP - additem \item, \amount - msgreceiveditem \msg, \item, \amount, \fanfare - .endm - + @ Prints the provided message after playing the fanfare music (can only be MUS_LEVEL_UP or MUS_OBTAIN_KEY_ITEM). + @ It then prints the message shown by using putitemaway. .macro msgreceiveditem msg:req, item:req, amount=1, fanfare=MUS_LEVEL_UP loadword 0, \msg setorcopyvar VAR_0x8000, \item @@ -1617,12 +1815,20 @@ callstd STD_RECEIVED_ITEM .endm + @ Adds the specified item to the bag, then prints a message with fanfare. See description of msgreceiveditem. + .macro giveitem_msg msg:req, item:req, amount=1, fanfare=MUS_LEVEL_UP + additem \item, \amount + msgreceiveditem \msg, \item, \amount, \fanfare + .endm + + @ Depends on the provided function. With the default argument, unlocks the specified entry in the Fame Checker. .macro famechecker person:req, index:req, function=SetFlavorTextFlagFromSpecialVars setvar VAR_0x8004, \person setvar VAR_0x8005, \index special \function .endm + @ Sets the 'defeated' flag for all trainers in the specified gym. .macro set_gym_trainers gym:req setvar VAR_0x8008, \gym call EventScript_SetGymTrainers @@ -1635,9 +1841,18 @@ goto_if_eq \dest .endm + @ Prints a braille message, then waits for users input. .macro braillemessage_wait text:req setvar VAR_0x8006, 0 braillemessage \text 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/asm/macros/movement.inc b/asm/macros/movement.inc index 7cbd1ffc4..775efb245 100644 --- a/asm/macros/movement.inc +++ b/asm/macros/movement.inc @@ -1,136 +1,177 @@ - .macro create_movement name - enum _\name + .macro create_movement_action name:req, value:req .macro \name - .byte _\name + .byte \value .endm .endm - enum_start 0 - create_movement face_down - create_movement face_up - create_movement face_left - create_movement face_right - create_movement face_down_fast - create_movement face_up_fast - create_movement face_left_fast - create_movement face_right_fast - create_movement walk_slower_down - create_movement walk_slower_up - create_movement walk_slower_left - create_movement walk_slower_right - create_movement walk_slow_down - create_movement walk_slow_up - create_movement walk_slow_left - create_movement walk_slow_right - create_movement walk_down - create_movement walk_up - create_movement walk_left - create_movement walk_right - create_movement jump_2_down - create_movement jump_2_up - create_movement jump_2_left - create_movement jump_2_right - create_movement delay_1 - create_movement delay_2 - create_movement delay_4 - create_movement delay_8 - create_movement delay_16 - create_movement walk_fast_down - create_movement walk_fast_up - create_movement walk_fast_left - create_movement walk_fast_right - create_movement walk_in_place_slow_down - create_movement walk_in_place_slow_up - create_movement walk_in_place_slow_left - create_movement walk_in_place_slow_right - create_movement walk_in_place_down - create_movement walk_in_place_up - create_movement walk_in_place_left - create_movement walk_in_place_right - create_movement walk_in_place_fast_down - create_movement walk_in_place_fast_up - create_movement walk_in_place_fast_left - create_movement walk_in_place_fast_right - create_movement walk_in_place_fastest_down - create_movement walk_in_place_fastest_up - create_movement walk_in_place_fastest_left - create_movement walk_in_place_fastest_right - create_movement ride_water_current_down - create_movement ride_water_current_up - create_movement ride_water_current_lefft - create_movement ride_water_current_right - create_movement walk_fastest_down - create_movement walk_fastest_up - create_movement walk_fastest_left - create_movement walk_fastest_right - create_movement slide_down - create_movement slide_up - create_movement slide_left - create_movement slide_right - create_movement player_run_down - create_movement player_run_up - create_movement player_run_left - create_movement player_run_right - create_movement player_run_down_slow - create_movement player_run_up_slow - create_movement player_run_left_slow - create_movement player_run_right_slow - create_movement step_45 - create_movement jump_down_run - create_movement jump_up_run - create_movement jump_left_run - create_movement jump_right_run - create_movement face_player - create_movement face_away_player - create_movement lock_facing_direction - create_movement unlock_facing_direction - create_movement jump_down - create_movement jump_up - create_movement jump_left - create_movement jump_right - create_movement jump_in_place_down - create_movement jump_in_place_up - create_movement jump_in_place_left - create_movement jump_in_place_right - create_movement jump_in_place_down_up - create_movement jump_in_place_up_down - create_movement jump_in_place_left_right - create_movement jump_in_place_right_left - create_movement face_original_direction - create_movement nurse_joy_bow - create_movement enable_jump_landing_ground_effect - create_movement disable_jump_landing_ground_effect - create_movement disable_anim - create_movement restore_anim - create_movement set_invisible - create_movement set_visible - create_movement emote_exclamation_mark - create_movement emote_question_mark - create_movement emote_x - create_movement emote_double_exclamation_mark - create_movement emote_smile - create_movement reveal_trainer - create_movement rock_smash_break - create_movement cut_tree - - enum_start 0x94 - create_movement spin_down - create_movement spin_up - create_movement spin_left - create_movement spin_right - - enum_start 0x9b - create_movement walk_slowest_down - create_movement walk_slowest_up - create_movement walk_slowest_left - create_movement walk_slowest_right - create_movement shake_head_or_walk_in_place - - enum_start 0xa6 - create_movement jump_special_with_effect_down - create_movement jump_special_with_effect_up - create_movement jump_special_with_effect_left - create_movement jump_special_with_effect_right - - enum_start 0xfe - create_movement step_end + create_movement_action face_down, MOVEMENT_ACTION_FACE_DOWN + create_movement_action face_up, MOVEMENT_ACTION_FACE_UP + create_movement_action face_left, MOVEMENT_ACTION_FACE_LEFT + create_movement_action face_right, MOVEMENT_ACTION_FACE_RIGHT + create_movement_action face_down_fast, MOVEMENT_ACTION_FACE_DOWN_FAST + create_movement_action face_up_fast, MOVEMENT_ACTION_FACE_UP_FAST + create_movement_action face_left_fast, MOVEMENT_ACTION_FACE_LEFT_FAST + create_movement_action face_right_fast, MOVEMENT_ACTION_FACE_RIGHT_FAST + create_movement_action walk_slower_down, MOVEMENT_ACTION_WALK_SLOWER_DOWN + create_movement_action walk_slower_up, MOVEMENT_ACTION_WALK_SLOWER_UP + create_movement_action walk_slower_left, MOVEMENT_ACTION_WALK_SLOWER_LEFT + create_movement_action walk_slower_right, MOVEMENT_ACTION_WALK_SLOWER_RIGHT + create_movement_action walk_slow_down, MOVEMENT_ACTION_WALK_SLOW_DOWN + create_movement_action walk_slow_up, MOVEMENT_ACTION_WALK_SLOW_UP + create_movement_action walk_slow_left, MOVEMENT_ACTION_WALK_SLOW_LEFT + create_movement_action walk_slow_right, MOVEMENT_ACTION_WALK_SLOW_RIGHT + create_movement_action walk_down, MOVEMENT_ACTION_WALK_NORMAL_DOWN + create_movement_action walk_up, MOVEMENT_ACTION_WALK_NORMAL_UP + create_movement_action walk_left, MOVEMENT_ACTION_WALK_NORMAL_LEFT + create_movement_action walk_right, MOVEMENT_ACTION_WALK_NORMAL_RIGHT + create_movement_action jump_2_down, MOVEMENT_ACTION_JUMP_2_DOWN + create_movement_action jump_2_up, MOVEMENT_ACTION_JUMP_2_UP + create_movement_action jump_2_left, MOVEMENT_ACTION_JUMP_2_LEFT + create_movement_action jump_2_right, MOVEMENT_ACTION_JUMP_2_RIGHT + create_movement_action delay_1, MOVEMENT_ACTION_DELAY_1 + create_movement_action delay_2, MOVEMENT_ACTION_DELAY_2 + create_movement_action delay_4, MOVEMENT_ACTION_DELAY_4 + create_movement_action delay_8, MOVEMENT_ACTION_DELAY_8 + create_movement_action delay_16, MOVEMENT_ACTION_DELAY_16 + create_movement_action walk_fast_down, MOVEMENT_ACTION_WALK_FAST_DOWN + create_movement_action walk_fast_up, MOVEMENT_ACTION_WALK_FAST_UP + create_movement_action walk_fast_left, MOVEMENT_ACTION_WALK_FAST_LEFT + create_movement_action walk_fast_right, MOVEMENT_ACTION_WALK_FAST_RIGHT + create_movement_action walk_in_place_slow_down, MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_DOWN + create_movement_action walk_in_place_slow_up, MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_UP + create_movement_action walk_in_place_slow_left, MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_LEFT + create_movement_action walk_in_place_slow_right, MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_RIGHT + create_movement_action walk_in_place_down, MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_DOWN + create_movement_action walk_in_place_up, MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_UP + create_movement_action walk_in_place_left, MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_LEFT + create_movement_action walk_in_place_right, MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_RIGHT + create_movement_action walk_in_place_fast_down, MOVEMENT_ACTION_WALK_IN_PLACE_FAST_DOWN + create_movement_action walk_in_place_fast_up, MOVEMENT_ACTION_WALK_IN_PLACE_FAST_UP + create_movement_action walk_in_place_fast_left, MOVEMENT_ACTION_WALK_IN_PLACE_FAST_LEFT + create_movement_action walk_in_place_fast_right, MOVEMENT_ACTION_WALK_IN_PLACE_FAST_RIGHT + create_movement_action walk_in_place_faster_down, MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_DOWN + create_movement_action walk_in_place_faster_up, MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_UP + create_movement_action walk_in_place_faster_left, MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_LEFT + create_movement_action walk_in_place_faster_right, MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_RIGHT + create_movement_action ride_water_current_down, MOVEMENT_ACTION_RIDE_WATER_CURRENT_DOWN + create_movement_action ride_water_current_up, MOVEMENT_ACTION_RIDE_WATER_CURRENT_UP + create_movement_action ride_water_current_lefft, MOVEMENT_ACTION_RIDE_WATER_CURRENT_LEFT + create_movement_action ride_water_current_right, MOVEMENT_ACTION_RIDE_WATER_CURRENT_RIGHT + create_movement_action walk_faster_down, MOVEMENT_ACTION_WALK_FASTER_DOWN + create_movement_action walk_faster_up, MOVEMENT_ACTION_WALK_FASTER_UP + create_movement_action walk_faster_left, MOVEMENT_ACTION_WALK_FASTER_LEFT + create_movement_action walk_faster_right, MOVEMENT_ACTION_WALK_FASTER_RIGHT + create_movement_action slide_down, MOVEMENT_ACTION_SLIDE_DOWN + create_movement_action slide_up, MOVEMENT_ACTION_SLIDE_UP + create_movement_action slide_left, MOVEMENT_ACTION_SLIDE_LEFT + create_movement_action slide_right, MOVEMENT_ACTION_SLIDE_RIGHT + create_movement_action player_run_down, MOVEMENT_ACTION_PLAYER_RUN_DOWN + create_movement_action player_run_up, MOVEMENT_ACTION_PLAYER_RUN_UP + create_movement_action player_run_left, MOVEMENT_ACTION_PLAYER_RUN_LEFT + create_movement_action player_run_right, MOVEMENT_ACTION_PLAYER_RUN_RIGHT + create_movement_action player_run_down_slow, MOVEMENT_ACTION_PLAYER_RUN_DOWN_SLOW + create_movement_action player_run_up_slow, MOVEMENT_ACTION_PLAYER_RUN_UP_SLOW + create_movement_action player_run_left_slow, MOVEMENT_ACTION_PLAYER_RUN_LEFT_SLOW + create_movement_action player_run_right_slow, MOVEMENT_ACTION_PLAYER_RUN_RIGHT_SLOW + create_movement_action start_anim_in_direction, MOVEMENT_ACTION_START_ANIM_IN_DIRECTION + create_movement_action jump_special_down, MOVEMENT_ACTION_JUMP_SPECIAL_DOWN + create_movement_action jump_special_up, MOVEMENT_ACTION_JUMP_SPECIAL_UP + create_movement_action jump_special_left, MOVEMENT_ACTION_JUMP_SPECIAL_LEFT + create_movement_action jump_special_right, MOVEMENT_ACTION_JUMP_SPECIAL_RIGHT + create_movement_action face_player, MOVEMENT_ACTION_FACE_PLAYER + create_movement_action face_away_player, MOVEMENT_ACTION_FACE_AWAY_PLAYER + create_movement_action lock_facing_direction, MOVEMENT_ACTION_LOCK_FACING_DIRECTION + create_movement_action unlock_facing_direction, MOVEMENT_ACTION_UNLOCK_FACING_DIRECTION + create_movement_action jump_down, MOVEMENT_ACTION_JUMP_DOWN + create_movement_action jump_up, MOVEMENT_ACTION_JUMP_UP + create_movement_action jump_left, MOVEMENT_ACTION_JUMP_LEFT + create_movement_action jump_right, MOVEMENT_ACTION_JUMP_RIGHT + create_movement_action jump_in_place_down, MOVEMENT_ACTION_JUMP_IN_PLACE_DOWN + create_movement_action jump_in_place_up, MOVEMENT_ACTION_JUMP_IN_PLACE_UP + create_movement_action jump_in_place_left, MOVEMENT_ACTION_JUMP_IN_PLACE_LEFT + create_movement_action jump_in_place_right, MOVEMENT_ACTION_JUMP_IN_PLACE_RIGHT + create_movement_action jump_in_place_down_up, MOVEMENT_ACTION_JUMP_IN_PLACE_DOWN_UP + create_movement_action jump_in_place_up_down, MOVEMENT_ACTION_JUMP_IN_PLACE_UP_DOWN + create_movement_action jump_in_place_left_right, MOVEMENT_ACTION_JUMP_IN_PLACE_LEFT_RIGHT + create_movement_action jump_in_place_right_left, MOVEMENT_ACTION_JUMP_IN_PLACE_RIGHT_LEFT + create_movement_action face_original_direction, MOVEMENT_ACTION_FACE_ORIGINAL_DIRECTION + create_movement_action nurse_joy_bow, MOVEMENT_ACTION_NURSE_JOY_BOW_DOWN + create_movement_action enable_jump_landing_ground_effect, MOVEMENT_ACTION_ENABLE_JUMP_LANDING_GROUND_EFFECT + create_movement_action disable_jump_landing_ground_effect, MOVEMENT_ACTION_DISABLE_JUMP_LANDING_GROUND_EFFECT + create_movement_action disable_anim, MOVEMENT_ACTION_DISABLE_ANIMATION + create_movement_action restore_anim, MOVEMENT_ACTION_RESTORE_ANIMATION + create_movement_action set_invisible, MOVEMENT_ACTION_SET_INVISIBLE + create_movement_action set_visible, MOVEMENT_ACTION_SET_VISIBLE + create_movement_action emote_exclamation_mark, MOVEMENT_ACTION_EMOTE_EXCLAMATION_MARK + create_movement_action emote_question_mark, MOVEMENT_ACTION_EMOTE_QUESTION_MARK + create_movement_action emote_x, MOVEMENT_ACTION_EMOTE_X + create_movement_action emote_double_exclamation_mark, MOVEMENT_ACTION_EMOTE_DOUBLE_EXCL_MARK + create_movement_action emote_smile, MOVEMENT_ACTION_EMOTE_SMILE + create_movement_action reveal_trainer, MOVEMENT_ACTION_REVEAL_TRAINER + create_movement_action rock_smash_break, MOVEMENT_ACTION_ROCK_SMASH_BREAK + create_movement_action cut_tree, MOVEMENT_ACTION_CUT_TREE + create_movement_action set_fixed_priority, MOVEMENT_ACTION_SET_FIXED_PRIORITY + create_movement_action clear_fixed_priority, MOVEMENT_ACTION_CLEAR_FIXED_PRIORITY + create_movement_action init_affine_anim, MOVEMENT_ACTION_INIT_AFFINE_ANIM + create_movement_action clear_affine_anim, MOVEMENT_ACTION_CLEAR_AFFINE_ANIM + create_movement_action walk_down_start_affine, MOVEMENT_ACTION_WALK_DOWN_START_AFFINE + create_movement_action walk_down_affine, MOVEMENT_ACTION_WALK_DOWN_AFFINE + create_movement_action acro_wheelie_face_down, MOVEMENT_ACTION_ACRO_WHEELIE_FACE_DOWN + create_movement_action acro_wheelie_face_up, MOVEMENT_ACTION_ACRO_WHEELIE_FACE_UP + create_movement_action acro_wheelie_face_left, MOVEMENT_ACTION_ACRO_WHEELIE_FACE_LEFT + create_movement_action acro_wheelie_face_right, MOVEMENT_ACTION_ACRO_WHEELIE_FACE_RIGHT + create_movement_action acro_pop_wheelie_down, MOVEMENT_ACTION_ACRO_POP_WHEELIE_DOWN + create_movement_action acro_pop_wheelie_up, MOVEMENT_ACTION_ACRO_POP_WHEELIE_UP + create_movement_action acro_pop_wheelie_left, MOVEMENT_ACTION_ACRO_POP_WHEELIE_LEFT + create_movement_action acro_pop_wheelie_right, MOVEMENT_ACTION_ACRO_POP_WHEELIE_RIGHT + create_movement_action acro_end_wheelie_face_down, MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_DOWN + create_movement_action acro_end_wheelie_face_up, MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_UP + create_movement_action acro_end_wheelie_face_left, MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_LEFT + create_movement_action acro_end_wheelie_face_right, MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_RIGHT + create_movement_action acro_wheelie_hop_face_down, MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_DOWN + create_movement_action acro_wheelie_hop_face_up, MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_UP + create_movement_action acro_wheelie_hop_face_left, MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_LEFT + create_movement_action acro_wheelie_hop_face_right, MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_RIGHT + create_movement_action acro_wheelie_hop_down, MOVEMENT_ACTION_ACRO_WHEELIE_HOP_DOWN + create_movement_action acro_wheelie_hop_up, MOVEMENT_ACTION_ACRO_WHEELIE_HOP_UP + create_movement_action acro_wheelie_hop_left, MOVEMENT_ACTION_ACRO_WHEELIE_HOP_LEFT + create_movement_action acro_wheelie_hop_right, MOVEMENT_ACTION_ACRO_WHEELIE_HOP_RIGHT + create_movement_action acro_wheelie_jump_down, MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_DOWN + create_movement_action acro_wheelie_jump_up, MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_UP + create_movement_action acro_wheelie_jump_left, MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_LEFT + create_movement_action acro_wheelie_jump_right, MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_RIGHT + create_movement_action acro_wheelie_in_place_down, MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_DOWN + create_movement_action acro_wheelie_in_place_up, MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_UP + create_movement_action acro_wheelie_in_place_left, MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_LEFT + create_movement_action acro_wheelie_in_place_right, MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_RIGHT + create_movement_action acro_pop_wheelie_move_down, MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_DOWN + create_movement_action acro_pop_wheelie_move_up, MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_UP + create_movement_action acro_pop_wheelie_move_left, MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_LEFT + create_movement_action acro_pop_wheelie_move_right, MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_RIGHT + create_movement_action acro_wheelie_move_down, MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_DOWN + create_movement_action acro_wheelie_move_up, MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_UP + create_movement_action acro_wheelie_move_left, MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_LEFT + create_movement_action acro_wheelie_move_right, MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_RIGHT + create_movement_action spin_down, MOVEMENT_ACTION_SPIN_DOWN + create_movement_action spin_up, MOVEMENT_ACTION_SPIN_UP + create_movement_action spin_left, MOVEMENT_ACTION_SPIN_LEFT + create_movement_action spin_right, MOVEMENT_ACTION_SPIN_RIGHT + create_movement_action raise_hand_and_stop, MOVEMENT_ACTION_RAISE_HAND_AND_STOP + create_movement_action raise_hand_and_jump, MOVEMENT_ACTION_RAISE_HAND_AND_JUMP + create_movement_action raise_hand_and_swim, MOVEMENT_ACTION_RAISE_HAND_AND_SWIM + create_movement_action walk_slowest_down, MOVEMENT_ACTION_WALK_SLOWEST_DOWN + create_movement_action walk_slowest_up, MOVEMENT_ACTION_WALK_SLOWEST_UP + create_movement_action walk_slowest_left, MOVEMENT_ACTION_WALK_SLOWEST_LEFT + create_movement_action walk_slowest_right, MOVEMENT_ACTION_WALK_SLOWEST_RIGHT + create_movement_action shake_head_or_walk_in_place, MOVEMENT_ACTION_SHAKE_HEAD_OR_WALK_IN_PLACE + create_movement_action glide_down, MOVEMENT_ACTION_GLIDE_DOWN + create_movement_action glide_up, MOVEMENT_ACTION_GLIDE_UP + create_movement_action glide_left, MOVEMENT_ACTION_GLIDE_LEFT + create_movement_action glide_right, MOVEMENT_ACTION_GLIDE_RIGHT + create_movement_action fly_up, MOVEMENT_ACTION_FLY_UP + create_movement_action fly_down, MOVEMENT_ACTION_FLY_DOWN + create_movement_action jump_special_with_effect_down, MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_DOWN + create_movement_action jump_special_with_effect_up, MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_UP + create_movement_action jump_special_with_effect_left, MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_LEFT + create_movement_action jump_special_with_effect_right, MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_RIGHT + create_movement_action step_end, MOVEMENT_ACTION_STEP_END diff --git a/data/event_scripts.s b/data/event_scripts.s index 004f61131..e76eb50f5 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,12 +1112,12 @@ EventScript_ChangePokemonNickname:: @ Unused EventScript_HandOverItem:: - getitemname 0, VAR_0x8004 + bufferitemname STR_VAR_1, VAR_0x8004 playfanfare MUS_OBTAIN_TMHM message Text_HandedOverItem waitmessage waitfanfare - removeitem VAR_0x8004, 1 + removeitem VAR_0x8004 return .include "data/scripts/pokemon_league.inc" @@ -1175,16 +1175,16 @@ EventScript_ReleaseEnd:: @ Unused EventScript_DelayedLookAround:: lockall - applymovement VAR_0x8004, Movement_WalkInPlaceFastestLeft + applymovement VAR_0x8004, Movement_WalkInPlaceFasterLeft waitmovement 0 delay 20 - applymovement VAR_0x8004, Movement_WalkInPlaceFastestUp + applymovement VAR_0x8004, Movement_WalkInPlaceFasterUp waitmovement 0 delay 20 - applymovement VAR_0x8004, Movement_WalkInPlaceFastestRight + applymovement VAR_0x8004, Movement_WalkInPlaceFasterRight waitmovement 0 delay 20 - applymovement VAR_0x8004, Movement_WalkInPlaceFastestDown + applymovement VAR_0x8004, Movement_WalkInPlaceFasterDown waitmovement 0 delay 20 releaseall @@ -1249,8 +1249,7 @@ VermilionCity_PokemonCenter_1F_EventScript_VSSeekerWoman:: msgbox VermilionCity_PokemonCenter_1F_Text_UrgeToBattleSomeoneAgain setflag FLAG_GOT_VS_SEEKER giveitem ITEM_VS_SEEKER - compare VAR_RESULT, FALSE - goto_if_eq EventScript_BagIsFull + goto_if_eq VAR_RESULT, FALSE, EventScript_BagIsFull msgbox VermilionCity_PokemonCenter_1F_Text_UseDeviceForRematches release end @@ -1264,7 +1263,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 +1279,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" @@ -1317,7 +1316,7 @@ EventScript_BrailleCursorWaitButton:: return EventScript_NoMoreRoomForPokemon:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox Text_NoMoreRoomForPokemon release end diff --git a/data/maps/BirthIsland_Exterior/scripts.inc b/data/maps/BirthIsland_Exterior/scripts.inc index 9c42fd3c1..64515f8d5 100644 --- a/data/maps/BirthIsland_Exterior/scripts.inc +++ b/data/maps/BirthIsland_Exterior/scripts.inc @@ -37,8 +37,7 @@ BirthIsland_Exterior_OnResume:: BirthIsland_Exterior_EventScript_TryRemoveDeoxys:: specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_CAUGHT - goto_if_ne EventScript_Return + goto_if_ne VAR_RESULT, B_OUTCOME_CAUGHT, EventScript_Return removeobject LOCALID_DEOXYS return @@ -71,9 +70,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, MAP_NUM(BIRTH_ISLAND_EXTERIOR) + setfieldeffectargument 2, MAP_GROUP(BIRTH_ISLAND_EXTERIOR) dofieldeffect FLDEFF_DESTROY_DEOXYS_ROCK playbgm MUS_ENCOUNTER_DEOXYS, 0 waitfieldeffect FLDEFF_DESTROY_DEOXYS_ROCK @@ -84,21 +83,15 @@ BirthIsland_Exterior_EventScript_Deoxys:: delay 40 waitmoncry setvar VAR_LAST_TALKED, LOCALID_DEOXYS - setvar VAR_0x8004, SPECIES_DEOXYS - setvar VAR_0x8005, 30 @ Level - setvar VAR_0x8006, ITEM_NONE - special CreateEventLegalEnemyMon + seteventmon SPECIES_DEOXYS, 30 setflag FLAG_SYS_SPECIAL_WILD_BATTLE special StartLegendaryBattle waitstate clearflag FLAG_SYS_SPECIAL_WILD_BATTLE specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_WON - goto_if_eq BirthIsland_Exterior_EventScript_DefeatedDeoxys - compare VAR_RESULT, B_OUTCOME_RAN - goto_if_eq BirthIsland_Exterior_EventScript_RanFromDeoxys - compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED - goto_if_eq BirthIsland_Exterior_EventScript_RanFromDeoxys + goto_if_eq VAR_RESULT, B_OUTCOME_WON, BirthIsland_Exterior_EventScript_DefeatedDeoxys + goto_if_eq VAR_RESULT, B_OUTCOME_RAN, BirthIsland_Exterior_EventScript_RanFromDeoxys + goto_if_eq VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED, BirthIsland_Exterior_EventScript_RanFromDeoxys setflag FLAG_FOUGHT_DEOXYS release end diff --git a/data/maps/CeladonCity_Condominiums_1F/scripts.inc b/data/maps/CeladonCity_Condominiums_1F/scripts.inc index 088efff72..c18a042f0 100644 --- a/data/maps/CeladonCity_Condominiums_1F/scripts.inc +++ b/data/maps/CeladonCity_Condominiums_1F/scripts.inc @@ -10,8 +10,7 @@ CeladonCity_Condominiums_1F_EventScript_TeaWoman:: msgbox CeladonCity_Condominiums_1F_Text_TryThisDrinkInstead setflag FLAG_GOT_TEA giveitem ITEM_TEA - compare VAR_RESULT, FALSE - goto_if_eq EventScript_BagIsFull + goto_if_eq VAR_RESULT, FALSE, EventScript_BagIsFull msgbox CeladonCity_Condominiums_1F_Text_NothingBeatsThirstLikeTea release end diff --git a/data/maps/CeladonCity_Condominiums_3F/scripts.inc b/data/maps/CeladonCity_Condominiums_3F/scripts.inc index c4c7f1099..866138a9f 100644 --- a/data/maps/CeladonCity_Condominiums_3F/scripts.inc +++ b/data/maps/CeladonCity_Condominiums_3F/scripts.inc @@ -17,8 +17,7 @@ CeladonCity_Condominiums_3F_EventScript_Designer:: lock faceplayer specialvar VAR_RESULT, HasAllKantoMons - compare VAR_RESULT, TRUE - goto_if_eq CeladonCity_Condominiums_3F_EventScript_CompletedPokedex + goto_if_eq VAR_RESULT, TRUE, CeladonCity_Condominiums_3F_EventScript_CompletedPokedex msgbox CeladonCity_Condominiums_3F_Text_ImGameDesignerShowMeFinishedPokedex release end diff --git a/data/maps/CeladonCity_Condominiums_RoofRoom/scripts.inc b/data/maps/CeladonCity_Condominiums_RoofRoom/scripts.inc index 079e461af..9463564e7 100644 --- a/data/maps/CeladonCity_Condominiums_RoofRoom/scripts.inc +++ b/data/maps/CeladonCity_Condominiums_RoofRoom/scripts.inc @@ -11,13 +11,10 @@ CeladonCity_Condominiums_RoofRoom_EventScript_EeveeBall:: lock faceplayer setvar VAR_TEMP_1, SPECIES_EEVEE - givemon SPECIES_EEVEE, 25, ITEM_NONE - compare VAR_RESULT, 0 - goto_if_eq CeladonCity_Condominiums_RoofRoom_EventScript_GetEeveeParty - compare VAR_RESULT, 1 - goto_if_eq CeladonCity_Condominiums_RoofRoom_EventScript_GetEeveePC - compare VAR_RESULT, 2 - goto_if_eq EventScript_NoMoreRoomForPokemon + givemon SPECIES_EEVEE, 25 + goto_if_eq VAR_RESULT, 0, CeladonCity_Condominiums_RoofRoom_EventScript_GetEeveeParty + goto_if_eq VAR_RESULT, 1, CeladonCity_Condominiums_RoofRoom_EventScript_GetEeveePC + goto_if_eq VAR_RESULT, 2, EventScript_NoMoreRoomForPokemon release end @@ -27,10 +24,9 @@ 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 + goto_if_eq VAR_RESULT, NO, CeladonCity_Condominiums_RoofRoom_EventScript_SetGotEevee call EventScript_GetGiftMonPartySlot call EventScript_ChangePokemonNickname goto CeladonCity_Condominiums_RoofRoom_EventScript_SetGotEevee @@ -42,10 +38,9 @@ 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 + goto_if_eq VAR_RESULT, NO, CeladonCity_Condominiums_RoofRoom_EventScript_TransferEeveeToPC call EventScript_NameReceivedBoxMon goto CeladonCity_Condominiums_RoofRoom_EventScript_TransferEeveeToPC end diff --git a/data/maps/CeladonCity_DepartmentStore_Elevator/scripts.inc b/data/maps/CeladonCity_DepartmentStore_Elevator/scripts.inc index 6c01bd9f8..80b1d2c6d 100644 --- a/data/maps/CeladonCity_DepartmentStore_Elevator/scripts.inc +++ b/data/maps/CeladonCity_DepartmentStore_Elevator/scripts.inc @@ -58,8 +58,7 @@ CeladonCity_DepartmentStore_Elevator_EventScript_ChooseFloor:: CeladonCity_DepartmentStore_Elevator_EventScript_To1F:: setvar VAR_0x8006, 4 setdynamicwarp MAP_CELADON_CITY_DEPARTMENT_STORE_1F, 255, 6, 1 - compare VAR_ELEVATOR_FLOOR, 4 - goto_if_eq CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 4, CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect call CeladonCity_DepartmentStore_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 4 goto CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect @@ -68,8 +67,7 @@ CeladonCity_DepartmentStore_Elevator_EventScript_To1F:: CeladonCity_DepartmentStore_Elevator_EventScript_To2F:: setvar VAR_0x8006, 5 setdynamicwarp MAP_CELADON_CITY_DEPARTMENT_STORE_2F, 255, 6, 1 - compare VAR_ELEVATOR_FLOOR, 5 - goto_if_eq CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 5, CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect call CeladonCity_DepartmentStore_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 5 goto CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect @@ -78,8 +76,7 @@ CeladonCity_DepartmentStore_Elevator_EventScript_To2F:: CeladonCity_DepartmentStore_Elevator_EventScript_To3F:: setvar VAR_0x8006, 6 setdynamicwarp MAP_CELADON_CITY_DEPARTMENT_STORE_3F, 255, 6, 1 - compare VAR_ELEVATOR_FLOOR, 6 - goto_if_eq CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 6, CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect call CeladonCity_DepartmentStore_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 6 goto CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect @@ -88,8 +85,7 @@ CeladonCity_DepartmentStore_Elevator_EventScript_To3F:: CeladonCity_DepartmentStore_Elevator_EventScript_To4F:: setvar VAR_0x8006, 7 setdynamicwarp MAP_CELADON_CITY_DEPARTMENT_STORE_4F, 255, 6, 1 - compare VAR_ELEVATOR_FLOOR, 7 - goto_if_eq CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 7, CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect call CeladonCity_DepartmentStore_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 7 goto CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect @@ -98,8 +94,7 @@ CeladonCity_DepartmentStore_Elevator_EventScript_To4F:: CeladonCity_DepartmentStore_Elevator_EventScript_To5F:: setvar VAR_0x8006, 8 setdynamicwarp MAP_CELADON_CITY_DEPARTMENT_STORE_5F, 255, 6, 1 - compare VAR_ELEVATOR_FLOOR, 8 - goto_if_eq CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 8, CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect call CeladonCity_DepartmentStore_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 8 goto CeladonCity_DepartmentStore_Elevator_EventScript_ExitFloorSelect diff --git a/data/maps/CeladonCity_DepartmentStore_Roof/scripts.inc b/data/maps/CeladonCity_DepartmentStore_Roof/scripts.inc index 14d250852..364d83c43 100644 --- a/data/maps/CeladonCity_DepartmentStore_Roof/scripts.inc +++ b/data/maps/CeladonCity_DepartmentStore_Roof/scripts.inc @@ -7,22 +7,18 @@ CeladonCity_DepartmentStore_Roof_EventScript_ThirstyGirl:: lock faceplayer call CeladonCity_DepartmentStore_Roof_EventScript_CheckPlayerHasDrinks - compare VAR_TEMP_1, 0 - goto_if_eq CeladonCity_DepartmentStore_Roof_EventScript_IWantDrink + goto_if_eq VAR_TEMP_1, 0, CeladonCity_DepartmentStore_Roof_EventScript_IWantDrink goto CeladonCity_DepartmentStore_Roof_EventScript_AskGiveDrink end CeladonCity_DepartmentStore_Roof_EventScript_CheckPlayerHasDrinks:: setvar VAR_TEMP_1, 0 - checkitem ITEM_FRESH_WATER, 1 - compare VAR_RESULT, TRUE - call_if_eq CeladonCity_DepartmentStore_Roof_EventScript_SetHasFreshWater - checkitem ITEM_SODA_POP, 1 - compare VAR_RESULT, TRUE - call_if_eq CeladonCity_DepartmentStore_Roof_EventScript_SetHasSodaPop - checkitem ITEM_LEMONADE, 1 - compare VAR_RESULT, TRUE - call_if_eq CeladonCity_DepartmentStore_Roof_EventScript_SetHasLemonade + checkitem ITEM_FRESH_WATER + call_if_eq VAR_RESULT, TRUE, CeladonCity_DepartmentStore_Roof_EventScript_SetHasFreshWater + checkitem ITEM_SODA_POP + call_if_eq VAR_RESULT, TRUE, CeladonCity_DepartmentStore_Roof_EventScript_SetHasSodaPop + checkitem ITEM_LEMONADE + call_if_eq VAR_RESULT, TRUE, CeladonCity_DepartmentStore_Roof_EventScript_SetHasLemonade return CeladonCity_DepartmentStore_Roof_EventScript_SetHasFreshWater:: @@ -39,12 +35,11 @@ CeladonCity_DepartmentStore_Roof_EventScript_SetHasLemonade:: CeladonCity_DepartmentStore_Roof_EventScript_AskGiveDrink:: msgbox CeladonCity_DepartmentStore_Roof_Text_ImThirstyGiveHerDrink, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CeladonCity_DepartmentStore_Roof_EventScript_DontGiveDrink - textcolor 3 + goto_if_eq VAR_RESULT, NO, CeladonCity_DepartmentStore_Roof_EventScript_DontGiveDrink + textcolor NPC_TEXT_COLOR_NEUTRAL message CeladonCity_DepartmentStore_Roof_Text_GiveWhichDrink waitmessage - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE switch VAR_TEMP_1 case 1, CeladonCity_DepartmentStore_Roof_EventScript_AskGiveFreshWater case 2, CeladonCity_DepartmentStore_Roof_EventScript_AskGiveSodaPop @@ -141,26 +136,22 @@ CeladonCity_DepartmentStore_Roof_EventScript_GiveLemonade:: end CeladonCity_DepartmentStore_Roof_EventScript_GiveDrink:: - getitemname 0, VAR_0x8008 - getitemname 1, VAR_0x8009 - removeitem VAR_0x8008, 1 - checkitemspace VAR_0x8009, 1 - compare VAR_RESULT, FALSE - goto_if_eq CeladonCity_DepartmentStore_Roof_EventScript_NoRoomForReward + bufferitemname STR_VAR_1, VAR_0x8008 + bufferitemname STR_VAR_2, VAR_0x8009 + removeitem VAR_0x8008 + checkitemspace VAR_0x8009 + goto_if_eq VAR_RESULT, FALSE, CeladonCity_DepartmentStore_Roof_EventScript_NoRoomForReward additem VAR_0x8009 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_LEVEL_UP message Text_ReceivedItemFromLittleGirl waitmessage waitfanfare putitemaway VAR_0x8009 call EventScript_RestorePrevTextColor - compare VAR_0x8008, ITEM_FRESH_WATER - call_if_eq CeladonCity_DepartmentStore_Roof_EventScript_ExplainTM16 - compare VAR_0x8008, ITEM_SODA_POP - call_if_eq CeladonCity_DepartmentStore_Roof_EventScript_ExplainTM20 - compare VAR_0x8008, ITEM_LEMONADE - call_if_eq CeladonCity_DepartmentStore_Roof_EventScript_ExplainTM33 + call_if_eq VAR_0x8008, ITEM_FRESH_WATER, CeladonCity_DepartmentStore_Roof_EventScript_ExplainTM16 + call_if_eq VAR_0x8008, ITEM_SODA_POP, CeladonCity_DepartmentStore_Roof_EventScript_ExplainTM20 + call_if_eq VAR_0x8008, ITEM_LEMONADE, CeladonCity_DepartmentStore_Roof_EventScript_ExplainTM33 release end @@ -210,7 +201,7 @@ CeladonCity_DepartmentStore_Roof_EventScript_VendingMachine:: lockall message CeladonCity_DepartmentStore_Roof_Text_VendingMachineWhatDoesItHave waitmessage - showmoneybox 0, 0, 0 + showmoneybox 0, 0 goto CeladonCity_DepartmentStore_Roof_EventScript_ChooseDrink end @@ -227,48 +218,43 @@ CeladonCity_DepartmentStore_Roof_EventScript_ChooseDrink:: CeladonCity_DepartmentStore_Roof_EventScript_BuyFreshWater:: setvar VAR_TEMP_0, ITEM_FRESH_WATER - checkmoney 200, 0 + checkmoney 200 goto CeladonCity_DepartmentStore_Roof_EventScript_TryBuyDrink end CeladonCity_DepartmentStore_Roof_EventScript_BuySodaPop:: setvar VAR_TEMP_0, ITEM_SODA_POP - checkmoney 300, 0 + checkmoney 300 goto CeladonCity_DepartmentStore_Roof_EventScript_TryBuyDrink end CeladonCity_DepartmentStore_Roof_EventScript_BuyLemonade:: setvar VAR_TEMP_0, ITEM_LEMONADE - checkmoney 350, 0 + checkmoney 350 goto CeladonCity_DepartmentStore_Roof_EventScript_TryBuyDrink end CeladonCity_DepartmentStore_Roof_EventScript_RemoveMoneyFreshWater:: - removemoney 200, 0 + removemoney 200 return CeladonCity_DepartmentStore_Roof_EventScript_RemoveMoneySodaPop:: - removemoney 300, 0 + removemoney 300 return CeladonCity_DepartmentStore_Roof_EventScript_RemoveMoneyLemonade:: - removemoney 350, 0 + removemoney 350 return CeladonCity_DepartmentStore_Roof_EventScript_TryBuyDrink:: - compare VAR_RESULT, FALSE - goto_if_eq CeladonCity_DepartmentStore_Roof_EventScript_NotEnoughMoney - checkitemspace VAR_TEMP_0, 1 - compare VAR_RESULT, FALSE - goto_if_eq CeladonCity_DepartmentStore_Roof_EventScript_NoRoomForDrink - compare VAR_TEMP_1, 0 - call_if_eq CeladonCity_DepartmentStore_Roof_EventScript_RemoveMoneyFreshWater - compare VAR_TEMP_1, 1 - 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 + goto_if_eq VAR_RESULT, FALSE, CeladonCity_DepartmentStore_Roof_EventScript_NotEnoughMoney + checkitemspace VAR_TEMP_0 + goto_if_eq VAR_RESULT, FALSE, CeladonCity_DepartmentStore_Roof_EventScript_NoRoomForDrink + call_if_eq VAR_TEMP_1, 0, CeladonCity_DepartmentStore_Roof_EventScript_RemoveMoneyFreshWater + call_if_eq VAR_TEMP_1, 1, CeladonCity_DepartmentStore_Roof_EventScript_RemoveMoneySodaPop + call_if_eq VAR_TEMP_1, 2, CeladonCity_DepartmentStore_Roof_EventScript_RemoveMoneyLemonade + updatemoneybox + bufferitemname STR_VAR_1, VAR_TEMP_0 playse SE_VEND msgbox CeladonCity_DepartmentStore_Roof_Text_DrinkCanPoppedOut additem VAR_TEMP_0 @@ -292,6 +278,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..120c59af1 100644 --- a/data/maps/CeladonCity_GameCorner/scripts.inc +++ b/data/maps/CeladonCity_GameCorner/scripts.inc @@ -24,7 +24,7 @@ CeladonCity_GameCorner_EventScript_CoinsClerk:: goto_if_questlog EventScript_ReleaseEnd lock faceplayer - showmoneybox 0, 0, 0 + showmoneybox 0, 0 showcoinsbox 0, 5 message CeladonCity_GameCorner_Text_WelcomeBuySomeCoins waitmessage @@ -39,38 +39,32 @@ CeladonCity_GameCorner_EventScript_CoinsClerk:: CeladonCity_GameCorner_EventScript_BuyCoins:: goto_if_unset FLAG_GOT_COIN_CASE, CeladonCity_GameCorner_EventScript_ClerkNoCoinCase - compare VAR_0x8009, 0 - goto_if_eq CeladonCity_GameCorner_EventScript_Buy50Coins - compare VAR_0x8009, 1 - goto_if_eq CeladonCity_GameCorner_EventScript_Buy500Coins + goto_if_eq VAR_0x8009, 0, CeladonCity_GameCorner_EventScript_Buy50Coins + goto_if_eq VAR_0x8009, 1, CeladonCity_GameCorner_EventScript_Buy500Coins end CeladonCity_GameCorner_EventScript_Buy500Coins:: checkcoins VAR_TEMP_1 - compare VAR_TEMP_1, (MAX_COINS + 1) - 500 - goto_if_ge CeladonCity_GameCorner_EventScript_ClerkNoRoomForCoins - checkmoney 10000, 0 - compare VAR_RESULT, FALSE - goto_if_eq CeladonCity_GameCorner_EventScript_ClerkNotEnoughMoney + goto_if_ge VAR_TEMP_1, (MAX_COINS + 1) - 500, CeladonCity_GameCorner_EventScript_ClerkNoRoomForCoins + checkmoney 10000 + goto_if_eq VAR_RESULT, FALSE, CeladonCity_GameCorner_EventScript_ClerkNotEnoughMoney addcoins 500 - removemoney 10000, 0 + removemoney 10000 goto CeladonCity_GameCorner_EventScript_BoughtCoins end CeladonCity_GameCorner_EventScript_Buy50Coins:: checkcoins VAR_TEMP_1 - compare VAR_TEMP_1, (MAX_COINS + 1) - 50 - goto_if_ge CeladonCity_GameCorner_EventScript_ClerkNoRoomForCoins - checkmoney 1000, 0 - compare VAR_RESULT, FALSE - goto_if_eq CeladonCity_GameCorner_EventScript_ClerkNotEnoughMoney + goto_if_ge VAR_TEMP_1, (MAX_COINS + 1) - 50, CeladonCity_GameCorner_EventScript_ClerkNoRoomForCoins + checkmoney 1000 + goto_if_eq VAR_RESULT, FALSE, CeladonCity_GameCorner_EventScript_ClerkNotEnoughMoney addcoins 50 - removemoney 1000, 0 + removemoney 1000 goto CeladonCity_GameCorner_EventScript_BoughtCoins end CeladonCity_GameCorner_EventScript_BoughtCoins:: - updatemoneybox 0, 0, 0 + updatemoneybox updatecoinsbox 0, 5 playse SE_SHOP msgbox CeladonCity_GameCorner_Text_HereAreYourCoins @@ -78,7 +72,7 @@ CeladonCity_GameCorner_EventScript_BoughtCoins:: end CeladonCity_GameCorner_EventScript_ClerkEnd:: - hidemoneybox 0, 0 + hidemoneybox hidecoinsbox 0, 5 release end @@ -131,10 +125,9 @@ CeladonCity_GameCorner_EventScript_Fisher:: msgbox CeladonCity_GameCorner_Text_DoYouWantToPlay goto_if_unset FLAG_GOT_COIN_CASE, CeladonCity_GameCorner_EventScript_GamblerNoCoinCase checkcoins VAR_TEMP_1 - compare VAR_TEMP_1, (MAX_COINS + 1) - 10 - goto_if_ge CeladonCity_GameCorner_EventScript_FisherNoRoomForCoins + goto_if_ge VAR_TEMP_1, (MAX_COINS + 1) - 10, CeladonCity_GameCorner_EventScript_FisherNoRoomForCoins addcoins 10 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox CeladonCity_GameCorner_Text_Received10CoinsFromMan playse SE_SHOP waitse @@ -148,7 +141,7 @@ CeladonCity_GameCorner_EventScript_FisherNoRoomForCoins:: end CeladonCity_GameCorner_EventScript_GamblerNoCoinCase:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox CeladonCity_GameCorner_Text_DontHaveCoinCase goto CeladonCity_GameCorner_EventScript_FaceSlotMachine end @@ -192,10 +185,9 @@ CeladonCity_GameCorner_EventScript_Scientist:: msgbox CeladonCity_GameCorner_Text_WantSomeCoins goto_if_unset FLAG_GOT_COIN_CASE, CeladonCity_GameCorner_EventScript_GamblerNoCoinCase checkcoins VAR_TEMP_1 - compare VAR_TEMP_1, (MAX_COINS + 1) - 20 - goto_if_ge CeladonCity_GameCorner_EventScript_ScientistNoRoomForCoins + goto_if_ge VAR_TEMP_1, (MAX_COINS + 1) - 20, CeladonCity_GameCorner_EventScript_ScientistNoRoomForCoins addcoins 20 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox CeladonCity_GameCorner_Text_Received20CoinsFromNiceGuy playse SE_SHOP waitse @@ -220,10 +212,9 @@ CeladonCity_GameCorner_EventScript_Gentleman:: msgbox CeladonCity_GameCorner_Text_HereAreSomeCoinsShoo goto_if_unset FLAG_GOT_COIN_CASE, CeladonCity_GameCorner_EventScript_GamblerNoCoinCase checkcoins VAR_TEMP_1 - compare VAR_TEMP_1, (MAX_COINS + 1) - 20 - goto_if_ge CeladonCity_GameCorner_EventScript_GentlemanNoRoomForCoins + goto_if_ge VAR_TEMP_1, (MAX_COINS + 1) - 20, CeladonCity_GameCorner_EventScript_GentlemanNoRoomForCoins addcoins 20 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox CeladonCity_GameCorner_Text_Received20CoinsFromMan playse SE_SHOP waitse @@ -254,11 +245,16 @@ CeladonCity_GameCorner_EventScript_DontPlaySlotMachine:: CeladonCity_GameCorner_EventScript_SlotMachine:: goto_if_unset FLAG_GOT_COIN_CASE, CeladonCity_GameCorner_EventScript_SlotMachineNoCoinCase 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 + goto_if_eq VAR_RESULT, NO, CeladonCity_GameCorner_EventScript_DontPlaySlotMachine + setfieldeffectargument 0, OBJ_EVENT_ID_PLAYER +.ifdef BUGFIX + setfieldeffectargument 1, MAP_NUM(CELADON_CITY_GAME_CORNER) + setfieldeffectargument 2, MAP_GROUP(CELADON_CITY_GAME_CORNER) +.else + @ Map num/group were provided in the wrong order + setfieldeffectargument 1, MAP_GROUP(CELADON_CITY_GAME_CORNER) + setfieldeffectargument 2, MAP_NUM(CELADON_CITY_GAME_CORNER) +.endif dofieldeffect FLDEFF_SMILEY_FACE_ICON waitfieldeffect FLDEFF_SMILEY_FACE_ICON specialvar VAR_RESULT, GetRandomSlotMachineId @@ -423,10 +419,8 @@ CeladonCity_GameCorner_EventScript_RocketGrunt:: CeladonCity_GameCorner_Text_DefeatedGrunt:: msgbox CeladonCity_GameCorner_Text_GruntPostBattle closemessage - compare VAR_FACING, DIR_WEST - call_if_eq CeladonCity_GameCorner_Text_GruntExitWest - compare VAR_FACING, DIR_WEST - call_if_ne CeladonCity_GameCorner_Text_GruntExit + call_if_eq VAR_FACING, DIR_WEST, CeladonCity_GameCorner_Text_GruntExitWest + call_if_ne VAR_FACING, DIR_WEST, CeladonCity_GameCorner_Text_GruntExit removeobject LOCALID_GRUNT release end diff --git a/data/maps/CeladonCity_GameCorner_PrizeRoom/scripts.inc b/data/maps/CeladonCity_GameCorner_PrizeRoom/scripts.inc index 8070c752c..9c753f3ad 100644 --- a/data/maps/CeladonCity_GameCorner_PrizeRoom/scripts.inc +++ b/data/maps/CeladonCity_GameCorner_PrizeRoom/scripts.inc @@ -104,14 +104,12 @@ 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 + goto_if_eq VAR_RESULT, NO, CeladonCity_GameCorner_PrizeRoom_EventScript_EndPrizeExchange checkcoins VAR_RESULT - compare VAR_RESULT, VAR_TEMP_2 - goto_if_lt CeladonCity_GameCorner_PrizeRoom_EventScript_NotEnoughCoins - textcolor 3 + goto_if_lt VAR_RESULT, VAR_TEMP_2, CeladonCity_GameCorner_PrizeRoom_EventScript_NotEnoughCoins + textcolor NPC_TEXT_COLOR_NEUTRAL switch VAR_TEMP_1 case SPECIES_ABRA, CeladonCity_GameCorner_PrizeRoom_EventScript_GiveAbra case SPECIES_CLEFAIRY, CeladonCity_GameCorner_PrizeRoom_EventScript_GiveClefairy @@ -123,10 +121,10 @@ CeladonCity_GameCorner_PrizeRoom_EventScript_ConfirmPrizeMon:: CeladonCity_GameCorner_PrizeRoom_EventScript_GiveAbra:: .ifdef FIRERED - givemon VAR_TEMP_1, 9, ITEM_NONE + givemon VAR_TEMP_1, 9 .else .ifdef LEAFGREEN - givemon VAR_TEMP_1, 7, ITEM_NONE + givemon VAR_TEMP_1, 7 .endif .endif goto CeladonCity_GameCorner_PrizeRoom_EventScript_CheckReceivedMon @@ -134,10 +132,10 @@ CeladonCity_GameCorner_PrizeRoom_EventScript_GiveAbra:: CeladonCity_GameCorner_PrizeRoom_EventScript_GiveClefairy:: .ifdef FIRERED - givemon VAR_TEMP_1, 8, ITEM_NONE + givemon VAR_TEMP_1, 8 .else .ifdef LEAFGREEN - givemon VAR_TEMP_1, 12, ITEM_NONE + givemon VAR_TEMP_1, 12 .endif .endif goto CeladonCity_GameCorner_PrizeRoom_EventScript_CheckReceivedMon @@ -145,47 +143,44 @@ CeladonCity_GameCorner_PrizeRoom_EventScript_GiveClefairy:: CeladonCity_GameCorner_PrizeRoom_EventScript_GiveDratini:: .ifdef FIRERED - givemon VAR_TEMP_1, 18, ITEM_NONE + givemon VAR_TEMP_1, 18 .else .ifdef LEAFGREEN - givemon VAR_TEMP_1, 24, ITEM_NONE + givemon VAR_TEMP_1, 24 .endif .endif goto CeladonCity_GameCorner_PrizeRoom_EventScript_CheckReceivedMon end CeladonCity_GameCorner_PrizeRoom_EventScript_GiveScyther:: - givemon VAR_TEMP_1, 25, ITEM_NONE + givemon VAR_TEMP_1, 25 goto CeladonCity_GameCorner_PrizeRoom_EventScript_CheckReceivedMon end CeladonCity_GameCorner_PrizeRoom_EventScript_GivePorygon:: .ifdef FIRERED - givemon VAR_TEMP_1, 26, ITEM_NONE + givemon VAR_TEMP_1, 26 .else .ifdef LEAFGREEN - givemon VAR_TEMP_1, 18, ITEM_NONE + givemon VAR_TEMP_1, 18 .endif .endif goto CeladonCity_GameCorner_PrizeRoom_EventScript_CheckReceivedMon end CeladonCity_GameCorner_PrizeRoom_EventScript_GivePinsir:: - givemon VAR_TEMP_1, 18, ITEM_NONE + givemon VAR_TEMP_1, 18 goto CeladonCity_GameCorner_PrizeRoom_EventScript_CheckReceivedMon end CeladonCity_GameCorner_PrizeRoom_EventScript_CheckReceivedMon:: - compare VAR_RESULT, 0 - goto_if_eq CeladonCity_GameCorner_PrizeRoom_EventScript_ReceivedMonParty - compare VAR_RESULT, 1 - goto_if_eq CeladonCity_GameCorner_PrizeRoom_EventScript_ReceivedMonPC - compare VAR_RESULT, 2 - goto_if_eq CeladonCity_GameCorner_PrizeRoom_EventScript_PartyFull + goto_if_eq VAR_RESULT, 0, CeladonCity_GameCorner_PrizeRoom_EventScript_ReceivedMonParty + goto_if_eq VAR_RESULT, 1, CeladonCity_GameCorner_PrizeRoom_EventScript_ReceivedMonPC + goto_if_eq VAR_RESULT, 2, CeladonCity_GameCorner_PrizeRoom_EventScript_PartyFull end CeladonCity_GameCorner_PrizeRoom_EventScript_PartyFull:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox Text_NoMoreRoomForPokemon hidecoinsbox 0, 0 release @@ -200,7 +195,7 @@ CeladonCity_GameCorner_PrizeRoom_EventScript_NicknamePartyMon:: end CeladonCity_GameCorner_PrizeRoom_EventScript_NeedCoinCase:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox CeladonCity_GameCorner_PrizeRoom_Text_CoinCaseRequired release end @@ -213,28 +208,26 @@ 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 waitfanfare msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq CeladonCity_GameCorner_PrizeRoom_EventScript_NicknamePartyMon + goto_if_eq VAR_RESULT, YES, CeladonCity_GameCorner_PrizeRoom_EventScript_NicknamePartyMon goto CeladonCity_GameCorner_PrizeRoom_EventScript_EndPrizeExchange end 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 waitfanfare msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CeladonCity_GameCorner_PrizeRoom_EventScript_TransferredToPC + goto_if_eq VAR_RESULT, NO, CeladonCity_GameCorner_PrizeRoom_EventScript_TransferredToPC call EventScript_NameReceivedBoxMon goto CeladonCity_GameCorner_PrizeRoom_EventScript_TransferredToPC end @@ -271,61 +264,57 @@ 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 CeladonCity_GameCorner_PrizeRoom_EventScript_ConfirmPrizeTM:: msgbox CeladonCity_GameCorner_PrizeRoom_Text_YouWantTM, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CeladonCity_GameCorner_PrizeRoom_EventScript_EndPrizeExchange + goto_if_eq VAR_RESULT, NO, CeladonCity_GameCorner_PrizeRoom_EventScript_EndPrizeExchange goto CeladonCity_GameCorner_PrizeRoom_EventScript_TryGivePrize 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 + goto_if_eq VAR_RESULT, NO, CeladonCity_GameCorner_PrizeRoom_EventScript_EndPrizeExchange goto CeladonCity_GameCorner_PrizeRoom_EventScript_TryGivePrize 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 - checkitemspace VAR_TEMP_1, 1 - compare VAR_RESULT, FALSE - goto_if_eq CeladonCity_GameCorner_PrizeRoom_EventScript_BagFull + goto_if_lt VAR_RESULT, VAR_TEMP_2, CeladonCity_GameCorner_PrizeRoom_EventScript_NotEnoughCoins + checkitemspace VAR_TEMP_1 + goto_if_eq VAR_RESULT, FALSE, CeladonCity_GameCorner_PrizeRoom_EventScript_BagFull removecoins VAR_TEMP_2 updatecoinsbox 0, 5 giveitem VAR_TEMP_1 @@ -333,7 +322,7 @@ CeladonCity_GameCorner_PrizeRoom_EventScript_TryGivePrize:: end CeladonCity_GameCorner_PrizeRoom_EventScript_BagFull:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox Text_TooBadBagFull hidecoinsbox 0, 0 release diff --git a/data/maps/CeladonCity_Gym/scripts.inc b/data/maps/CeladonCity_Gym/scripts.inc index 9795156b1..3ab6ce298 100644 --- a/data/maps/CeladonCity_Gym/scripts.inc +++ b/data/maps/CeladonCity_Gym/scripts.inc @@ -21,9 +21,8 @@ CeladonCity_Gym_EventScript_DefeatedErika:: CeladonCity_Gym_EventScript_GiveTM19:: msgbox CeladonCity_Gym_Text_ExplainRainbowBadgeTakeThis - checkitemspace ITEM_TM19, 1 - compare VAR_RESULT, FALSE - goto_if_eq CeladonCity_Gym_EventScript_NoRoomForTM19 + checkitemspace ITEM_TM19 + goto_if_eq VAR_RESULT, FALSE, CeladonCity_Gym_EventScript_NoRoomForTM19 giveitem_msg CeladonCity_Gym_Text_ReceivedTM19FromErika, ITEM_TM19 setflag FLAG_GOT_TM19_FROM_ERIKA msgbox CeladonCity_Gym_Text_ExplainTM19 diff --git a/data/maps/CeladonCity_Restaurant/scripts.inc b/data/maps/CeladonCity_Restaurant/scripts.inc index 65a625c7c..910434982 100644 --- a/data/maps/CeladonCity_Restaurant/scripts.inc +++ b/data/maps/CeladonCity_Restaurant/scripts.inc @@ -14,9 +14,8 @@ CeladonCity_Restaurant_EventScript_CoinCaseMan:: faceplayer goto_if_set FLAG_GOT_COIN_CASE, CeladonCity_Restaurant_EventScript_AlreadyGotCoinCase msgbox CeladonCity_Restaurant_Text_TakeThisImBusted - checkitemspace ITEM_COIN_CASE, 1 - compare VAR_RESULT, FALSE - goto_if_eq CeladonCity_Restaurant_EventScript_NoRoomForCoinCase + checkitemspace ITEM_COIN_CASE + goto_if_eq VAR_RESULT, FALSE, CeladonCity_Restaurant_EventScript_NoRoomForCoinCase giveitem_msg CeladonCity_Restaurant_Text_ReceivedCoinCaseFromMan, ITEM_COIN_CASE setflag FLAG_GOT_COIN_CASE release diff --git a/data/maps/CeruleanCave_B1F/scripts.inc b/data/maps/CeruleanCave_B1F/scripts.inc index 2963e9228..63a110bb4 100644 --- a/data/maps/CeruleanCave_B1F/scripts.inc +++ b/data/maps/CeruleanCave_B1F/scripts.inc @@ -9,8 +9,7 @@ CeruleanCave_B1F_OnResume:: CeruleanCave_B1F_EventScript_TryRemoveMewtwo:: specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_CAUGHT - goto_if_ne EventScript_Return + goto_if_ne VAR_RESULT, B_OUTCOME_CAUGHT, EventScript_Return removeobject VAR_LAST_TALKED return @@ -35,18 +34,15 @@ CeruleanCave_B1F_EventScript_Mewtwo:: delay 20 playbgm MUS_ENCOUNTER_GYM_LEADER, 0 waitbuttonpress - setwildbattle SPECIES_MEWTWO, 70, ITEM_NONE + setwildbattle SPECIES_MEWTWO, 70 setflag FLAG_SYS_SPECIAL_WILD_BATTLE special StartLegendaryBattle waitstate clearflag FLAG_SYS_SPECIAL_WILD_BATTLE specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_WON - goto_if_eq CeruleanCave_B1F_EventScript_DefeatedMewtwo - compare VAR_RESULT, B_OUTCOME_RAN - goto_if_eq CeruleanCave_B1F_EventScript_RanFromMewtwo - compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED - goto_if_eq CeruleanCave_B1F_EventScript_RanFromMewtwo + goto_if_eq VAR_RESULT, B_OUTCOME_WON, CeruleanCave_B1F_EventScript_DefeatedMewtwo + goto_if_eq VAR_RESULT, B_OUTCOME_RAN, CeruleanCave_B1F_EventScript_RanFromMewtwo + goto_if_eq VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED, CeruleanCave_B1F_EventScript_RanFromMewtwo setflag FLAG_FOUGHT_MEWTWO release end diff --git a/data/maps/CeruleanCity/scripts.inc b/data/maps/CeruleanCity/scripts.inc index 110a2de4c..be2405292 100644 --- a/data/maps/CeruleanCity/scripts.inc +++ b/data/maps/CeruleanCity/scripts.inc @@ -41,7 +41,7 @@ CeruleanCity_EventScript_RivalTriggerRight:: end CeruleanCity_EventScript_Rival:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE setvar VAR_MAP_SCENE_ROUTE22, 2 playbgm MUS_ENCOUNTER_RIVAL, 0 addobject LOCALID_RIVAL @@ -49,22 +49,16 @@ CeruleanCity_EventScript_Rival:: waitmovement 0 msgbox CeruleanCity_Text_RivalIntro setvar VAR_LAST_TALKED, LOCALID_RIVAL - compare VAR_STARTER_MON, 2 - call_if_eq CeruleanCity_EventScript_RivalSquirtle - compare VAR_STARTER_MON, 1 - call_if_eq CeruleanCity_EventScript_RivalBulbasaur - compare VAR_STARTER_MON, 0 - call_if_eq CeruleanCity_EventScript_RivalCharmander + call_if_eq VAR_STARTER_MON, 2, CeruleanCity_EventScript_RivalSquirtle + call_if_eq VAR_STARTER_MON, 1, CeruleanCity_EventScript_RivalBulbasaur + call_if_eq VAR_STARTER_MON, 0, CeruleanCity_EventScript_RivalCharmander famechecker FAMECHECKER_BILL, 0 msgbox CeruleanCity_Text_RivalPostBattle closemessage playbgm MUS_RIVAL_EXIT, 0 - compare VAR_TEMP_1, 0 - call_if_eq CeruleanCity_EventScript_RivalStartExit - compare VAR_TEMP_1, 1 - call_if_eq CeruleanCity_EventScript_RivalStartExit - compare VAR_TEMP_1, 2 - call_if_eq CeruleanCity_EventScript_RivalStartExitRight + call_if_eq VAR_TEMP_1, 0, CeruleanCity_EventScript_RivalStartExit + call_if_eq VAR_TEMP_1, 1, CeruleanCity_EventScript_RivalStartExit + call_if_eq VAR_TEMP_1, 2, CeruleanCity_EventScript_RivalStartExitRight msgbox CeruleanCity_Text_OhRightLittlePresentAsFavor setvar VAR_MAP_SCENE_CERULEAN_CITY_RIVAL, 1 setflag FLAG_GOT_FAME_CHECKER @@ -105,17 +99,17 @@ CeruleanCity_EventScript_RivalStartExitRight:: CeruleanCity_Movement_PlayerWatchRivalExit:: delay_16 delay_8 - walk_in_place_fastest_right + walk_in_place_faster_right delay_16 - walk_in_place_fastest_down + walk_in_place_faster_down step_end CeruleanCity_Movement_PlayerWatchRivalExitRight:: delay_16 delay_8 - walk_in_place_fastest_left + walk_in_place_faster_left delay_16 - walk_in_place_fastest_down + walk_in_place_faster_down step_end CeruleanCity_Movement_RivalEnter:: @@ -189,9 +183,8 @@ CeruleanCity_EventScript_Grunt:: CeruleanCity_EventScript_GruntDefeated:: msgbox CeruleanCity_Text_OkayIllReturnStolenTM - checkitemspace ITEM_TM28, 1 - compare VAR_RESULT, FALSE - goto_if_eq CeruleanCity_EventScript_NoRoomForTM28 + checkitemspace ITEM_TM28 + goto_if_eq VAR_RESULT, FALSE, CeruleanCity_EventScript_NoRoomForTM28 giveitem_msg CeruleanCity_Text_RecoveredTM28FromGrunt, ITEM_TM28 msgbox CeruleanCity_Text_BetterGetMovingBye closemessage @@ -203,7 +196,7 @@ CeruleanCity_EventScript_GruntDefeated:: end CeruleanCity_EventScript_NoRoomForTM28:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox CeruleanCity_Text_MakeRoomForThisCantRun release end @@ -211,9 +204,9 @@ CeruleanCity_EventScript_NoRoomForTM28:: CeruleanCity_EventScript_GruntTriggerTop:: lockall setvar VAR_TEMP_1, 0 - applymovement LOCALID_GRUNT, Movement_WalkInPlaceFastestUp + applymovement LOCALID_GRUNT, Movement_WalkInPlaceFasterUp waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown waitmovement 0 goto CeruleanCity_EventScript_GruntTrigger end @@ -221,15 +214,15 @@ CeruleanCity_EventScript_GruntTriggerTop:: CeruleanCity_EventScript_GruntTriggerBottom:: lockall setvar VAR_TEMP_1, 1 - applymovement LOCALID_GRUNT, Movement_WalkInPlaceFastestDown + applymovement LOCALID_GRUNT, Movement_WalkInPlaceFasterDown waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 goto CeruleanCity_EventScript_GruntTrigger end CeruleanCity_EventScript_GruntTrigger:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox CeruleanCity_Text_GruntIntro setvar VAR_LAST_TALKED, LOCALID_GRUNT trainerbattle_no_intro TRAINER_TEAM_ROCKET_GRUNT_5, CeruleanCity_Text_GruntDefeat @@ -286,24 +279,18 @@ CeruleanCity_EventScript_Lass:: lock random 3 copyvar VAR_0x8008, VAR_RESULT - compare VAR_0x8008, 0 - call_if_eq CeruleanCity_EventScript_SlowbroCommand1 - compare VAR_0x8008, 1 - call_if_eq CeruleanCity_EventScript_SlowbroCommand2 - compare VAR_0x8008, 2 - call_if_eq CeruleanCity_EventScript_SlowbroCommand3 + call_if_eq VAR_0x8008, 0, CeruleanCity_EventScript_SlowbroCommand1 + call_if_eq VAR_0x8008, 1, CeruleanCity_EventScript_SlowbroCommand2 + call_if_eq VAR_0x8008, 2, CeruleanCity_EventScript_SlowbroCommand3 waitmessage delay 40 playse SE_PIN applymovement LOCALID_SLOWBRO, Movement_QuestionMark waitmovement 0 delay 30 - compare VAR_0x8008, 0 - call_if_eq CeruleanCity_EventScript_SlowbroFailed1 - compare VAR_0x8008, 1 - call_if_eq CeruleanCity_EventScript_SlowbroFailed2 - compare VAR_0x8008, 2 - call_if_eq CeruleanCity_EventScript_SlowbroFailed3 + call_if_eq VAR_0x8008, 0, CeruleanCity_EventScript_SlowbroFailed1 + call_if_eq VAR_0x8008, 1, CeruleanCity_EventScript_SlowbroFailed2 + call_if_eq VAR_0x8008, 2, CeruleanCity_EventScript_SlowbroFailed3 release end @@ -335,14 +322,10 @@ CeruleanCity_EventScript_Slowbro:: lock random 4 copyvar VAR_0x8008, VAR_RESULT - compare VAR_0x8008, 0 - call_if_eq CeruleanCity_EventScript_SlowbroText1 - compare VAR_0x8008, 1 - call_if_eq CeruleanCity_EventScript_SlowbroText2 - compare VAR_0x8008, 2 - call_if_eq CeruleanCity_EventScript_SlowbroText3 - compare VAR_0x8008, 3 - call_if_eq CeruleanCity_EventScript_SlowbroText4 + call_if_eq VAR_0x8008, 0, CeruleanCity_EventScript_SlowbroText1 + call_if_eq VAR_0x8008, 1, CeruleanCity_EventScript_SlowbroText2 + call_if_eq VAR_0x8008, 2, CeruleanCity_EventScript_SlowbroText3 + call_if_eq VAR_0x8008, 3, CeruleanCity_EventScript_SlowbroText4 release end diff --git a/data/maps/CeruleanCity_BikeShop/scripts.inc b/data/maps/CeruleanCity_BikeShop/scripts.inc index d20038d1f..9e8e0001f 100644 --- a/data/maps/CeruleanCity_BikeShop/scripts.inc +++ b/data/maps/CeruleanCity_BikeShop/scripts.inc @@ -6,7 +6,7 @@ CeruleanCity_BikeShop_EventScript_Clerk:: faceplayer goto_if_set FLAG_GOT_BICYCLE, CeruleanCity_BikeShop_EventScript_AlreadyGotBicycle goto_if_set FLAG_GOT_BIKE_VOUCHER, CeruleanCity_BikeShop_EventScript_ExchangeBikeVoucher - showmoneybox 0, 0, 0 + showmoneybox 0, 0 message CeruleanCity_BikeShop_Text_WelcomeToBikeShop waitmessage multichoice 11, 0, MULTICHOICE_BIKE_SHOP, FALSE @@ -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_Gym/scripts.inc b/data/maps/CeruleanCity_Gym/scripts.inc index 1a1a02476..94190b086 100644 --- a/data/maps/CeruleanCity_Gym/scripts.inc +++ b/data/maps/CeruleanCity_Gym/scripts.inc @@ -20,9 +20,8 @@ CeruleanCity_Gym_EventScript_MistyDefeated:: CeruleanCity_Gym_EventScript_GiveTM03:: msgbox CeruleanCity_Gym_Text_ExplainCascadeBadge - checkitemspace ITEM_TM03, 1 - compare VAR_RESULT, FALSE - goto_if_eq CeruleanCity_Gym_EventScript_NoRoomForTM03 + checkitemspace ITEM_TM03 + goto_if_eq VAR_RESULT, FALSE, CeruleanCity_Gym_EventScript_NoRoomForTM03 giveitem_msg CeruleanCity_Gym_Text_ReceivedTM03FromMisty, ITEM_TM03 setflag FLAG_GOT_TM03_FROM_MISTY msgbox CeruleanCity_Gym_Text_ExplainTM03 diff --git a/data/maps/CeruleanCity_House3/scripts.inc b/data/maps/CeruleanCity_House3/scripts.inc index d0e4fda5e..2e3913696 100644 --- a/data/maps/CeruleanCity_House3/scripts.inc +++ b/data/maps/CeruleanCity_House3/scripts.inc @@ -12,14 +12,11 @@ CeruleanCity_House3_EventScript_Dontae:: call EventScript_GetInGameTradeSpeciesInfo goto_if_set FLAG_DID_ZYNX_TRADE, CeruleanCity_House3_EventScript_AlreadyTraded msgbox Trade_Text_DoYouHaveMonWouldYouTradeForMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CeruleanCity_House3_EventScript_DeclineTrade + goto_if_eq VAR_RESULT, NO, CeruleanCity_House3_EventScript_DeclineTrade call EventScript_ChooseMonForInGameTrade - compare VAR_0x8004, PARTY_SIZE - goto_if_ge CeruleanCity_House3_EventScript_DeclineTrade + goto_if_ge VAR_0x8004, PARTY_SIZE, CeruleanCity_House3_EventScript_DeclineTrade call EventScript_GetInGameTradeSpecies - compare VAR_RESULT, VAR_0x8009 - goto_if_ne CeruleanCity_House3_EventScript_NotRequestedMon + goto_if_ne VAR_RESULT, VAR_0x8009, CeruleanCity_House3_EventScript_NotRequestedMon call EventScript_DoInGameTrade msgbox Trade_Text_Thanks setflag FLAG_DID_ZYNX_TRADE @@ -32,7 +29,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_House4/scripts.inc b/data/maps/CeruleanCity_House4/scripts.inc index f338f5173..8774b70ef 100644 --- a/data/maps/CeruleanCity_House4/scripts.inc +++ b/data/maps/CeruleanCity_House4/scripts.inc @@ -9,20 +9,13 @@ CeruleanCity_House4_EventScript_WonderNewsBerryMan:: lock specialvar VAR_0x8004, GetMENewsJisanItemAndState copyvar VAR_0x8008, VAR_RESULT - compare VAR_0x8004, 0 - goto_if_eq CeruleanCity_House4_EventScript_NoNews - compare VAR_0x8004, 1 - goto_if_eq CeruleanCity_House4_EventScript_News1 - compare VAR_0x8004, 2 - goto_if_eq CeruleanCity_House4_EventScript_News2 - compare VAR_0x8004, 3 - goto_if_eq CeruleanCity_House4_EventScript_NewsNotSpread - compare VAR_0x8004, 4 - goto_if_eq CeruleanCity_House4_EventScript_NewsSpread1 - compare VAR_0x8004, 5 - goto_if_eq CeruleanCity_House4_EventScript_NewsSpread2 - compare VAR_0x8004, 6 - goto_if_eq CeruleanCity_House4_EventScript_NewsDone + goto_if_eq VAR_0x8004, 0, CeruleanCity_House4_EventScript_NoNews + goto_if_eq VAR_0x8004, 1, CeruleanCity_House4_EventScript_News1 + goto_if_eq VAR_0x8004, 2, CeruleanCity_House4_EventScript_News2 + goto_if_eq VAR_0x8004, 3, CeruleanCity_House4_EventScript_NewsNotSpread + goto_if_eq VAR_0x8004, 4, CeruleanCity_House4_EventScript_NewsSpread1 + goto_if_eq VAR_0x8004, 5, CeruleanCity_House4_EventScript_NewsSpread2 + goto_if_eq VAR_0x8004, 6, CeruleanCity_House4_EventScript_NewsDone end CeruleanCity_House4_EventScript_NoNews:: @@ -34,8 +27,7 @@ CeruleanCity_House4_EventScript_News1:: call CeruleanCity_House4_EventScript_MovementReactionToNews msgbox CeruleanCity_House4_Text_NewNewsInformativeHaveThis giveitem VAR_0x8008 - compare VAR_RESULT, FALSE - goto_if_eq CeruleanCity_House4_EventScript_NoRoomForBerries + goto_if_eq VAR_RESULT, FALSE, CeruleanCity_House4_EventScript_NoRoomForBerries release end @@ -43,8 +35,7 @@ CeruleanCity_House4_EventScript_News2:: call CeruleanCity_House4_EventScript_MovementReactionToNews msgbox CeruleanCity_House4_Text_IncredibleNewsHaveBerries giveitem VAR_0x8008, 4 - compare VAR_RESULT, FALSE - goto_if_eq CeruleanCity_House4_EventScript_NoRoomForBerries + goto_if_eq VAR_RESULT, FALSE, CeruleanCity_House4_EventScript_NoRoomForBerries release end @@ -59,8 +50,7 @@ CeruleanCity_House4_EventScript_NewsSpread1:: call CeruleanCity_House4_EventScript_MovementReactionToNews msgbox CeruleanCity_House4_Text_ThanksForSpreadingNewsTakeThis giveitem VAR_0x8008 - compare VAR_RESULT, FALSE - goto_if_eq CeruleanCity_House4_EventScript_NoRoomForBerries + goto_if_eq VAR_RESULT, FALSE, CeruleanCity_House4_EventScript_NoRoomForBerries release end @@ -68,8 +58,7 @@ CeruleanCity_House4_EventScript_NewsSpread2:: call CeruleanCity_House4_EventScript_MovementReactionToNews msgbox CeruleanCity_House4_Text_MagnificentNewsSpreadHaveBerries giveitem VAR_0x8008, 4 - compare VAR_RESULT, FALSE - goto_if_eq CeruleanCity_House4_EventScript_NoRoomForBerries + goto_if_eq VAR_RESULT, FALSE, CeruleanCity_House4_EventScript_NoRoomForBerries release end diff --git a/data/maps/CeruleanCity_House5/scripts.inc b/data/maps/CeruleanCity_House5/scripts.inc index bebc51077..a9413ecf1 100644 --- a/data/maps/CeruleanCity_House5/scripts.inc +++ b/data/maps/CeruleanCity_House5/scripts.inc @@ -6,14 +6,12 @@ CeruleanCity_House5_EventScript_BerryPowderMan:: faceplayer goto_if_set FLAG_GOT_POWDER_JAR, CeruleanCity_House5_EventScript_AskToExchangePowder msgbox CeruleanCity_House1_Text_AnyInterestInBerries, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CeruleanCity_House5_EventScript_NoInterestInBerries + goto_if_eq VAR_RESULT, NO, CeruleanCity_House5_EventScript_NoInterestInBerries goto_if_unset FLAG_SYS_GOT_BERRY_POUCH, CeruleanCity_House5_EventScript_NoBerries msgbox CeruleanCity_House1_Text_HaveJustTheThing setflag FLAG_GOT_POWDER_JAR giveitem ITEM_POWDER_JAR - compare VAR_RESULT, FALSE - goto_if_eq EventScript_BagIsFull + goto_if_eq VAR_RESULT, FALSE, EventScript_BagIsFull msgbox CeruleanCity_House1_Text_GoCrushBerriesAtDirectCorner release end @@ -57,77 +55,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 @@ -141,21 +139,17 @@ CeruleanCity_House5_EventScript_ExitMenu:: CeruleanCity_House5_EventScript_ExchangePowderForItem:: msgbox CeruleanCity_House1_Text_YoullExchangeBerryPowderForItem, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CeruleanCity_House5_EventScript_ChooseExchangeItem + goto_if_eq VAR_RESULT, NO, CeruleanCity_House5_EventScript_ChooseExchangeItem copyvar VAR_0x8004, VAR_0x8009 specialvar VAR_RESULT, Script_HasEnoughBerryPowder - compare VAR_RESULT, FALSE - goto_if_eq CeruleanCity_House5_EventScript_NotEnoughBerryPowder + goto_if_eq VAR_RESULT, FALSE, CeruleanCity_House5_EventScript_NotEnoughBerryPowder giveitem VAR_0x8008 - compare VAR_RESULT, FALSE - goto_if_eq CeruleanCity_House5_EventScript_BagIsFull + goto_if_eq VAR_RESULT, FALSE, CeruleanCity_House5_EventScript_BagIsFull copyvar VAR_0x8004, VAR_0x8009 special Script_TakeBerryPowder special PrintPlayerBerryPowderAmount msgbox CeruleanCity_House1_Text_TradeMoreBerryPowder, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq CeruleanCity_House5_EventScript_ChooseExchangeItem + goto_if_eq VAR_RESULT, YES, CeruleanCity_House5_EventScript_ChooseExchangeItem msgbox CeruleanCity_House1_Text_HopeToSeeYouAgain special RemoveBerryPowderVendorMenu release diff --git a/data/maps/CinnabarIsland/scripts.inc b/data/maps/CinnabarIsland/scripts.inc index f4e2dc6af..7746af9a7 100644 --- a/data/maps/CinnabarIsland/scripts.inc +++ b/data/maps/CinnabarIsland/scripts.inc @@ -9,12 +9,9 @@ CinnabarIsland_MapScripts:: CinnabarIsland_OnTransition:: setworldmapflag FLAG_WORLD_MAP_CINNABAR_ISLAND call CinnabarIsland_EventScript_CheckUnlockGym - compare VAR_MAP_SCENE_CINNABAR_ISLAND, 1 - call_if_eq CinnabarIsland_EventScript_ReadyObjectsSailToOneIsland - compare VAR_MAP_SCENE_CINNABAR_ISLAND, 3 - call_if_eq CinnabarIsland_EventScript_ReadyObjectsReturnFromSeviiIslands - compare VAR_MAP_SCENE_CINNABAR_ISLAND_2, 1 - call_if_eq CinnabarIsland_EventScript_ReadyObjectsSailToOneIslandFromPokeCenter + call_if_eq VAR_MAP_SCENE_CINNABAR_ISLAND, 1, CinnabarIsland_EventScript_ReadyObjectsSailToOneIsland + call_if_eq VAR_MAP_SCENE_CINNABAR_ISLAND, 3, CinnabarIsland_EventScript_ReadyObjectsReturnFromSeviiIslands + call_if_eq VAR_MAP_SCENE_CINNABAR_ISLAND_2, 1, CinnabarIsland_EventScript_ReadyObjectsSailToOneIslandFromPokeCenter end CinnabarIsland_EventScript_ReadyObjectsSailToOneIslandFromPokeCenter:: @@ -27,8 +24,7 @@ CinnabarIsland_EventScript_ReadyObjectsSailToOneIslandFromPokeCenter:: CinnabarIsland_EventScript_ReadyObjectsSailToOneIsland:: getplayerxy VAR_0x8004, VAR_0x8005 - compare VAR_0x8004, 18 - goto_if_ge CinnabarIsland_EventScript_MoveSeagallopDown + goto_if_ge VAR_0x8004, 18, CinnabarIsland_EventScript_MoveSeagallopDown setflag FLAG_TEMP_2 setobjectxyperm LOCALID_BILL, 18, 12 setobjectmovementtype LOCALID_BILL, MOVEMENT_TYPE_FACE_UP @@ -62,7 +58,7 @@ CinnabarIsland_EventScript_ExitPokeCenterForOneIsland:: lockall clearflag FLAG_DONT_TRANSITION_MUSIC savebgm MUS_DUMMY - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE setvar VAR_MAP_SCENE_CINNABAR_ISLAND_2, 2 delay 20 call CinnabarIsland_EventScript_SailToOneIsland @@ -71,7 +67,7 @@ CinnabarIsland_EventScript_ExitPokeCenterForOneIsland:: CinnabarIsland_EventScript_ReturnFromSeviiIslands:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox CinnabarIsland_Text_IfYouHaveTriPassYouCanGoAgain closemessage applymovement LOCALID_BILL, CinnabarIsland_Movement_BillExit @@ -94,7 +90,7 @@ CinnabarIsland_Movement_BillExit:: CinnabarIsland_EventScript_BillScene:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE call_if_unset FLAG_TEMP_2, CinnabarIsland_EventScript_BillFacePlayer1 call_if_set FLAG_TEMP_2, CinnabarIsland_EventScript_BillFacePlayer2 playse SE_PIN @@ -106,19 +102,17 @@ CinnabarIsland_EventScript_BillScene:: call_if_set FLAG_TEMP_2, CinnabarIsland_EventScript_BillApproachPlayer2 msgbox CinnabarIsland_Text_HeyIfItIsntPlayer msgbox CinnabarIsland_Text_ComeWithMeToOneIsland, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq CinnabarIsland_EventScript_AgreeSailToOneIsland - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_EventScript_DeclineSailToOneIsland + goto_if_eq VAR_RESULT, YES, CinnabarIsland_EventScript_AgreeSailToOneIsland + goto_if_eq VAR_RESULT, NO, CinnabarIsland_EventScript_DeclineSailToOneIsland end CinnabarIsland_EventScript_BillFacePlayer1:: - applymovement LOCALID_BILL, Movement_WalkInPlaceFastestUp + applymovement LOCALID_BILL, Movement_WalkInPlaceFasterUp waitmovement 0 return CinnabarIsland_EventScript_BillFacePlayer2:: - applymovement LOCALID_BILL, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_BILL, Movement_WalkInPlaceFasterLeft waitmovement 0 return @@ -130,7 +124,7 @@ CinnabarIsland_EventScript_BillApproachPlayer1:: CinnabarIsland_EventScript_BillApproachPlayer2:: applymovement LOCALID_BILL, CinnabarIsland_Movement_BillApproachPlayer2 waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 return @@ -181,13 +175,13 @@ CinnabarIsland_EventScript_BillReturnToPokeCenter:: CinnabarIsland_Movement_PlayerWatchBillExit:: walk_left - walk_in_place_fastest_right + walk_in_place_faster_right step_end CinnabarIsland_Movement_BillApproachDoor:: delay_16 walk_left - walk_in_place_fastest_up + walk_in_place_faster_up step_end CinnabarIsland_Movement_BillReEnterPokeCenter:: @@ -278,7 +272,7 @@ CinnabarIsland_Movement_BillFaceBoat:: delay_16 delay_16 delay_8 - walk_in_place_fastest_right + walk_in_place_faster_right step_end CinnabarIsland_Movement_ApproachShore:: @@ -301,7 +295,7 @@ CinnabarIsland_Movement_PlayerBoardBoat:: walk_right walk_down walk_down - walk_in_place_fastest_right + walk_in_place_faster_right delay_4 walk_right delay_4 @@ -319,7 +313,7 @@ CinnabarIsland_Movement_PlayerBoardBoatFromShore:: @ Triggered when VAR_TEMP_1 is 0 CinnabarIsland_EventScript_GymDoorLocked:: lockall - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 delay 20 msgbox CinnabarIsland_Text_DoorIsLocked diff --git a/data/maps/CinnabarIsland_Gym/scripts.inc b/data/maps/CinnabarIsland_Gym/scripts.inc index 0d9a1ff0a..58da8ac3f 100644 --- a/data/maps/CinnabarIsland_Gym/scripts.inc +++ b/data/maps/CinnabarIsland_Gym/scripts.inc @@ -73,9 +73,8 @@ CinnabarIsland_Gym_EventScript_DefeatedBlaine:: CinnabarIsland_Gym_EventScript_GiveTM38:: msgbox CinnabarIsland_Gym_Text_ExplainVolcanoBadge - checkitemspace ITEM_TM38, 1 - compare VAR_RESULT, FALSE - goto_if_eq CinnabarIsland_Gym_EventScript_NoRoomForTM38 + checkitemspace ITEM_TM38 + goto_if_eq VAR_RESULT, FALSE, CinnabarIsland_Gym_EventScript_NoRoomForTM38 giveitem_msg CinnabarIsland_Gym_Text_ReceivedTM38FromBlaine, ITEM_TM38 setflag FLAG_GOT_TM38_FROM_BLAINE msgbox CinnabarIsland_Gym_Text_FireBlastIsUltimateFireMove @@ -217,10 +216,8 @@ CinnabarIsland_Gym_EventScript_Quz1Right:: CinnabarIsland_Gym_EventScript_Quiz1:: msgbox CinnabarIsland_Gym_Text_PokemonQuizRules msgbox CinnabarIsland_Gym_Text_QuizQuestion1, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq CinnabarIsland_Gym_EventScript_Quiz1Correct - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_Gym_EventScript_Quiz1Incorrect + goto_if_eq VAR_RESULT, YES, CinnabarIsland_Gym_EventScript_Quiz1Correct + goto_if_eq VAR_RESULT, NO, CinnabarIsland_Gym_EventScript_Quiz1Incorrect end CinnabarIsland_Gym_EventScript_CorrectAnswer:: @@ -263,11 +260,9 @@ CinnabarIsland_Gym_EventScript_Quiz1Incorrect:: end CinnabarIsland_Gym_EventScript_BattleQuinn:: - compare VAR_TEMP_1, 0 - call_if_eq CinnabarIsland_Gym_EventScript_QuinnApproachLeft - compare VAR_TEMP_1, 1 - call_if_eq CinnabarIsland_Gym_EventScript_QuinnApproachRight - textcolor 0 + call_if_eq VAR_TEMP_1, 0, CinnabarIsland_Gym_EventScript_QuinnApproachLeft + call_if_eq VAR_TEMP_1, 1, CinnabarIsland_Gym_EventScript_QuinnApproachRight + textcolor NPC_TEXT_COLOR_MALE msgbox CinnabarIsland_Gym_Text_QuinnIntro trainerbattle_no_intro TRAINER_BURGLAR_QUINN, CinnabarIsland_Gym_Text_QuinnDefeat goto_if_set FLAG_CINNABAR_GYM_QUIZ_1, CinnabarIsland_Gym_EventScript_DoorAlreadyOpen @@ -276,13 +271,13 @@ CinnabarIsland_Gym_EventScript_BattleQuinn:: end CinnabarIsland_Gym_EventScript_QuinnApproachLeft:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight applymovement LOCALID_QUINN, CinnabarIsland_Gym_Movement_QuinnApproachLeft waitmovement 0 return CinnabarIsland_Gym_EventScript_QuinnApproachRight:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight applymovement LOCALID_QUINN, CinnabarIsland_Gym_Movement_QuinnApproachRight waitmovement 0 return @@ -311,10 +306,8 @@ CinnabarIsland_Gym_EventScript_Quiz2Right:: CinnabarIsland_Gym_EventScript_Quiz2:: msgbox CinnabarIsland_Gym_Text_PokemonQuizRules msgbox CinnabarIsland_Gym_Text_QuizQuestion2, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq CinnabarIsland_Gym_EventScript_Quiz2Incorrect - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_Gym_EventScript_Quiz2Correct + goto_if_eq VAR_RESULT, YES, CinnabarIsland_Gym_EventScript_Quiz2Incorrect + goto_if_eq VAR_RESULT, NO, CinnabarIsland_Gym_EventScript_Quiz2Correct end CinnabarIsland_Gym_EventScript_Quiz2Correct:: @@ -339,11 +332,9 @@ CinnabarIsland_Gym_EventScript_Quiz2Incorrect:: end CinnabarIsland_Gym_EventScript_BattleAvery:: - compare VAR_TEMP_1, 0 - call_if_eq CinnabarIsland_Gym_EventScript_AveryApproachLeft - compare VAR_TEMP_1, 1 - call_if_eq CinnabarIsland_Gym_EventScript_AveryApproachRight - textcolor 0 + call_if_eq VAR_TEMP_1, 0, CinnabarIsland_Gym_EventScript_AveryApproachLeft + call_if_eq VAR_TEMP_1, 1, CinnabarIsland_Gym_EventScript_AveryApproachRight + textcolor NPC_TEXT_COLOR_MALE msgbox CinnabarIsland_Gym_Text_AveryIntro trainerbattle_no_intro TRAINER_SUPER_NERD_AVERY, CinnabarIsland_Gym_Text_AveryDefeat goto_if_set FLAG_CINNABAR_GYM_QUIZ_2, CinnabarIsland_Gym_EventScript_DoorAlreadyOpen @@ -372,13 +363,13 @@ CinnabarIsland_Gym_Movement_AveryApproachLeft:: CinnabarIsland_Gym_Movement_AveryApproachRight:: walk_up walk_up - walk_in_place_fastest_left + walk_in_place_faster_left step_end CinnabarIsland_Gym_Movement_PlayerFaceAvery:: delay_16 delay_16 - walk_in_place_fastest_right + walk_in_place_faster_right step_end CinnabarIsland_Gym_EventScript_Quiz3Left:: @@ -396,10 +387,8 @@ CinnabarIsland_Gym_EventScript_Quiz3Right:: CinnabarIsland_Gym_EventScript_Quiz3:: msgbox CinnabarIsland_Gym_Text_PokemonQuizRules msgbox CinnabarIsland_Gym_Text_QuizQuestion3, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq CinnabarIsland_Gym_EventScript_Quiz3Incorrect - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_Gym_EventScript_Quiz3Correct + goto_if_eq VAR_RESULT, YES, CinnabarIsland_Gym_EventScript_Quiz3Incorrect + goto_if_eq VAR_RESULT, NO, CinnabarIsland_Gym_EventScript_Quiz3Correct end CinnabarIsland_Gym_EventScript_Quiz3Correct:: @@ -424,11 +413,9 @@ CinnabarIsland_Gym_EventScript_Quiz3Incorrect:: end CinnabarIsland_Gym_EventScript_BattleRamon:: - compare VAR_TEMP_1, 0 - call_if_eq CinnabarIsland_Gym_EventScript_RamonApproachLeft - compare VAR_TEMP_1, 1 - call_if_eq CinnabarIsland_Gym_EventScript_RamonApproachRight - textcolor 0 + call_if_eq VAR_TEMP_1, 0, CinnabarIsland_Gym_EventScript_RamonApproachLeft + call_if_eq VAR_TEMP_1, 1, CinnabarIsland_Gym_EventScript_RamonApproachRight + textcolor NPC_TEXT_COLOR_MALE msgbox CinnabarIsland_Gym_Text_RamonIntro trainerbattle_no_intro TRAINER_BURGLAR_RAMON, CinnabarIsland_Gym_Text_RamonDefeat goto_if_set FLAG_CINNABAR_GYM_QUIZ_3, CinnabarIsland_Gym_EventScript_DoorAlreadyOpen @@ -437,13 +424,13 @@ CinnabarIsland_Gym_EventScript_BattleRamon:: end CinnabarIsland_Gym_EventScript_RamonApproachLeft:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight applymovement LOCALID_RAMON, CinnabarIsland_Gym_Movement_RamonApproachLeft waitmovement 0 return CinnabarIsland_Gym_EventScript_RamonApproachRight:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight applymovement LOCALID_RAMON, CinnabarIsland_Gym_Movement_RamonApproachRight waitmovement 0 return @@ -472,10 +459,8 @@ CinnabarIsland_Gym_EventScript_Quiz4Right:: CinnabarIsland_Gym_EventScript_Quiz4:: msgbox CinnabarIsland_Gym_Text_PokemonQuizRules msgbox CinnabarIsland_Gym_Text_QuizQuestion4, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq CinnabarIsland_Gym_EventScript_Quiz4Incorrect - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_Gym_EventScript_Quiz4Correct + goto_if_eq VAR_RESULT, YES, CinnabarIsland_Gym_EventScript_Quiz4Incorrect + goto_if_eq VAR_RESULT, NO, CinnabarIsland_Gym_EventScript_Quiz4Correct end CinnabarIsland_Gym_EventScript_Quiz4Correct:: @@ -500,11 +485,9 @@ CinnabarIsland_Gym_EventScript_Quiz4Incorrect:: end CinnabarIsland_Gym_EventScript_BattleDerek:: - compare VAR_TEMP_1, 0 - call_if_eq CinnabarIsland_Gym_EventScript_DerekApproachLeft - compare VAR_TEMP_1, 1 - call_if_eq CinnabarIsland_Gym_EventScript_DerekApproachRight - textcolor 0 + call_if_eq VAR_TEMP_1, 0, CinnabarIsland_Gym_EventScript_DerekApproachLeft + call_if_eq VAR_TEMP_1, 1, CinnabarIsland_Gym_EventScript_DerekApproachRight + textcolor NPC_TEXT_COLOR_MALE msgbox CinnabarIsland_Gym_Text_DerekIntro trainerbattle_no_intro TRAINER_SUPER_NERD_DEREK, CinnabarIsland_Gym_Text_DerekDefeat goto_if_set FLAG_CINNABAR_GYM_QUIZ_4, CinnabarIsland_Gym_EventScript_DoorAlreadyOpen @@ -513,13 +496,13 @@ CinnabarIsland_Gym_EventScript_BattleDerek:: end CinnabarIsland_Gym_EventScript_DerekApproachLeft:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight applymovement LOCALID_DEREK, CinnabarIsland_Gym_Movement_DerekApproachLeft waitmovement 0 return CinnabarIsland_Gym_EventScript_DerekApproachRight:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight applymovement LOCALID_DEREK, CinnabarIsland_Gym_Movement_DerekApproachRight waitmovement 0 return @@ -548,10 +531,8 @@ CinnabarIsland_Gym_EventScript_Quiz5Right:: CinnabarIsland_Gym_EventScript_Quiz5:: msgbox CinnabarIsland_Gym_Text_PokemonQuizRules msgbox CinnabarIsland_Gym_Text_QuizQuestion5, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq CinnabarIsland_Gym_EventScript_Quiz5Correct - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_Gym_EventScript_Quiz5Incorrect + goto_if_eq VAR_RESULT, YES, CinnabarIsland_Gym_EventScript_Quiz5Correct + goto_if_eq VAR_RESULT, NO, CinnabarIsland_Gym_EventScript_Quiz5Incorrect end CinnabarIsland_Gym_EventScript_Quiz5Correct:: @@ -576,11 +557,9 @@ CinnabarIsland_Gym_EventScript_Quiz5Incorrect:: end CinnabarIsland_Gym_EventScript_BattleDusty:: - compare VAR_TEMP_1, 0 - call_if_eq CinnabarIsland_Gym_EventScript_DustyApproachLeft - compare VAR_TEMP_1, 1 - call_if_eq CinnabarIsland_Gym_EventScript_DustyApproachRight - textcolor 0 + call_if_eq VAR_TEMP_1, 0, CinnabarIsland_Gym_EventScript_DustyApproachLeft + call_if_eq VAR_TEMP_1, 1, CinnabarIsland_Gym_EventScript_DustyApproachRight + textcolor NPC_TEXT_COLOR_MALE msgbox CinnabarIsland_Gym_Text_DustyIntro trainerbattle_no_intro TRAINER_BURGLAR_DUSTY, CinnabarIsland_Gym_Text_DustyDefeat goto_if_set FLAG_CINNABAR_GYM_QUIZ_5, CinnabarIsland_Gym_EventScript_DoorAlreadyOpen @@ -589,13 +568,13 @@ CinnabarIsland_Gym_EventScript_BattleDusty:: end CinnabarIsland_Gym_EventScript_DustyApproachLeft:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight applymovement LOCALID_DUSTY, CinnabarIsland_Gym_Movement_DustyApproachLeft waitmovement 0 return CinnabarIsland_Gym_EventScript_DustyApproachRight:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight applymovement LOCALID_DUSTY, CinnabarIsland_Gym_Movement_DustyApproachRight waitmovement 0 return @@ -624,10 +603,8 @@ CinnabarIsland_Gym_EventScript_Quiz6Right:: CinnabarIsland_Gym_EventScript_Quiz6:: msgbox CinnabarIsland_Gym_Text_PokemonQuizRules msgbox CinnabarIsland_Gym_Text_QuizQuestion6, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq CinnabarIsland_Gym_EventScript_Quiz6Incorrect - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_Gym_EventScript_Quiz6Correct + goto_if_eq VAR_RESULT, YES, CinnabarIsland_Gym_EventScript_Quiz6Incorrect + goto_if_eq VAR_RESULT, NO, CinnabarIsland_Gym_EventScript_Quiz6Correct end CinnabarIsland_Gym_EventScript_Quiz6Correct:: @@ -652,11 +629,9 @@ CinnabarIsland_Gym_EventScript_Quiz6Incorrect:: end CinnabarIsland_Gym_EventScript_BattleZac:: - compare VAR_TEMP_1, 0 - call_if_eq CinnabarIsland_Gym_EventScript_ZacApproachLeft - compare VAR_TEMP_1, 1 - call_if_eq CinnabarIsland_Gym_EventScript_ZacApproachRight - textcolor 0 + call_if_eq VAR_TEMP_1, 0, CinnabarIsland_Gym_EventScript_ZacApproachLeft + call_if_eq VAR_TEMP_1, 1, CinnabarIsland_Gym_EventScript_ZacApproachRight + textcolor NPC_TEXT_COLOR_MALE msgbox CinnabarIsland_Gym_Text_ZacIntro trainerbattle_no_intro TRAINER_SUPER_NERD_ZAC, CinnabarIsland_Gym_Text_ZacDefeat goto_if_set FLAG_CINNABAR_GYM_QUIZ_6, CinnabarIsland_Gym_EventScript_DoorAlreadyOpen @@ -665,13 +640,13 @@ CinnabarIsland_Gym_EventScript_BattleZac:: end CinnabarIsland_Gym_EventScript_ZacApproachLeft:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight applymovement LOCALID_ZAC, CinnabarIsland_Gym_Movement_ZacApproachLeft waitmovement 0 return CinnabarIsland_Gym_EventScript_ZacApproachRight:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight applymovement LOCALID_ZAC, CinnabarIsland_Gym_Movement_ZacApproachRight waitmovement 0 return diff --git a/data/maps/CinnabarIsland_PokemonCenter_1F/scripts.inc b/data/maps/CinnabarIsland_PokemonCenter_1F/scripts.inc index 5644b408b..5f0b86d7e 100644 --- a/data/maps/CinnabarIsland_PokemonCenter_1F/scripts.inc +++ b/data/maps/CinnabarIsland_PokemonCenter_1F/scripts.inc @@ -32,8 +32,7 @@ CinnabarIsland_PokemonCenter_1F_EventScript_Bill:: lock faceplayer msgbox CinnabarIsland_PokemonCenter_1F_Text_ReadyToSailToOneIsland, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_PokemonCenter_1F_EventScript_NotReadyToSail + goto_if_eq VAR_RESULT, NO, CinnabarIsland_PokemonCenter_1F_EventScript_NotReadyToSail msgbox CinnabarIsland_PokemonCenter_1F_Text_LetsGo closemessage playbgm MUS_FOLLOW_ME, 1 @@ -41,16 +40,13 @@ CinnabarIsland_PokemonCenter_1F_EventScript_Bill:: setflag FLAG_DONT_TRANSITION_MUSIC setflag FLAG_HIDE_CINNABAR_POKECENTER_BILL delay 20 - compare VAR_FACING, DIR_SOUTH - call_if_eq CinnabarIsland_PokemonCenter_1F_EventScript_ExitWithBillSouth - compare VAR_FACING, DIR_EAST - call_if_eq CinnabarIsland_PokemonCenter_1F_EventScript_ExitWithBillEast - compare VAR_FACING, DIR_WEST - call_if_eq CinnabarIsland_PokemonCenter_1F_EventScript_ExitWithBillWest + call_if_eq VAR_FACING, DIR_SOUTH, CinnabarIsland_PokemonCenter_1F_EventScript_ExitWithBillSouth + call_if_eq VAR_FACING, DIR_EAST, CinnabarIsland_PokemonCenter_1F_EventScript_ExitWithBillEast + call_if_eq VAR_FACING, DIR_WEST, CinnabarIsland_PokemonCenter_1F_EventScript_ExitWithBillWest removeobject LOCALID_BILL setvar VAR_MAP_SCENE_CINNABAR_ISLAND_2, 1 clearflag FLAG_HIDE_CINNABAR_BILL - warp MAP_CINNABAR_ISLAND, 255, 14, 11 + warp MAP_CINNABAR_ISLAND, 14, 11 waitstate release end diff --git a/data/maps/CinnabarIsland_PokemonLab_Entrance/scripts.inc b/data/maps/CinnabarIsland_PokemonLab_Entrance/scripts.inc index d06864639..7969a84f3 100644 --- a/data/maps/CinnabarIsland_PokemonLab_Entrance/scripts.inc +++ b/data/maps/CinnabarIsland_PokemonLab_Entrance/scripts.inc @@ -3,8 +3,7 @@ CinnabarIsland_PokemonLab_Entrance_MapScripts:: .byte 0 CinnabarIsland_PokemonLab_Entrance_OnTransition:: - compare VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_REVIVE_STATE, 1 - call_if_eq CinnabarIsland_PokemonLab_Entrance_EventScript_ReadyFossil + call_if_eq VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_REVIVE_STATE, 1, CinnabarIsland_PokemonLab_Entrance_EventScript_ReadyFossil end CinnabarIsland_PokemonLab_Entrance_EventScript_ReadyFossil:: diff --git a/data/maps/CinnabarIsland_PokemonLab_ExperimentRoom/scripts.inc b/data/maps/CinnabarIsland_PokemonLab_ExperimentRoom/scripts.inc index 6f81a5407..92cfb97ea 100644 --- a/data/maps/CinnabarIsland_PokemonLab_ExperimentRoom/scripts.inc +++ b/data/maps/CinnabarIsland_PokemonLab_ExperimentRoom/scripts.inc @@ -12,14 +12,11 @@ CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_Garett:: call EventScript_GetInGameTradeSpeciesInfo goto_if_set FLAG_DID_SEELOR_TRADE, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_AlreadyTraded msgbox Trade_Text_LookingForMonWannaTradeForMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_DeclineTrade + goto_if_eq VAR_RESULT, NO, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_DeclineTrade call EventScript_ChooseMonForInGameTrade - compare VAR_0x8004, PARTY_SIZE - goto_if_ge CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_DeclineTrade + goto_if_ge VAR_0x8004, PARTY_SIZE, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_DeclineTrade call EventScript_GetInGameTradeSpecies - compare VAR_RESULT, VAR_0x8009 - goto_if_ne CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NotRequestedMon + goto_if_ne VAR_RESULT, VAR_0x8009, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NotRequestedMon call EventScript_DoInGameTrade msgbox Trade_Text_HeyThanks setflag FLAG_DID_SEELOR_TRADE @@ -32,7 +29,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 @@ -47,21 +44,15 @@ CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_FossilScientist:: faceplayer setvar VAR_RESULT, FALSE call_if_set FLAG_REVIVED_AMBER, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_CheckRevivedMtMoonFossil - compare VAR_RESULT, TRUE - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_RevivedAllFossils - compare VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_REVIVE_STATE, 2 - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveRevivedMon - compare VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_REVIVE_STATE, 1 - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_FossilStillReviving + goto_if_eq VAR_RESULT, TRUE, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_RevivedAllFossils + goto_if_eq VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_REVIVE_STATE, 2, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveRevivedMon + goto_if_eq VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_REVIVE_STATE, 1, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_FossilStillReviving call CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_CheckAddHelixFossilToList - compare VAR_RESULT, TRUE - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilHelix + goto_if_eq VAR_RESULT, TRUE, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilHelix call CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_CheckAddDomeFossilToList - compare VAR_RESULT, TRUE - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilDome + goto_if_eq VAR_RESULT, TRUE, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilDome call CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_CheckAddOldAmberToList - compare VAR_RESULT, TRUE - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilAmber + goto_if_eq VAR_RESULT, TRUE, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilAmber msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_HaveYouAFossilForMe goto CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_DontShowFossil end @@ -97,8 +88,7 @@ CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilHelix:: message CinnabarIsland_PokemonLab_ExperimentRoom_Text_HaveYouAFossilForMe waitmessage call CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_CheckAddOldAmberToList - compare VAR_RESULT, TRUE - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilHelixAmber + goto_if_eq VAR_RESULT, TRUE, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilHelixAmber multichoice 0, 0, MULTICHOICE_HELIX, FALSE switch VAR_RESULT case 0, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ShowHelixFossil @@ -110,8 +100,7 @@ CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilDome:: message CinnabarIsland_PokemonLab_ExperimentRoom_Text_HaveYouAFossilForMe waitmessage call CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_CheckAddOldAmberToList - compare VAR_RESULT, TRUE - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilDomeAmber + goto_if_eq VAR_RESULT, TRUE, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ChooseFossilDomeAmber multichoice 0, 0, MULTICHOICE_DOME, FALSE switch VAR_RESULT case 0, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_ShowDomeFossil @@ -148,13 +137,12 @@ 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 + goto_if_eq VAR_RESULT, NO, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_DeclineReviveFossil msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_HandedFossilToWeirdDoctor - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE removeitem ITEM_HELIX_FOSSIL msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_TakesTimeGoForWalk setvar VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_REVIVE_STATE, 1 @@ -163,13 +151,12 @@ 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 + goto_if_eq VAR_RESULT, NO, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_DeclineReviveFossil msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_HandedFossilToWeirdDoctor - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE removeitem ITEM_DOME_FOSSIL msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_TakesTimeGoForWalk setvar VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_REVIVE_STATE, 1 @@ -178,13 +165,12 @@ 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 + goto_if_eq VAR_RESULT, NO, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_DeclineReviveFossil msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_HandedFossilToWeirdDoctor - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE removeitem ITEM_OLD_AMBER msgbox CinnabarIsland_PokemonLab_ExperimentRoom_Text_TakesTimeGoForWalk setvar VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_REVIVE_STATE, 1 @@ -203,81 +189,67 @@ CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_FossilStillReviving:: end CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveRevivedMon:: - compare VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_WHICH_FOSSIL, HELIX_FOSSIL - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveOmanyte - compare VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_WHICH_FOSSIL, DOME_FOSSIL - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveKabuto - compare VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_WHICH_FOSSIL, OLD_AMBER - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveAerodactyl + goto_if_eq VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_WHICH_FOSSIL, HELIX_FOSSIL, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveOmanyte + goto_if_eq VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_WHICH_FOSSIL, DOME_FOSSIL, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveKabuto + goto_if_eq VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_WHICH_FOSSIL, OLD_AMBER, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_GiveAerodactyl end 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 - goto_if_eq EventScript_NoMoreRoomForPokemon + givemon SPECIES_OMANYTE, 5 + goto_if_eq VAR_RESULT, 2, EventScript_NoMoreRoomForPokemon setflag FLAG_REVIVED_HELIX - compare VAR_RESULT, 0 - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonParty - compare VAR_RESULT, 1 - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonPC + goto_if_eq VAR_RESULT, 0, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonParty + goto_if_eq VAR_RESULT, 1, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonPC end 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 - goto_if_eq EventScript_NoMoreRoomForPokemon + givemon SPECIES_KABUTO, 5 + goto_if_eq VAR_RESULT, 2, EventScript_NoMoreRoomForPokemon setflag FLAG_REVIVED_DOME - compare VAR_RESULT, 0 - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonParty - compare VAR_RESULT, 1 - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonPC + goto_if_eq VAR_RESULT, 0, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonParty + goto_if_eq VAR_RESULT, 1, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonPC end 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 - goto_if_eq EventScript_NoMoreRoomForPokemon + givemon SPECIES_AERODACTYL, 5 + goto_if_eq VAR_RESULT, 2, EventScript_NoMoreRoomForPokemon setflag FLAG_REVIVED_AMBER - compare VAR_RESULT, 0 - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonParty - compare VAR_RESULT, 1 - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonPC + goto_if_eq VAR_RESULT, 0, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonParty + goto_if_eq VAR_RESULT, 1, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonPC end CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonParty:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_LEVEL_UP message CinnabarIsland_PokemonLab_ExperimentRoom_Text_ReceivedMonFromDoctor waitmessage waitfanfare setvar VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_REVIVE_STATE, 0 msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_EndGiveMon + goto_if_eq VAR_RESULT, NO, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_EndGiveMon call EventScript_GetGiftMonPartySlot call EventScript_ChangePokemonNickname goto CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_EndGiveMon end CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_NicknameMonPC:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_LEVEL_UP message CinnabarIsland_PokemonLab_ExperimentRoom_Text_ReceivedMonFromDoctor waitmessage waitfanfare setvar VAR_MAP_SCENE_CINNABAR_ISLAND_POKEMON_LAB_EXPERIMENT_ROOM_REVIVE_STATE, 0 msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_MonSentToPC + goto_if_eq VAR_RESULT, NO, CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_MonSentToPC call EventScript_NameReceivedBoxMon goto CinnabarIsland_PokemonLab_ExperimentRoom_EventScript_MonSentToPC end diff --git a/data/maps/CinnabarIsland_PokemonLab_Lounge/scripts.inc b/data/maps/CinnabarIsland_PokemonLab_Lounge/scripts.inc index 45d2a11c0..cbe712834 100644 --- a/data/maps/CinnabarIsland_PokemonLab_Lounge/scripts.inc +++ b/data/maps/CinnabarIsland_PokemonLab_Lounge/scripts.inc @@ -12,14 +12,11 @@ CinnabarIsland_PokemonLab_Lounge_EventScript_Clifton:: call EventScript_GetInGameTradeSpeciesInfo goto_if_set FLAG_DID_ESPHERE_TRADE, CinnabarIsland_PokemonLab_Lounge_EventScript_CliftonAlreadyTraded msgbox Trade_Text_DoYouHaveMonWouldYouTradeForMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_PokemonLab_Lounge_EventScript_CliftonDeclineTrade + goto_if_eq VAR_RESULT, NO, CinnabarIsland_PokemonLab_Lounge_EventScript_CliftonDeclineTrade call EventScript_ChooseMonForInGameTrade - compare VAR_0x8004, PARTY_SIZE - goto_if_ge CinnabarIsland_PokemonLab_Lounge_EventScript_CliftonDeclineTrade + goto_if_ge VAR_0x8004, PARTY_SIZE, CinnabarIsland_PokemonLab_Lounge_EventScript_CliftonDeclineTrade call EventScript_GetInGameTradeSpecies - compare VAR_RESULT, VAR_0x8009 - goto_if_ne CinnabarIsland_PokemonLab_Lounge_EventScript_CliftonNotRequestedMon + goto_if_ne VAR_RESULT, VAR_0x8009, CinnabarIsland_PokemonLab_Lounge_EventScript_CliftonNotRequestedMon call EventScript_DoInGameTrade msgbox Trade_Text_Thanks setflag FLAG_DID_ESPHERE_TRADE @@ -32,7 +29,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 @@ -51,18 +48,15 @@ CinnabarIsland_PokemonLab_Lounge_EventScript_Norma:: copyvar VAR_0x8009, VAR_RESULT goto_if_set FLAG_DID_TANGENY_TRADE, CinnabarIsland_PokemonLab_Lounge_EventScript_NormaAlreadyTraded msgbox Trade_Text_DoYouHaveMonWantToTradeForMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CinnabarIsland_PokemonLab_Lounge_EventScript_NormaDeclineTrade + goto_if_eq VAR_RESULT, NO, CinnabarIsland_PokemonLab_Lounge_EventScript_NormaDeclineTrade special ChoosePartyMon waitstate copyvar VAR_0x800A, VAR_0x8004 - compare VAR_0x8004, PARTY_SIZE - goto_if_ge CinnabarIsland_PokemonLab_Lounge_EventScript_NormaDeclineTrade + goto_if_ge VAR_0x8004, PARTY_SIZE, CinnabarIsland_PokemonLab_Lounge_EventScript_NormaDeclineTrade copyvar VAR_0x8005, VAR_0x800A specialvar VAR_RESULT, GetTradeSpecies copyvar VAR_0x800B, VAR_RESULT - compare VAR_RESULT, VAR_0x8009 - goto_if_ne CinnabarIsland_PokemonLab_Lounge_EventScript_NormaNotRequestedMon + goto_if_ne VAR_RESULT, VAR_0x8009, CinnabarIsland_PokemonLab_Lounge_EventScript_NormaNotRequestedMon copyvar VAR_0x8004, VAR_0x8008 copyvar VAR_0x8005, VAR_0x800A special CreateInGameTradePokemon @@ -79,7 +73,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_LostCave_Room10/scripts.inc b/data/maps/FiveIsland_LostCave_Room10/scripts.inc index d442b9b40..646136ff4 100644 --- a/data/maps/FiveIsland_LostCave_Room10/scripts.inc +++ b/data/maps/FiveIsland_LostCave_Room10/scripts.inc @@ -19,7 +19,7 @@ FiveIsland_LostCave_Room10_OnFrame:: FiveIsland_LostCave_Room10_EventScript_FindSelphyScene:: lockall - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE applymovement LOCALID_SELPHY, FiveIsland_LostCave_Room10_Movement_SelphyWander waitmovement 0 delay 100 @@ -31,7 +31,7 @@ FiveIsland_LostCave_Room10_EventScript_FindSelphyScene:: msgbox FiveIsland_LostCave_Room10_Text_MayIAskYouToTakeMeHome closemessage call FiveIsland_LostCave_Room10_EventScript_SetSelphyFound - warp MAP_FIVE_ISLAND_RESORT_GORGEOUS, 255, 39, 10 + warp MAP_FIVE_ISLAND_RESORT_GORGEOUS, 39, 10 waitstate releaseall end @@ -54,9 +54,9 @@ FiveIsland_LostCave_Room10_Movement_SelphyWander:: delay_16 walk_right delay_16 - walk_in_place_fastest_up + walk_in_place_faster_up delay_16 - walk_in_place_fastest_down + walk_in_place_faster_down step_end FiveIsland_LostCave_Room10_Movement_SelphyApproach:: diff --git a/data/maps/FiveIsland_MemorialPillar/scripts.inc b/data/maps/FiveIsland_MemorialPillar/scripts.inc index c240bdbba..336b45902 100644 --- a/data/maps/FiveIsland_MemorialPillar/scripts.inc +++ b/data/maps/FiveIsland_MemorialPillar/scripts.inc @@ -13,7 +13,7 @@ FiveIsland_MemorialPillar_EventScript_MemorialMan:: waitmovement 0 delay 45 msgbox FiveIsland_MemorialPillar_Text_YourMonsLookHealthy - applymovement LOCALID_MEMORIAL_MAN, Movement_WalkInPlaceFastestUp + applymovement LOCALID_MEMORIAL_MAN, Movement_WalkInPlaceFasterUp waitmovement 0 msgbox FiveIsland_MemorialPillar_Text_ThisIsWhereIBuriedMyOnix release @@ -27,8 +27,7 @@ FiveIsland_MemorialPillar_EventScript_AlreadyGotTM42:: FiveIsland_MemorialPillar_EventScript_ReturnedForTM42:: msgbox FiveIsland_MemorialPillar_Text_StillHaveThingAsMyThanks giveitem ITEM_TM42 - compare VAR_RESULT, FALSE - goto_if_eq FiveIsland_MemorialPillar_EventScript_NoRoomForTM42 + goto_if_eq VAR_RESULT, FALSE, FiveIsland_MemorialPillar_EventScript_NoRoomForTM42 call FiveIsland_MemorialPillar_EventScript_ReceivedTM42 release end @@ -40,40 +39,37 @@ FiveIsland_MemorialPillar_EventScript_Memorial:: goto_if_set FLAG_GOT_TM42_AT_MEMORIAL_PILLAR, FiveIsland_MemorialPillar_EventScript_MemorialLemonadeAlreadyPlaced goto_if_set FLAG_NO_ROOM_FOR_TM42_AT_MEMORIAL_PILLAR, FiveIsland_MemorialPillar_EventScript_MemorialLemonadeAlreadyPlaced msgbox FiveIsland_MemorialPillar_Text_HereLiesTectonixLemonadeOffering - checkitem ITEM_LEMONADE, 1 - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_MemorialPillar_EventScript_AskPlaceLemonade + checkitem ITEM_LEMONADE + goto_if_eq VAR_RESULT, TRUE, FiveIsland_MemorialPillar_EventScript_AskPlaceLemonade releaseall end FiveIsland_MemorialPillar_EventScript_AskPlaceLemonade:: msgbox FiveIsland_MemorialPillar_Text_LeaveAnotherLemonadeOffering, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FiveIsland_MemorialPillar_EventScript_PlaceLemonade + goto_if_eq VAR_RESULT, YES, FiveIsland_MemorialPillar_EventScript_PlaceLemonade releaseall end FiveIsland_MemorialPillar_EventScript_PlaceLemonade:: - removeitem ITEM_LEMONADE, 1 + removeitem ITEM_LEMONADE msgbox FiveIsland_MemorialPillar_Text_PlacedCanOfLemonade closemessage - applymovement LOCALID_MEMORIAL_MAN, Movement_WalkInPlaceFastestRight + applymovement LOCALID_MEMORIAL_MAN, Movement_WalkInPlaceFasterRight waitmovement 0 delay 45 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox FiveIsland_MemorialPillar_Text_ThankYouPleaseTakeThis giveitem ITEM_TM42 - compare VAR_RESULT, FALSE - goto_if_eq FiveIsland_MemorialPillar_EventScript_NoRoomForTM42 + goto_if_eq VAR_RESULT, FALSE, FiveIsland_MemorialPillar_EventScript_NoRoomForTM42 call FiveIsland_MemorialPillar_EventScript_ReceivedTM42 releaseall end FiveIsland_MemorialPillar_EventScript_ReceivedTM42:: msgbox FiveIsland_MemorialPillar_Text_BeGoodToYourMonsToo - applymovement LOCALID_MEMORIAL_MAN, Movement_WalkInPlaceFastestUp + applymovement LOCALID_MEMORIAL_MAN, Movement_WalkInPlaceFasterUp waitmovement 0 setflag FLAG_GOT_TM42_AT_MEMORIAL_PILLAR return diff --git a/data/maps/FiveIsland_ResortGorgeous/scripts.inc b/data/maps/FiveIsland_ResortGorgeous/scripts.inc index 2e6cf1777..a9ad66461 100644 --- a/data/maps/FiveIsland_ResortGorgeous/scripts.inc +++ b/data/maps/FiveIsland_ResortGorgeous/scripts.inc @@ -19,10 +19,10 @@ FiveIsland_ResortGorgeous_OnFrame:: FiveIsland_ResortGorgeous_EventScript_SelphyReturnHomeScene:: lockall - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox FiveIsland_ResortGorgeous_Text_SelphyThanksYouMayGoNow closemessage - applymovement LOCALID_SELPHY, Movement_WalkInPlaceFastestUp + applymovement LOCALID_SELPHY, Movement_WalkInPlaceFasterUp waitmovement 0 opendoor 39, 8 waitdooranim diff --git a/data/maps/FiveIsland_ResortGorgeous_House/scripts.inc b/data/maps/FiveIsland_ResortGorgeous_House/scripts.inc index 9b42f9966..36ada6601 100644 --- a/data/maps/FiveIsland_ResortGorgeous_House/scripts.inc +++ b/data/maps/FiveIsland_ResortGorgeous_House/scripts.inc @@ -12,10 +12,8 @@ FiveIsland_ResortGorgeous_House_EventScript_Selphy:: lock faceplayer goto_if_set SHOWN_REQUESTED_MON, FiveIsland_ResortGorgeous_House_EventScript_JustFulfilledRequest - compare VAR_RESORT_GORGEOUS_REQUESTED_MON, 0xFFFF - goto_if_eq FiveIsland_ResortGorgeous_House_EventScript_RequestTookTooLong - compare VAR_RESORT_GORGEOUS_REQUESTED_MON, SPECIES_NONE - goto_if_ne FiveIsland_ResortGorgeous_House_EventScript_CheckForRequestedMon + goto_if_eq VAR_RESORT_GORGEOUS_REQUESTED_MON, 0xFFFF, FiveIsland_ResortGorgeous_House_EventScript_RequestTookTooLong + goto_if_ne VAR_RESORT_GORGEOUS_REQUESTED_MON, SPECIES_NONE, FiveIsland_ResortGorgeous_House_EventScript_CheckForRequestedMon msgbox FiveIsland_ResortGorgeous_House_Text_PleaseHearMyWish goto FiveIsland_ResortGorgeous_House_EventScript_RequestMon end @@ -34,8 +32,7 @@ FiveIsland_ResortGorgeous_House_EventScript_RequestTookTooLong:: FiveIsland_ResortGorgeous_House_EventScript_CheckForRequestedMon:: copyvar VAR_0x8004, VAR_RESORT_GORGEOUS_REQUESTED_MON specialvar VAR_RESULT, DoesPlayerPartyContainSpecies - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_ResortGorgeous_House_EventScript_ShowRequestedMon + goto_if_eq VAR_RESULT, TRUE, FiveIsland_ResortGorgeous_House_EventScript_ShowRequestedMon goto FiveIsland_ResortGorgeous_House_EventScript_RequestMon end @@ -45,53 +42,48 @@ FiveIsland_ResortGorgeous_House_EventScript_ShowRequestedMon:: addobject LOCALID_BUTLER applymovement LOCALID_BUTLER, FiveIsland_ResortGorgeous_House_Movement_ButlerEnter waitmovement 0 - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox FiveIsland_ResortGorgeous_House_Text_ButlerYesMyLady - applymovement LOCALID_SELPHY, Movement_WalkInPlaceFastestUp + applymovement LOCALID_SELPHY, Movement_WalkInPlaceFasterUp waitmovement 0 - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox FiveIsland_ResortGorgeous_House_Text_SelphyGiveTokenOfAppreciation - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox FiveIsland_ResortGorgeous_House_Text_ButlerIShallDoAsYouBid closemessage - compare VAR_FACING, DIR_NORTH - call_if_eq FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerSouth - compare VAR_FACING, DIR_EAST - call_if_eq FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerEast - compare VAR_FACING, DIR_WEST - call_if_eq FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerWest - moveobjectoffscreen LOCALID_BUTLER + call_if_eq VAR_FACING, DIR_NORTH, FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerNorth + call_if_eq VAR_FACING, DIR_SOUTH, FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerSouth + call_if_eq VAR_FACING, DIR_EAST, FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerEast + call_if_eq VAR_FACING, DIR_WEST, FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerWest + copyobjectxytoperm LOCALID_BUTLER msgbox FiveIsland_ResortGorgeous_House_Text_ButlerPleaseAcceptThisAsHerThanks giveitem VAR_RESORT_GORGEOUS_REWARD - compare VAR_RESULT, FALSE - goto_if_eq FiveIsland_ResortGorgeous_House_EventScript_NoRoomForReward + goto_if_eq VAR_RESULT, FALSE, FiveIsland_ResortGorgeous_House_EventScript_NoRoomForReward setflag SHOWN_REQUESTED_MON setvar VAR_RESORT_GORGEOUS_REQUESTED_MON, SPECIES_NONE release end FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerNorth:: - applymovement LOCALID_SELPHY, Movement_WalkInPlaceFastestDown + applymovement LOCALID_SELPHY, Movement_WalkInPlaceFasterDown applymovement LOCALID_BUTLER, FiveIsland_ResortGorgeous_House_Movement_ButlerApproachPlayerNorth waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 return FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerSouth:: applymovement LOCALID_BUTLER, FiveIsland_ResortGorgeous_House_Movement_ButlerApproachPlayerSouth waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 return FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerEast:: - applymovement LOCALID_SELPHY, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_SELPHY, Movement_WalkInPlaceFasterLeft applymovement LOCALID_BUTLER, FiveIsland_ResortGorgeous_House_Movement_ButlerApproachPlayerEast waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 return @@ -101,9 +93,9 @@ FiveIsland_ResortGorgeous_House_EventScript_ButlerApproachPlayerWest:: return FiveIsland_ResortGorgeous_House_EventScript_NoRoomForReward:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox FiveIsland_ResortGorgeous_House_Text_ButlerBagAppearsToBeFull - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox FiveIsland_ResortGorgeous_House_Text_OhHowDisappointing setflag SHOWN_REQUESTED_MON setvar VAR_RESORT_GORGEOUS_REQUESTED_MON, SPECIES_NONE @@ -122,13 +114,13 @@ FiveIsland_ResortGorgeous_House_Movement_ButlerApproachPlayerNorth:: walk_down walk_down walk_down - walk_in_place_fastest_right + walk_in_place_faster_right step_end FiveIsland_ResortGorgeous_House_Movement_ButlerApproachPlayerSouth:: walk_left walk_left - walk_in_place_fastest_down + walk_in_place_faster_down step_end FiveIsland_ResortGorgeous_House_Movement_ButlerApproachPlayerEast:: diff --git a/data/maps/FiveIsland_RocketWarehouse/scripts.inc b/data/maps/FiveIsland_RocketWarehouse/scripts.inc index 28ad89a8e..a5b30422f 100644 --- a/data/maps/FiveIsland_RocketWarehouse/scripts.inc +++ b/data/maps/FiveIsland_RocketWarehouse/scripts.inc @@ -43,7 +43,7 @@ FiveIsland_RocketWarehouse_EventScript_Computer:: FiveIsland_RocketWarehouse_EventScript_Admin2Trigger:: lockall - applymovement LOCALID_ADMIN2, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_ADMIN2, Movement_WalkInPlaceFasterLeft waitmovement 0 setvar VAR_MAP_SCENE_ROCKET_WAREHOUSE, 1 releaseall @@ -84,8 +84,7 @@ FiveIsland_RocketWarehouse_EventScript_Admin2:: FiveIsland_RocketWarehouse_EventScript_DefeatedAdmin2:: getplayerxy PLAYER_X_POS, PLAYER_Y_POS - compare PLAYER_X_POS, 24 - call_if_le FiveIsland_RocketWarehouse_EventScript_PlayerFaceAdmin2 + call_if_le PLAYER_X_POS, 24, FiveIsland_RocketWarehouse_EventScript_PlayerFaceAdmin2 msgbox FiveIsland_RocketWarehouse_Text_Admin2PostBattle closemessage fadescreen FADE_TO_BLACK @@ -101,7 +100,7 @@ FiveIsland_RocketWarehouse_EventScript_DefeatedAdmin2:: end FiveIsland_RocketWarehouse_EventScript_PlayerFaceAdmin2:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 return @@ -118,38 +117,28 @@ FiveIsland_RocketWarehouse_EventScript_Admin1:: FiveIsland_RocketWarehouse_EventScript_DefeatedAdmin1:: getplayerxy PLAYER_X_POS, PLAYER_Y_POS specialvar VAR_RESULT, GetPlayerFacingDirection - compare VAR_RESULT, DIR_NORTH - call_if_eq FiveIsland_RocketWarehouse_EventScript_PlayerFaceAdmin1 + call_if_eq VAR_RESULT, DIR_NORTH, FiveIsland_RocketWarehouse_EventScript_PlayerFaceAdmin1 msgbox FiveIsland_RocketWarehouse_Text_Admin1PostBattle closemessage - compare PLAYER_X_POS, 24 - call_if_le FiveIsland_RocketWarehouse_EventScript_AdminWalkToSwitchFar - compare PLAYER_X_POS, 25 - call_if_eq FiveIsland_RocketWarehouse_EventScript_AdminWalkToSwitch - compare PLAYER_X_POS, 26 - call_if_eq FiveIsland_RocketWarehouse_EventScript_AdminFaceSwitch - compare PLAYER_X_POS, 27 - call_if_eq FiveIsland_RocketWarehouse_EventScript_AdminFaceSwitch + call_if_le PLAYER_X_POS, 24, FiveIsland_RocketWarehouse_EventScript_AdminWalkToSwitchFar + call_if_eq PLAYER_X_POS, 25, FiveIsland_RocketWarehouse_EventScript_AdminWalkToSwitch + call_if_eq PLAYER_X_POS, 26, FiveIsland_RocketWarehouse_EventScript_AdminFaceSwitch + call_if_eq PLAYER_X_POS, 27, FiveIsland_RocketWarehouse_EventScript_AdminFaceSwitch playse SE_PIN call FiveIsland_RocketWarehouse_EventScript_SetArrowsForReEntry special DrawWholeMapView waitse - compare PLAYER_X_POS, 24 - call_if_le FiveIsland_RocketWarehouse_EventScript_AdminFacePlayerLeft - compare PLAYER_X_POS, 25 - call_if_eq FiveIsland_RocketWarehouse_EventScript_AdminFacePlayerLeft - compare PLAYER_X_POS, 26 - call_if_eq FiveIsland_RocketWarehouse_EventScript_AdminFacePlayerLeft - compare PLAYER_X_POS, 27 - call_if_eq FiveIsland_RocketWarehouse_EventScript_AdminFacePlayerDown + call_if_le PLAYER_X_POS, 24, FiveIsland_RocketWarehouse_EventScript_AdminFacePlayerLeft + call_if_eq PLAYER_X_POS, 25, FiveIsland_RocketWarehouse_EventScript_AdminFacePlayerLeft + call_if_eq PLAYER_X_POS, 26, FiveIsland_RocketWarehouse_EventScript_AdminFacePlayerLeft + call_if_eq PLAYER_X_POS, 27, FiveIsland_RocketWarehouse_EventScript_AdminFacePlayerDown msgbox FiveIsland_RocketWarehouse_Text_MadeItSoYouCanComeBackThrough release end FiveIsland_RocketWarehouse_EventScript_PlayerFaceAdmin1:: - compare PLAYER_X_POS, 27 - goto_if_eq EventScript_Return - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + goto_if_eq PLAYER_X_POS, 27, EventScript_Return + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 return @@ -164,27 +153,27 @@ FiveIsland_RocketWarehouse_EventScript_AdminWalkToSwitch:: return FiveIsland_RocketWarehouse_EventScript_AdminFaceSwitch:: - applymovement LOCALID_ADMIN1, Movement_WalkInPlaceFastestUp + applymovement LOCALID_ADMIN1, Movement_WalkInPlaceFasterUp waitmovement 0 return FiveIsland_RocketWarehouse_EventScript_AdminFacePlayerLeft:: - applymovement LOCALID_ADMIN1, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_ADMIN1, Movement_WalkInPlaceFasterLeft waitmovement 0 return FiveIsland_RocketWarehouse_EventScript_AdminFacePlayerDown:: - applymovement LOCALID_ADMIN1, Movement_WalkInPlaceFastestDown + applymovement LOCALID_ADMIN1, Movement_WalkInPlaceFasterDown waitmovement 0 return FiveIsland_RocketWarehouse_Movement_AdminWalkToSwitchFar:: walk_right walk_right - walk_in_place_fastest_up + walk_in_place_faster_up step_end FiveIsland_RocketWarehouse_Movement_AdminWalkToSwitch:: walk_right - walk_in_place_fastest_up + walk_in_place_faster_up step_end diff --git a/data/maps/FiveIsland_WaterLabyrinth/scripts.inc b/data/maps/FiveIsland_WaterLabyrinth/scripts.inc index eb5febc8c..a6b7b8133 100644 --- a/data/maps/FiveIsland_WaterLabyrinth/scripts.inc +++ b/data/maps/FiveIsland_WaterLabyrinth/scripts.inc @@ -10,8 +10,7 @@ FiveIsland_WaterLabyrinth_EventScript_EggGentleman:: goto_if_set FLAG_NO_ROOM_FOR_TOGEPI_EGG, FiveIsland_WaterLabyrinth_EventScript_ReturnForEgg msgbox FiveIsland_WaterLabyrinth_Text_LetMeTakeLookAtMons specialvar VAR_RESULT, GetLeadMonFriendship - compare VAR_RESULT, 6 @ Max friendship - goto_if_eq FiveIsland_WaterLabyrinth_EventScript_LeadMonMaxFriendship + goto_if_eq VAR_RESULT, 6, FiveIsland_WaterLabyrinth_EventScript_LeadMonMaxFriendship msgbox FiveIsland_WaterLabyrinth_Text_HmmISeeIsee release end @@ -29,11 +28,10 @@ FiveIsland_WaterLabyrinth_EventScript_LeadMonMaxFriendship:: FiveIsland_WaterLabyrinth_EventScript_TryGiveEgg:: getpartysize - compare VAR_RESULT, PARTY_SIZE - goto_if_eq FiveIsland_WaterLabyrinth_EventScript_NoRoomForEgg + goto_if_eq VAR_RESULT, PARTY_SIZE, FiveIsland_WaterLabyrinth_EventScript_NoRoomForEgg setflag FLAG_GOT_TOGEPI_EGG giveegg SPECIES_TOGEPI - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_LEVEL_UP message FiveIsland_WaterLabyrinth_Text_ReceivedEggFromMan waitfanfare @@ -45,16 +43,14 @@ 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 + goto_if_eq VAR_RESULT, TRUE, FiveIsland_WaterLabyrinth_EventScript_MonDaisyComment + bufferspeciesname STR_VAR_2, SPECIES_TOGETIC setvar VAR_0x8004, SPECIES_TOGETIC specialvar VAR_RESULT, PlayerPartyContainsSpeciesWithPlayerID - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_WaterLabyrinth_EventScript_MonDaisyComment + goto_if_eq VAR_RESULT, TRUE, FiveIsland_WaterLabyrinth_EventScript_MonDaisyComment msgbox FiveIsland_WaterLabyrinth_Text_GladIMetSomeoneLikeYou release end diff --git a/data/maps/FourIsland/scripts.inc b/data/maps/FourIsland/scripts.inc index 024171e8f..be6dcd7cf 100644 --- a/data/maps/FourIsland/scripts.inc +++ b/data/maps/FourIsland/scripts.inc @@ -8,8 +8,7 @@ FourIsland_MapScripts:: FourIsland_OnTransition:: setworldmapflag FLAG_WORLD_MAP_FOUR_ISLAND - compare VAR_MAP_SCENE_FOUR_ISLAND, 0 - call_if_eq FourIsland_EventScript_ShowRival + call_if_eq VAR_MAP_SCENE_FOUR_ISLAND, 0, FourIsland_EventScript_ShowRival call FourIsland_EventScript_TrySetDayCareManPos end @@ -29,8 +28,8 @@ FourIsland_OnFrame:: FourIsland_EventScript_RivalScene:: lockall - textcolor 0 - applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestDown + textcolor NPC_TEXT_COLOR_MALE + applymovement LOCALID_RIVAL, Movement_WalkInPlaceFasterDown waitmovement 0 playbgm MUS_ENCOUNTER_RIVAL, 0 applymovement LOCALID_RIVAL, Movement_ExclamationMark @@ -68,7 +67,7 @@ FourIsland_Movement_RivalExit:: FourIsland_Movement_PlayerWatchRivalExit:: walk_left - walk_in_place_fastest_right + walk_in_place_faster_right step_end FourIsland_EventScript_DaycareMan:: @@ -78,23 +77,18 @@ FourIsland_EventScript_DaycareMan:: faceplayer special GetDaycareMonNicknames specialvar VAR_RESULT, GetDaycareState - compare VAR_RESULT, DAYCARE_EGG_WAITING - goto_if_eq FourIsland_EventScript_DaycareEggWaiting - compare VAR_RESULT, DAYCARE_ONE_MON - goto_if_eq FourIsland_EventScript_CheckOnOneMon - compare VAR_RESULT, DAYCARE_TWO_MONS - goto_if_eq FourIsland_EventScript_CheckOnTwoMons + goto_if_eq VAR_RESULT, DAYCARE_EGG_WAITING, FourIsland_EventScript_DaycareEggWaiting + goto_if_eq VAR_RESULT, DAYCARE_ONE_MON, FourIsland_EventScript_CheckOnOneMon + goto_if_eq VAR_RESULT, DAYCARE_TWO_MONS, FourIsland_EventScript_CheckOnTwoMons msgbox DayCare_Text_ImDaycareManSpeakToMyWife release end FourIsland_EventScript_DaycareEggWaiting:: msgbox DayCare_Text_DoYouWantEgg, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FourIsland_EventScript_DaycareAcceptEgg + goto_if_eq VAR_RESULT, YES, FourIsland_EventScript_DaycareAcceptEgg msgbox DayCare_Text_IWillKeepDoYouWantIt, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FourIsland_EventScript_DaycareAcceptEgg + goto_if_eq VAR_RESULT, YES, FourIsland_EventScript_DaycareAcceptEgg msgbox DayCare_Text_IllKeepIt clearflag FLAG_PENDING_DAYCARE_EGG special RejectEggFromDayCare @@ -103,14 +97,13 @@ FourIsland_EventScript_DaycareEggWaiting:: FourIsland_EventScript_DaycareAcceptEgg:: specialvar VAR_RESULT, CalculatePlayerPartyCount - compare VAR_RESULT, PARTY_SIZE - goto_if_ne FourIsland_EventScript_DaycareReceivedEgg + goto_if_ne VAR_RESULT, PARTY_SIZE, FourIsland_EventScript_DaycareReceivedEgg msgbox DayCare_Text_YouHaveNoRoomForIt release end FourIsland_EventScript_DaycareReceivedEgg:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL message DayCare_Text_ReceivedEgg call EventScript_RestorePrevTextColor playfanfare MUS_LEVEL_UP diff --git a/data/maps/FourIsland_IcefallCave_Back/scripts.inc b/data/maps/FourIsland_IcefallCave_Back/scripts.inc index b0ef13da6..987a08764 100644 --- a/data/maps/FourIsland_IcefallCave_Back/scripts.inc +++ b/data/maps/FourIsland_IcefallCave_Back/scripts.inc @@ -8,8 +8,7 @@ FourIsland_IcefallCave_Back_MapScripts:: .byte 0 FourIsland_IcefallCave_Back_OnTransition:: - compare VAR_MAP_SCENE_ICEFALL_CAVE_BACK, 1 - call_if_eq FourIsland_IcefallCave_Back_EventScript_HideLorelei + call_if_eq VAR_MAP_SCENE_ICEFALL_CAVE_BACK, 1, FourIsland_IcefallCave_Back_EventScript_HideLorelei end FourIsland_IcefallCave_Back_EventScript_HideLorelei:: @@ -18,27 +17,27 @@ FourIsland_IcefallCave_Back_EventScript_HideLorelei:: FourIsland_IcefallCave_Back_EventScript_LoreleiRocketsScene:: lockall - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox FourIsland_IcefallCave_Back_Text_LoreleiKeepHandsOffMons applymovement LOCALID_ROCKET1, FourIsland_IcefallCave_Back_Movement_WalkInPlaceDown waitmovement 0 - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox FourIsland_IcefallCave_Back_Text_ShutItLadyLeaveUsBe closemessage playse SE_PIN applymovement LOCALID_LORELEI, Movement_ExclamationMark waitmovement 0 - applymovement LOCALID_LORELEI, Movement_WalkInPlaceFastestDown + applymovement LOCALID_LORELEI, Movement_WalkInPlaceFasterDown waitmovement 0 applymovement LOCALID_LORELEI, Movement_Delay48 waitmovement 0 - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox FourIsland_IcefallCave_Back_Text_LoreleiPlayerHelpMeKickPoachersOut closemessage - applymovement LOCALID_LORELEI, Movement_WalkInPlaceFastestRight + applymovement LOCALID_LORELEI, Movement_WalkInPlaceFasterRight waitmovement 0 delay 18 - applymovement LOCALID_LORELEI, Movement_WalkInPlaceFastestDown + applymovement LOCALID_LORELEI, Movement_WalkInPlaceFasterDown waitmovement 0 delay 35 applymovement LOCALID_ROCKET3, FourIsland_IcefallCave_Back_Movement_Rocket3FaceLorelei @@ -48,17 +47,17 @@ FourIsland_IcefallCave_Back_EventScript_LoreleiRocketsScene:: applymovement LOCALID_ROCKET2, FourIsland_IcefallCave_Back_Movement_WalkInPlaceDown waitmovement 0 playbgm MUS_ENCOUNTER_ROCKET, 0 - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox FourIsland_IcefallCave_Back_Text_GruntIntro setvar VAR_LAST_TALKED, LOCALID_ROCKET3 trainerbattle_no_intro TRAINER_TEAM_ROCKET_GRUNT_45, FourIsland_IcefallCave_Back_Text_GruntDefeat applymovement LOCALID_LORELEI, FourIsland_IcefallCave_Back_Movement_WalkInPlaceUp waitmovement 0 - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox FourIsland_IcefallCave_Back_Text_LoreleiWhereHaveYouTakenMons - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox FourIsland_IcefallCave_Back_Text_NotTellingYouThat - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE message FourIsland_IcefallCave_Back_Text_LoreleiWellDeepFreezeYou waitmessage waitse @@ -67,7 +66,7 @@ FourIsland_IcefallCave_Back_EventScript_LoreleiRocketsScene:: waitmoncry applymovement LOCALID_ROCKET1, FourIsland_IcefallCave_Back_Movement_Rocket1ReactToThreat waitmovement 0 - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox FourIsland_IcefallCave_Back_Text_OkayRocketWareHouseFiveIsland closemessage applymovement LOCALID_LORELEI, FourIsland_IcefallCave_Back_Movement_LoreleiWatchRocketsExit @@ -82,9 +81,9 @@ FourIsland_IcefallCave_Back_EventScript_LoreleiRocketsScene:: delay 50 applymovement LOCALID_LORELEI, FourIsland_IcefallCave_Back_Movement_LoreleiWalkToPlayer waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox FourIsland_IcefallCave_Back_Text_ThankYouThisIsAwful setflag FLAG_HIDE_RUIN_VALLEY_SCIENTIST clearflag FLAG_HIDE_LORELEI_IN_HER_HOUSE @@ -101,10 +100,10 @@ FourIsland_IcefallCave_Back_Movement_PlayerToRockets:: FourIsland_IcefallCave_Back_Movement_PlayerWatchRocketsExit:: delay_16 - walk_in_place_fastest_left + walk_in_place_faster_left delay_16 delay_16 - walk_in_place_fastest_down + walk_in_place_faster_down step_end FourIsland_IcefallCave_Back_Movement_WalkInPlaceDown:: @@ -163,7 +162,7 @@ FourIsland_IcefallCave_Back_Movement_Rocket3Exit:: FourIsland_IcefallCave_Back_Movement_Rocket3FaceLorelei:: delay_16 delay_8 - walk_in_place_fastest_right + walk_in_place_faster_right step_end FourIsland_IcefallCave_Back_Movement_UnusedWalkLeft:: @@ -182,10 +181,10 @@ FourIsland_IcefallCave_Back_Movement_WalkInPlaceUp:: FourIsland_IcefallCave_Back_Movement_LoreleiWatchRocketsExit:: delay_8 - walk_in_place_fastest_right + walk_in_place_faster_right delay_16 delay_16 - walk_in_place_fastest_down + walk_in_place_faster_down step_end FourIsland_IcefallCave_Back_Movement_LoreleiWalkToPlayer:: diff --git a/data/maps/FourIsland_PokemonDayCare/scripts.inc b/data/maps/FourIsland_PokemonDayCare/scripts.inc index aef24b72b..fb2a1fbc7 100644 --- a/data/maps/FourIsland_PokemonDayCare/scripts.inc +++ b/data/maps/FourIsland_PokemonDayCare/scripts.inc @@ -8,32 +8,25 @@ FourIsland_PokemonDayCare_EventScript_DaycareWoman:: lock faceplayer specialvar VAR_RESULT, GetDaycareState - compare VAR_RESULT, DAYCARE_EGG_WAITING - goto_if_eq FourIsland_PokemonDayCare_EggWaiting - compare VAR_RESULT, DAYCARE_ONE_MON - goto_if_eq FourIsland_PokemonDayCare_OneMonInDaycare - compare VAR_RESULT, DAYCARE_TWO_MONS - goto_if_eq FourIsland_PokemonDayCare_TwoMonsInDaycare + goto_if_eq VAR_RESULT, DAYCARE_EGG_WAITING, FourIsland_PokemonDayCare_EggWaiting + goto_if_eq VAR_RESULT, DAYCARE_ONE_MON, FourIsland_PokemonDayCare_OneMonInDaycare + goto_if_eq VAR_RESULT, DAYCARE_TWO_MONS, FourIsland_PokemonDayCare_TwoMonsInDaycare msgbox DayCare_Text_WouldYouLikeUsToRaiseMon, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FourIsland_PokemonDayCare_GiveMonToRaise + goto_if_eq VAR_RESULT, YES, FourIsland_PokemonDayCare_GiveMonToRaise msgbox DayCare_Text_FineThenComeAgain release end FourIsland_PokemonDayCare_GiveMonToRaise:: specialvar VAR_RESULT, CountPartyNonEggMons - compare VAR_RESULT, 1 - goto_if_eq FourIsland_PokemonDayCare_OnlyOneMonInParty + goto_if_eq VAR_RESULT, 1, FourIsland_PokemonDayCare_OnlyOneMonInParty msgbox DayCare_Text_WhichMonShouldWeRaise fadescreen FADE_TO_BLACK special ChooseSendDaycareMon waitstate - compare VAR_0x8004, PARTY_SIZE - goto_if_ge FourIsland_PokemonDayCare_ComeAgain + goto_if_ge VAR_0x8004, PARTY_SIZE, FourIsland_PokemonDayCare_ComeAgain specialvar VAR_RESULT, CountPartyAliveNonEggMons_IgnoreVar0x8004Slot - compare VAR_RESULT, 0 - goto_if_eq FourIsland_PokemonDayCare_OnlyOneAliveMonInParty + goto_if_eq VAR_RESULT, 0, FourIsland_PokemonDayCare_OnlyOneAliveMonInParty specialvar VAR_0x8005, GetSelectedMonNicknameAndSpecies waitse playmoncry VAR_0x8005, CRY_MODE_NORMAL @@ -42,8 +35,7 @@ FourIsland_PokemonDayCare_GiveMonToRaise:: special StoreSelectedPokemonInDaycare incrementgamestat GAME_STAT_USED_DAYCARE specialvar VAR_RESULT, GetDaycareState - compare VAR_RESULT, DAYCARE_ONE_MON - goto_if_eq FourIsland_PokemonDayCare_CanRaiseOneMore + goto_if_eq VAR_RESULT, DAYCARE_ONE_MON, FourIsland_PokemonDayCare_CanRaiseOneMore release end @@ -54,8 +46,7 @@ FourIsland_PokemonDayCare_ComeAgain:: FourIsland_PokemonDayCare_CanRaiseOneMore:: msgbox DayCare_Text_WeCanRaiseOneMore, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FourIsland_PokemonDayCare_GiveMonToRaise + goto_if_eq VAR_RESULT, YES, FourIsland_PokemonDayCare_GiveMonToRaise goto FourIsland_PokemonDayCare_ComeAgain end @@ -80,8 +71,7 @@ FourIsland_PokemonDayCare_MonHasGrownXLevels:: FourIsland_PokemonDayCare_DisplayLevelsGained:: specialvar VAR_RESULT, GetNumLevelsGainedFromDaycare - compare VAR_RESULT, 0 - call_if_ne FourIsland_PokemonDayCare_MonHasGrownXLevels + call_if_ne VAR_RESULT, 0, FourIsland_PokemonDayCare_MonHasGrownXLevels return FourIsland_PokemonDayCare_OneMonInDaycare:: @@ -89,42 +79,35 @@ FourIsland_PokemonDayCare_OneMonInDaycare:: setvar VAR_0x8004, 0 call FourIsland_PokemonDayCare_DisplayLevelsGained msgbox DayCare_Text_WeCanRaiseOneMore, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FourIsland_PokemonDayCare_GiveMonToRaise + goto_if_eq VAR_RESULT, YES, FourIsland_PokemonDayCare_GiveMonToRaise msgbox DayCare_Text_TakeYourMonBack, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FourIsland_PokemonDayCare_TryRetrieveMon + goto_if_eq VAR_RESULT, YES, FourIsland_PokemonDayCare_TryRetrieveMon goto FourIsland_PokemonDayCare_ComeAgain end FourIsland_PokemonDayCare_TryRetrieveMon:: specialvar VAR_RESULT, CalculatePlayerPartyCount - compare VAR_RESULT, PARTY_SIZE - goto_if_eq FourIsland_PokemonDayCare_NoRoomInParty + goto_if_eq VAR_RESULT, PARTY_SIZE, FourIsland_PokemonDayCare_NoRoomInParty specialvar VAR_RESULT, GetDaycareState setvar VAR_0x8004, 0 - compare VAR_RESULT, DAYCARE_ONE_MON - goto_if_eq FourIsland_PokemonDayCare_CostPrompt + goto_if_eq VAR_RESULT, DAYCARE_ONE_MON, FourIsland_PokemonDayCare_CostPrompt special ShowDaycareLevelMenu waitstate copyvar VAR_0x8004, VAR_RESULT - compare VAR_RESULT, DAYCARE_EXITED_LEVEL_MENU - goto_if_eq FourIsland_PokemonDayCare_ComeAgain + goto_if_eq VAR_RESULT, DAYCARE_EXITED_LEVEL_MENU, FourIsland_PokemonDayCare_ComeAgain goto FourIsland_PokemonDayCare_CostPrompt end FourIsland_PokemonDayCare_CostPrompt:: special GetDaycareCost msgbox DayCare_Text_ItWillCostX, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FourIsland_PokemonDayCare_CheckEnoughMoney + goto_if_eq VAR_RESULT, YES, FourIsland_PokemonDayCare_CheckEnoughMoney goto FourIsland_PokemonDayCare_ComeAgain end FourIsland_PokemonDayCare_CheckEnoughMoney:: specialvar VAR_RESULT, IsEnoughForCostInVar0x8005 - compare VAR_RESULT, TRUE - goto_if_eq FourIsland_PokemonDayCare_RetrieveMon + goto_if_eq VAR_RESULT, TRUE, FourIsland_PokemonDayCare_RetrieveMon msgbox DayCare_Text_NotEnoughMoney release end @@ -138,20 +121,18 @@ FourIsland_PokemonDayCare_RetrieveMon:: msgbox DayCare_Text_HeresYourMon waitse playmoncry VAR_RESULT, CRY_MODE_NORMAL - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox DayCare_Text_TookBackMon call EventScript_RestorePrevTextColor waitmoncry specialvar VAR_RESULT, GetDaycareState - compare VAR_RESULT, DAYCARE_ONE_MON - goto_if_eq FourIsland_PokemonDayCare_AskRetrieveOtherMon + goto_if_eq VAR_RESULT, DAYCARE_ONE_MON, FourIsland_PokemonDayCare_AskRetrieveOtherMon goto FourIsland_PokemonDayCare_ComeAgain end FourIsland_PokemonDayCare_AskRetrieveOtherMon:: msgbox DayCare_Text_TakeOtherOneBackToo, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FourIsland_PokemonDayCare_TryRetrieveMon + goto_if_eq VAR_RESULT, YES, FourIsland_PokemonDayCare_TryRetrieveMon goto FourIsland_PokemonDayCare_ComeAgain end @@ -193,8 +174,7 @@ FourIsland_PokemonDayCare_TwoMonsInDaycare:: setvar VAR_0x8004, 1 call FourIsland_PokemonDayCare_DisplayLevelsGained msgbox DayCare_Text_TakeYourMonBack, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FourIsland_PokemonDayCare_TryRetrieveMon + goto_if_eq VAR_RESULT, YES, FourIsland_PokemonDayCare_TryRetrieveMon msgbox DayCare_Text_ComeAgain release end @@ -203,8 +183,7 @@ FourIsland_PokemonDayCare_TwoMonsInDaycare:: FourIsland_PokemonDayCare_EventScript_UnusedRetrieveMon:: special ShowDaycareLevelMenu waitstate - compare VAR_RESULT, 2 - goto_if_eq FourIsland_PokemonDayCare_ComeAgain + goto_if_eq VAR_RESULT, 2, FourIsland_PokemonDayCare_ComeAgain copyvar VAR_0x8004, VAR_RESULT specialvar VAR_RESULT, TakePokemonFromDaycare msgbox DayCare_Text_HeresYourMon 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_Gym/scripts.inc b/data/maps/FuchsiaCity_Gym/scripts.inc index 5b915f855..86d0a1a7f 100644 --- a/data/maps/FuchsiaCity_Gym/scripts.inc +++ b/data/maps/FuchsiaCity_Gym/scripts.inc @@ -20,9 +20,8 @@ FuchsiaCity_Gym_EventScript_DefeatedKoga:: FuchsiaCity_Gym_EventScript_GiveTM06:: msgbox FuchsiaCity_Gym_Text_KogaExplainSoulBadge - checkitemspace ITEM_TM06, 1 - compare VAR_RESULT, FALSE - goto_if_eq FuchsiaCity_Gym_EventScript_NoRoomForTM06 + checkitemspace ITEM_TM06 + goto_if_eq VAR_RESULT, FALSE, FuchsiaCity_Gym_EventScript_NoRoomForTM06 giveitem_msg FuchsiaCity_Gym_Text_ReceivedTM06FromKoga, ITEM_TM06 setflag FLAG_GOT_TM06_FROM_KOGA msgbox FuchsiaCity_Gym_Text_KogaExplainTM06 diff --git a/data/maps/FuchsiaCity_House2/scripts.inc b/data/maps/FuchsiaCity_House2/scripts.inc index 1d5df4cec..1b9d8be45 100644 --- a/data/maps/FuchsiaCity_House2/scripts.inc +++ b/data/maps/FuchsiaCity_House2/scripts.inc @@ -6,8 +6,7 @@ FuchsiaCity_House2_EventScript_FishingGurusBrother:: faceplayer goto_if_set FLAG_GOT_GOOD_ROD, FuchsiaCity_House2_EventScript_AlreadyGotGoodRod msgbox FuchsiaCity_House2_Text_DoYouLikeToFish, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FuchsiaCity_House2_EventScript_GiveGoodRod + goto_if_eq VAR_RESULT, YES, FuchsiaCity_House2_EventScript_GiveGoodRod msgbox FuchsiaCity_House2_Text_OhThatsDisappointing release end @@ -19,9 +18,8 @@ FuchsiaCity_House2_EventScript_AlreadyGotGoodRod:: FuchsiaCity_House2_EventScript_GiveGoodRod:: msgbox FuchsiaCity_House2_Text_LikeYourStyleTakeThis - checkitemspace ITEM_GOOD_ROD, 1 - compare VAR_RESULT, FALSE - goto_if_eq FuchsiaCity_House2_EventScript_NoRoomForGoodRod + checkitemspace ITEM_GOOD_ROD + goto_if_eq VAR_RESULT, FALSE, FuchsiaCity_House2_EventScript_NoRoomForGoodRod giveitem_msg FuchsiaCity_House2_Text_ReceivedGoodRod, ITEM_GOOD_ROD msgbox FuchsiaCity_House2_Text_GoodRodCanCatchBetterMons setflag FLAG_GOT_GOOD_ROD diff --git a/data/maps/FuchsiaCity_House3/scripts.inc b/data/maps/FuchsiaCity_House3/scripts.inc index c22477162..07110433d 100644 --- a/data/maps/FuchsiaCity_House3/scripts.inc +++ b/data/maps/FuchsiaCity_House3/scripts.inc @@ -5,8 +5,7 @@ FuchsiaCity_House3_EventScript_MoveDeleter:: lock faceplayer msgbox FuchsiaCity_House3_Text_WouldYouLikeToForgetMove, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FuchsiaCity_House3_EventScript_ChooseMonForMoveDeleter + goto_if_eq VAR_RESULT, YES, FuchsiaCity_House3_EventScript_ChooseMonForMoveDeleter goto FuchsiaCity_House3_EventScript_CancelForgetMove end @@ -14,24 +13,19 @@ FuchsiaCity_House3_EventScript_ChooseMonForMoveDeleter:: msgbox FuchsiaCity_House3_Text_WhichMonShouldForgetMove special ChoosePartyMon waitstate - compare VAR_0x8004, PARTY_SIZE - goto_if_ge FuchsiaCity_House3_EventScript_CancelForgetMove + goto_if_ge VAR_0x8004, PARTY_SIZE, FuchsiaCity_House3_EventScript_CancelForgetMove special IsSelectedMonEgg - compare VAR_RESULT, TRUE - goto_if_eq FuchsiaCity_House3_EventScript_CantForgetMoveEgg + goto_if_eq VAR_RESULT, TRUE, FuchsiaCity_House3_EventScript_CantForgetMoveEgg special GetNumMovesSelectedMonHas - compare VAR_RESULT, 1 - goto_if_eq FuchsiaCity_House3_EventScript_CantForgetOnlyMove + goto_if_eq VAR_RESULT, 1, FuchsiaCity_House3_EventScript_CantForgetOnlyMove msgbox FuchsiaCity_House3_Text_WhichMoveShouldBeForgotten fadescreen FADE_TO_BLACK special SelectMoveDeleterMove fadescreen FADE_FROM_BLACK - compare VAR_0x8005, MAX_MON_MOVES - goto_if_eq FuchsiaCity_House3_EventScript_ChooseMonForMoveDeleter + goto_if_eq VAR_0x8005, MAX_MON_MOVES, FuchsiaCity_House3_EventScript_ChooseMonForMoveDeleter special BufferMoveDeleterNicknameAndMove msgbox FuchsiaCity_House3_Text_MonsMoveShouldBeForgotten, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FuchsiaCity_House3_EventScript_ForgetMove + goto_if_eq VAR_RESULT, YES, FuchsiaCity_House3_EventScript_ForgetMove goto FuchsiaCity_House3_EventScript_CancelForgetMove end diff --git a/data/maps/FuchsiaCity_SafariZone_Entrance/scripts.inc b/data/maps/FuchsiaCity_SafariZone_Entrance/scripts.inc index e58fc0c65..474f29023 100644 --- a/data/maps/FuchsiaCity_SafariZone_Entrance/scripts.inc +++ b/data/maps/FuchsiaCity_SafariZone_Entrance/scripts.inc @@ -11,7 +11,7 @@ FuchsiaCity_SafariZone_Entrance_OnFrame:: @ When player runs out of balls mid-battle FuchsiaCity_SafariZone_Entrance_EventScript_ExitWalkIn:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE applymovement OBJ_EVENT_ID_PLAYER, FuchsiaCity_SafariZone_Entrance_Movement_ApproachCounter waitmovement 0 msgbox FuchsiaCity_SafariZone_Entrance_Text_CatchFairShareComeAgain @@ -26,7 +26,7 @@ FuchsiaCity_SafariZone_Entrance_EventScript_ExitWalkIn:: @ When player runs of out balls after catching a pokemon, or runs out of steps FuchsiaCity_SafariZone_Entrance_EventScript_ExitWarpIn:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox FuchsiaCity_SafariZone_Entrance_Text_CatchFairShareComeAgain closemessage applymovement OBJ_EVENT_ID_PLAYER, FuchsiaCity_SafariZone_Entrance_Movement_Exit @@ -39,10 +39,9 @@ FuchsiaCity_SafariZone_Entrance_EventScript_ExitWarpIn:: @ When player re-enters the entrance building with balls/steps remaining FuchsiaCity_SafariZone_Entrance_EventScript_ExitEarly:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox FuchsiaCity_SafariZone_Entrance_Text_GoingToLeaveSafariZoneEarly, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq FuchsiaCity_SafariZone_Entrance_EventScript_ReturnToSafariZone + goto_if_eq VAR_RESULT, NO, FuchsiaCity_SafariZone_Entrance_EventScript_ReturnToSafariZone msgbox FuchsiaCity_SafariZone_Entrance_Text_PleaseReturnSafariBalls closemessage applymovement OBJ_EVENT_ID_PLAYER, FuchsiaCity_SafariZone_Entrance_Movement_Exit @@ -57,7 +56,7 @@ FuchsiaCity_SafariZone_Entrance_EventScript_ReturnToSafariZone:: closemessage applymovement OBJ_EVENT_ID_PLAYER, FuchsiaCity_SafariZone_Entrance_Movement_ReEnter waitmovement 0 - warp MAP_SAFARI_ZONE_CENTER, 255, 26, 30 + warp MAP_SAFARI_ZONE_CENTER, 26, 30 waitstate end @@ -99,40 +98,35 @@ FuchsiaCity_SafariZone_Entrance_EventScript_EntryTriggerLeft:: end FuchsiaCity_SafariZone_Entrance_EventScript_AskEnterSafariZone:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox FuchsiaCity_SafariZone_Entrance_Text_WelcomeToSafariZone - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 - showmoneybox 0, 0, 0 + showmoneybox 0, 0 msgbox FuchsiaCity_SafariZone_Entrance_Text_PlaySafariGameFor500, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FuchsiaCity_SafariZone_Entrance_EventScript_TryEnterSafariZone + goto_if_eq VAR_RESULT, YES, FuchsiaCity_SafariZone_Entrance_EventScript_TryEnterSafariZone msgbox FuchsiaCity_SafariZone_Entrance_Text_OkayPleaseComeAgain goto FuchsiaCity_SafariZone_Entrance_EventScript_ForcePlayerBack end FuchsiaCity_SafariZone_Entrance_EventScript_TryEnterSafariZone:: call FuchsiaCity_SafariZone_Entrance_EventScript_CheckSpaceForMons - checkmoney 500, 0 - compare VAR_RESULT, FALSE - goto_if_eq FuchsiaCity_SafariZone_Entrance_EventScript_NotEnoughMoney - removemoney 500, 0 - updatemoneybox 0, 0, 0 + checkmoney 500 + goto_if_eq VAR_RESULT, FALSE, FuchsiaCity_SafariZone_Entrance_EventScript_NotEnoughMoney + removemoney 500 + updatemoneybox msgbox FuchsiaCity_SafariZone_Entrance_Text_ThatllBe500WeOnlyUseSpecialBalls - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_LEVEL_UP message FuchsiaCity_SafariZone_Entrance_Text_PlayerReceived30SafariBalls waitfanfare call EventScript_RestorePrevTextColor msgbox FuchsiaCity_SafariZone_Entrance_Text_CallYouOnPAWhenYouRunOut closemessage - hidemoneybox 0, 0 - compare VAR_TEMP_2, 0 - call_if_eq FuchsiaCity_SafariZone_Entrance_EventScript_EnterSafariZoneMid - compare VAR_TEMP_2, 1 - call_if_eq FuchsiaCity_SafariZone_Entrance_EventScript_EnterSafariZoneRight - compare VAR_TEMP_2, 2 - call_if_eq FuchsiaCity_SafariZone_Entrance_EventScript_EnterSafariZoneLeft + hidemoneybox + call_if_eq VAR_TEMP_2, 0, FuchsiaCity_SafariZone_Entrance_EventScript_EnterSafariZoneMid + call_if_eq VAR_TEMP_2, 1, FuchsiaCity_SafariZone_Entrance_EventScript_EnterSafariZoneRight + call_if_eq VAR_TEMP_2, 2, FuchsiaCity_SafariZone_Entrance_EventScript_EnterSafariZoneLeft special EnterSafariMode setvar VAR_MAP_SCENE_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE, 2 warp MAP_SAFARI_ZONE_CENTER, 255, 26, 30 @@ -156,11 +150,9 @@ FuchsiaCity_SafariZone_Entrance_EventScript_EnterSafariZoneLeft:: FuchsiaCity_SafariZone_Entrance_EventScript_CheckSpaceForMons:: getpartysize - compare VAR_RESULT, PARTY_SIZE - goto_if_ne EventScript_Return + goto_if_ne VAR_RESULT, PARTY_SIZE, EventScript_Return specialvar VAR_RESULT, IsThereRoomInAnyBoxForMorePokemon - compare VAR_RESULT, TRUE - goto_if_eq EventScript_Return + goto_if_eq VAR_RESULT, TRUE, EventScript_Return msgbox SafariZone_Text_ExcuseMeYourPCBoxIsFull goto FuchsiaCity_SafariZone_Entrance_EventScript_ForcePlayerBack end @@ -172,7 +164,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 @@ -203,8 +195,7 @@ FuchsiaCity_SafariZone_Entrance_EventScript_InfoAttendant:: lock faceplayer msgbox FuchsiaCity_SafariZone_Entrance_Text_FirstTimeAtSafariZone, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq FuchsiaCity_SafariZone_Entrance_EventScript_ExplainSafariZone + goto_if_eq VAR_RESULT, YES, FuchsiaCity_SafariZone_Entrance_EventScript_ExplainSafariZone msgbox FuchsiaCity_SafariZone_Entrance_Text_SorryYoureARegularHere release end diff --git a/data/maps/FuchsiaCity_WardensHouse/scripts.inc b/data/maps/FuchsiaCity_WardensHouse/scripts.inc index 77ae03d2c..b3f951881 100644 --- a/data/maps/FuchsiaCity_WardensHouse/scripts.inc +++ b/data/maps/FuchsiaCity_WardensHouse/scripts.inc @@ -7,15 +7,13 @@ FuchsiaCity_WardensHouse_EventScript_Warden:: goto_if_set FLAG_GOT_HM04, FuchsiaCity_WardensHouse_EventScript_ExplainStrength goto_if_set FLAG_HIDE_SAFARI_ZONE_WEST_GOLD_TEETH, FuchsiaCity_WardensHouse_EventScript_GiveGoldTeeth msgbox FuchsiaCity_WardensHouse_Text_HifFuffHefifoo, MSGBOX_YESNO - compare VAR_RESULT, YES - call_if_eq FuchsiaCity_WardensHouse_EventScript_WardenYes - compare VAR_RESULT, NO - call_if_eq FuchsiaCity_WardensHouse_EventScript_WardenNo + call_if_eq VAR_RESULT, YES, FuchsiaCity_WardensHouse_EventScript_WardenYes + call_if_eq VAR_RESULT, NO, FuchsiaCity_WardensHouse_EventScript_WardenNo release end FuchsiaCity_WardensHouse_EventScript_GiveGoldTeeth:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_OBTAIN_TMHM message FuchsiaCity_WardensHouse_Text_GaveGoldTeethToWarden waitmessage @@ -23,13 +21,11 @@ FuchsiaCity_WardensHouse_EventScript_GiveGoldTeeth:: msgbox FuchsiaCity_WardensHouse_Text_WardenPoppedInHisTeeth call EventScript_RestorePrevTextColor checkplayergender - compare VAR_RESULT, MALE - call_if_eq FuchsiaCity_WardensHouse_EventScript_WardenThanksMale - compare VAR_RESULT, FEMALE - call_if_eq FuchsiaCity_WardensHouse_EventScript_WardenThanksFemale + call_if_eq VAR_RESULT, MALE, FuchsiaCity_WardensHouse_EventScript_WardenThanksMale + call_if_eq VAR_RESULT, FEMALE, FuchsiaCity_WardensHouse_EventScript_WardenThanksFemale giveitem_msg FuchsiaCity_WardensHouse_Text_ReceivedHM04FromWarden, ITEM_HM04 setflag FLAG_GOT_HM04 - removeitem ITEM_GOLD_TEETH, 1 + removeitem ITEM_GOLD_TEETH release end diff --git a/data/maps/IndigoPlateau_Exterior/scripts.inc b/data/maps/IndigoPlateau_Exterior/scripts.inc index 9f64c22a5..6c46913d7 100644 --- a/data/maps/IndigoPlateau_Exterior/scripts.inc +++ b/data/maps/IndigoPlateau_Exterior/scripts.inc @@ -8,8 +8,7 @@ IndigoPlateau_Exterior_MapScripts:: IndigoPlateau_Exterior_OnTransition:: setworldmapflag FLAG_WORLD_MAP_INDIGO_PLATEAU_EXTERIOR - compare VAR_MAP_SCENE_INDIGO_PLATEAU_EXTERIOR, 1 - call_if_eq IndigoPlateau_Exterior_EventScript_PlayCreditsMusic + call_if_eq VAR_MAP_SCENE_INDIGO_PLATEAU_EXTERIOR, 1, IndigoPlateau_Exterior_EventScript_PlayCreditsMusic end IndigoPlateau_Exterior_EventScript_PlayCreditsMusic:: @@ -104,12 +103,12 @@ IndigoPlateau_Exterior_Movement_PlayerExitBuilding:: IndigoPlateau_Exterior_Movement_PlayerWatchRivalLeave:: delay_16 delay_4 - walk_in_place_fastest_down + walk_in_place_faster_down step_end IndigoPlateau_Exterior_Movement_PlayerWatchOakLeave:: delay_8 - walk_in_place_fastest_right + walk_in_place_faster_right delay_16 delay_16 delay_16 @@ -121,7 +120,7 @@ IndigoPlateau_Exterior_Movement_PlayerWatchOakLeave:: delay_16 delay_16 delay_16 - walk_in_place_fastest_down + walk_in_place_faster_down step_end IndigoPlateau_Exterior_Movement_PlayerBeginLeave:: @@ -134,7 +133,7 @@ IndigoPlateau_Exterior_Movement_PlayerBeginLeave:: step_end IndigoPlateau_Exterior_Movement_PlayerTurnAround:: - walk_in_place_fastest_down + walk_in_place_faster_down step_end IndigoPlateau_Exterior_Movement_PushPlayerOutOfWay:: @@ -145,7 +144,7 @@ IndigoPlateau_Exterior_Movement_PushPlayerOutOfWay:: step_end IndigoPlateau_Exterior_Movement_PlayerFaceLeague:: - walk_in_place_fastest_up + walk_in_place_faster_up step_end IndigoPlateau_Exterior_Movement_RivalLeave:: @@ -163,7 +162,7 @@ IndigoPlateau_Exterior_Movement_RivalExitBuilding:: step_end IndigoPlateau_Exterior_Movement_OakLeave:: - walk_in_place_fastest_left + walk_in_place_faster_left delay_16 delay_16 delay_16 @@ -174,7 +173,7 @@ IndigoPlateau_Exterior_Movement_OakLeave:: delay_16 delay_16 delay_16 - walk_in_place_fastest_down + walk_in_place_faster_down delay_16 walk_down walk_down diff --git a/data/maps/IndigoPlateau_PokemonCenter_1F/scripts.inc b/data/maps/IndigoPlateau_PokemonCenter_1F/scripts.inc index 71f06da2d..bb6d74b5f 100644 --- a/data/maps/IndigoPlateau_PokemonCenter_1F/scripts.inc +++ b/data/maps/IndigoPlateau_PokemonCenter_1F/scripts.inc @@ -8,8 +8,7 @@ IndigoPlateau_PokemonCenter_1F_MapScripts:: IndigoPlateau_PokemonCenter_1F_OnTransition:: setrespawn SPAWN_INDIGO_PLATEAU specialvar VAR_RESULT, IsNationalPokedexEnabled - compare VAR_RESULT, TRUE - call_if_eq IndigoPlateau_PokemonCenter_1F_EventScript_CheckBlockDoor + call_if_eq VAR_RESULT, TRUE, IndigoPlateau_PokemonCenter_1F_EventScript_CheckBlockDoor end IndigoPlateau_PokemonCenter_1F_EventScript_CheckBlockDoor:: @@ -21,8 +20,7 @@ IndigoPlateau_PokemonCenter_1F_EventScript_DoorGuard:: lock faceplayer specialvar VAR_RESULT, IsNationalPokedexEnabled - compare VAR_RESULT, TRUE - goto_if_eq IndigoPlateau_PokemonCenter_1F_EventScript_CheckSeviiIslandComplete + goto_if_eq VAR_RESULT, TRUE, IndigoPlateau_PokemonCenter_1F_EventScript_CheckSeviiIslandComplete msgbox IndigoPlateau_PokemonCenter_1F_Text_FaceEliteFourGoodLuck release end diff --git a/data/maps/LavenderTown/scripts.inc b/data/maps/LavenderTown/scripts.inc index 40f3b2146..4832d2d9d 100644 --- a/data/maps/LavenderTown/scripts.inc +++ b/data/maps/LavenderTown/scripts.inc @@ -12,8 +12,7 @@ LavenderTown_EventScript_LittleGirl:: lock faceplayer msgbox LavenderTown_Text_DoYouBelieveInGhosts, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq LavenderTown_EventScript_LittleGirlBelieve + goto_if_eq VAR_RESULT, YES, LavenderTown_EventScript_LittleGirlBelieve msgbox LavenderTown_Text_JustImaginingWhiteHand release end diff --git a/data/maps/LavenderTown_House2/scripts.inc b/data/maps/LavenderTown_House2/scripts.inc index 6f8f7d350..8e353ecfc 100644 --- a/data/maps/LavenderTown_House2/scripts.inc +++ b/data/maps/LavenderTown_House2/scripts.inc @@ -5,20 +5,16 @@ LavenderTown_House2_EventScript_NameRater:: lock faceplayer msgbox LavenderTown_House2_Text_WantMeToRateNicknames, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq LavenderTown_House2_EventScript_ChooseMon - compare VAR_RESULT, NO - goto_if_eq LavenderTown_House2_EventScript_DontRateNickname + goto_if_eq VAR_RESULT, YES, LavenderTown_House2_EventScript_ChooseMon + goto_if_eq VAR_RESULT, NO, LavenderTown_House2_EventScript_DontRateNickname end LavenderTown_House2_EventScript_ChooseMon:: msgbox LavenderTown_House2_Text_CritiqueWhichMonsNickname special ChoosePartyMon waitstate - compare VAR_0x8004, PARTY_SIZE - goto_if_lt LavenderTown_House2_EventScript_CheckCanRateMon - compare VAR_0x8004, PARTY_SIZE - goto_if_ge LavenderTown_House2_EventScript_DontRateNickname + goto_if_lt VAR_0x8004, PARTY_SIZE, LavenderTown_House2_EventScript_CheckCanRateMon + goto_if_ge VAR_0x8004, PARTY_SIZE, LavenderTown_House2_EventScript_DontRateNickname end LavenderTown_House2_EventScript_DontRateNickname:: @@ -28,21 +24,16 @@ LavenderTown_House2_EventScript_DontRateNickname:: LavenderTown_House2_EventScript_CheckCanRateMon:: specialvar VAR_RESULT, GetPartyMonSpecies - compare VAR_RESULT, SPECIES_EGG - goto_if_eq LavenderTown_House2_EventScript_CantNicknameEgg + goto_if_eq VAR_RESULT, SPECIES_EGG, LavenderTown_House2_EventScript_CantNicknameEgg special BufferMonNickname special IsMonOTIDNotPlayers - compare VAR_RESULT, TRUE - goto_if_eq LavenderTown_House2_EventScript_CantNicknameTradeMon + goto_if_eq VAR_RESULT, TRUE, LavenderTown_House2_EventScript_CantNicknameTradeMon specialvar VAR_RESULT, IsMonOTNameNotPlayers special BufferMonNickname - compare VAR_RESULT, TRUE - goto_if_eq LavenderTown_House2_EventScript_CantNicknameTradeMon + goto_if_eq VAR_RESULT, TRUE, LavenderTown_House2_EventScript_CantNicknameTradeMon msgbox LavenderTown_House2_Text_GiveItANicerName, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq LavenderTown_House2_EventScript_ChooseNewNickname - compare VAR_RESULT, NO - goto_if_eq LavenderTown_House2_EventScript_DontRateNickname + goto_if_eq VAR_RESULT, YES, LavenderTown_House2_EventScript_ChooseNewNickname + goto_if_eq VAR_RESULT, NO, LavenderTown_House2_EventScript_DontRateNickname end LavenderTown_House2_EventScript_CantNicknameEgg:: @@ -60,8 +51,7 @@ LavenderTown_House2_EventScript_ChooseNewNickname:: call EventScript_ChangePokemonNickname specialvar VAR_RESULT, NameRaterWasNicknameChanged special BufferMonNickname - compare VAR_RESULT, TRUE - goto_if_eq LavenderTown_House2_EventScript_ChoseNewNickname + goto_if_eq VAR_RESULT, TRUE, LavenderTown_House2_EventScript_ChoseNewNickname msgbox LavenderTown_House2_Text_FromNowOnShallBeKnownAsSameName release end diff --git a/data/maps/LavenderTown_VolunteerPokemonHouse/scripts.inc b/data/maps/LavenderTown_VolunteerPokemonHouse/scripts.inc index 1fe10e416..2e31c8789 100644 --- a/data/maps/LavenderTown_VolunteerPokemonHouse/scripts.inc +++ b/data/maps/LavenderTown_VolunteerPokemonHouse/scripts.inc @@ -6,9 +6,8 @@ LavenderTown_VolunteerPokemonHouse_EventScript_MrFuji:: faceplayer goto_if_set FLAG_GOT_POKE_FLUTE, LavenderTown_VolunteerPokemonHouse_EventScript_AlreadyHavePokeFlute msgbox LavenderTown_VolunteerPokemonHouse_Text_IdLikeYouToHaveThis - checkitemspace ITEM_POKE_FLUTE, 1 - compare VAR_RESULT, FALSE - goto_if_eq LavenderTown_VolunteerPokemonHouse_EventScript_NoRoomForPokeFlute + checkitemspace ITEM_POKE_FLUTE + goto_if_eq VAR_RESULT, FALSE, LavenderTown_VolunteerPokemonHouse_EventScript_NoRoomForPokeFlute setflag FLAG_GOT_POKE_FLUTE giveitem_msg LavenderTown_VolunteerPokemonHouse_Text_ReceivedPokeFluteFromMrFuji, ITEM_POKE_FLUTE, 1, MUS_OBTAIN_KEY_ITEM msgbox LavenderTown_VolunteerPokemonHouse_Text_ExplainPokeFlute diff --git a/data/maps/MtEmber_Exterior/scripts.inc b/data/maps/MtEmber_Exterior/scripts.inc index 770deab35..d5519c96a 100644 --- a/data/maps/MtEmber_Exterior/scripts.inc +++ b/data/maps/MtEmber_Exterior/scripts.inc @@ -8,8 +8,7 @@ MtEmber_Exterior_MapScripts:: MtEmber_Exterior_OnTransition:: setworldmapflag FLAG_WORLD_MAP_MT_EMBER_EXTERIOR - compare VAR_MAP_SCENE_MT_EMBER_EXTERIOR, 2 - call_if_eq MtEmber_Exterior_EventScript_RocketsFaceDown + call_if_eq VAR_MAP_SCENE_MT_EMBER_EXTERIOR, 2, MtEmber_Exterior_EventScript_RocketsFaceDown end MtEmber_Exterior_EventScript_RocketsFaceDown:: @@ -18,8 +17,7 @@ MtEmber_Exterior_EventScript_RocketsFaceDown:: return MtEmber_Exterior_OnLoad:: - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 4 - call_if_ge MtEmber_Exterior_EventScript_OpenCave + call_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 4, MtEmber_Exterior_EventScript_OpenCave end MtEmber_Exterior_EventScript_OpenCave:: @@ -29,8 +27,7 @@ MtEmber_Exterior_EventScript_OpenCave:: MtEmber_Exterior_EventScript_Grunt1:: lock goto_if_defeated TRAINER_TEAM_ROCKET_GRUNT_43, MtEmber_Exterior_EventScript_Grunt1Defeated - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 4 - goto_if_eq MtEmber_Exterior_EventScript_BattleGrunt1 + goto_if_eq VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 4, MtEmber_Exterior_EventScript_BattleGrunt1 msgbox MtEmber_Exterior_Text_WellTryDiggingHere release end @@ -65,8 +62,7 @@ MtEmber_Exterior_EventScript_Grunt2:: lock faceplayer goto_if_defeated TRAINER_TEAM_ROCKET_GRUNT_44, MtEmber_Exterior_EventScript_DefeatedGrunt2 - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 4 - goto_if_eq MtEmber_Exterior_EventScript_BattleGrunt2 + goto_if_eq VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 4, MtEmber_Exterior_EventScript_BattleGrunt2 msgbox MtEmber_Exterior_Text_YoureInTheWayGetLost closemessage applymovement LOCALID_GRUNT2, Movement_FaceOriginalDirection @@ -90,7 +86,7 @@ MtEmber_Exterior_EventScript_BattleGrunt2:: MtEmber_Exterior_EventScript_RocketPasswordScene:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox MtEmber_Exterior_Text_PunchedThroughAtLast message MtEmber_Exterior_Text_WhatsPasswordAgain waitmessage @@ -99,14 +95,14 @@ MtEmber_Exterior_EventScript_RocketPasswordScene:: waitmovement 0 waitbuttonpress msgbox MtEmber_Exterior_Text_FirstPasswordGoldeen - applymovement LOCALID_GRUNT1, Movement_WalkInPlaceFastestDown + applymovement LOCALID_GRUNT1, Movement_WalkInPlaceFasterDown waitmovement 0 playse SE_PIN applymovement LOCALID_GRUNT1, Movement_ExclamationMark waitmovement 0 applymovement LOCALID_GRUNT1, Movement_Delay48 waitmovement 0 - applymovement LOCALID_GRUNT2, Movement_WalkInPlaceFastestDown + applymovement LOCALID_GRUNT2, Movement_WalkInPlaceFasterDown waitmovement 0 call MtEmber_Exterior_EventScript_RocketsFaceDown msgbox MtEmber_Exterior_Text_SnoopsBeenListeningIn diff --git a/data/maps/MtEmber_Summit/scripts.inc b/data/maps/MtEmber_Summit/scripts.inc index 3c3757e63..5cc41d7ad 100644 --- a/data/maps/MtEmber_Summit/scripts.inc +++ b/data/maps/MtEmber_Summit/scripts.inc @@ -9,8 +9,7 @@ MtEmber_Summit_OnResume:: MtEmber_Summit_EventScript_TryRemoveMoltres:: specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_CAUGHT - goto_if_ne EventScript_Return + goto_if_ne VAR_RESULT, B_OUTCOME_CAUGHT, EventScript_Return removeobject VAR_LAST_TALKED return @@ -27,7 +26,7 @@ MtEmber_Summit_EventScript_Moltres:: special QuestLog_CutRecording lock faceplayer - setwildbattle SPECIES_MOLTRES, 50, ITEM_NONE + setwildbattle SPECIES_MOLTRES, 50 waitse playmoncry SPECIES_MOLTRES, CRY_MODE_ENCOUNTER message Text_Gyaoo @@ -41,12 +40,9 @@ MtEmber_Summit_EventScript_Moltres:: waitstate clearflag FLAG_SYS_SPECIAL_WILD_BATTLE specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_WON - goto_if_eq MtEmber_Summit_EventScript_DefeatedMoltres - compare VAR_RESULT, B_OUTCOME_RAN - goto_if_eq MtEmber_Summit_EventScript_RanFromMoltres - compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED - goto_if_eq MtEmber_Summit_EventScript_RanFromMoltres + goto_if_eq VAR_RESULT, B_OUTCOME_WON, MtEmber_Summit_EventScript_DefeatedMoltres + goto_if_eq VAR_RESULT, B_OUTCOME_RAN, MtEmber_Summit_EventScript_RanFromMoltres + goto_if_eq VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED, MtEmber_Summit_EventScript_RanFromMoltres setflag FLAG_FOUGHT_MOLTRES release end diff --git a/data/maps/MtMoon_B2F/scripts.inc b/data/maps/MtMoon_B2F/scripts.inc index 7b2ca76ae..32213a5b4 100644 --- a/data/maps/MtMoon_B2F/scripts.inc +++ b/data/maps/MtMoon_B2F/scripts.inc @@ -17,7 +17,7 @@ MtMoon_B2F_EventScript_ShowFossils:: MtMoon_B2F_EventScript_MiguelTrigger:: lockall - applymovement LOCALID_MIGUEL, Movement_WalkInPlaceFastestRight + applymovement LOCALID_MIGUEL, Movement_WalkInPlaceFasterRight waitmovement 0 call MtMoon_B2F_EventScript_BattleMiguel releaseall @@ -33,7 +33,7 @@ MtMoon_B2F_EventScript_Miguel:: end MtMoon_B2F_EventScript_BattleMiguel:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE message MtMoon_B2F_Text_MiguelIntro waitmessage playbgm MUS_ENCOUNTER_GYM_LEADER, 0 @@ -58,8 +58,7 @@ MtMoon_B2F_EventScript_DomeFossil:: lock faceplayer msgbox MtMoon_B2F_Text_YouWantDomeFossil, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq MtMoon_B2F_EventScript_DontTakeFossil + goto_if_eq VAR_RESULT, NO, MtMoon_B2F_EventScript_DontTakeFossil removeobject LOCALID_DOME_FOSSIL giveitem_msg MtMoon_B2F_Text_ObtainedDomeFossil, ITEM_DOME_FOSSIL, 1, MUS_OBTAIN_KEY_ITEM closemessage @@ -67,8 +66,8 @@ MtMoon_B2F_EventScript_DomeFossil:: delay 10 applymovement LOCALID_MIGUEL, MtMoon_B2F_Movement_MiguelToHelixFossil waitmovement 0 - moveobjectoffscreen LOCALID_MIGUEL - textcolor 0 + copyobjectxytoperm LOCALID_MIGUEL + textcolor NPC_TEXT_COLOR_MALE playfanfare MUS_OBTAIN_KEY_ITEM message MtMoon_B2F_Text_ThenThisFossilIsMine waitmessage @@ -90,8 +89,7 @@ MtMoon_B2F_EventScript_HelixFossil:: lock faceplayer msgbox MtMoon_B2F_Text_YouWantHelixFossil, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq MtMoon_B2F_EventScript_DontTakeFossil + goto_if_eq VAR_RESULT, NO, MtMoon_B2F_EventScript_DontTakeFossil removeobject LOCALID_HELIX_FOSSIL giveitem_msg MtMoon_B2F_Text_ObtainedHelixFossil, ITEM_HELIX_FOSSIL, 1, MUS_OBTAIN_KEY_ITEM closemessage @@ -99,8 +97,8 @@ MtMoon_B2F_EventScript_HelixFossil:: delay 10 applymovement LOCALID_MIGUEL, MtMoon_B2F_Movement_MiguelToDomeFossil waitmovement 0 - moveobjectoffscreen LOCALID_MIGUEL - textcolor 0 + copyobjectxytoperm LOCALID_MIGUEL + textcolor NPC_TEXT_COLOR_MALE playfanfare MUS_OBTAIN_KEY_ITEM message MtMoon_B2F_Text_ThenThisFossilIsMine waitmessage diff --git a/data/maps/NavelRock_Base/scripts.inc b/data/maps/NavelRock_Base/scripts.inc index b63ac1fd7..4919a5ac4 100644 --- a/data/maps/NavelRock_Base/scripts.inc +++ b/data/maps/NavelRock_Base/scripts.inc @@ -25,8 +25,7 @@ NavelRock_Base_OnResume:: NavelRock_Base_EventScript_TryRemoveLugia:: specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_CAUGHT - goto_if_ne EventScript_Return + goto_if_ne VAR_RESULT, B_OUTCOME_CAUGHT, EventScript_Return removeobject LOCALID_LUGIA return @@ -56,21 +55,15 @@ NavelRock_Base_EventScript_Lugia:: playmoncry SPECIES_LUGIA, CRY_MODE_ENCOUNTER waitmoncry delay 20 - setvar VAR_0x8004, SPECIES_LUGIA - setvar VAR_0x8005, 70 @ Level - setvar VAR_0x8006, ITEM_NONE - special CreateEventLegalEnemyMon + seteventmon SPECIES_LUGIA, 70 setflag FLAG_SYS_SPECIAL_WILD_BATTLE special StartLegendaryBattle waitstate clearflag FLAG_SYS_SPECIAL_WILD_BATTLE specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_WON - goto_if_eq NavelRock_Base_EventScript_DefeatedLugia - compare VAR_RESULT, B_OUTCOME_RAN - goto_if_eq NavelRock_Base_EventScript_RanFromLugia - compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED - goto_if_eq NavelRock_Base_EventScript_RanFromLugia + goto_if_eq VAR_RESULT, B_OUTCOME_WON, NavelRock_Base_EventScript_DefeatedLugia + goto_if_eq VAR_RESULT, B_OUTCOME_RAN, NavelRock_Base_EventScript_RanFromLugia + goto_if_eq VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED, NavelRock_Base_EventScript_RanFromLugia setflag FLAG_FOUGHT_LUGIA release end diff --git a/data/maps/NavelRock_Summit/scripts.inc b/data/maps/NavelRock_Summit/scripts.inc index 1f01b72eb..068f99a03 100644 --- a/data/maps/NavelRock_Summit/scripts.inc +++ b/data/maps/NavelRock_Summit/scripts.inc @@ -28,8 +28,7 @@ NavelRock_Summit_OnResume:: NavelRock_Summit_EventScript_TryRemoveHoOh:: specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_CAUGHT - goto_if_ne EventScript_Return + goto_if_ne VAR_RESULT, B_OUTCOME_CAUGHT, EventScript_Return removeobject LOCALID_HO_OH return @@ -60,22 +59,16 @@ NavelRock_Summit_EventScript_HoOh:: applymovement LOCALID_HO_OH, Movement_HoOhApproach waitmovement 0 special RemoveCameraObject - setvar VAR_0x8004, SPECIES_HO_OH - setvar VAR_0x8005, 70 @ Level - setvar VAR_0x8006, ITEM_NONE - special CreateEventLegalEnemyMon + seteventmon SPECIES_HO_OH, 70 setflag FLAG_SYS_SPECIAL_WILD_BATTLE special StartLegendaryBattle waitstate clearflag FLAG_SYS_SPECIAL_WILD_BATTLE setvar VAR_LAST_TALKED, LOCALID_HO_OH specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_WON - goto_if_eq NavelRock_Summit_EventScript_DefeatedHoOh - compare VAR_RESULT, B_OUTCOME_RAN - goto_if_eq NavelRock_Summit_EventScript_RanFromHoOh - compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED - goto_if_eq NavelRock_Summit_EventScript_RanFromHoOh + goto_if_eq VAR_RESULT, B_OUTCOME_WON, NavelRock_Summit_EventScript_DefeatedHoOh + goto_if_eq VAR_RESULT, B_OUTCOME_RAN, NavelRock_Summit_EventScript_RanFromHoOh + goto_if_eq VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED, NavelRock_Summit_EventScript_RanFromHoOh setflag FLAG_FOUGHT_HO_OH releaseall end diff --git a/data/maps/OneIsland/scripts.inc b/data/maps/OneIsland/scripts.inc index a8943e17a..8cab73528 100644 --- a/data/maps/OneIsland/scripts.inc +++ b/data/maps/OneIsland/scripts.inc @@ -15,7 +15,7 @@ OneIsland_OnFrame:: OneIsland_EventScript_EnterOneIslandFirstTime:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE applymovement OBJ_EVENT_ID_PLAYER, OneIsland_Movement_PlayerExitHarbor waitmovement 0 msgbox OneIsland_Text_BillLetsGoSeeCelio @@ -32,7 +32,7 @@ OneIsland_EventScript_EnterOneIslandFirstTime:: waitdooranim removeobject LOCALID_BILL setvar VAR_MAP_SCENE_ONE_ISLAND_HARBOR, 3 - warp MAP_ONE_ISLAND_POKEMON_CENTER_1F, 255, 9, 9 + warp MAP_ONE_ISLAND_POKEMON_CENTER_1F, 9, 9 waitstate releaseall end diff --git a/data/maps/OneIsland_Harbor/scripts.inc b/data/maps/OneIsland_Harbor/scripts.inc index 359730fe5..0c0c2238e 100644 --- a/data/maps/OneIsland_Harbor/scripts.inc +++ b/data/maps/OneIsland_Harbor/scripts.inc @@ -17,11 +17,11 @@ OneIsland_Harbor_OnFrame:: OneIsland_Harbor_EventScript_PlayerEnterHarborFirstTime:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE applymovement OBJ_EVENT_ID_PLAYER, OneIsland_Harbor_Movement_PlayerExitHarbor waitmovement 0 setvar VAR_MAP_SCENE_ONE_ISLAND_HARBOR, 2 - warp MAP_ONE_ISLAND, 255, 12, 18 + warp MAP_ONE_ISLAND, 12, 18 waitstate releaseall end diff --git a/data/maps/OneIsland_PokemonCenter_1F/scripts.inc b/data/maps/OneIsland_PokemonCenter_1F/scripts.inc index 7219df19e..05c082315 100644 --- a/data/maps/OneIsland_PokemonCenter_1F/scripts.inc +++ b/data/maps/OneIsland_PokemonCenter_1F/scripts.inc @@ -9,8 +9,7 @@ OneIsland_PokemonCenter_1F_MapScripts:: .byte 0 OneIsland_PokemonCenter_1F_OnLoad:: - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5 - call_if_ge OneIsland_PokemonCenter_1F_EventScript_SetRubyMetatile + call_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5, OneIsland_PokemonCenter_1F_EventScript_SetRubyMetatile call_if_set FLAG_SYS_CAN_LINK_WITH_RS, OneIsland_PokemonCenter_1F_EventScript_SetNetworkMachineOn end @@ -30,12 +29,9 @@ OneIsland_PokemonCenter_1F_EventScript_SetNetworkMachineOn:: OneIsland_PokemonCenter_1F_OnTransition:: setrespawn SPAWN_ONE_ISLAND - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 6 - call_if_eq OneIsland_PokemonCenter_1F_EventScript_SetCelioQuestDone - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 0 - call_if_eq OneIsland_PokemonCenter_1F_EventScript_SetBillCelioFirstMeetingPos - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 2 - call_if_eq OneIsland_PokemonCenter_1F_EventScript_SetBillCelioReadyToLeavePos + call_if_eq VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 6, OneIsland_PokemonCenter_1F_EventScript_SetCelioQuestDone + call_if_eq VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 0, OneIsland_PokemonCenter_1F_EventScript_SetBillCelioFirstMeetingPos + call_if_eq VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 2, OneIsland_PokemonCenter_1F_EventScript_SetBillCelioReadyToLeavePos end OneIsland_PokemonCenter_1F_EventScript_SetCelioQuestDone:: @@ -62,65 +58,63 @@ OneIsland_PokemonCenter_1F_OnFrame:: OneIsland_PokemonCenter_1F_EventScript_MeetCelioScene:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE applymovement OBJ_EVENT_ID_PLAYER, OneIsland_PokemonCenter_1F_Movement_PlayerWalkToCelio applymovement LOCALID_BILL, OneIsland_PokemonCenter_1F_Movement_BillWalkToCelio waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_BillHeyThereCelio - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 playse SE_PIN applymovement LOCALID_CELIO, Movement_ExclamationMark waitmovement 0 - applymovement LOCALID_CELIO, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_CELIO, Movement_WalkInPlaceFasterLeft waitmovement 0 applymovement LOCALID_CELIO, Movement_Delay48 waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_CelioCantBelieveYouCameOut msgbox OneIsland_PokemonCenter_1F_Text_BillHowsYourResearchComing - applymovement LOCALID_BILL, Movement_WalkInPlaceFastestDown - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement LOCALID_BILL, Movement_WalkInPlaceFasterDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_ThisIsMyBuddyCelio - applymovement LOCALID_BILL, Movement_WalkInPlaceFastestRight + applymovement LOCALID_BILL, Movement_WalkInPlaceFasterRight waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 call_if_set FLAG_SYS_GAME_CLEAR, OneIsland_PokemonCenter_1F_EventScript_IntroducePlayerChamp call_if_unset FLAG_SYS_GAME_CLEAR, OneIsland_PokemonCenter_1F_EventScript_IntroducePlayerNotChamp - applymovement LOCALID_CELIO, Movement_WalkInPlaceFastestDown + applymovement LOCALID_CELIO, Movement_WalkInPlaceFasterDown waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_CelioThatsReallyImpressive msgbox OneIsland_PokemonCenter_1F_Text_BillBringMeUpToSpeed - applymovement LOCALID_CELIO, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_CELIO, Movement_WalkInPlaceFasterLeft waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_CelioPCsCantLinkWithYours closemessage - applymovement LOCALID_BILL, Movement_WalkInPlaceFastestUp + applymovement LOCALID_BILL, Movement_WalkInPlaceFasterUp waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_BillLetMeHelpYou - applymovement LOCALID_BILL, Movement_WalkInPlaceFastestDown + applymovement LOCALID_BILL, Movement_WalkInPlaceFasterDown waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_CanYouDeliverThisMeteoritePlayer msgreceiveditem OneIsland_PokemonCenter_1F_Text_AcceptedMeteoriteFromBill, ITEM_METEORITE, 1, MUS_OBTAIN_KEY_ITEM additem ITEM_METEORITE - applymovement LOCALID_CELIO, Movement_WalkInPlaceFastestDown + applymovement LOCALID_CELIO, Movement_WalkInPlaceFasterDown waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_CelioPleaseTakeThis giveitem_msg OneIsland_PokemonCenter_1F_Text_ObtainedTriPass, ITEM_TRI_PASS, 1, MUS_OBTAIN_KEY_ITEM msgbox OneIsland_PokemonCenter_1F_Text_PassLetsYouTravelBetweenIslands - compare VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 2 - call_if_ge OneIsland_PokemonCenter_1F_EventScript_ReceiveTownMapPage - compare VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 2 - call_if_lt OneIsland_PokemonCenter_1F_EventScript_ReceiveTownMap + call_if_ge VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 2, OneIsland_PokemonCenter_1F_EventScript_ReceiveTownMapPage + call_if_lt VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 2, OneIsland_PokemonCenter_1F_EventScript_ReceiveTownMap setflag FLAG_SYS_SEVII_MAP_123 msgbox OneIsland_PokemonCenter_1F_Text_BillCatchYouLater closemessage - applymovement LOCALID_BILL, Movement_WalkInPlaceFastestUp + applymovement LOCALID_BILL, Movement_WalkInPlaceFasterUp waitmovement 0 - applymovement LOCALID_CELIO, Movement_WalkInPlaceFastestUp + applymovement LOCALID_CELIO, Movement_WalkInPlaceFasterUp waitmovement 0 setflag FLAG_SYS_PC_STORAGE_DISABLED setvar VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 1 @@ -136,7 +130,7 @@ OneIsland_PokemonCenter_1F_EventScript_IntroducePlayerNotChamp:: return OneIsland_PokemonCenter_1F_EventScript_ReceiveTownMapPage:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_OBTAIN_KEY_ITEM message OneIsland_PokemonCenter_1F_Text_ReceivedExtraPageForTownMap waitmessage @@ -158,7 +152,7 @@ OneIsland_PokemonCenter_1F_Movement_PlayerWalkToCelio:: walk_right walk_right walk_right - walk_in_place_fastest_up + walk_in_place_faster_up step_end OneIsland_PokemonCenter_1F_Movement_BillWalkToCelio:: @@ -169,7 +163,7 @@ OneIsland_PokemonCenter_1F_Movement_BillWalkToCelio:: walk_right walk_right walk_up - walk_in_place_fastest_right + walk_in_place_faster_right step_end @ Unused @@ -180,7 +174,7 @@ Movement_170E8F:: @ Unused Movement_170E91:: walk_left - walk_in_place_fastest_right + walk_in_place_faster_right step_end OneIsland_PokemonCenter_1F_EventScript_Nurse:: @@ -207,21 +201,15 @@ OneIsland_PokemonCenter_1F_EventScript_BillGoTakeStroll:: OneIsland_PokemonCenter_1F_EventScript_Celio:: lock faceplayer - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 7 - goto_if_eq OneIsland_PokemonCenter_1F_EventScript_CelioGiveBillFact - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 6 - goto_if_eq OneIsland_PokemonCenter_1F_EventScript_CelioJustGivenSapphire + goto_if_eq VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 7, OneIsland_PokemonCenter_1F_EventScript_CelioGiveBillFact + goto_if_eq VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 6, OneIsland_PokemonCenter_1F_EventScript_CelioJustGivenSapphire goto_if_set FLAG_RECOVERED_SAPPHIRE, OneIsland_PokemonCenter_1F_EventScript_GiveCelioSapphire - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5 - goto_if_eq OneIsland_PokemonCenter_1F_EventScript_ExplainRainbowPass + goto_if_eq VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5, OneIsland_PokemonCenter_1F_EventScript_ExplainRainbowPass goto_if_set FLAG_GOT_RUBY, OneIsland_PokemonCenter_1F_EventScript_GiveCelioRuby - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 4 - goto_if_eq OneIsland_PokemonCenter_1F_EventScript_CelioWaitingForRuby + goto_if_eq VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 4, OneIsland_PokemonCenter_1F_EventScript_CelioWaitingForRuby specialvar VAR_RESULT, IsNationalPokedexEnabled - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_PokemonCenter_1F_EventScript_CelioRequestRuby - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 3 - goto_if_eq OneIsland_PokemonCenter_1F_EventScript_CelioPlayerMissingNationalDex + goto_if_eq VAR_RESULT, TRUE, OneIsland_PokemonCenter_1F_EventScript_CelioRequestRuby + goto_if_eq VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 3, OneIsland_PokemonCenter_1F_EventScript_CelioPlayerMissingNationalDex msgbox OneIsland_PokemonCenter_1F_Text_SorryForBeingPoorHost closemessage applymovement LOCALID_CELIO, Movement_FaceOriginalDirection @@ -232,10 +220,8 @@ OneIsland_PokemonCenter_1F_EventScript_Celio:: OneIsland_PokemonCenter_1F_EventScript_CelioGiveBillFact:: msgbox OneIsland_PokemonCenter_1F_Text_CelioHearingRumorsAboutYou random 3 - compare VAR_RESULT, 0 - goto_if_eq OneIsland_PokemonCenter_1F_EventScript_BillFact1 - compare VAR_RESULT, 1 - goto_if_eq OneIsland_PokemonCenter_1F_EventScript_BillFact2 + goto_if_eq VAR_RESULT, 0, OneIsland_PokemonCenter_1F_EventScript_BillFact1 + goto_if_eq VAR_RESULT, 1, OneIsland_PokemonCenter_1F_EventScript_BillFact2 famechecker FAMECHECKER_BILL, 5 msgbox OneIsland_PokemonCenter_1F_Text_BillCantStomachMilk release @@ -259,13 +245,13 @@ OneIsland_PokemonCenter_1F_EventScript_CelioJustGivenSapphire:: end OneIsland_PokemonCenter_1F_EventScript_GiveCelioSapphire:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_OBTAIN_TMHM message OneIsland_PokemonCenter_1F_Text_HandedSapphireToCelio waitmessage waitfanfare call EventScript_RestorePrevTextColor - removeitem ITEM_SAPPHIRE, 1 + removeitem ITEM_SAPPHIRE msgbox OneIsland_PokemonCenter_1F_Text_ThankYouGiveMeTime closemessage applymovement LOCALID_CELIO, OneIsland_PokemonCenter_1F_Movement_CelioPutGemInMachine @@ -305,7 +291,7 @@ OneIsland_PokemonCenter_1F_EventScript_ExplainRainbowPass:: OneIsland_PokemonCenter_1F_EventScript_GiveCelioRuby:: msgbox OneIsland_PokemonCenter_1F_Text_OhThats - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_OBTAIN_TMHM message OneIsland_PokemonCenter_1F_Text_HandedRubyToCelio waitmessage @@ -321,26 +307,24 @@ OneIsland_PokemonCenter_1F_EventScript_GiveCelioRuby:: applymovement LOCALID_CELIO, Movement_FacePlayer waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_MayIAskOneMoreFavor, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq OneIsland_PokemonCenter_1F_EventScript_DeclineHelpCelio + goto_if_eq VAR_RESULT, NO, OneIsland_PokemonCenter_1F_EventScript_DeclineHelpCelio goto OneIsland_PokemonCenter_1F_EventScript_GiveRainbowPass end OneIsland_PokemonCenter_1F_EventScript_DeclineHelpCelio:: msgbox OneIsland_PokemonCenter_1F_Text_PleaseINeedYourHelp, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq OneIsland_PokemonCenter_1F_EventScript_DeclineHelpCelio + goto_if_eq VAR_RESULT, NO, OneIsland_PokemonCenter_1F_EventScript_DeclineHelpCelio goto OneIsland_PokemonCenter_1F_EventScript_GiveRainbowPass end OneIsland_PokemonCenter_1F_EventScript_GiveRainbowPass:: msgbox OneIsland_PokemonCenter_1F_Text_AnotherGemstoneInSeviiIslands - removeitem ITEM_RUBY, 1 - removeitem ITEM_TRI_PASS, 1 + removeitem ITEM_RUBY + removeitem ITEM_TRI_PASS setvar VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5 additem ITEM_RAINBOW_PASS setflag FLAG_SYS_SEVII_MAP_4567 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_OBTAIN_KEY_ITEM message OneIsland_PokemonCenter_1F_Text_ReturnedTriPassForRainbowPass waitmessage @@ -360,7 +344,7 @@ OneIsland_PokemonCenter_1F_EventScript_CelioWaitingForRuby:: OneIsland_PokemonCenter_1F_EventScript_CelioRequestRuby:: msgbox OneIsland_PokemonCenter_1F_Text_CelioCaughtMoreMonMaybeICanBeUseful - applymovement LOCALID_CELIO, Movement_WalkInPlaceFastestUp + applymovement LOCALID_CELIO, Movement_WalkInPlaceFasterUp waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_YoullBeTradingFromTrainersFarAway applymovement LOCALID_CELIO, Movement_FacePlayer @@ -383,7 +367,7 @@ OneIsland_PokemonCenter_1F_Movement_CelioCheckMachine:: step_end OneIsland_PokemonCenter_1F_Movement_CelioPutGemInMachine:: - walk_in_place_fastest_up + walk_in_place_faster_up walk_in_place_up delay_16 walk_in_place_up @@ -454,46 +438,42 @@ OneIsland_PokemonCenter_1F_EventScript_LeaveOneIslandTriggerBottom:: end OneIsland_PokemonCenter_1F_EventScript_LeaveOneIslandScene:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE playse SE_PIN applymovement LOCALID_BILL, Movement_ExclamationMark waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_BillOhHeyPlayer closemessage - compare VAR_TEMP_1, 1 - call_if_eq OneIsland_PokemonCenter_1F_EventScript_PlayerWalkToBillTop - compare VAR_TEMP_1, 2 - call_if_eq OneIsland_PokemonCenter_1F_EventScript_PlayerWalkToBillMidTop - compare VAR_TEMP_1, 3 - call_if_eq OneIsland_PokemonCenter_1F_EventScript_PlayerWalkToBillMidBottom - compare VAR_TEMP_1, 4 - call_if_eq OneIsland_PokemonCenter_1F_EventScript_PlayerWalkToBillBottom + call_if_eq VAR_TEMP_1, 1, OneIsland_PokemonCenter_1F_EventScript_PlayerWalkToBillTop + call_if_eq VAR_TEMP_1, 2, OneIsland_PokemonCenter_1F_EventScript_PlayerWalkToBillMidTop + call_if_eq VAR_TEMP_1, 3, OneIsland_PokemonCenter_1F_EventScript_PlayerWalkToBillMidBottom + call_if_eq VAR_TEMP_1, 4, OneIsland_PokemonCenter_1F_EventScript_PlayerWalkToBillBottom delay 10 msgbox OneIsland_PokemonCenter_1F_Text_BillWeGotItDone - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_CelioJobWentQuick - applymovement LOCALID_BILL, Movement_WalkInPlaceFastestDown + applymovement LOCALID_BILL, Movement_WalkInPlaceFasterDown waitmovement 0 - applymovement LOCALID_CELIO, Movement_WalkInPlaceFastestUp + applymovement LOCALID_CELIO, Movement_WalkInPlaceFasterUp waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_BillYouveLearnedALot msgbox OneIsland_PokemonCenter_1F_Text_CelioOhReallyEhehe closemessage - applymovement LOCALID_BILL, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_BILL, Movement_WalkInPlaceFasterLeft waitmovement 0 delay 10 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 delay 15 msgbox OneIsland_PokemonCenter_1F_Text_BillWeShouldHeadBackToKanto closemessage - applymovement LOCALID_BILL, Movement_WalkInPlaceFastestDown + applymovement LOCALID_BILL, Movement_WalkInPlaceFasterDown waitmovement 0 delay 15 - applymovement LOCALID_CELIO, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_CELIO, Movement_WalkInPlaceFasterLeft waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown waitmovement 0 msgbox OneIsland_PokemonCenter_1F_Text_CelioPromiseIllShowYouAroundSometime closemessage @@ -534,7 +514,7 @@ OneIsland_PokemonCenter_1F_EventScript_PlayerWalkToBillBottom:: OneIsland_PokemonCenter_1F_Movement_PlayerWalkToBillTop:: walk_right walk_down - walk_in_place_fastest_right + walk_in_place_faster_right step_end OneIsland_PokemonCenter_1F_Movement_PlayerWalkToBillMidTop:: @@ -544,14 +524,14 @@ OneIsland_PokemonCenter_1F_Movement_PlayerWalkToBillMidTop:: OneIsland_PokemonCenter_1F_Movement_PlayerWalkToBillMidBottom:: walk_right walk_up - walk_in_place_fastest_right + walk_in_place_faster_right step_end OneIsland_PokemonCenter_1F_Movement_PlayerWalkToBillBottom:: walk_right walk_up walk_up - walk_in_place_fastest_right + walk_in_place_faster_right step_end @ Unused @@ -559,7 +539,7 @@ Movement_17131F:: delay_16 delay_16 delay_4 - walk_in_place_fastest_left + walk_in_place_faster_left step_end @ Unused diff --git a/data/maps/PalletTown/scripts.inc b/data/maps/PalletTown/scripts.inc index f6a1777ab..00202f054 100644 --- a/data/maps/PalletTown/scripts.inc +++ b/data/maps/PalletTown/scripts.inc @@ -11,16 +11,13 @@ PalletTown_MapScripts:: PalletTown_OnTransition:: setworldmapflag FLAG_WORLD_MAP_PALLET_TOWN call_if_set FLAG_PALLET_LADY_NOT_BLOCKING_SIGN, PalletTown_EventScript_TryReadySignLady - compare VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 0 - call_if_eq PalletTown_EventScript_SetSignLadyPos - compare VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 1 - call_if_eq PalletTown_EventScript_SetSignLadyDone + call_if_eq VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 0, PalletTown_EventScript_SetSignLadyPos + call_if_eq VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 1, PalletTown_EventScript_SetSignLadyDone end PalletTown_EventScript_TryReadySignLady:: goto_if_unset FLAG_OPENED_START_MENU, EventScript_Return - compare VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 1 - goto_if_ge EventScript_Return + goto_if_ge VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 1, EventScript_Return setvar VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 1 return @@ -47,7 +44,7 @@ PalletTown_OnFrame:: @ Oak approaches player after exiting their house post Elite Four to check if they should receieve the National Dex PalletTown_EventScript_OakRatingScene:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE setobjectxyperm LOCALID_PROF_OAK, 14, 14 setobjectmovementtype LOCALID_PROF_OAK, MOVEMENT_TYPE_FACE_LEFT addobject LOCALID_PROF_OAK @@ -59,10 +56,9 @@ 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 - compare VAR_0x8009, 60 - goto_if_lt PalletTown_EventScript_NotEnoughMonsForNationalDex + buffernumberstring STR_VAR_1, VAR_0x8008 + buffernumberstring STR_VAR_2, VAR_0x8009 + goto_if_lt VAR_0x8009, 60, PalletTown_EventScript_NotEnoughMonsForNationalDex msgbox PalletTown_Text_CaughtXImpressiveFollowMe closemessage playbgm MUS_FOLLOW_ME, 0 @@ -79,7 +75,7 @@ PalletTown_EventScript_OakRatingScene:: setvar VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 7 setvar VAR_MAP_SCENE_PALLET_TOWN_OAK, 3 setflag FLAG_HIDE_OAK_IN_PALLET_TOWN - warp MAP_PALLET_TOWN_PROFESSOR_OAKS_LAB, 255, 6, 12 + warp MAP_PALLET_TOWN_PROFESSOR_OAKS_LAB, 6, 12 waitstate releaseall end @@ -117,7 +113,7 @@ PalletTown_Movement_OakWalkToPlayersDoor:: walk_left walk_left walk_left - walk_in_place_fastest_up + walk_in_place_faster_up step_end PalletTown_Movement_OakExit:: @@ -152,7 +148,7 @@ PalletTown_Movement_OakWalkToLabFromHouse:: walk_right walk_right walk_right - walk_in_place_fastest_up + walk_in_place_faster_up step_end PalletTown_Movement_PlayerWalkToLabFromHouse:: @@ -187,32 +183,28 @@ PalletTown_EventScript_OakTriggerRight:: PalletTown_EventScript_OakTrigger:: famechecker FAMECHECKER_OAK, FCPICKSTATE_COLORED, UpdatePickStateFromSpecialVar8005 - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE delay 30 playbgm MUS_OAK, 0 message PalletTown_Text_OakDontGoOut waitmessage delay 85 closemessage - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown waitmovement 0 playse SE_PIN applymovement OBJ_EVENT_ID_PLAYER, Movement_ExclamationMark waitmovement 0 delay 30 addobject LOCALID_PROF_OAK - compare VAR_TEMP_1, 0 - call_if_eq PalletTown_EventScript_OakEnterLeft - compare VAR_TEMP_1, 1 - call_if_eq PalletTown_EventScript_OakEnterRight + call_if_eq VAR_TEMP_1, 0, PalletTown_EventScript_OakEnterLeft + call_if_eq VAR_TEMP_1, 1, PalletTown_EventScript_OakEnterRight delay 30 msgbox PalletTown_Text_OakGrassUnsafeNeedMon closemessage delay 30 - compare VAR_TEMP_1, 0 - call_if_eq PalletTown_EventScript_OakLeadPlayerToLabLeft - compare VAR_TEMP_1, 1 - call_if_eq PalletTown_EventScript_OakLeadPlayerToLabRight + call_if_eq VAR_TEMP_1, 0, PalletTown_EventScript_OakLeadPlayerToLabLeft + call_if_eq VAR_TEMP_1, 1, PalletTown_EventScript_OakLeadPlayerToLabRight opendoor 16, 13 waitdooranim applymovement LOCALID_PROF_OAK, PalletTown_Movement_OakEnterLab @@ -225,7 +217,7 @@ PalletTown_EventScript_OakTrigger:: setvar VAR_MAP_SCENE_PALLET_TOWN_OAK, 1 setflag FLAG_HIDE_OAK_IN_PALLET_TOWN setflag FLAG_DONT_TRANSITION_MUSIC - warp MAP_PALLET_TOWN_PROFESSOR_OAKS_LAB, 255, 6, 12 + warp MAP_PALLET_TOWN_PROFESSOR_OAKS_LAB, 6, 12 waitstate releaseall end @@ -298,7 +290,7 @@ PalletTown_Movement_OakWalkToLabLeft:: walk_down walk_to_lab walk_right - walk_in_place_fastest_up + walk_in_place_faster_up step_end PalletTown_Movement_OakWalkToLabRight:: @@ -306,7 +298,7 @@ PalletTown_Movement_OakWalkToLabRight:: walk_left walk_to_lab walk_right - walk_in_place_fastest_up + walk_in_place_faster_up step_end PalletTown_Movement_OakEnterLab:: @@ -335,12 +327,9 @@ PalletTown_Movement_PlayerEnterLab:: PalletTown_EventScript_SignLady:: lock - compare VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 2 - goto_if_eq PalletTown_EventScript_SignLadyDone - compare VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 1 - goto_if_eq PalletTown_EventScript_SignLadyJustShowedSign - compare SIGN_LADY_READY, TRUE - goto_if_eq PalletTown_EventScript_SignLadyStartShowSign + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 2, PalletTown_EventScript_SignLadyDone + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 1, PalletTown_EventScript_SignLadyJustShowedSign + goto_if_eq SIGN_LADY_READY, TRUE, PalletTown_EventScript_SignLadyStartShowSign goto_if_set FLAG_TEMP_2, PalletTown_EventScript_SignLadyGoReadSign msgbox PalletTown_Text_HmmIsThatRight applymovement LOCALID_SIGN_LADY, Movement_FacePlayer @@ -352,11 +341,9 @@ PalletTown_EventScript_SignLady:: waitmovement 0 msgbox PalletTown_Text_OhLookLook closemessage - compare VAR_FACING, DIR_EAST - call_if_eq PalletTown_EventScript_SignLadyMoveOutOfWayRight - compare VAR_FACING, DIR_EAST - call_if_ne PalletTown_EventScript_SignLadyMoveOutOfWayLeft - moveobjectoffscreen 1 + call_if_eq VAR_FACING, DIR_EAST, PalletTown_EventScript_SignLadyMoveOutOfWayRight + call_if_ne VAR_FACING, DIR_EAST, PalletTown_EventScript_SignLadyMoveOutOfWayLeft + copyobjectxytoperm LOCALID_SIGN_LADY setflag FLAG_TEMP_2 release end @@ -394,12 +381,12 @@ PalletTown_EventScript_SignLadyJustShowedSign:: PalletTown_Movement_SignLadyMoveOutOfWayRight:: walk_right - walk_in_place_fastest_left + walk_in_place_faster_left step_end PalletTown_Movement_SignLadyMoveOutOfWayLeft:: walk_left - walk_in_place_fastest_right + walk_in_place_faster_right step_end PalletTown_EventScript_FatMan:: @@ -434,19 +421,19 @@ PalletTown_EventScript_TrainerTips:: PalletTown_EventScript_SignLadyTrigger:: lockall - applymovement LOCALID_SIGN_LADY, Movement_WalkInPlaceFastestRight - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_SIGN_LADY, Movement_WalkInPlaceFasterRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 call PalletTown_EventScript_SignLadyShowSign releaseall end PalletTown_EventScript_SignLadyShowSign:: - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox PalletTown_Text_LookCopiedTrainerTipsSign closemessage delay 20 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL setflag FLAG_OPENED_START_MENU setvar VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 1 setvar SIGN_LADY_READY, FALSE diff --git a/data/maps/PalletTown_PlayersHouse_1F/scripts.inc b/data/maps/PalletTown_PlayersHouse_1F/scripts.inc index 00a622d3a..01028e6fb 100644 --- a/data/maps/PalletTown_PlayersHouse_1F/scripts.inc +++ b/data/maps/PalletTown_PlayersHouse_1F/scripts.inc @@ -8,10 +8,8 @@ PalletTown_PlayersHouse_1F_EventScript_Mom:: faceplayer goto_if_set FLAG_BEAT_RIVAL_IN_OAKS_LAB, PalletTown_PlayersHouse_1F_EventScript_MomHeal checkplayergender - compare VAR_RESULT, MALE - call_if_eq PalletTown_PlayersHouse_1F_EventScript_MomOakLookingForYouMale - compare VAR_RESULT, FEMALE - call_if_eq PalletTown_PlayersHouse_1F_EventScript_MomOakLookingForYouFemale + call_if_eq VAR_RESULT, MALE, PalletTown_PlayersHouse_1F_EventScript_MomOakLookingForYouMale + call_if_eq VAR_RESULT, FEMALE, PalletTown_PlayersHouse_1F_EventScript_MomOakLookingForYouFemale closemessage applymovement LOCALID_MOM, Movement_FaceOriginalDirection waitmovement 0 @@ -37,18 +35,15 @@ PalletTown_PlayersHouse_1F_EventScript_MomHeal:: @ Displays special text if interacted with from side or back (which are normally inaccessible) PalletTown_PlayersHouse_1F_EventScript_TV:: lockall - compare VAR_FACING, DIR_NORTH - goto_if_eq PalletTown_PlayersHouse_1F_EventScript_TVScreen + goto_if_eq VAR_FACING, DIR_NORTH, PalletTown_PlayersHouse_1F_EventScript_TVScreen msgbox PalletTown_PlayersHouse_1F_Text_OopsWrongSide releaseall end PalletTown_PlayersHouse_1F_EventScript_TVScreen:: checkplayergender - compare VAR_RESULT, MALE - call_if_eq PalletTown_PlayersHouse_1F_EventScript_TVScreenMale - compare VAR_RESULT, FEMALE - call_if_eq PalletTown_PlayersHouse_1F_EventScript_TVScreenFemale + call_if_eq VAR_RESULT, MALE, PalletTown_PlayersHouse_1F_EventScript_TVScreenMale + call_if_eq VAR_RESULT, FEMALE, PalletTown_PlayersHouse_1F_EventScript_TVScreenFemale releaseall end diff --git a/data/maps/PalletTown_PlayersHouse_2F/scripts.inc b/data/maps/PalletTown_PlayersHouse_2F/scripts.inc index 2bfdc0654..a26d8588a 100644 --- a/data/maps/PalletTown_PlayersHouse_2F/scripts.inc +++ b/data/maps/PalletTown_PlayersHouse_2F/scripts.inc @@ -4,8 +4,7 @@ PalletTown_PlayersHouse_2F_MapScripts:: .byte 0 PalletTown_PlayersHouse_2F_OnTransition:: - compare VAR_MAP_SCENE_PALLET_TOWN_PLAYERS_HOUSE_2F, 0 - call_if_eq PalletTown_PlayersHouse_2F_EventScript_SetRespawn + call_if_eq VAR_MAP_SCENE_PALLET_TOWN_PLAYERS_HOUSE_2F, 0, PalletTown_PlayersHouse_2F_EventScript_SetRespawn end PalletTown_PlayersHouse_2F_EventScript_SetRespawn:: diff --git a/data/maps/PalletTown_ProfessorOaksLab/scripts.inc b/data/maps/PalletTown_ProfessorOaksLab/scripts.inc index 1d6fbfbeb..8b646176d 100644 --- a/data/maps/PalletTown_ProfessorOaksLab/scripts.inc +++ b/data/maps/PalletTown_ProfessorOaksLab/scripts.inc @@ -21,12 +21,9 @@ PalletTown_ProfessorOaksLab_MapScripts:: PalletTown_ProfessorOaksLab_OnTransition:: setflag FLAG_VISITED_OAKS_LAB - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 1 - call_if_eq PalletTown_ProfessorOaksLab_EventScript_ReadyOakForStarterScene - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 7 - call_if_eq PalletTown_ProfessorOaksLab_EventScript_ReadyOakForNationalDexScene - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 8 - call_if_eq PalletTown_ProfessorOaksLab_EventScript_SetNationalDexSceneFinished + call_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 1, PalletTown_ProfessorOaksLab_EventScript_ReadyOakForStarterScene + call_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 7, PalletTown_ProfessorOaksLab_EventScript_ReadyOakForNationalDexScene + call_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 8, PalletTown_ProfessorOaksLab_EventScript_SetNationalDexSceneFinished call_if_set FLAG_GOT_POKEBALLS_FROM_OAK_AFTER_22_RIVAL, PalletTown_ProfessorOaksLab_EventScript_SetSkipPokeBallCheck end @@ -65,7 +62,7 @@ PalletTown_ProfessorOaksLab_OnFrame:: PalletTown_ProfessorOaksLab_EventScript_EnterForNationalDexScene:: @ 8169002 lockall setvar VAR_FACING, DIR_NORTH - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakEnter waitmovement 0 removeobject LOCALID_PROF_OAK @@ -80,33 +77,23 @@ PalletTown_ProfessorOaksLab_EventScript_EnterForNationalDexScene:: @ 8169002 PalletTown_ProfessorOaksLab_EventScript_NationalDexScene:: msgbox PalletTown_ProfessorOaksLab_Text_OakSightingsOfRareMons closemessage - compare VAR_FACING, DIR_NORTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterSouth - compare VAR_FACING, DIR_EAST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterEastWest - compare VAR_FACING, DIR_WEST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterEastWest + call_if_eq VAR_FACING, DIR_NORTH, PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterNorth + call_if_eq VAR_FACING, DIR_SOUTH, PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterSouth + call_if_eq VAR_FACING, DIR_EAST, PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterEastWest + call_if_eq VAR_FACING, DIR_WEST, PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterEastWest msgbox PalletTown_ProfessorOaksLab_Text_RivalJustLetMeHandleEverything fadedefaultbgm msgbox PalletTown_ProfessorOaksLab_Text_OakNeedYourHelpTooNeedToSeePokedexes - compare VAR_FACING, DIR_NORTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_PlayerFaceOakNorth - compare VAR_FACING, DIR_WEST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_PlayerFaceOakWest - textcolor 3 + call_if_eq VAR_FACING, DIR_NORTH, PalletTown_ProfessorOaksLab_EventScript_PlayerFaceOakNorth + call_if_eq VAR_FACING, DIR_WEST, PalletTown_ProfessorOaksLab_EventScript_PlayerFaceOakWest + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PalletTown_ProfessorOaksLab_Text_OakTookBothPokedexUnits closemessage call EventScript_RestorePrevTextColor - compare VAR_FACING, DIR_NORTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskSouth - compare VAR_FACING, DIR_EAST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskEast - compare VAR_FACING, DIR_WEST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskWest + call_if_eq VAR_FACING, DIR_NORTH, PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskNorth + call_if_eq VAR_FACING, DIR_SOUTH, PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskSouth + call_if_eq VAR_FACING, DIR_EAST, PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskEast + call_if_eq VAR_FACING, DIR_WEST, PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskWest addobject LOCALID_POKEDEX_1 addobject LOCALID_POKEDEX_2 delay 30 @@ -115,15 +102,11 @@ PalletTown_ProfessorOaksLab_EventScript_NationalDexScene:: removeobject LOCALID_POKEDEX_1 removeobject LOCALID_POKEDEX_2 delay 30 - compare VAR_FACING, DIR_NORTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverSouth - compare VAR_FACING, DIR_EAST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverEast - compare VAR_FACING, DIR_WEST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverWest - textcolor 3 + call_if_eq VAR_FACING, DIR_NORTH, PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverNorth + call_if_eq VAR_FACING, DIR_SOUTH, PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverSouth + call_if_eq VAR_FACING, DIR_EAST, PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverEast + call_if_eq VAR_FACING, DIR_WEST, PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverWest + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_OBTAIN_KEY_ITEM message PalletTown_ProfessorOaksLab_Text_PlayersPokedexWasUpgraded waitmessage @@ -134,14 +117,10 @@ PalletTown_ProfessorOaksLab_EventScript_NationalDexScene:: msgbox PalletTown_ProfessorOaksLab_Text_RivalIllCompleteThePokedex closemessage playbgm MUS_RIVAL_EXIT, 0 - compare VAR_FACING, DIR_NORTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExitNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExit - compare VAR_FACING, DIR_EAST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExit - compare VAR_FACING, DIR_WEST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExit + call_if_eq VAR_FACING, DIR_NORTH, PalletTown_ProfessorOaksLab_EventScript_RivalExitNorth + call_if_eq VAR_FACING, DIR_SOUTH, PalletTown_ProfessorOaksLab_EventScript_RivalExit + call_if_eq VAR_FACING, DIR_EAST, PalletTown_ProfessorOaksLab_EventScript_RivalExit + call_if_eq VAR_FACING, DIR_WEST, PalletTown_ProfessorOaksLab_EventScript_RivalExit removeobject LOCALID_RIVAL fadedefaultbgm setvar VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 8 @@ -161,7 +140,7 @@ PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterEastWest:: setobjectxyperm LOCALID_RIVAL, 6, 10 addobject LOCALID_RIVAL playbgm MUS_ENCOUNTER_RIVAL, 0 - applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown + applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFasterDown applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_WatchRivalEnterEastWest applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalEnter waitmovement 0 @@ -171,18 +150,18 @@ PalletTown_ProfessorOaksLab_EventScript_NationalDexSceneRivalEnterSouth:: setobjectxyperm LOCALID_RIVAL, 6, 10 addobject LOCALID_RIVAL playbgm MUS_ENCOUNTER_RIVAL, 0 - applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown + applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFasterDown applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalEnter waitmovement 0 return PalletTown_ProfessorOaksLab_EventScript_PlayerFaceOakNorth:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 return PalletTown_ProfessorOaksLab_EventScript_PlayerFaceOakWest:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 return @@ -212,7 +191,7 @@ PalletTown_ProfessorOaksLab_EventScript_OakBringDexesToDeskWest:: PalletTown_ProfessorOaksLab_Movement_OakBringDexesToDesk:: walk_up walk_left - walk_in_place_fastest_up + walk_in_place_faster_up delay_16 delay_4 step_end @@ -227,7 +206,7 @@ PalletTown_ProfessorOaksLab_Movement_OakBringDexesToDeskSouth:: PalletTown_ProfessorOaksLab_ChooseStarterScene:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE applymovement LOCALID_PROF_OAK, PalletTown_ProfessorOaksLab_Movement_OakEnter waitmovement 0 removeobject LOCALID_PROF_OAK @@ -236,7 +215,7 @@ PalletTown_ProfessorOaksLab_ChooseStarterScene:: clearflag FLAG_HIDE_OAK_IN_HIS_LAB applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_PlayerEnter waitmovement 0 - applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestUp + applymovement LOCALID_RIVAL, Movement_WalkInPlaceFasterUp waitmovement 0 clearflag FLAG_DONT_TRANSITION_MUSIC savebgm MUS_DUMMY @@ -282,7 +261,7 @@ PalletTown_ProfessorOaksLab_Movement_RivalReact:: PalletTown_ProfessorOaksLab_EventScript_LeaveStarterSceneTrigger:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE applymovement LOCALID_PROF_OAK, Movement_FaceDown waitmovement 0 msgbox PalletTown_ProfessorOaksLab_Text_OakHeyDontGoAwayYet @@ -315,22 +294,19 @@ PalletTown_ProfessorOaksLab_EventScript_RivalBattleTriggerRight:: end PalletTown_ProfessorOaksLab_EventScript_RivalBattle:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE playbgm MUS_ENCOUNTER_RIVAL, 0 - applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestDown + applymovement LOCALID_RIVAL, Movement_WalkInPlaceFasterDown waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 msgbox PalletTown_ProfessorOaksLab_Text_RivalLetsCheckOutMons closemessage applymovement LOCALID_PROF_OAK, Movement_FaceDown waitmovement 0 - compare VAR_STARTER_MON, 0 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmander - compare VAR_STARTER_MON, 1 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaur - compare VAR_STARTER_MON, 2 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtle + goto_if_eq VAR_STARTER_MON, 0, PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmander + goto_if_eq VAR_STARTER_MON, 1, PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaur + goto_if_eq VAR_STARTER_MON, 2, PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtle end @ The scripts for the rival approaching the player for battle are a bit bloated because @@ -338,12 +314,9 @@ PalletTown_ProfessorOaksLab_EventScript_RivalBattle:: @ NOTE: Names below refer to the Rival's mon (e.g. for RivalBattleSquirtle, player has Charmander) PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtle:: - compare VAR_TEMP_2, 1 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleLeft - compare VAR_TEMP_2, 2 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleMid - compare VAR_TEMP_2, 3 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleRight + goto_if_eq VAR_TEMP_2, 1, PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleLeft + goto_if_eq VAR_TEMP_2, 2, PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleMid + goto_if_eq VAR_TEMP_2, 3, PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleRight end PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleSquirtleLeft:: @@ -394,12 +367,9 @@ PalletTown_ProfessorOaksLab_Movement_RivalApproachForBattleSquirtleRight:: step_end PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmander:: - compare VAR_TEMP_2, 1 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderLeft - compare VAR_TEMP_2, 2 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderMid - compare VAR_TEMP_2, 3 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderRight + goto_if_eq VAR_TEMP_2, 1, PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderLeft + goto_if_eq VAR_TEMP_2, 2, PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderMid + goto_if_eq VAR_TEMP_2, 3, PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderRight end PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleCharmanderLeft:: @@ -453,12 +423,9 @@ PalletTown_ProfessorOaksLab_Movement_ApproachForBattleCharmanderRight:: step_end PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaur:: - compare VAR_TEMP_2, 1 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurLeft - compare VAR_TEMP_2, 2 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurMid - compare VAR_TEMP_2, 3 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurRight + goto_if_eq VAR_TEMP_2, 1, PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurLeft + goto_if_eq VAR_TEMP_2, 2, PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurMid + goto_if_eq VAR_TEMP_2, 3, PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurRight end PalletTown_ProfessorOaksLab_EventScript_RivalApproachForBattleBulbasaurLeft:: @@ -510,12 +477,9 @@ PalletTown_ProfessorOaksLab_EventScript_EndRivalBattle:: msgbox PalletTown_ProfessorOaksLab_Text_RivalGoToughenMyMon closemessage playbgm MUS_RIVAL_EXIT, 0 - compare VAR_TEMP_2, 1 - call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExitAfterBattleLeft - compare VAR_TEMP_2, 2 - call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExitAfterBattleMid - compare VAR_TEMP_2, 3 - call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExitAfterBattleRight + call_if_eq VAR_TEMP_2, 1, PalletTown_ProfessorOaksLab_EventScript_RivalExitAfterBattleLeft + call_if_eq VAR_TEMP_2, 2, PalletTown_ProfessorOaksLab_EventScript_RivalExitAfterBattleMid + call_if_eq VAR_TEMP_2, 3, PalletTown_ProfessorOaksLab_EventScript_RivalExitAfterBattleRight removeobject LOCALID_RIVAL playse SE_EXIT fadedefaultbgm @@ -576,26 +540,24 @@ PalletTown_ProfessorOaksLab_Movement_RivalExitAfterBattleMid:: PalletTown_ProfessorOaksLab_Movement_PlayerWatchRivalExitAfterBattle:: delay_16 delay_8 - walk_in_place_fastest_right + walk_in_place_faster_right delay_16 - walk_in_place_fastest_down + walk_in_place_faster_down step_end PalletTown_ProfessorOaksLab_Movement_PlayerWatchRivalExitAfterBattleRight:: delay_16 delay_8 - walk_in_place_fastest_left + walk_in_place_faster_left delay_16 - walk_in_place_fastest_down + walk_in_place_faster_down step_end PalletTown_ProfessorOaksLab_EventScript_Rival:: lock faceplayer - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalChoseStarter - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalWaitingForStarter + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3, PalletTown_ProfessorOaksLab_EventScript_RivalChoseStarter + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2, PalletTown_ProfessorOaksLab_EventScript_RivalWaitingForStarter msgbox PalletTown_ProfessorOaksLab_Text_RivalGrampsIsntAround release end @@ -614,21 +576,14 @@ PalletTown_ProfessorOaksLab_EventScript_ProfOak:: lock faceplayer goto_if_set SHOWED_OAK_COMPLETE_DEX, PalletTown_ProfessorOaksLab_EventScript_OakJustShownCompleteDex - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 9 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RatePokedex - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 8 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_MonsAroundWorldWait + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 9, PalletTown_ProfessorOaksLab_EventScript_RatePokedex + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 8, PalletTown_ProfessorOaksLab_EventScript_MonsAroundWorldWait goto_if_set FLAG_SYS_GAME_CLEAR, PalletTown_ProfessorOaksLab_EventScript_TryStartNationalDexScene - compare VAR_MAP_SCENE_CERULEAN_CITY_RIVAL, 1 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RatePokedex - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 6 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RatePokedexOrTryGiveBalls - compare VAR_MAP_SCENE_VIRIDIAN_CITY_MART, 1 - goto_if_ge PalletTown_ProfessorOaksLab_EventScript_ReceiveDexScene - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 4 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBattleMonForItToGrow - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_OakCanReachNextTownWithMon + goto_if_eq VAR_MAP_SCENE_CERULEAN_CITY_RIVAL, 1, PalletTown_ProfessorOaksLab_EventScript_RatePokedex + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 6, PalletTown_ProfessorOaksLab_EventScript_RatePokedexOrTryGiveBalls + goto_if_ge VAR_MAP_SCENE_VIRIDIAN_CITY_MART, 1, PalletTown_ProfessorOaksLab_EventScript_ReceiveDexScene + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 4, PalletTown_ProfessorOaksLab_EventScript_OakBattleMonForItToGrow + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3, PalletTown_ProfessorOaksLab_EventScript_OakCanReachNextTownWithMon msgbox PalletTown_ProfessorOaksLab_Text_OakWhichOneWillYouChoose release end @@ -650,25 +605,21 @@ PalletTown_ProfessorOaksLab_EventScript_OakBattleMonForItToGrow:: PalletTown_ProfessorOaksLab_EventScript_ReceiveDexScene:: msgbox PalletTown_ProfessorOaksLab_Text_OakHaveSomethingForMe - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_OBTAIN_TMHM message PalletTown_ProfessorOaksLab_Text_DeliveredOaksParcel waitmessage waitfanfare call EventScript_RestorePrevTextColor - removeitem ITEM_OAKS_PARCEL, 1 + removeitem ITEM_OAKS_PARCEL msgbox PalletTown_ProfessorOaksLab_Text_OakCustomBallIOrdered playbgm MUS_ENCOUNTER_RIVAL, 0 msgbox PalletTown_ProfessorOaksLab_Text_RivalGramps closemessage - compare VAR_FACING, DIR_NORTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterSouth - compare VAR_FACING, DIR_EAST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterEastWest - compare VAR_FACING, DIR_WEST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterEastWest + call_if_eq VAR_FACING, DIR_NORTH, PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterNorth + call_if_eq VAR_FACING, DIR_SOUTH, PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterSouth + call_if_eq VAR_FACING, DIR_EAST, PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterEastWest + call_if_eq VAR_FACING, DIR_WEST, PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterEastWest fadedefaultbgm msgbox PalletTown_ProfessorOaksLab_Text_RivalWhatDidYouCallMeFor closemessage @@ -678,45 +629,33 @@ PalletTown_ProfessorOaksLab_EventScript_ReceiveDexScene:: waitmovement 0 applymovement LOCALID_PROF_OAK, Movement_Delay48 waitmovement 0 - compare VAR_FACING, DIR_SOUTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalSouth - compare VAR_FACING, DIR_EAST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalEast - compare VAR_FACING, DIR_WEST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalWest - compare VAR_FACING, DIR_NORTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalNorth + call_if_eq VAR_FACING, DIR_SOUTH, PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalSouth + call_if_eq VAR_FACING, DIR_EAST, PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalEast + call_if_eq VAR_FACING, DIR_WEST, PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalWest + call_if_eq VAR_FACING, DIR_NORTH, PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalNorth msgbox PalletTown_ProfessorOaksLab_Text_OakHaveRequestForYouTwo closemessage - compare VAR_FACING, DIR_NORTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskSouth - compare VAR_FACING, DIR_EAST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskEast - compare VAR_FACING, DIR_WEST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskWest + call_if_eq VAR_FACING, DIR_NORTH, PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskNorth + call_if_eq VAR_FACING, DIR_SOUTH, PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskSouth + call_if_eq VAR_FACING, DIR_EAST, PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskEast + call_if_eq VAR_FACING, DIR_WEST, PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskWest msgbox PalletTown_ProfessorOaksLab_Text_OakPokedexOnDesk closemessage delay 40 msgbox PalletTown_ProfessorOaksLab_Text_OakTakeTheseWithYou closemessage - applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestUp + applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFasterUp waitmovement 0 removeobject LOCALID_POKEDEX_1 delay 10 removeobject LOCALID_POKEDEX_2 delay 25 - compare VAR_FACING, DIR_NORTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverSouth - compare VAR_FACING, DIR_EAST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverEast - compare VAR_FACING, DIR_WEST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverWest + call_if_eq VAR_FACING, DIR_NORTH, PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverNorth + call_if_eq VAR_FACING, DIR_SOUTH, PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverSouth + call_if_eq VAR_FACING, DIR_EAST, PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverEast + call_if_eq VAR_FACING, DIR_WEST, PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverWest delay 10 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_OBTAIN_KEY_ITEM message PalletTown_ProfessorOaksLab_Text_ReceivedPokedexFromOak waitmessage @@ -731,25 +670,17 @@ PalletTown_ProfessorOaksLab_EventScript_ReceiveDexScene:: famechecker FAMECHECKER_OAK, 1 msgbox PalletTown_ProfessorOaksLab_Text_OakCompleteMonGuideWasMyDream msgbox PalletTown_ProfessorOaksLab_Text_RivalLeaveItToMeGramps - compare VAR_FACING, DIR_NORTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerSouth - compare VAR_FACING, DIR_EAST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerEastWest - compare VAR_FACING, DIR_WEST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerEastWest + call_if_eq VAR_FACING, DIR_NORTH, PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerNorth + call_if_eq VAR_FACING, DIR_SOUTH, PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerSouth + call_if_eq VAR_FACING, DIR_EAST, PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerEastWest + call_if_eq VAR_FACING, DIR_WEST, PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerEastWest msgbox PalletTown_ProfessorOaksLab_Text_RivalTellSisNotToGiveYouMap closemessage playbgm MUS_RIVAL_EXIT, 0 - compare VAR_FACING, DIR_NORTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExitNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExit - compare VAR_FACING, DIR_EAST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExit - compare VAR_FACING, DIR_WEST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalExit + call_if_eq VAR_FACING, DIR_NORTH, PalletTown_ProfessorOaksLab_EventScript_RivalExitNorth + call_if_eq VAR_FACING, DIR_SOUTH, PalletTown_ProfessorOaksLab_EventScript_RivalExit + call_if_eq VAR_FACING, DIR_EAST, PalletTown_ProfessorOaksLab_EventScript_RivalExit + call_if_eq VAR_FACING, DIR_WEST, PalletTown_ProfessorOaksLab_EventScript_RivalExit removeobject LOCALID_RIVAL fadedefaultbgm setvar VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 6 @@ -784,7 +715,7 @@ PalletTown_ProfessorOaksLab_EventScript_OakBringDexesOverWest:: PalletTown_ProfessorOaksLab_Movement_PlayerFaceOakForDexEast:: delay_16 delay_8 - walk_in_place_fastest_right + walk_in_place_faster_right step_end PalletTown_ProfessorOaksLab_Movement_OakBringDexesOver:: @@ -823,20 +754,20 @@ PalletTown_ProfessorOaksLab_EventScript_DexSceneOakWalkToDeskWest:: PalletTown_ProfessorOaksLab_Movement_WatchOakWalkToDeskEast:: delay_16 delay_8 - walk_in_place_fastest_up + walk_in_place_faster_up step_end PalletTown_ProfessorOaksLab_Movement_WatchOakWalkToDesk:: delay_16 delay_8 - walk_in_place_fastest_left + walk_in_place_faster_left step_end PalletTown_ProfessorOaksLab_Movement_OakWalkToDesk:: walk_up walk_left delay_16 - walk_in_place_fastest_down + walk_in_place_faster_down step_end PalletTown_ProfessorOaksLab_Movement_OakWalkToDeskSouth:: @@ -844,7 +775,7 @@ PalletTown_ProfessorOaksLab_Movement_OakWalkToDeskSouth:: walk_left walk_up delay_16 - walk_in_place_fastest_right + walk_in_place_faster_right step_end PalletTown_ProfessorOaksLab_EventScript_RatePokedexOrTryGiveBalls:: @@ -852,10 +783,9 @@ 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 - compare VAR_0x8009, 1 @ Player only has starter - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_CheckIfPlayerNeedsBalls + buffernumberstring STR_VAR_1, VAR_0x8008 + buffernumberstring STR_VAR_2, VAR_0x8009 + goto_if_eq VAR_0x8009, 1, PalletTown_ProfessorOaksLab_EventScript_CheckIfPlayerNeedsBalls @ Player only has starter goto PalletTown_ProfessorOaksLab_EventScript_RatePokedex end @@ -870,14 +800,10 @@ PalletTown_ProfessorOaksLab_EventScript_DexCompleted:: delay 40 message PokedexRating_Text_Wroooaaarrr waitmessage - compare VAR_FACING, DIR_NORTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakExcitedNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakExcitedSouth - compare VAR_FACING, DIR_EAST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakExcitedEast - compare VAR_FACING, DIR_WEST - call_if_eq PalletTown_ProfessorOaksLab_EventScript_OakExcitedWest + call_if_eq VAR_FACING, DIR_NORTH, PalletTown_ProfessorOaksLab_EventScript_OakExcitedNorth + call_if_eq VAR_FACING, DIR_SOUTH, PalletTown_ProfessorOaksLab_EventScript_OakExcitedSouth + call_if_eq VAR_FACING, DIR_EAST, PalletTown_ProfessorOaksLab_EventScript_OakExcitedEast + call_if_eq VAR_FACING, DIR_WEST, PalletTown_ProfessorOaksLab_EventScript_OakExcitedWest applymovement LOCALID_PROF_OAK, Movement_FacePlayer waitmovement 0 closemessage @@ -946,27 +872,27 @@ PalletTown_ProfessorOaksLab_Movement_OakExcitedWest:: @ Unused Movement_1699AC:: walk_left - walk_in_place_fastest_down + walk_in_place_faster_down delay_8 - walk_in_place_fastest_right + walk_in_place_faster_right delay_8 - walk_in_place_fastest_up + walk_in_place_faster_up delay_8 - walk_in_place_fastest_left + walk_in_place_faster_left delay_8 - walk_in_place_fastest_down + walk_in_place_faster_down delay_8 walk_right walk_right - walk_in_place_fastest_up + walk_in_place_faster_up delay_8 - walk_in_place_fastest_left + walk_in_place_faster_left delay_8 - walk_in_place_fastest_down + walk_in_place_faster_down delay_8 - walk_in_place_fastest_right + walk_in_place_faster_right delay_8 - walk_in_place_fastest_up + walk_in_place_faster_up delay_8 walk_left step_end @@ -986,8 +912,7 @@ Movement_1699C5: PalletTown_ProfessorOaksLab_EventScript_TryStartNationalDexScene:: call PokedexRating_EventScript_RateInPerson closemessage - compare VAR_0x8009, 60 - goto_if_lt PalletTown_ProfessorOaksLab_EventScript_DontStartNationalDexScene + goto_if_lt VAR_0x8009, 60, PalletTown_ProfessorOaksLab_EventScript_DontStartNationalDexScene goto_if_unset FLAG_WORLD_MAP_ONE_ISLAND, PalletTown_ProfessorOaksLab_EventScript_DontStartNationalDexScene delay 30 msgbox PalletTown_ProfessorOaksLab_Text_OakFavorToAskYouPlayer @@ -1003,15 +928,13 @@ PalletTown_ProfessorOaksLab_EventScript_CheckIfPlayerNeedsBalls:: special QuestLog_CutRecording goto_if_set FLAG_OAK_SKIP_22_RIVAL_CHECK, PalletTown_ProfessorOaksLab_EventScript_MonsAroundWorldWait goto_if_set FLAG_GOT_POKEBALLS_FROM_OAK_AFTER_22_RIVAL, PalletTown_ProfessorOaksLab_EventScript_PlayerAlreadyGotBalls - checkitem ITEM_POKE_BALL, 1 - compare VAR_RESULT, FALSE - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_PlayerOutOfBalls + checkitem ITEM_POKE_BALL + goto_if_eq VAR_RESULT, FALSE, PalletTown_ProfessorOaksLab_EventScript_PlayerOutOfBalls goto PalletTown_ProfessorOaksLab_EventScript_MonsAroundWorldWait end PalletTown_ProfessorOaksLab_EventScript_PlayerOutOfBalls:: - compare VAR_MAP_SCENE_ROUTE22, 2 - goto_if_ge PalletTown_ProfessorOaksLab_EventScript_GivePlayerMoreBalls + goto_if_ge VAR_MAP_SCENE_ROUTE22, 2, PalletTown_ProfessorOaksLab_EventScript_GivePlayerMoreBalls goto PalletTown_ProfessorOaksLab_EventScript_MonsAroundWorldWait end @@ -1043,7 +966,7 @@ PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterNorth:: PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterEastWest:: setobjectxyperm LOCALID_RIVAL, 6, 10 addobject LOCALID_RIVAL - applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown + applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFasterDown applymovement OBJ_EVENT_ID_PLAYER, PalletTown_ProfessorOaksLab_Movement_WatchRivalEnterEastWest applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalEnter waitmovement 0 @@ -1052,7 +975,7 @@ PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterEastWest:: PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalEnterSouth:: setobjectxyperm LOCALID_RIVAL, 6, 10 addobject LOCALID_RIVAL - applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown + applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFasterDown applymovement LOCALID_RIVAL, PalletTown_ProfessorOaksLab_Movement_RivalEnter waitmovement 0 return @@ -1061,7 +984,7 @@ PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalSouth:: applymovement LOCALID_PROF_OAK, Movement_FacePlayer waitmovement 0 delay 15 - applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown + applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFasterDown waitmovement 0 return @@ -1069,8 +992,8 @@ PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalWest:: applymovement LOCALID_PROF_OAK, Movement_FacePlayer waitmovement 0 delay 15 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft - applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft + applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFasterDown waitmovement 0 return @@ -1078,26 +1001,26 @@ PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalEast:: applymovement LOCALID_PROF_OAK, Movement_FacePlayer waitmovement 0 delay 15 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight - applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight + applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFasterDown waitmovement 0 return PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerNorth:: applymovement LOCALID_RIVAL, Movement_FacePlayer - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 return PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerSouth:: - applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestUp - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement LOCALID_RIVAL, Movement_WalkInPlaceFasterUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown waitmovement 0 return PalletTown_ProfessorOaksLab_EventScript_DexSceneRivalFacePlayerEastWest:: applymovement LOCALID_RIVAL, Movement_FacePlayer - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown waitmovement 0 return @@ -1113,24 +1036,24 @@ PalletTown_ProfessorOaksLab_EventScript_RivalExit:: return PalletTown_ProfessorOaksLab_EventScript_DexSceneOakFacePlayerAndRivalNorth:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 return PalletTown_ProfessorOaksLab_Movement_WatchRivalEnterEastWest:: delay_4 - walk_in_place_fastest_down + walk_in_place_faster_down step_end PalletTown_ProfessorOaksLab_Movement_WatchRivalEnterNorth:: - walk_in_place_fastest_down + walk_in_place_faster_down delay_16 delay_16 delay_16 delay_16 delay_16 delay_8 - walk_in_place_fastest_left + walk_in_place_faster_left step_end PalletTown_ProfessorOaksLab_Movement_RivalEnter:: @@ -1158,10 +1081,8 @@ PalletTown_ProfessorOaksLab_EventScript_BulbasaurBall:: setvar PLAYER_STARTER_SPECIES, SPECIES_BULBASAUR setvar RIVAL_STARTER_SPECIES, SPECIES_CHARMANDER setvar RIVAL_STARTER_ID, LOCALID_CHARMANDER_BALL - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3 - goto_if_ge PalletTown_ProfessorOaksLab_EventScript_LastPokeBall - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmStarterChoice + goto_if_ge VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3, PalletTown_ProfessorOaksLab_EventScript_LastPokeBall + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2, PalletTown_ProfessorOaksLab_EventScript_ConfirmStarterChoice msgbox PalletTown_ProfessorOaksLab_Text_ThoseArePokeBalls release end @@ -1169,64 +1090,53 @@ PalletTown_ProfessorOaksLab_EventScript_BulbasaurBall:: PalletTown_ProfessorOaksLab_EventScript_ConfirmStarterChoice:: applymovement LOCALID_PROF_OAK, Movement_FaceRight waitmovement 0 - drawmonpic PLAYER_STARTER_SPECIES, 10, 3 - textcolor 0 - compare PLAYER_STARTER_NUM, 0 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmBulbasaur - compare PLAYER_STARTER_NUM, 1 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmSquirtle - compare PLAYER_STARTER_NUM, 2 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmCharmander + showmonpic PLAYER_STARTER_SPECIES, 10, 3 + textcolor NPC_TEXT_COLOR_MALE + goto_if_eq PLAYER_STARTER_NUM, 0, PalletTown_ProfessorOaksLab_EventScript_ConfirmBulbasaur + goto_if_eq PLAYER_STARTER_NUM, 1, PalletTown_ProfessorOaksLab_EventScript_ConfirmSquirtle + goto_if_eq PLAYER_STARTER_NUM, 2, PalletTown_ProfessorOaksLab_EventScript_ConfirmCharmander end PalletTown_ProfessorOaksLab_EventScript_ConfirmBulbasaur:: msgbox PalletTown_ProfessorOaksLab_Text_OakChoosingBulbasaur, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ChoseStarter - compare VAR_RESULT, NO - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_DeclinedStarter + goto_if_eq VAR_RESULT, YES, PalletTown_ProfessorOaksLab_EventScript_ChoseStarter + goto_if_eq VAR_RESULT, NO, PalletTown_ProfessorOaksLab_EventScript_DeclinedStarter end PalletTown_ProfessorOaksLab_EventScript_ConfirmSquirtle:: msgbox PalletTown_ProfessorOaksLab_Text_OakChoosingSquirtle, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ChoseStarter - compare VAR_RESULT, NO - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_DeclinedStarter + goto_if_eq VAR_RESULT, YES, PalletTown_ProfessorOaksLab_EventScript_ChoseStarter + goto_if_eq VAR_RESULT, NO, PalletTown_ProfessorOaksLab_EventScript_DeclinedStarter end PalletTown_ProfessorOaksLab_EventScript_ConfirmCharmander:: msgbox PalletTown_ProfessorOaksLab_Text_OakChoosingCharmander, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ChoseStarter - compare VAR_RESULT, NO - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_DeclinedStarter + goto_if_eq VAR_RESULT, YES, PalletTown_ProfessorOaksLab_EventScript_ChoseStarter + goto_if_eq VAR_RESULT, NO, PalletTown_ProfessorOaksLab_EventScript_DeclinedStarter 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 setflag FLAG_SYS_POKEMON_GET setflag FLAG_PALLET_LADY_NOT_BLOCKING_SIGN - givemon PLAYER_STARTER_SPECIES, 5, ITEM_NONE + givemon PLAYER_STARTER_SPECIES, 5 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 waitfanfare msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq EventScript_GiveNicknameToStarter - compare VAR_RESULT, NO - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalPicksStarter + goto_if_eq VAR_RESULT, YES, EventScript_GiveNicknameToStarter + goto_if_eq VAR_RESULT, NO, PalletTown_ProfessorOaksLab_EventScript_RivalPicksStarter end EventScript_GiveNicknameToStarter:: @@ -1237,12 +1147,9 @@ EventScript_GiveNicknameToStarter:: PalletTown_ProfessorOaksLab_EventScript_RivalPicksStarter:: closemessage - compare PLAYER_STARTER_NUM, 0 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalWalksToCharmander - compare PLAYER_STARTER_NUM, 1 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalWalksToBulbasaur - compare PLAYER_STARTER_NUM, 2 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_RivalWalksToSquirtle + goto_if_eq PLAYER_STARTER_NUM, 0, PalletTown_ProfessorOaksLab_EventScript_RivalWalksToCharmander + goto_if_eq PLAYER_STARTER_NUM, 1, PalletTown_ProfessorOaksLab_EventScript_RivalWalksToBulbasaur + goto_if_eq PLAYER_STARTER_NUM, 2, PalletTown_ProfessorOaksLab_EventScript_RivalWalksToSquirtle end PalletTown_ProfessorOaksLab_EventScript_RivalWalksToCharmander:: @@ -1264,11 +1171,11 @@ PalletTown_ProfessorOaksLab_EventScript_RivalWalksToBulbasaur:: end PalletTown_ProfessorOaksLab_EventScript_RivalTakesStarter:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox PalletTown_ProfessorOaksLab_Text_RivalIllTakeThisOneThen removeobject RIVAL_STARTER_ID - textcolor 3 - getspeciesname 0, RIVAL_STARTER_SPECIES + textcolor NPC_TEXT_COLOR_NEUTRAL + bufferspeciesname STR_VAR_1, RIVAL_STARTER_SPECIES message PalletTown_ProfessorOaksLab_Text_RivalReceivedMonFromOak waitmessage playfanfare MUS_OBTAIN_KEY_ITEM @@ -1299,7 +1206,7 @@ PalletTown_ProfessorOaksLab_Movement_RivalWalksToSquirtle:: walk_right walk_right walk_right - walk_in_place_fastest_up + walk_in_place_faster_up step_end PalletTown_ProfessorOaksLab_Movement_RivalWalksToBulbasaur:: @@ -1307,7 +1214,7 @@ PalletTown_ProfessorOaksLab_Movement_RivalWalksToBulbasaur:: walk_right walk_right walk_right - walk_in_place_fastest_up + walk_in_place_faster_up step_end PalletTown_ProfessorOaksLab_EventScript_SquirtleBall:: @@ -1317,10 +1224,8 @@ PalletTown_ProfessorOaksLab_EventScript_SquirtleBall:: setvar PLAYER_STARTER_SPECIES, SPECIES_SQUIRTLE setvar RIVAL_STARTER_SPECIES, SPECIES_BULBASAUR setvar RIVAL_STARTER_ID, LOCALID_BULBASAUR_BALL - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3 - goto_if_ge PalletTown_ProfessorOaksLab_EventScript_LastPokeBall - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmStarterChoice + goto_if_ge VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3, PalletTown_ProfessorOaksLab_EventScript_LastPokeBall + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2, PalletTown_ProfessorOaksLab_EventScript_ConfirmStarterChoice msgbox PalletTown_ProfessorOaksLab_Text_ThoseArePokeBalls release end @@ -1332,10 +1237,8 @@ PalletTown_ProfessorOaksLab_EventScript_CharmanderBall:: setvar PLAYER_STARTER_SPECIES, SPECIES_CHARMANDER setvar RIVAL_STARTER_SPECIES, SPECIES_SQUIRTLE setvar RIVAL_STARTER_ID, LOCALID_SQUIRTLE_BALL - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3 - goto_if_ge PalletTown_ProfessorOaksLab_EventScript_LastPokeBall - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2 - goto_if_eq PalletTown_ProfessorOaksLab_EventScript_ConfirmStarterChoice + goto_if_ge VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 3, PalletTown_ProfessorOaksLab_EventScript_LastPokeBall + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 2, PalletTown_ProfessorOaksLab_EventScript_ConfirmStarterChoice msgbox PalletTown_ProfessorOaksLab_Text_ThoseArePokeBalls release end @@ -1395,8 +1298,7 @@ PalletTown_ProfessorOaksLab_EventScript_LeftSign:: PalletTown_ProfessorOaksLab_EventScript_RightSign:: lockall - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 6 - goto_if_ge PalletTown_ProfessorOaksLab_EventScript_RightSignAlt + goto_if_ge VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 6, PalletTown_ProfessorOaksLab_EventScript_RightSignAlt msgbox PalletTown_ProfessorOaksLab_Text_SaveOptionInMenu releaseall end diff --git a/data/maps/PalletTown_RivalsHouse/scripts.inc b/data/maps/PalletTown_RivalsHouse/scripts.inc index 119ccba49..7dbca25da 100644 --- a/data/maps/PalletTown_RivalsHouse/scripts.inc +++ b/data/maps/PalletTown_RivalsHouse/scripts.inc @@ -8,10 +8,8 @@ PalletTown_RivalsHouse_MapScripts:: .byte 0 PalletTown_RivalsHouse_OnTransition:: - compare VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 2 - call_if_lt PalletTown_RivalsHouse_EventScript_MoveDaisyToTable - compare VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 2 - call_if_ge PalletTown_RivalsHouse_EventScript_AlreadyReceivedTownMap + call_if_lt VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 2, PalletTown_RivalsHouse_EventScript_MoveDaisyToTable + call_if_ge VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 2, PalletTown_RivalsHouse_EventScript_AlreadyReceivedTownMap end PalletTown_RivalsHouse_EventScript_MoveDaisyToTable:: @@ -28,14 +26,10 @@ PalletTown_RivalsHouse_EventScript_Daisy:: faceplayer famechecker FAMECHECKER_DAISY, FCPICKSTATE_COLORED, UpdatePickStateFromSpecialVar8005 goto_if_set FLAG_SYS_GAME_CLEAR, PalletTown_RivalsHouse_EventScript_GroomMon - compare RECEIVED_TOWN_MAP, TRUE - goto_if_eq PalletTown_RivalsHouse_EventScript_PleaseGiveMonsRest - compare VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 2 - goto_if_eq PalletTown_RivalsHouse_EventScript_ExplainTownMap - compare VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 1 - goto_if_eq PalletTown_RivalsHouse_EventScript_GiveTownMap - compare VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 1 - goto_if_ge PalletTown_RivalsHouse_EventScript_HeardBattledRival + goto_if_eq RECEIVED_TOWN_MAP, TRUE, PalletTown_RivalsHouse_EventScript_PleaseGiveMonsRest + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 2, PalletTown_RivalsHouse_EventScript_ExplainTownMap + goto_if_eq VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 1, PalletTown_RivalsHouse_EventScript_GiveTownMap + goto_if_ge VAR_MAP_SCENE_PALLET_TOWN_PROFESSOR_OAKS_LAB, 1, PalletTown_RivalsHouse_EventScript_HeardBattledRival msgbox PalletTown_RivalsHouse_Text_HiBrothersAtLab closemessage applymovement LOCALID_DAISY, Movement_FaceOriginalDirection @@ -51,21 +45,17 @@ PalletTown_RivalsHouse_EventScript_HeardBattledRival:: PalletTown_RivalsHouse_EventScript_GroomMon:: goto_if_questlog EventScript_ReleaseEnd special QuestLog_CutRecording - compare VAR_MASSAGE_COOLDOWN_STEP_COUNTER, 500 - goto_if_lt PalletTown_RivalsHouse_EventScript_RateMonFriendship + goto_if_lt VAR_MASSAGE_COOLDOWN_STEP_COUNTER, 500, PalletTown_RivalsHouse_EventScript_RateMonFriendship msgbox PalletTown_RivalsHouse_Text_LikeMeToGroomMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq PalletTown_RivalsHouse_EventScript_DeclineGrooming + goto_if_eq VAR_RESULT, NO, PalletTown_RivalsHouse_EventScript_DeclineGrooming msgbox PalletTown_RivalsHouse_Text_GroomWhichOne special ChoosePartyMon waitstate lock faceplayer - compare VAR_0x8004, PARTY_SIZE - goto_if_ge PalletTown_RivalsHouse_EventScript_DeclineGrooming + goto_if_ge VAR_0x8004, PARTY_SIZE, PalletTown_RivalsHouse_EventScript_DeclineGrooming specialvar VAR_RESULT, GetPartyMonSpecies - compare VAR_RESULT, SPECIES_EGG - goto_if_eq PalletTown_RivalsHouse_EventScript_CantGroomEgg + goto_if_eq VAR_RESULT, SPECIES_EGG, PalletTown_RivalsHouse_EventScript_CantGroomEgg msgbox PalletTown_RivalsHouse_Text_LookingNiceInNoTime closemessage fadescreen FADE_TO_BLACK @@ -144,10 +134,9 @@ PalletTown_RivalsHouse_EventScript_PleaseGiveMonsRest:: PalletTown_RivalsHouse_EventScript_GiveTownMap:: msgbox PalletTown_RivalsHouse_Text_ErrandForGrandpaThisWillHelp closemessage - checkitemspace ITEM_TOWN_MAP, 1 - compare VAR_RESULT, FALSE - goto_if_eq PalletTown_RivalsHouse_EventScript_NoRoomForTownMap - applymovement LOCALID_DAISY, Movement_WalkInPlaceFastestRight + checkitemspace ITEM_TOWN_MAP + goto_if_eq VAR_RESULT, FALSE, PalletTown_RivalsHouse_EventScript_NoRoomForTownMap + applymovement LOCALID_DAISY, Movement_WalkInPlaceFasterRight waitmovement 0 removeobject LOCALID_TOWN_MAP setvar VAR_MAP_SCENE_PALLET_TOWN_RIVALS_HOUSE, 2 diff --git a/data/maps/PewterCity/scripts.inc b/data/maps/PewterCity/scripts.inc index 42cfcbca2..e559e3322 100644 --- a/data/maps/PewterCity/scripts.inc +++ b/data/maps/PewterCity/scripts.inc @@ -19,8 +19,7 @@ PewterCity_EventScript_GymGuide:: msgbox PewterCity_Text_BrocksLookingForChallengersFollowMe closemessage playbgm MUS_FOLLOW_ME, 0 - compare VAR_FACING, DIR_EAST - call_if_eq PewterCity_EventScript_WalkToGymEast + call_if_eq VAR_FACING, DIR_EAST, PewterCity_EventScript_WalkToGymEast msgbox PewterCity_Text_GoTakeOnBrock closemessage applymovement LOCALID_GYM_GUIDE, PewterCity_Movement_GymGuideExit @@ -170,7 +169,7 @@ PewterCity_Movement_PlayerWaitForGuideEast:: delay_16 delay_16 delay_4 - walk_in_place_fastest_down + walk_in_place_faster_down step_end PewterCity_Movement_PlayerWalkToGymEast:: @@ -207,14 +206,14 @@ PewterCity_Movement_PlayerWalkToGymNorth:: PewterCity_Movement_GuideMoveToLeadEast:: walk_down walk_left - walk_in_place_fastest_up + walk_in_place_faster_up walk_in_place_up step_end PewterCity_Movement_GuideWalkToGymEast:: walk_to_gym walk_right - walk_in_place_fastest_left + walk_in_place_faster_left step_end PewterCity_Movement_GuideMoveToLeadWest:: @@ -228,7 +227,7 @@ PewterCity_Movement_GuideWalkToGymWest:: walk_left walk_to_gym_alt walk_right - walk_in_place_fastest_left + walk_in_place_faster_left step_end PewterCity_Movement_GuideMoveToLeadNorth:: @@ -242,7 +241,7 @@ PewterCity_Movement_GuideWalkToGymNorth:: walk_left walk_to_gym_alt walk_right - walk_in_place_fastest_left + walk_in_place_faster_left step_end PewterCity_Movement_GymGuideExit:: @@ -284,16 +283,13 @@ PewterCity_EventScript_GymGuideTriggerRight:: end PewterCity_EventScript_GymGuideTrigger:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox PewterCity_Text_BrocksLookingForChallengersFollowMe closemessage playbgm MUS_FOLLOW_ME, 0 - compare VAR_TEMP_1, 0 - call_if_eq PewterCity_EventScript_WalkToGymTop - compare VAR_TEMP_1, 1 - call_if_eq PewterCity_EventScript_WalkToGymMid - compare VAR_TEMP_1, 2 - call_if_eq PewterCity_EventScript_WalkToGymBottom + call_if_eq VAR_TEMP_1, 0, PewterCity_EventScript_WalkToGymTop + call_if_eq VAR_TEMP_1, 1, PewterCity_EventScript_WalkToGymMid + call_if_eq VAR_TEMP_1, 2, PewterCity_EventScript_WalkToGymBottom msgbox PewterCity_Text_GoTakeOnBrock closemessage applymovement LOCALID_GYM_GUIDE, PewterCity_Movement_GymGuideExit @@ -372,7 +368,7 @@ PewterCity_Movement_PlayerWalkToGymRight:: PewterCity_Movement_GuideMoveToLeadTop:: walk_left walk_down - walk_in_place_fastest_right + walk_in_place_faster_right walk_in_place_right step_end @@ -399,14 +395,14 @@ PewterCity_Movement_GuideApproachPlayerRight:: PewterCity_Movement_GuideWalkToGymTop:: walk_to_gym walk_right - walk_in_place_fastest_left + walk_in_place_faster_left step_end PewterCity_Movement_GuideWalkToGymMid:: walk_left walk_to_gym walk_right - walk_in_place_fastest_left + walk_in_place_faster_left step_end PewterCity_Movement_GuideWalkToGymBottom:: @@ -414,7 +410,7 @@ PewterCity_Movement_GuideWalkToGymBottom:: walk_left walk_to_gym walk_right - walk_in_place_fastest_left + walk_in_place_faster_left step_end PewterCity_Movement_GuideWalkToGymRight:: @@ -429,7 +425,7 @@ PewterCity_Movement_GuideWalkToGymRight:: walk_up walk_to_gym_alt walk_right - walk_in_place_fastest_left + walk_in_place_faster_left step_end PewterCity_EventScript_Lass:: @@ -440,20 +436,15 @@ PewterCity_EventScript_MuseumGuide:: lock faceplayer msgbox PewterCity_Text_DidYouCheckOutMuseum, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq PewterCity_EventScript_CheckedOutMuseum + goto_if_eq VAR_RESULT, YES, PewterCity_EventScript_CheckedOutMuseum msgbox PewterCity_Text_ReallyYouHaveToGo closemessage delay 10 playbgm MUS_FOLLOW_ME, 0 - compare VAR_FACING, DIR_NORTH - call_if_eq PewterCity_EventScript_LeadToMuseumNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq PewterCity_EventScript_LeadToMuseumSouth - compare VAR_FACING, DIR_WEST - call_if_eq PewterCity_EventScript_LeadToMuseumWest - compare VAR_FACING, DIR_EAST - call_if_eq PewterCity_EventScript_LeadToMuseumEast + call_if_eq VAR_FACING, DIR_NORTH, PewterCity_EventScript_LeadToMuseumNorth + call_if_eq VAR_FACING, DIR_SOUTH, PewterCity_EventScript_LeadToMuseumSouth + call_if_eq VAR_FACING, DIR_WEST, PewterCity_EventScript_LeadToMuseumWest + call_if_eq VAR_FACING, DIR_EAST, PewterCity_EventScript_LeadToMuseumEast msgbox PewterCity_Text_ThisIsTheMuseum closemessage delay 10 @@ -550,13 +541,13 @@ PewterCity_Movement_PlayerWalkToMuseumNorth:: walk_up walk_to_museum delay_8 - walk_in_place_fastest_up + walk_in_place_faster_up step_end PewterCity_Movement_GuideWalkToMuseumNorth:: walk_to_museum walk_left - walk_in_place_fastest_up + walk_in_place_faster_up step_end PewterCity_Movement_PlayerWalkToMuseumSouth:: @@ -565,7 +556,7 @@ PewterCity_Movement_PlayerWalkToMuseumSouth:: walk_left walk_to_museum_south delay_8 - walk_in_place_fastest_up + walk_in_place_faster_up step_end PewterCity_Movement_GuideWalkToMuseumSouth:: @@ -573,33 +564,33 @@ PewterCity_Movement_GuideWalkToMuseumSouth:: walk_up walk_to_museum_south walk_left - walk_in_place_fastest_up + walk_in_place_faster_up step_end PewterCity_Movement_PlayerWalkToMuseumWest:: walk_left walk_to_museum delay_8 - walk_in_place_fastest_up + walk_in_place_faster_up step_end PewterCity_Movement_GuideWalkToMuseumWest:: walk_to_museum walk_left - walk_in_place_fastest_up + walk_in_place_faster_up step_end PewterCity_Movement_PlayerWalkToMuseumEast:: walk_right walk_to_museum delay_8 - walk_in_place_fastest_up + walk_in_place_faster_up step_end PewterCity_Movement_GuideWalkToMuseumEast:: walk_to_museum walk_left - walk_in_place_fastest_up + walk_in_place_faster_up step_end PewterCity_Movement_MuseumGuideExit:: @@ -631,8 +622,7 @@ PewterCity_EventScript_BugCatcher:: lock faceplayer msgbox PewterCity_Text_DoYouKnowWhatImDoing, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq PewterCity_EventScript_KnowWhatTheyreDoing + goto_if_eq VAR_RESULT, YES, PewterCity_EventScript_KnowWhatTheyreDoing msgbox PewterCity_Text_SprayingRepelToKeepWildMonsOut release end @@ -695,13 +685,10 @@ PewterCity_EventScript_RunningShoesAideTriggerBottom:: end PewterCity_EventScript_AideGiveRunningShoes:: - textcolor 0 - compare VAR_TEMP_1, 1 - call_if_eq PewterCity_EventScript_AideNoticePlayer - compare VAR_TEMP_1, 2 - call_if_eq PewterCity_EventScript_AideNoticePlayer - compare VAR_TEMP_1, 3 - call_if_eq PewterCity_EventScript_AideNoticePlayer + textcolor NPC_TEXT_COLOR_MALE + call_if_eq VAR_TEMP_1, 1, PewterCity_EventScript_AideNoticePlayer + call_if_eq VAR_TEMP_1, 2, PewterCity_EventScript_AideNoticePlayer + call_if_eq VAR_TEMP_1, 3, PewterCity_EventScript_AideNoticePlayer waitse playse SE_PIN applymovement LOCALID_AIDE, Movement_ExclamationMark @@ -709,16 +696,12 @@ PewterCity_EventScript_AideGiveRunningShoes:: applymovement LOCALID_AIDE, Movement_Delay48 waitmovement 0 msgbox PewterCity_Text_OhPlayer - compare VAR_TEMP_1, 0 - call_if_eq PewterCity_EventScript_AideApproachPlayer0 - compare VAR_TEMP_1, 1 - call_if_eq PewterCity_EventScript_AideApproachPlayer1 - compare VAR_TEMP_1, 2 - call_if_eq PewterCity_EventScript_AideApproachPlayer2 - compare VAR_TEMP_1, 3 - call_if_eq PewterCity_EventScript_AideApproachPlayer3 + call_if_eq VAR_TEMP_1, 0, PewterCity_EventScript_AideApproachPlayer0 + call_if_eq VAR_TEMP_1, 1, PewterCity_EventScript_AideApproachPlayer1 + call_if_eq VAR_TEMP_1, 2, PewterCity_EventScript_AideApproachPlayer2 + call_if_eq VAR_TEMP_1, 3, PewterCity_EventScript_AideApproachPlayer3 msgbox PewterCity_Text_AskedToDeliverThis - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_OBTAIN_KEY_ITEM message PewterCity_Text_ReceivedRunningShoesFromAide waitmessage @@ -731,16 +714,12 @@ PewterCity_EventScript_AideGiveRunningShoes:: call EventScript_RestorePrevTextColor msgbox PewterCity_Text_MustBeGoingBackToLab closemessage - compare VAR_TEMP_1, 0 - call_if_eq PewterCity_EventScript_AideExit0 - compare VAR_TEMP_1, 1 - call_if_eq PewterCity_EventScript_AideExit1 - compare VAR_TEMP_1, 2 - call_if_eq PewterCity_EventScript_AideExit2 - compare VAR_TEMP_1, 3 - call_if_eq PewterCity_EventScript_AideExit3 + call_if_eq VAR_TEMP_1, 0, PewterCity_EventScript_AideExit0 + call_if_eq VAR_TEMP_1, 1, PewterCity_EventScript_AideExit1 + call_if_eq VAR_TEMP_1, 2, PewterCity_EventScript_AideExit2 + call_if_eq VAR_TEMP_1, 3, PewterCity_EventScript_AideExit3 delay 30 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PewterCity_Text_RunningShoesLetterFromMom closemessage removeobject LOCALID_AIDE @@ -749,7 +728,7 @@ PewterCity_EventScript_AideGiveRunningShoes:: return PewterCity_EventScript_AideNoticePlayer:: - applymovement LOCALID_AIDE, Movement_WalkInPlaceFastestDown + applymovement LOCALID_AIDE, Movement_WalkInPlaceFasterDown waitmovement 0 return @@ -761,7 +740,7 @@ PewterCity_EventScript_AideApproachPlayer0:: PewterCity_EventScript_AideApproachPlayer1:: closemessage - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 return @@ -769,7 +748,7 @@ PewterCity_EventScript_AideApproachPlayer2:: closemessage applymovement LOCALID_AIDE, PewterCity_Movement_AideApproachPlayerMid waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 return @@ -777,7 +756,7 @@ PewterCity_EventScript_AideApproachPlayer3:: closemessage applymovement LOCALID_AIDE, PewterCity_Movement_AideApproachPlayerBottom waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 return diff --git a/data/maps/PewterCity_Gym/scripts.inc b/data/maps/PewterCity_Gym/scripts.inc index 0ab615946..dfc7ed92d 100644 --- a/data/maps/PewterCity_Gym/scripts.inc +++ b/data/maps/PewterCity_Gym/scripts.inc @@ -22,9 +22,8 @@ PewterCity_Gym_EventScript_DefeatedBrock:: PewterCity_Gym_EventScript_GiveTM39:: msgbox PewterCity_Gym_Text_TakeThisWithYou - checkitemspace ITEM_TM39, 1 - compare VAR_RESULT, FALSE - goto_if_eq PewterCity_Gym_EventScript_NoRoomForTM39 + checkitemspace ITEM_TM39 + goto_if_eq VAR_RESULT, FALSE, PewterCity_Gym_EventScript_NoRoomForTM39 giveitem_msg PewterCity_Gym_Text_ReceivedTM39FromBrock, ITEM_TM39 setflag FLAG_GOT_TM39_FROM_BROCK msgbox PewterCity_Gym_Text_ExplainTM39 @@ -46,10 +45,8 @@ PewterCity_Gym_EventScript_GymGuy:: faceplayer goto_if_set FLAG_DEFEATED_BROCK, PewterCity_Gym_EventScript_GymGuyPostVictory msgbox PewterCity_Gym_Text_LetMeTakeYouToTheTop, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq PewterCity_Gym_EventScript_GymGuyTakeMeToTop - compare VAR_RESULT, NO - goto_if_eq PewterCity_Gym_EventScript_GymGuyDontTakeMeToTop + goto_if_eq VAR_RESULT, YES, PewterCity_Gym_EventScript_GymGuyTakeMeToTop + goto_if_eq VAR_RESULT, NO, PewterCity_Gym_EventScript_GymGuyDontTakeMeToTop end PewterCity_Gym_EventScript_GymGuyPostVictory:: diff --git a/data/maps/PewterCity_Gym/text.inc b/data/maps/PewterCity_Gym/text.inc index 0b12ccd6c..a92ebe095 100644 --- a/data/maps/PewterCity_Gym/text.inc +++ b/data/maps/PewterCity_Gym/text.inc @@ -16,7 +16,7 @@ PewterCity_Gym_Text_BrockIntro:: @ NOTE: This defeat text actually causes a buffer overflow. It's too long for the gDisplayedStringBattle @ buffer that it's put into, and it stomps all over the gBattleTextBuffs after, as well as the otherwise -@ unused array after that, gUnknown_2022AE8. Perhaps that's the reason why said array exists. +@ unused array after that, sFlickerArray. Perhaps that's the reason why said array exists. PewterCity_Gym_Text_BrockDefeat:: .string "I took you for granted, and so\n" .string "I lost.\p" diff --git a/data/maps/PewterCity_House1/scripts.inc b/data/maps/PewterCity_House1/scripts.inc index 56e9c623f..9003913dd 100644 --- a/data/maps/PewterCity_House1/scripts.inc +++ b/data/maps/PewterCity_House1/scripts.inc @@ -24,7 +24,7 @@ PewterCity_House1_EventScript_Nidoran:: end PewterCity_House1_EventScript_DoNidoranCry:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL waitse playmoncry SPECIES_NIDORAN_M, CRY_MODE_NORMAL msgbox PewterCity_House1_Text_Nidoran diff --git a/data/maps/PewterCity_Museum_1F/scripts.inc b/data/maps/PewterCity_Museum_1F/scripts.inc index d73ae856c..e41feef0d 100644 --- a/data/maps/PewterCity_Museum_1F/scripts.inc +++ b/data/maps/PewterCity_Museum_1F/scripts.inc @@ -7,22 +7,17 @@ PewterCity_Museum_1F_MapScripts:: PewterCity_Museum_1F_EventScript_Scientist1:: lock faceplayer - compare VAR_FACING, DIR_WEST - goto_if_eq PewterCity_Museum_1F_EventScript_Scientist1BehindCounter - compare VAR_FACING, DIR_SOUTH - goto_if_eq PewterCity_Museum_1F_EventScript_Scientist1BehindCounter - compare VAR_FACING, DIR_NORTH - goto_if_eq PewterCity_Museum_1F_EventScript_Scientist1BehindCounter + goto_if_eq VAR_FACING, DIR_WEST, PewterCity_Museum_1F_EventScript_Scientist1BehindCounter + goto_if_eq VAR_FACING, DIR_SOUTH, PewterCity_Museum_1F_EventScript_Scientist1BehindCounter + goto_if_eq VAR_FACING, DIR_NORTH, PewterCity_Museum_1F_EventScript_Scientist1BehindCounter msgbox PewterCity_Museum_1F_Text_PleaseEnjoyYourself release end PewterCity_Museum_1F_EventScript_Scientist1BehindCounter:: msgbox PewterCity_Museum_1F_Text_DoYouKnowWhatAmberIs, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq PewterCity_Museum_1F_EventScript_AmberHasGeneticMatter - compare VAR_RESULT, NO - goto_if_eq PewterCity_Museum_1F_EventScript_ExplainAmber + goto_if_eq VAR_RESULT, YES, PewterCity_Museum_1F_EventScript_AmberHasGeneticMatter + goto_if_eq VAR_RESULT, NO, PewterCity_Museum_1F_EventScript_ExplainAmber end PewterCity_Museum_1F_EventScript_AmberHasGeneticMatter:: @@ -42,7 +37,7 @@ PewterCity_Museum_1F_EventScript_ExplainAmber:: PewterCity_Museum_1F_EventScript_EntranceTriggerLeft:: lockall setvar VAR_TEMP_1, 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 goto PewterCity_Museum_1F_EventScript_EntranceTrigger end @@ -50,7 +45,7 @@ PewterCity_Museum_1F_EventScript_EntranceTriggerLeft:: PewterCity_Museum_1F_EventScript_EntranceTriggerMid:: lockall setvar VAR_TEMP_1, 1 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 goto PewterCity_Museum_1F_EventScript_EntranceTrigger end @@ -58,43 +53,38 @@ PewterCity_Museum_1F_EventScript_EntranceTriggerMid:: PewterCity_Museum_1F_EventScript_EntranceTriggerRight:: lockall setvar VAR_TEMP_1, 2 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 goto PewterCity_Museum_1F_EventScript_EntranceTrigger end PewterCity_Museum_1F_EventScript_EntranceTrigger:: - textcolor 0 - showmoneybox 0, 0, 0 + textcolor NPC_TEXT_COLOR_MALE + showmoneybox 0, 0 msgbox PewterCity_Museum_1F_Text_Its50YForChildsTicket, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq PewterCity_Museum_1F_EventScript_TryPayForTicket + goto_if_eq VAR_RESULT, YES, 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 end PewterCity_Museum_1F_EventScript_TryPayForTicket:: - checkmoney 50, 0 - compare VAR_RESULT, FALSE - goto_if_eq PewterCity_Museum_1F_EventScript_NotEnoughMoney + checkmoney 50 + goto_if_eq VAR_RESULT, FALSE, PewterCity_Museum_1F_EventScript_NotEnoughMoney closemessage - compare VAR_TEMP_1, 0 - call_if_eq PewterCity_Museum_1F_EventScript_PlayerApproachCounterLeft - compare VAR_TEMP_1, 1 - call_if_eq PewterCity_Museum_1F_EventScript_PlayerApproachCounterMid - compare VAR_TEMP_1, 2 - call_if_eq PewterCity_Museum_1F_EventScript_PlayerApproachCounterRight + call_if_eq VAR_TEMP_1, 0, PewterCity_Museum_1F_EventScript_PlayerApproachCounterLeft + call_if_eq VAR_TEMP_1, 1, PewterCity_Museum_1F_EventScript_PlayerApproachCounterMid + call_if_eq VAR_TEMP_1, 2, PewterCity_Museum_1F_EventScript_PlayerApproachCounterRight playse SE_SHOP - removemoney 50, 0 - updatemoneybox 0, 0, 0 + removemoney 50 + 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 +106,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 @@ -157,9 +147,8 @@ PewterCity_Museum_1F_EventScript_OldAmberScientist:: faceplayer goto_if_set FLAG_GOT_OLD_AMBER, PewterCity_Museum_1F_EventScript_AlreadyGotOldAmber msgbox PewterCity_Museum_1F_Text_WantYouToGetAmberExamined - checkitemspace ITEM_OLD_AMBER, 1 - compare VAR_RESULT, FALSE - goto_if_eq PewterCity_Museum_1F_EventScript_NoRoomForOldAmber + checkitemspace ITEM_OLD_AMBER + goto_if_eq VAR_RESULT, FALSE, PewterCity_Museum_1F_EventScript_NoRoomForOldAmber setflag FLAG_GOT_OLD_AMBER removeobject LOCALID_OLD_AMBER giveitem_msg PewterCity_Museum_1F_Text_ReceivedOldAmberFromMan, ITEM_OLD_AMBER, 1, MUS_OBTAIN_KEY_ITEM diff --git a/data/maps/PokemonLeague_AgathasRoom/scripts.inc b/data/maps/PokemonLeague_AgathasRoom/scripts.inc index 34b1a8062..f66f243b8 100644 --- a/data/maps/PokemonLeague_AgathasRoom/scripts.inc +++ b/data/maps/PokemonLeague_AgathasRoom/scripts.inc @@ -12,8 +12,7 @@ PokemonLeague_AgathasRoom_OnResume:: PokemonLeague_AgathasRoom_OnLoad:: call_if_set FLAG_DEFEATED_AGATHA, PokemonLeague_AgathasRoom_EventScript_SetDoorOpen - compare VAR_MAP_SCENE_POKEMON_LEAGUE, 3 - call_if_eq PokemonLeague_AgathasRoom_EventScript_CloseEntry + call_if_eq VAR_MAP_SCENE_POKEMON_LEAGUE, 3, PokemonLeague_AgathasRoom_EventScript_CloseEntry end PokemonLeague_AgathasRoom_EventScript_CloseEntry:: diff --git a/data/maps/PokemonLeague_BrunosRoom/scripts.inc b/data/maps/PokemonLeague_BrunosRoom/scripts.inc index 3d87c4520..a54266d4e 100644 --- a/data/maps/PokemonLeague_BrunosRoom/scripts.inc +++ b/data/maps/PokemonLeague_BrunosRoom/scripts.inc @@ -14,8 +14,7 @@ PokemonLeague_BrunosRoom_OnResume:: PokemonLeague_BrunosRoom_OnLoad:: call_if_set FLAG_DEFEATED_BRUNO, PokemonLeague_BrunosRoom_EventScript_SetDoorOpen - compare VAR_MAP_SCENE_POKEMON_LEAGUE, 2 - call_if_eq PokemonLeague_BrunosRoom_EventScript_CloseEntry + call_if_eq VAR_MAP_SCENE_POKEMON_LEAGUE, 2, PokemonLeague_BrunosRoom_EventScript_CloseEntry end PokemonLeague_BrunosRoom_EventScript_CloseEntry:: @@ -81,14 +80,10 @@ PokemonLeague_BrunosRoom_EventScript_Rematch:: PokemonLeague_BrunosRoom_EventScript_PostBattle:: msgbox PokemonLeague_BrunosRoom_Text_PostBattle closemessage - compare VAR_FACING, DIR_NORTH - call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayRight - compare VAR_FACING, DIR_SOUTH - call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayLeft - compare VAR_FACING, DIR_WEST - call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown - compare VAR_FACING, DIR_EAST - call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown + call_if_eq VAR_FACING, DIR_NORTH, PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayRight + call_if_eq VAR_FACING, DIR_SOUTH, PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayLeft + call_if_eq VAR_FACING, DIR_WEST, PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown + call_if_eq VAR_FACING, DIR_EAST, PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown release end @@ -97,28 +92,24 @@ PokemonLeague_BrunosRoom_EventScript_DefeatedBruno:: call PokemonLeague_EventScript_OpenDoor msgbox PokemonLeague_BrunosRoom_Text_PostBattle closemessage - compare VAR_FACING, DIR_NORTH - call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayRight - compare VAR_FACING, DIR_SOUTH - call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayLeft - compare VAR_FACING, DIR_WEST - call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown - compare VAR_FACING, DIR_EAST - call_if_eq PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown + call_if_eq VAR_FACING, DIR_NORTH, PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayRight + call_if_eq VAR_FACING, DIR_SOUTH, PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayLeft + call_if_eq VAR_FACING, DIR_WEST, PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown + call_if_eq VAR_FACING, DIR_EAST, PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown release end PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayLeft:: - applymovement LOCALID_BRUNO, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_BRUNO, Movement_WalkInPlaceFasterLeft waitmovement 0 return PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayRight:: - applymovement LOCALID_BRUNO, Movement_WalkInPlaceFastestRight + applymovement LOCALID_BRUNO, Movement_WalkInPlaceFasterRight waitmovement 0 return PokemonLeague_BrunosRoom_EventScript_BrunoLookAwayDown:: - applymovement LOCALID_BRUNO, Movement_WalkInPlaceFastestDown + applymovement LOCALID_BRUNO, Movement_WalkInPlaceFasterDown waitmovement 0 return diff --git a/data/maps/PokemonLeague_ChampionsRoom/scripts.inc b/data/maps/PokemonLeague_ChampionsRoom/scripts.inc index 1c9558459..c45d61e8b 100644 --- a/data/maps/PokemonLeague_ChampionsRoom/scripts.inc +++ b/data/maps/PokemonLeague_ChampionsRoom/scripts.inc @@ -10,12 +10,9 @@ PokemonLeague_ChampionsRoom_MapScripts:: PokemonLeague_ChampionsRoom_OnResume:: setvar VAR_0x8004, 4 call PokemonLeague_EventScript_DoLightingEffect - compare VAR_STARTER_MON, 2 - call_if_eq PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerSquirtle - compare VAR_STARTER_MON, 1 - call_if_eq PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerBulbasaur - compare VAR_STARTER_MON, 0 - call_if_eq PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerCharmander + call_if_eq VAR_STARTER_MON, 2, PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerSquirtle + call_if_eq VAR_STARTER_MON, 1, PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerBulbasaur + call_if_eq VAR_STARTER_MON, 0, PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerCharmander end PokemonLeague_ChampionsRoom_EventScript_CheckStopTriggerSquirtle:: @@ -51,7 +48,7 @@ PokemonLeague_ChampionsRoom_OnFrame:: PokemonLeague_ChampionsRoom_EventScript_EnterRoom:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE setflag FLAG_TEMP_2 applymovement OBJ_EVENT_ID_PLAYER, PokemonLeague_ChampionsRoom_Movement_PlayerEnter waitmovement 0 @@ -79,14 +76,14 @@ 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 + applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFasterRight + applymovement LOCALID_RIVAL, Movement_WalkInPlaceFasterLeft waitmovement 0 msgbox PokemonLeague_ChampionsRoom_Text_OakImDisappointedRival closemessage - applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestDown + applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFasterDown waitmovement 0 delay 20 msgbox PokemonLeague_ChampionsRoom_Text_OakPlayerComeWithMe @@ -96,7 +93,7 @@ PokemonLeague_ChampionsRoom_EventScript_EnterRoom:: applymovement OBJ_EVENT_ID_PLAYER, PokemonLeague_ChampionsRoom_Movement_PlayerExit waitmovement 0 setvar VAR_TEMP_1, 1 - warp MAP_POKEMON_LEAGUE_HALL_OF_FAME, 255, 5, 12 + warp MAP_POKEMON_LEAGUE_HALL_OF_FAME, 5, 12 waitstate releaseall end @@ -107,21 +104,15 @@ PokemonLeague_ChampionsRoom_EventScript_QuestLogEnd:: end PokemonLeague_ChampionsRoom_EventScript_Battle:: - compare VAR_STARTER_MON, 2 - call_if_eq PokemonLeague_ChampionsRoom_EventScript_BattleSquirtle - compare VAR_STARTER_MON, 1 - call_if_eq PokemonLeague_ChampionsRoom_EventScript_BattleBulbasaur - compare VAR_STARTER_MON, 0 - call_if_eq PokemonLeague_ChampionsRoom_EventScript_BattleCharmander + call_if_eq VAR_STARTER_MON, 2, PokemonLeague_ChampionsRoom_EventScript_BattleSquirtle + call_if_eq VAR_STARTER_MON, 1, PokemonLeague_ChampionsRoom_EventScript_BattleBulbasaur + call_if_eq VAR_STARTER_MON, 0, PokemonLeague_ChampionsRoom_EventScript_BattleCharmander return PokemonLeague_ChampionsRoom_EventScript_Rematch:: - compare VAR_STARTER_MON, 2 - call_if_eq PokemonLeague_ChampionsRoom_EventScript_RematchSquirtle - compare VAR_STARTER_MON, 1 - call_if_eq PokemonLeague_ChampionsRoom_EventScript_RematchBulbasaur - compare VAR_STARTER_MON, 0 - call_if_eq PokemonLeague_ChampionsRoom_EventScript_RematchCharmander + call_if_eq VAR_STARTER_MON, 2, PokemonLeague_ChampionsRoom_EventScript_RematchSquirtle + call_if_eq VAR_STARTER_MON, 1, PokemonLeague_ChampionsRoom_EventScript_RematchBulbasaur + call_if_eq VAR_STARTER_MON, 0, PokemonLeague_ChampionsRoom_EventScript_RematchCharmander return PokemonLeague_ChampionsRoom_EventScript_Intro:: @@ -186,7 +177,7 @@ PokemonLeague_ChampionsRoom_Movement_PlayerExit:: PokemonLeague_ChampionsRoom_Movement_PlayerWatchOakEnter:: delay_8 - walk_in_place_fastest_down + walk_in_place_faster_down delay_16 delay_16 delay_16 @@ -194,7 +185,7 @@ PokemonLeague_ChampionsRoom_Movement_PlayerWatchOakEnter:: delay_16 delay_16 delay_16 - walk_in_place_fastest_left + walk_in_place_faster_left step_end PokemonLeague_ChampionsRoom_Movement_OakEnter:: @@ -208,7 +199,7 @@ PokemonLeague_ChampionsRoom_Movement_OakEnter:: walk_left walk_up walk_up - walk_in_place_fastest_down + walk_in_place_faster_down delay_16 step_end @@ -234,5 +225,5 @@ PokemonLeague_ChampionsRoom_Movement_RivalWatchOakEnter:: delay_16 delay_16 delay_16 - walk_in_place_fastest_left + walk_in_place_faster_left step_end diff --git a/data/maps/PokemonLeague_HallOfFame/scripts.inc b/data/maps/PokemonLeague_HallOfFame/scripts.inc index c91027354..426f594b9 100644 --- a/data/maps/PokemonLeague_HallOfFame/scripts.inc +++ b/data/maps/PokemonLeague_HallOfFame/scripts.inc @@ -19,17 +19,17 @@ PokemonLeague_HallOfFame_OnFrame:: PokemonLeague_HallOfFame_EventScript_EnterRoom:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE applymovement OBJ_EVENT_ID_PLAYER, PokemonLeague_HallOfFame_Movement_EnterRoom waitmovement 0 - applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestLeft - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFasterLeft + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 delay 18 msgbox PokemonLeague_HallOfFame_Text_OakCongratulations closemessage - applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFastestUp - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement LOCALID_PROF_OAK, Movement_WalkInPlaceFasterUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 delay 20 dofieldeffect FLDEFF_HALL_OF_FAME_RECORD diff --git a/data/maps/PokemonLeague_LancesRoom/scripts.inc b/data/maps/PokemonLeague_LancesRoom/scripts.inc index e191cd3c6..908c7a5d1 100644 --- a/data/maps/PokemonLeague_LancesRoom/scripts.inc +++ b/data/maps/PokemonLeague_LancesRoom/scripts.inc @@ -13,8 +13,7 @@ PokemonLeague_LancesRoom_OnResume:: end PokemonLeague_LancesRoom_OnLoad:: - compare VAR_MAP_SCENE_POKEMON_LEAGUE, 4 - call_if_eq PokemonLeague_LancesRoom_EventScript_CloseEntry + call_if_eq VAR_MAP_SCENE_POKEMON_LEAGUE, 4, PokemonLeague_LancesRoom_EventScript_CloseEntry call_if_set FLAG_DEFEATED_LANCE, PokemonLeague_LancesRoom_EventScript_SetDoorOpen end @@ -159,10 +158,10 @@ PokemonLeague_LancesRoom_EventScript_LanceMoveOutOfWayRight:: PokemonLeague_LancesRoom_Movement_LanceMoveOutOfWayLeft:: walk_left - walk_in_place_fastest_right + walk_in_place_faster_right step_end PokemonLeague_LancesRoom_Movement_LanceMoveOutOfWayRight:: walk_right - walk_in_place_fastest_left + walk_in_place_faster_left step_end diff --git a/data/maps/PokemonLeague_LoreleisRoom/scripts.inc b/data/maps/PokemonLeague_LoreleisRoom/scripts.inc index 98430fcce..7f56673d2 100644 --- a/data/maps/PokemonLeague_LoreleisRoom/scripts.inc +++ b/data/maps/PokemonLeague_LoreleisRoom/scripts.inc @@ -13,8 +13,7 @@ PokemonLeague_LoreleisRoom_OnResume:: PokemonLeague_LoreleisRoom_OnLoad:: call_if_set FLAG_DEFEATED_LORELEI, PokemonLeague_LoreleisRoom_EventScript_SetDoorOpen - compare VAR_MAP_SCENE_POKEMON_LEAGUE, 1 - call_if_eq PokemonLeague_LoreleisRoom_EventScript_CloseEntry + call_if_eq VAR_MAP_SCENE_POKEMON_LEAGUE, 1, PokemonLeague_LoreleisRoom_EventScript_CloseEntry end PokemonLeague_LoreleisRoom_EventScript_CloseEntry:: diff --git a/data/maps/PokemonTower_1F/scripts.inc b/data/maps/PokemonTower_1F/scripts.inc index 5e5665a15..119737136 100644 --- a/data/maps/PokemonTower_1F/scripts.inc +++ b/data/maps/PokemonTower_1F/scripts.inc @@ -22,8 +22,7 @@ PokemonTower_1F_EventScript_Woman2:: lock faceplayer checkplayergender - compare VAR_RESULT, MALE - goto_if_eq PokemonTower_1F_EventScript_Woman2MalePlayer + goto_if_eq VAR_RESULT, MALE, PokemonTower_1F_EventScript_Woman2MalePlayer msgbox PokemonTower_1F_Text_ComeToPayRespectsGirl release end diff --git a/data/maps/PokemonTower_2F/scripts.inc b/data/maps/PokemonTower_2F/scripts.inc index c20e4e1ce..3d7a6b715 100644 --- a/data/maps/PokemonTower_2F/scripts.inc +++ b/data/maps/PokemonTower_2F/scripts.inc @@ -20,31 +20,24 @@ PokemonTower_2F_EventScript_RivalTriggerDown:: end PokemonTower_2F_EventScript_Rival:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE playbgm MUS_ENCOUNTER_RIVAL, 0 - compare VAR_TEMP_1, 0 - call_if_eq PokemonTower_2F_EventScript_RivalFacePlayerRight - compare VAR_TEMP_1, 1 - call_if_eq PokemonTower_2F_EventScript_RivalFacePlayerDown + call_if_eq VAR_TEMP_1, 0, PokemonTower_2F_EventScript_RivalFacePlayerRight + call_if_eq VAR_TEMP_1, 1, PokemonTower_2F_EventScript_RivalFacePlayerDown applymovement LOCALID_RIVAL, Movement_ExclamationMark waitmovement 0 applymovement LOCALID_RIVAL, Movement_Delay48 waitmovement 0 msgbox PokemonTower_2F_Text_RivalIntro setvar VAR_LAST_TALKED, LOCALID_RIVAL - compare VAR_STARTER_MON, 2 - call_if_eq PokemonTower_2F_EventScript_RivalSquirtle - compare VAR_STARTER_MON, 1 - call_if_eq PokemonTower_2F_EventScript_RivalBulbasaur - compare VAR_STARTER_MON, 0 - call_if_eq PokemonTower_2F_EventScript_RivalCharmander + call_if_eq VAR_STARTER_MON, 2, PokemonTower_2F_EventScript_RivalSquirtle + call_if_eq VAR_STARTER_MON, 1, PokemonTower_2F_EventScript_RivalBulbasaur + call_if_eq VAR_STARTER_MON, 0, PokemonTower_2F_EventScript_RivalCharmander msgbox PokemonTower_2F_Text_RivalPostBattle closemessage playbgm MUS_RIVAL_EXIT, 0 - compare VAR_TEMP_1, 0 - call_if_eq PokemonTower_2F_EventScript_RivalExitRight - compare VAR_TEMP_1, 1 - call_if_eq PokemonTower_2F_EventScript_RivalExitDown + call_if_eq VAR_TEMP_1, 0, PokemonTower_2F_EventScript_RivalExitRight + call_if_eq VAR_TEMP_1, 1, PokemonTower_2F_EventScript_RivalExitDown playse SE_EXIT delay 25 fadedefaultbgm @@ -54,14 +47,14 @@ PokemonTower_2F_EventScript_Rival:: end PokemonTower_2F_EventScript_RivalFacePlayerRight:: - applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestRight - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_RIVAL, Movement_WalkInPlaceFasterRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 return PokemonTower_2F_EventScript_RivalFacePlayerDown:: - applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestDown - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement LOCALID_RIVAL, Movement_WalkInPlaceFasterDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 return @@ -95,7 +88,7 @@ PokemonTower_2F_Movement_RivalExitRight:: walk_down walk_down walk_down - walk_in_place_fastest_right + walk_in_place_faster_right step_end PokemonTower_2F_Movement_RivalExitDown:: @@ -106,5 +99,5 @@ PokemonTower_2F_Movement_RivalExitDown:: walk_down walk_down walk_down - walk_in_place_fastest_right + walk_in_place_faster_right step_end diff --git a/data/maps/PokemonTower_6F/scripts.inc b/data/maps/PokemonTower_6F/scripts.inc index e5c33b9af..ca0ff6895 100644 --- a/data/maps/PokemonTower_6F/scripts.inc +++ b/data/maps/PokemonTower_6F/scripts.inc @@ -3,15 +3,14 @@ PokemonTower_6F_MapScripts:: PokemonTower_6F_EventScript_MarowakGhost:: lockall - textcolor 2 + textcolor NPC_TEXT_COLOR_MON msgbox PokemonTower_6F_Text_BeGoneIntruders goto_if_questlog EventScript_ReleaseEnd - setwildbattle SPECIES_MAROWAK, 30, ITEM_NONE + setwildbattle SPECIES_MAROWAK, 30 special StartMarowakBattle waitstate special QuestLog_CutRecording - compare VAR_RESULT, FALSE @ Set by CB2_EndMarowakBattle - goto_if_eq PokemonTower_6F_EventScript_DefeatedMarowakGhost + goto_if_eq VAR_RESULT, FALSE, PokemonTower_6F_EventScript_DefeatedMarowakGhost @ VAR_RESULT set by CB2_EndMarowakBattle applymovement OBJ_EVENT_ID_PLAYER, PokemonTower_6F_Movement_ForcePlayerUp waitmovement 0 releaseall diff --git a/data/maps/PokemonTower_7F/scripts.inc b/data/maps/PokemonTower_7F/scripts.inc index 91379e132..f3a4d9b8e 100644 --- a/data/maps/PokemonTower_7F/scripts.inc +++ b/data/maps/PokemonTower_7F/scripts.inc @@ -14,7 +14,7 @@ PokemonTower_7F_EventScript_MrFuji:: setflag FLAG_RESCUED_MR_FUJI msgbox PokemonTower_7F_Text_MrFujiThankYouFollowMe closemessage - warp MAP_LAVENDER_TOWN_VOLUNTEER_POKEMON_HOUSE, 255, 4, 7 + warp MAP_LAVENDER_TOWN_VOLUNTEER_POKEMON_HOUSE, 4, 7 waitstate release end @@ -28,12 +28,9 @@ PokemonTower_7F_EventScript_DefeatedGrunt1:: msgbox PokemonTower_7F_Text_Grunt1PostBattle closemessage getplayerxy VAR_0x8004, VAR_0x8005 - compare VAR_0x8004, 10 - goto_if_eq PokemonTower_7F_EventScript_Grunt1ExitMid - compare VAR_0x8004, 11 - goto_if_eq PokemonTower_7F_EventScript_Grunt1ExitRight - compare VAR_0x8004, 9 - goto_if_eq PokemonTower_7F_EventScript_Grunt1ExitLeft + goto_if_eq VAR_0x8004, 10, PokemonTower_7F_EventScript_Grunt1ExitMid + goto_if_eq VAR_0x8004, 11, PokemonTower_7F_EventScript_Grunt1ExitRight + goto_if_eq VAR_0x8004, 9, PokemonTower_7F_EventScript_Grunt1ExitLeft applymovement LOCALID_GRUNT1, PokemonTower_7F_Movement_Grunt1Exit waitmovement 0 goto PokemonTower_7F_EventScript_RemoveGrunt1 @@ -103,7 +100,7 @@ PokemonTower_7F_Movement_Grunt1ExitLeft:: walk_right walk_down walk_down - walk_in_place_fastest_left + walk_in_place_faster_left step_end PokemonTower_7F_EventScript_Grunt2:: @@ -116,10 +113,8 @@ PokemonTower_7F_EventScript_DefeatedGrunt2:: msgbox PokemonTower_7F_Text_Grunt2PostBattle closemessage getplayerxy VAR_0x8004, VAR_0x8005 - compare VAR_0x8004, 12 - goto_if_eq PokemonTower_7F_EventScript_Grunt2ExitLeft - compare VAR_0x8004, 13 - goto_if_eq PokemonTower_7F_EventScript_Grunt2ExitRight + goto_if_eq VAR_0x8004, 12, PokemonTower_7F_EventScript_Grunt2ExitLeft + goto_if_eq VAR_0x8004, 13, PokemonTower_7F_EventScript_Grunt2ExitRight applymovement LOCALID_GRUNT2, PokemonTower_7F_Movement_Grunt2Exit waitmovement 0 goto PokemonTower_7F_EventScript_RemoveGrunt2 @@ -181,10 +176,8 @@ PokemonTower_7F_EventScript_DefeatedGrunt3:: msgbox PokemonTower_7F_Text_Grunt3PostBattle closemessage getplayerxy VAR_0x8004, VAR_0x8005 - compare VAR_0x8004, 10 - goto_if_eq PokemonTower_7F_EventScript_Grunt3ExitRight - compare VAR_0x8004, 9 - goto_if_eq PokemonTower_7F_EventScript_Grunt3ExitLeft + goto_if_eq VAR_0x8004, 10, PokemonTower_7F_EventScript_Grunt3ExitRight + goto_if_eq VAR_0x8004, 9, PokemonTower_7F_EventScript_Grunt3ExitLeft applymovement LOCALID_GRUNT3, PokemonTower_7F_Movement_Grunt3Exit waitmovement 0 goto PokemonTower_7F_EventScript_RemoveGrunt3 diff --git a/data/maps/PowerPlant/scripts.inc b/data/maps/PowerPlant/scripts.inc index 0be023701..ec48a3778 100644 --- a/data/maps/PowerPlant/scripts.inc +++ b/data/maps/PowerPlant/scripts.inc @@ -9,8 +9,7 @@ PowerPlant_OnResume:: PowerPlant_EventScript_TryRemoveStaticMon:: specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_CAUGHT - goto_if_ne EventScript_Return + goto_if_ne VAR_RESULT, B_OUTCOME_CAUGHT, EventScript_Return removeobject VAR_LAST_TALKED return @@ -38,7 +37,7 @@ PowerPlant_EventScript_Zapdos:: special QuestLog_CutRecording lock faceplayer - setwildbattle SPECIES_ZAPDOS, 50, ITEM_NONE + setwildbattle SPECIES_ZAPDOS, 50 waitse playmoncry SPECIES_ZAPDOS, CRY_MODE_ENCOUNTER message Text_Gyaoo @@ -52,12 +51,9 @@ PowerPlant_EventScript_Zapdos:: waitstate clearflag FLAG_SYS_SPECIAL_WILD_BATTLE specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_WON - goto_if_eq PowerPlant_EventScript_DefeatedZapdos - compare VAR_RESULT, B_OUTCOME_RAN - goto_if_eq PowerPlant_EventScript_RanFromZapdos - compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED - goto_if_eq PowerPlant_EventScript_RanFromZapdos + goto_if_eq VAR_RESULT, B_OUTCOME_WON, PowerPlant_EventScript_DefeatedZapdos + goto_if_eq VAR_RESULT, B_OUTCOME_RAN, PowerPlant_EventScript_RanFromZapdos + goto_if_eq VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED, PowerPlant_EventScript_RanFromZapdos setflag FLAG_FOUGHT_ZAPDOS release end @@ -76,7 +72,7 @@ PowerPlant_EventScript_Electrode1:: goto_if_questlog EventScript_ReleaseEnd lock faceplayer - setwildbattle SPECIES_ELECTRODE, 34, ITEM_NONE + setwildbattle SPECIES_ELECTRODE, 34 waitse playmoncry SPECIES_ELECTRODE, CRY_MODE_ENCOUNTER delay 40 @@ -86,12 +82,9 @@ PowerPlant_EventScript_Electrode1:: clearflag FLAG_SYS_SPECIAL_WILD_BATTLE special QuestLog_CutRecording specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_WON - goto_if_eq PowerPlant_EventScript_FoughtElectrode1 - compare VAR_RESULT, B_OUTCOME_RAN - goto_if_eq PowerPlant_EventScript_FoughtElectrode1 - compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED - goto_if_eq PowerPlant_EventScript_FoughtElectrode1 + goto_if_eq VAR_RESULT, B_OUTCOME_WON, PowerPlant_EventScript_FoughtElectrode1 + goto_if_eq VAR_RESULT, B_OUTCOME_RAN, PowerPlant_EventScript_FoughtElectrode1 + goto_if_eq VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED, PowerPlant_EventScript_FoughtElectrode1 setflag FLAG_FOUGHT_POWER_PLANT_ELECTRODE_1 release end @@ -105,7 +98,7 @@ PowerPlant_EventScript_Electrode2:: goto_if_questlog EventScript_ReleaseEnd lock faceplayer - setwildbattle SPECIES_ELECTRODE, 34, ITEM_NONE + setwildbattle SPECIES_ELECTRODE, 34 waitse playmoncry SPECIES_ELECTRODE, CRY_MODE_ENCOUNTER delay 40 @@ -115,12 +108,9 @@ PowerPlant_EventScript_Electrode2:: clearflag FLAG_SYS_SPECIAL_WILD_BATTLE special QuestLog_CutRecording specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_WON - goto_if_eq PowerPlant_EventScript_FoughtElectrode2 - compare VAR_RESULT, B_OUTCOME_RAN - goto_if_eq PowerPlant_EventScript_FoughtElectrode2 - compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED - goto_if_eq PowerPlant_EventScript_FoughtElectrode2 + goto_if_eq VAR_RESULT, B_OUTCOME_WON, PowerPlant_EventScript_FoughtElectrode2 + goto_if_eq VAR_RESULT, B_OUTCOME_RAN, PowerPlant_EventScript_FoughtElectrode2 + goto_if_eq VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED, PowerPlant_EventScript_FoughtElectrode2 setflag FLAG_FOUGHT_POWER_PLANT_ELECTRODE_2 release end diff --git a/data/maps/RocketHideout_B4F/scripts.inc b/data/maps/RocketHideout_B4F/scripts.inc index eceb02ee2..7d0c50b98 100644 --- a/data/maps/RocketHideout_B4F/scripts.inc +++ b/data/maps/RocketHideout_B4F/scripts.inc @@ -12,8 +12,7 @@ RocketHideout_B4F_OnLoad:: setvar NUM_DOOR_GRUNTS_DEFEATED, 0 call_if_defeated TRAINER_TEAM_ROCKET_GRUNT_16, RocketHideout_B4F_EventScript_CountGruntDefeated call_if_defeated TRAINER_TEAM_ROCKET_GRUNT_17, RocketHideout_B4F_EventScript_CountGruntDefeated - compare NUM_DOOR_GRUNTS_DEFEATED, 2 - call_if_ne RocketHideout_B4F_EventScript_SetBarrier + call_if_ne NUM_DOOR_GRUNTS_DEFEATED, 2, RocketHideout_B4F_EventScript_SetBarrier end RocketHideout_B4F_EventScript_CountGruntDefeated:: @@ -46,8 +45,7 @@ RocketHideout_B4F_EventScript_SilphScope:: faceplayer removeobject LOCALID_SILPH_SCOPE giveitem ITEM_SILPH_SCOPE - compare VAR_RESULT, FALSE - goto_if_eq EventScript_BagIsFull + goto_if_eq VAR_RESULT, FALSE, EventScript_BagIsFull release end @@ -70,8 +68,7 @@ RocketHideout_B4F_EventScript_LiftKey:: setflag FLAG_CAN_USE_ROCKET_HIDEOUT_LIFT removeobject LOCALID_LIFT_KEY giveitem ITEM_LIFT_KEY - compare VAR_RESULT, FALSE - goto_if_eq EventScript_BagIsFull + goto_if_eq VAR_RESULT, FALSE, EventScript_BagIsFull release end @@ -84,10 +81,8 @@ RocketHideout_B4F_EventScript_DefeatedGrunt2:: setvar NUM_DOOR_GRUNTS_DEFEATED, 0 call_if_defeated TRAINER_TEAM_ROCKET_GRUNT_16, RocketHideout_B4F_EventScript_CountGruntDefeated call_if_defeated TRAINER_TEAM_ROCKET_GRUNT_17, RocketHideout_B4F_EventScript_CountGruntDefeated - compare NUM_DOOR_GRUNTS_DEFEATED, 2 - call_if_eq RocketHideout_B4F_EventScript_RemoveBarrier - compare NUM_DOOR_GRUNTS_DEFEATED, 2 - call_if_eq RocketHideout_B4F_EventScript_DrawMapForBarrierRemoval + call_if_eq NUM_DOOR_GRUNTS_DEFEATED, 2, RocketHideout_B4F_EventScript_RemoveBarrier + call_if_eq NUM_DOOR_GRUNTS_DEFEATED, 2, RocketHideout_B4F_EventScript_DrawMapForBarrierRemoval release end @@ -100,10 +95,8 @@ RocketHideout_B4F_EventScript_DefeatedGrunt3:: setvar NUM_DOOR_GRUNTS_DEFEATED, 0 call_if_defeated TRAINER_TEAM_ROCKET_GRUNT_16, RocketHideout_B4F_EventScript_CountGruntDefeated call_if_defeated TRAINER_TEAM_ROCKET_GRUNT_17, RocketHideout_B4F_EventScript_CountGruntDefeated - compare NUM_DOOR_GRUNTS_DEFEATED, 2 - call_if_eq RocketHideout_B4F_EventScript_RemoveBarrier - compare NUM_DOOR_GRUNTS_DEFEATED, 2 - call_if_eq RocketHideout_B4F_EventScript_DrawMapForBarrierRemoval + call_if_eq NUM_DOOR_GRUNTS_DEFEATED, 2, RocketHideout_B4F_EventScript_RemoveBarrier + call_if_eq NUM_DOOR_GRUNTS_DEFEATED, 2, RocketHideout_B4F_EventScript_DrawMapForBarrierRemoval release end diff --git a/data/maps/RocketHideout_Elevator/scripts.inc b/data/maps/RocketHideout_Elevator/scripts.inc index eb7adaa96..00a0dd894 100644 --- a/data/maps/RocketHideout_Elevator/scripts.inc +++ b/data/maps/RocketHideout_Elevator/scripts.inc @@ -45,8 +45,7 @@ RocketHideout_Elevator_EventScript_ChooseFloor:: RocketHideout_Elevator_EventScript_ToB1F:: setvar VAR_0x8006, 3 setdynamicwarp MAP_ROCKET_HIDEOUT_B1F, 255, 24, 25 - compare VAR_ELEVATOR_FLOOR, 3 - goto_if_eq RocketHideout_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 3, RocketHideout_Elevator_EventScript_ExitFloorSelect call RocketHideout_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 3 goto RocketHideout_Elevator_EventScript_ExitFloorSelect @@ -55,8 +54,7 @@ RocketHideout_Elevator_EventScript_ToB1F:: RocketHideout_Elevator_EventScript_ToB2F:: setvar VAR_0x8006, 2 setdynamicwarp MAP_ROCKET_HIDEOUT_B2F, 255, 28, 16 - compare VAR_ELEVATOR_FLOOR, 2 - goto_if_eq RocketHideout_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 2, RocketHideout_Elevator_EventScript_ExitFloorSelect call RocketHideout_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 2 goto RocketHideout_Elevator_EventScript_ExitFloorSelect @@ -65,8 +63,7 @@ RocketHideout_Elevator_EventScript_ToB2F:: RocketHideout_Elevator_EventScript_ToB4F:: setvar VAR_0x8006, 0 setdynamicwarp MAP_ROCKET_HIDEOUT_B4F, 255, 20, 23 - compare VAR_ELEVATOR_FLOOR, 0 - goto_if_eq RocketHideout_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 0, RocketHideout_Elevator_EventScript_ExitFloorSelect call RocketHideout_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 0 goto RocketHideout_Elevator_EventScript_ExitFloorSelect diff --git a/data/maps/Route1/scripts.inc b/data/maps/Route1/scripts.inc index 90bc0327b..ba2e22d9c 100644 --- a/data/maps/Route1/scripts.inc +++ b/data/maps/Route1/scripts.inc @@ -6,11 +6,10 @@ Route1_EventScript_MartClerk:: faceplayer goto_if_set FLAG_GOT_POTION_ON_ROUTE_1, Route1_EventScript_AlreadyGotPotion msgbox Route1_Text_WorkAtPokeMartTakeSample - textcolor 3 - checkitemspace ITEM_POTION, 1 - compare VAR_RESULT, FALSE - goto_if_eq EventScript_BagIsFull - getitemname 1, ITEM_POTION + textcolor NPC_TEXT_COLOR_NEUTRAL + checkitemspace ITEM_POTION + goto_if_eq VAR_RESULT, FALSE, EventScript_BagIsFull + 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..1624afbef 100644 --- a/data/maps/Route10_PokemonCenter_1F/scripts.inc +++ b/data/maps/Route10_PokemonCenter_1F/scripts.inc @@ -35,18 +35,15 @@ Route10_PokemonCenter_1F_EventScript_Aide:: call Route10_PokemonCenter_1F_EventScript_GetAideRequestInfo goto_if_set FLAG_GOT_EVERSTONE_FROM_OAKS_AIDE, Route10_PokemonCenter_1F_EventScript_AlreadyGotEverstone msgbox Route10_PokemonCenter_1F_Text_GiveEverstoneIfCaught20Mons, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq Aide_EventScript_DeclineCheckMons + goto_if_eq VAR_RESULT, NO, 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 + goto_if_lt VAR_0x8006, REQUIRED_OWNED_MONS, Aide_EventScript_HaventCaughtEnough msgbox Route10_PokemonCenter_1F_Text_GreatHereYouGo - checkitemspace ITEM_EVERSTONE, 1 - compare VAR_RESULT, FALSE - goto_if_eq Aide_EventScript_NoRoomForItem + checkitemspace ITEM_EVERSTONE + goto_if_eq VAR_RESULT, FALSE, Aide_EventScript_NoRoomForItem giveitem_msg Route10_PokemonCenter_1F_Text_ReceivedEverstoneFromAide, ITEM_EVERSTONE setflag FLAG_GOT_EVERSTONE_FROM_OAKS_AIDE msgbox Route10_PokemonCenter_1F_Text_ExplainEverstone @@ -59,6 +56,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..487c92fce 100644 --- a/data/maps/Route11_EastEntrance_2F/scripts.inc +++ b/data/maps/Route11_EastEntrance_2F/scripts.inc @@ -26,14 +26,11 @@ Route11_EastEntrance_2F_EventScript_Turner:: call EventScript_GetInGameTradeSpeciesInfo goto_if_set FLAG_DID_NINA_TRADE, Route11_EastEntrance_2F_EventScript_AlreadyTraded msgbox Trade_Text_LookingForMonWannaTradeForMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq Route11_EastEntrance_2F_EventScript_DeclineTrade + goto_if_eq VAR_RESULT, NO, Route11_EastEntrance_2F_EventScript_DeclineTrade call EventScript_ChooseMonForInGameTrade - compare VAR_0x8004, PARTY_SIZE - goto_if_ge Route11_EastEntrance_2F_EventScript_DeclineTrade + goto_if_ge VAR_0x8004, PARTY_SIZE, Route11_EastEntrance_2F_EventScript_DeclineTrade call EventScript_GetInGameTradeSpecies - compare VAR_RESULT, VAR_0x8009 - goto_if_ne Route11_EastEntrance_2F_EventScript_NotRequestedMon + goto_if_ne VAR_RESULT, VAR_0x8009, Route11_EastEntrance_2F_EventScript_NotRequestedMon call EventScript_DoInGameTrade msgbox Trade_Text_HeyThanks setflag FLAG_DID_NINA_TRADE @@ -46,7 +43,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 @@ -62,18 +59,15 @@ Route11_EastEntrance_2F_EventScript_Aide:: call Route11_EastEntrance_2F_EventScript_GetAideRequestInfo goto_if_set FLAG_GOT_ITEMFINDER, Route11_EastEntrance_2F_EventScript_AlreadyGotItemfinder msgbox Route11_EastEntrance_2F_Text_GiveItemfinderIfCaught30, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq Aide_EventScript_DeclineCheckMons + goto_if_eq VAR_RESULT, NO, 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 + goto_if_lt VAR_0x8006, REQUIRED_CAUGHT_MONS, Aide_EventScript_HaventCaughtEnough msgbox Route11_EastEntrance_2F_Text_GreatHereYouGo - checkitemspace ITEM_ITEMFINDER, 1 - compare VAR_RESULT, FALSE - goto_if_eq Aide_EventScript_NoRoomForItem + checkitemspace ITEM_ITEMFINDER + goto_if_eq VAR_RESULT, FALSE, Aide_EventScript_NoRoomForItem giveitem_msg Route11_EastEntrance_2F_Text_ReceivedItemfinderFromAide, ITEM_ITEMFINDER setflag FLAG_GOT_ITEMFINDER msgbox Route11_EastEntrance_2F_Text_ExplainItemfinder @@ -86,6 +80,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/Route12/scripts.inc b/data/maps/Route12/scripts.inc index e6a1bc440..7e17f2573 100644 --- a/data/maps/Route12/scripts.inc +++ b/data/maps/Route12/scripts.inc @@ -17,10 +17,9 @@ Route12_EventScript_Snorlax:: goto_if_questlog EventScript_ReleaseEnd special QuestLog_CutRecording msgbox Text_WantToUsePokeFlute, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq Route12_EventScript_DontUsePokeFlute + goto_if_eq VAR_RESULT, NO, Route12_EventScript_DontUsePokeFlute call EventScript_AwakenSnorlax - setwildbattle SPECIES_SNORLAX, 30, ITEM_NONE + setwildbattle SPECIES_SNORLAX, 30 waitse playmoncry SPECIES_SNORLAX, CRY_MODE_ENCOUNTER delay 40 @@ -31,12 +30,9 @@ Route12_EventScript_Snorlax:: dowildbattle clearflag FLAG_SYS_SPECIAL_WILD_BATTLE specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_WON - goto_if_eq Route12_EventScript_FoughtSnorlax - compare VAR_RESULT, B_OUTCOME_RAN - goto_if_eq Route12_EventScript_FoughtSnorlax - compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED - goto_if_eq Route12_EventScript_FoughtSnorlax + goto_if_eq VAR_RESULT, B_OUTCOME_WON, Route12_EventScript_FoughtSnorlax + goto_if_eq VAR_RESULT, B_OUTCOME_RAN, Route12_EventScript_FoughtSnorlax + goto_if_eq VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED, Route12_EventScript_FoughtSnorlax release end diff --git a/data/maps/Route12_FishingHouse/scripts.inc b/data/maps/Route12_FishingHouse/scripts.inc index 620753d7d..545472154 100644 --- a/data/maps/Route12_FishingHouse/scripts.inc +++ b/data/maps/Route12_FishingHouse/scripts.inc @@ -6,16 +6,14 @@ Route12_FishingHouse_EventScript_FishingGuruBrother:: faceplayer goto_if_set FLAG_GOT_SUPER_ROD, Route12_FishingHouse_EventScript_CheckMagikarpRecord msgbox Route12_FishingHouse_Text_DoYouLikeToFish, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq Route12_FishingHouse_EventScript_GiveSuperRod + goto_if_eq VAR_RESULT, YES, Route12_FishingHouse_EventScript_GiveSuperRod msgbox Route12_FishingHouse_Text_OhThatsDisappointing release end Route12_FishingHouse_EventScript_GiveSuperRod:: - checkitemspace ITEM_SUPER_ROD, 1 - compare VAR_RESULT, FALSE - goto_if_eq Route12_FishingHouse_EventScript_NoRoomForSuperRod + checkitemspace ITEM_SUPER_ROD + goto_if_eq VAR_RESULT, FALSE, Route12_FishingHouse_EventScript_NoRoomForSuperRod additem ITEM_SUPER_ROD msgbox Route12_FishingHouse_Text_TakeThisAndFish msgreceiveditem Route12_FishingHouse_Text_ReceivedSuperRod, ITEM_SUPER_ROD @@ -34,24 +32,18 @@ Route12_FishingHouse_EventScript_CheckMagikarpRecord:: special QuestLog_CutRecording setvar VAR_0x8004, SPECIES_MAGIKARP specialvar VAR_RESULT, DoesPlayerPartyContainSpecies - compare VAR_RESULT, FALSE - goto_if_eq Route12_FishingHouse_EventScript_NoMagikarpInParty + goto_if_eq VAR_RESULT, FALSE, Route12_FishingHouse_EventScript_NoMagikarpInParty special GetMagikarpSizeRecordInfo msgbox Route12_FishingHouse_Text_OhMagikarpAllowMeToSee special ChoosePartyMon waitstate copyvar VAR_RESULT, VAR_0x8004 - compare VAR_RESULT, PARTY_SIZE - goto_if_ge Route12_FishingHouse_EventScript_CancelShowMon + goto_if_ge VAR_RESULT, PARTY_SIZE, Route12_FishingHouse_EventScript_CancelShowMon special CompareMagikarpSize - compare VAR_RESULT, 1 - goto_if_eq Route12_FishingHouse_EventScript_NotMagikarp - compare VAR_RESULT, 2 - goto_if_eq Route12_FishingHouse_EventScript_NotRecordMagikarp - compare VAR_RESULT, 3 - goto_if_eq Route12_FishingHouse_EventScript_NewRecordMagikarp - compare VAR_RESULT, 4 - goto_if_eq Route12_FishingHouse_EventScript_TieRecordMagikarp + goto_if_eq VAR_RESULT, 1, Route12_FishingHouse_EventScript_NotMagikarp + goto_if_eq VAR_RESULT, 2, Route12_FishingHouse_EventScript_NotRecordMagikarp + goto_if_eq VAR_RESULT, 3, Route12_FishingHouse_EventScript_NewRecordMagikarp + goto_if_eq VAR_RESULT, 4, Route12_FishingHouse_EventScript_TieRecordMagikarp release end @@ -85,8 +77,7 @@ Route12_FishingHouse_EventScript_NewRecordMagikarp:: setflag FLAG_GOT_RECORD_SETTING_MAGIKARP msgbox Route12_FishingHouse_Text_WhoaXInchesTakeThis giveitem ITEM_NET_BALL - compare VAR_RESULT, FALSE - goto_if_eq Route12_FishingHouse_EventScript_NoRoomForNetBall + goto_if_eq VAR_RESULT, FALSE, Route12_FishingHouse_EventScript_NoRoomForNetBall msgbox Route12_FishingHouse_Text_LookForwardToGreaterRecords release end diff --git a/data/maps/Route12_NorthEntrance_2F/scripts.inc b/data/maps/Route12_NorthEntrance_2F/scripts.inc index c30488de4..93a8caeaf 100644 --- a/data/maps/Route12_NorthEntrance_2F/scripts.inc +++ b/data/maps/Route12_NorthEntrance_2F/scripts.inc @@ -14,13 +14,10 @@ Route12_NorthEntrance_2F_EventScript_Lass:: faceplayer goto_if_set FLAG_GOT_TM27, Route12_NorthEntrance_2F_EventScript_ExplainTM27 checkplayergender - compare VAR_RESULT, MALE - call_if_eq Route12_NorthEntrance_2F_EventScript_TakeTMMale - compare VAR_RESULT, FEMALE - call_if_eq Route12_NorthEntrance_2F_EventScript_TakeTMFemale - checkitemspace ITEM_TM27, 1 - compare VAR_RESULT, FALSE - goto_if_eq Route12_NorthEntrance_2F_EventScript_NoRoomForTM27 + call_if_eq VAR_RESULT, MALE, Route12_NorthEntrance_2F_EventScript_TakeTMMale + call_if_eq VAR_RESULT, FEMALE, Route12_NorthEntrance_2F_EventScript_TakeTMFemale + checkitemspace ITEM_TM27 + goto_if_eq VAR_RESULT, FALSE, Route12_NorthEntrance_2F_EventScript_NoRoomForTM27 giveitem_msg Route12_NorthEntrance_2F_Text_ReceivedTM27FromLittleGirl, ITEM_TM27 msgbox Route12_NorthEntrance_2F_Text_ExplainTM27 setflag FLAG_GOT_TM27 diff --git a/data/maps/Route15_WestEntrance_2F/scripts.inc b/data/maps/Route15_WestEntrance_2F/scripts.inc index 9b74877b8..4606f2f27 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 @@ -25,18 +25,15 @@ Route15_WestEntrance_2F_EventScript_Aide:: call Route15_WestEntrance_2F_EventScript_GetAideRequestInfo goto_if_set FLAG_GOT_EXP_SHARE_FROM_OAKS_AIDE, Route15_WestEntrance_2F_EventScript_AlreadyGotExpShare msgbox Route15_WestEntrance_2F_Text_GiveItemIfCaughtEnough, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq Aide_EventScript_DeclineCheckMons + goto_if_eq VAR_RESULT, NO, 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 + goto_if_lt VAR_0x8006, REQUIRED_CAUGHT_MONS, Aide_EventScript_HaventCaughtEnough msgbox Route15_WestEntrance_2F_Text_GreatHereYouGo - checkitemspace ITEM_EXP_SHARE, 1 - compare VAR_RESULT, FALSE - goto_if_eq Aide_EventScript_NoRoomForItem + checkitemspace ITEM_EXP_SHARE + goto_if_eq VAR_RESULT, FALSE, Aide_EventScript_NoRoomForItem giveitem_msg Route15_WestEntrance_2F_Text_ReceivedItemFromAide, ITEM_EXP_SHARE setflag FLAG_GOT_EXP_SHARE_FROM_OAKS_AIDE msgbox Route15_WestEntrance_2F_Text_ExplainExpShare @@ -49,6 +46,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/scripts.inc b/data/maps/Route16/scripts.inc index c1cd5e8a8..27ad5ce6f 100644 --- a/data/maps/Route16/scripts.inc +++ b/data/maps/Route16/scripts.inc @@ -13,8 +13,7 @@ Route16_EventScript_RemoveSnorlax:: return Route16_OnTransition:: - compare VAR_MAP_SCENE_ROUTE16, 1 - call_if_eq Route16_OnTransitionCyclingRoad + call_if_eq VAR_MAP_SCENE_ROUTE16, 1, Route16_OnTransitionCyclingRoad end Route16_OnTransitionCyclingRoad:: @@ -36,10 +35,9 @@ Route16_EventScript_Snorlax:: goto_if_questlog EventScript_ReleaseEnd special QuestLog_CutRecording msgbox Text_WantToUsePokeFlute, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq Route16_EventScript_DontUsePokeFlute + goto_if_eq VAR_RESULT, NO, Route16_EventScript_DontUsePokeFlute call EventScript_AwakenSnorlax - setwildbattle SPECIES_SNORLAX, 30, ITEM_NONE + setwildbattle SPECIES_SNORLAX, 30 waitse playmoncry SPECIES_SNORLAX, CRY_MODE_ENCOUNTER delay 40 @@ -49,12 +47,9 @@ Route16_EventScript_Snorlax:: dowildbattle clearflag FLAG_SYS_SPECIAL_WILD_BATTLE specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_WON - goto_if_eq Route16_EventScript_FoughtSnorlax - compare VAR_RESULT, B_OUTCOME_RAN - goto_if_eq Route16_EventScript_FoughtSnorlax - compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED - goto_if_eq Route16_EventScript_FoughtSnorlax + goto_if_eq VAR_RESULT, B_OUTCOME_WON, Route16_EventScript_FoughtSnorlax + goto_if_eq VAR_RESULT, B_OUTCOME_RAN, Route16_EventScript_FoughtSnorlax + goto_if_eq VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED, Route16_EventScript_FoughtSnorlax release end diff --git a/data/maps/Route16_House/scripts.inc b/data/maps/Route16_House/scripts.inc index 373259698..a1abb3d82 100644 --- a/data/maps/Route16_House/scripts.inc +++ b/data/maps/Route16_House/scripts.inc @@ -6,9 +6,8 @@ Route16_House_EventScript_Woman:: faceplayer goto_if_set FLAG_GOT_HM02, Route16_House_EventScript_AlreadyGotHM02 msgbox Route16_House_Text_FoundMySecretRetreat - checkitemspace ITEM_HM02, 1 - compare VAR_RESULT, FALSE - goto_if_eq Route16_House_EventScript_NoRoomForHM02 + checkitemspace ITEM_HM02 + goto_if_eq VAR_RESULT, FALSE, Route16_House_EventScript_NoRoomForHM02 giveitem_msg Route16_House_Text_ReceivedHM02FromGirl, ITEM_HM02 msgbox Route16_House_Text_ExplainHM02 setflag FLAG_GOT_HM02 diff --git a/data/maps/Route16_NorthEntrance_1F/scripts.inc b/data/maps/Route16_NorthEntrance_1F/scripts.inc index f305b656d..b7e9fcfcc 100644 --- a/data/maps/Route16_NorthEntrance_1F/scripts.inc +++ b/data/maps/Route16_NorthEntrance_1F/scripts.inc @@ -46,20 +46,16 @@ Route16_NorthEntrance_1F_EventScript_NeedBikeTriggerBottom:: end Route16_NorthEntrance_1F_EventScript_NeedBikeTrigger:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox Route16_NorthEntrance_1F_Text_ExcuseMeWaitUp closemessage - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 delay 20 - compare VAR_0x8008, 1 - call_if_eq Route16_NorthEntrance_1F_EventScript_PlayerWalkToCounterMidTop - compare VAR_0x8008, 2 - call_if_eq Route16_NorthEntrance_1F_EventScript_PlayerWalkToCounterMid - compare VAR_0x8008, 3 - call_if_eq Route16_NorthEntrance_1F_EventScript_PlayerWalkToCounterMidBottom - compare VAR_0x8008, 4 - call_if_eq Route16_NorthEntrance_1F_EventScript_PlayerWalkToCounterBottom + call_if_eq VAR_0x8008, 1, Route16_NorthEntrance_1F_EventScript_PlayerWalkToCounterMidTop + call_if_eq VAR_0x8008, 2, Route16_NorthEntrance_1F_EventScript_PlayerWalkToCounterMid + call_if_eq VAR_0x8008, 3, Route16_NorthEntrance_1F_EventScript_PlayerWalkToCounterMidBottom + call_if_eq VAR_0x8008, 4, Route16_NorthEntrance_1F_EventScript_PlayerWalkToCounterBottom msgbox Route16_NorthEntrance_1F_Text_NoPedestriansOnCyclingRoad closemessage applymovement OBJ_EVENT_ID_PLAYER, Route16_NorthEntrance_1F_Movement_WalkRight diff --git a/data/maps/Route16_NorthEntrance_2F/scripts.inc b/data/maps/Route16_NorthEntrance_2F/scripts.inc index 57ef19ea4..c96c1c589 100644 --- a/data/maps/Route16_NorthEntrance_2F/scripts.inc +++ b/data/maps/Route16_NorthEntrance_2F/scripts.inc @@ -25,18 +25,15 @@ Route16_NorthEntrance_2F_EventScript_Aide:: call Route16_NorthEntrance_2F_EventScript_GetAideRequestInfo goto_if_set FLAG_GOT_AMULET_COIN_FROM_OAKS_AIDE, Route16_NorthEntrance_2F_EventScript_AlreadyGotAmuletCoin msgbox Route16_NorthEntrance_2F_Text_GiveAmuletCoinIfCaught40, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq Aide_EventScript_DeclineCheckMons + goto_if_eq VAR_RESULT, NO, 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 + goto_if_lt VAR_0x8006, REQUIRED_CAUGHT_MONS, Aide_EventScript_HaventCaughtEnough msgbox Route16_NorthEntrance_2F_Text_GreatHereYouGo - checkitemspace ITEM_AMULET_COIN, 1 - compare VAR_RESULT, FALSE - goto_if_eq Aide_EventScript_NoRoomForItem + checkitemspace ITEM_AMULET_COIN + goto_if_eq VAR_RESULT, FALSE, Aide_EventScript_NoRoomForItem giveitem_msg Route16_NorthEntrance_2F_Text_ReceivedAmuletCoinFromAide, ITEM_AMULET_COIN setflag FLAG_GOT_AMULET_COIN_FROM_OAKS_AIDE msgbox Route16_NorthEntrance_2F_Text_ExplainAmuletCoin @@ -49,6 +46,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/scripts.inc b/data/maps/Route18/scripts.inc index 8269eceb5..4f5e9019f 100644 --- a/data/maps/Route18/scripts.inc +++ b/data/maps/Route18/scripts.inc @@ -4,8 +4,7 @@ Route18_MapScripts:: .byte 0 Route18_OnTransition:: - compare VAR_MAP_SCENE_ROUTE16, 1 - call_if_eq Route18_OnTransitionCyclingRoad + call_if_eq VAR_MAP_SCENE_ROUTE16, 1, Route18_OnTransitionCyclingRoad end Route18_OnTransitionCyclingRoad:: diff --git a/data/maps/Route18_EastEntrance_1F/scripts.inc b/data/maps/Route18_EastEntrance_1F/scripts.inc index 6d3afed96..0c05c8beb 100644 --- a/data/maps/Route18_EastEntrance_1F/scripts.inc +++ b/data/maps/Route18_EastEntrance_1F/scripts.inc @@ -46,20 +46,16 @@ Route18_EastEntrance_1F_EventScript_NeedBikeTriggerBottom:: end Route18_EastEntrance_1F_EventScript_NeedBikeTrigger:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox Route18_EastEntrance_1F_Text_ExcuseMe closemessage - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 delay 20 - compare VAR_0x8008, 1 - call_if_eq Route18_EastEntrance_1F_EventScript_PlayerWalkToCounterMidTop - compare VAR_0x8008, 2 - call_if_eq Route18_EastEntrance_1F_EventScript_PlayerWalkToCounterMid - compare VAR_0x8008, 3 - call_if_eq Route18_EastEntrance_1F_EventScript_PlayerWalkToCounterMidBottom - compare VAR_0x8008, 4 - call_if_eq Route18_EastEntrance_1F_EventScript_PlayerWalkToCounterBottom + call_if_eq VAR_0x8008, 1, Route18_EastEntrance_1F_EventScript_PlayerWalkToCounterMidTop + call_if_eq VAR_0x8008, 2, Route18_EastEntrance_1F_EventScript_PlayerWalkToCounterMid + call_if_eq VAR_0x8008, 3, Route18_EastEntrance_1F_EventScript_PlayerWalkToCounterMidBottom + call_if_eq VAR_0x8008, 4, Route18_EastEntrance_1F_EventScript_PlayerWalkToCounterBottom msgbox Route18_EastEntrance_1F_Text_NeedBicycleForCyclingRoad closemessage applymovement OBJ_EVENT_ID_PLAYER, Route18_EastEntrance_1F_Movement_WalkRight diff --git a/data/maps/Route18_EastEntrance_2F/scripts.inc b/data/maps/Route18_EastEntrance_2F/scripts.inc index edf1eafe1..506e21d1e 100644 --- a/data/maps/Route18_EastEntrance_2F/scripts.inc +++ b/data/maps/Route18_EastEntrance_2F/scripts.inc @@ -16,14 +16,11 @@ Route18_EastEntrance_2F_EventScript_Haden:: call EventScript_GetInGameTradeSpeciesInfo goto_if_set FLAG_DID_MARC_TRADE, Route18_EastEntrance_2F_EventScript_AlreadyTraded msgbox Trade_Text_LookingForMonWannaTradeForMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq Route18_EastEntrance_2F_EventScript_DeclineTrade + goto_if_eq VAR_RESULT, NO, Route18_EastEntrance_2F_EventScript_DeclineTrade call EventScript_ChooseMonForInGameTrade - compare VAR_0x8004, PARTY_SIZE - goto_if_ge Route18_EastEntrance_2F_EventScript_DeclineTrade + goto_if_ge VAR_0x8004, PARTY_SIZE, Route18_EastEntrance_2F_EventScript_DeclineTrade call EventScript_GetInGameTradeSpecies - compare VAR_RESULT, VAR_0x8009 - goto_if_ne Route18_EastEntrance_2F_EventScript_NotRequestedMon + goto_if_ne VAR_RESULT, VAR_0x8009, Route18_EastEntrance_2F_EventScript_NotRequestedMon call EventScript_DoInGameTrade msgbox Trade_Text_HeyThanks setflag FLAG_DID_MARC_TRADE @@ -36,7 +33,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/scripts.inc b/data/maps/Route22/scripts.inc index 5df278bae..6f45b8518 100644 --- a/data/maps/Route22/scripts.inc +++ b/data/maps/Route22/scripts.inc @@ -24,33 +24,24 @@ Route22_EventScript_EarlyRivalTriggerBottom:: end Route22_EventScript_EarlyRival:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE playbgm MUS_ENCOUNTER_RIVAL, 0 addobject LOCALID_RIVAL - compare VAR_TEMP_1, 0 - call_if_eq Route22_EventScript_EarlyRivalApproach - compare VAR_TEMP_1, 1 - call_if_eq Route22_EventScript_EarlyRivalApproach - compare VAR_TEMP_1, 2 - call_if_eq Route22_EventScript_EarlyRivalApproachBottom + call_if_eq VAR_TEMP_1, 0, Route22_EventScript_EarlyRivalApproach + call_if_eq VAR_TEMP_1, 1, Route22_EventScript_EarlyRivalApproach + call_if_eq VAR_TEMP_1, 2, Route22_EventScript_EarlyRivalApproachBottom delay 6 msgbox Route22_Text_EarlyRivalIntro - compare VAR_STARTER_MON, 2 - call_if_eq Route22_EventScript_EarlyRivalSquirtle - compare VAR_STARTER_MON, 1 - call_if_eq Route22_EventScript_EarlyRivalBulbasaur - compare VAR_STARTER_MON, 0 - call_if_eq Route22_EventScript_EarlyRivalCharmander + call_if_eq VAR_STARTER_MON, 2, Route22_EventScript_EarlyRivalSquirtle + call_if_eq VAR_STARTER_MON, 1, Route22_EventScript_EarlyRivalBulbasaur + call_if_eq VAR_STARTER_MON, 0, Route22_EventScript_EarlyRivalCharmander msgbox Route22_Text_EarlyRivalPostBattle closemessage delay 10 playbgm MUS_RIVAL_EXIT, 0 - compare VAR_TEMP_1, 0 - call_if_eq Route22_EventScript_EarlyRivalExit - compare VAR_TEMP_1, 1 - call_if_eq Route22_EventScript_EarlyRivalExit - compare VAR_TEMP_1, 2 - call_if_eq Route22_EventScript_EarlyRivalExitBottom + call_if_eq VAR_TEMP_1, 0, Route22_EventScript_EarlyRivalExit + call_if_eq VAR_TEMP_1, 1, Route22_EventScript_EarlyRivalExit + call_if_eq VAR_TEMP_1, 2, Route22_EventScript_EarlyRivalExitBottom fadedefaultbgm removeobject LOCALID_RIVAL setvar VAR_MAP_SCENE_ROUTE22, 2 @@ -148,7 +139,7 @@ Route22_Movement_RivalApproachBottom:: walk_right walk_right walk_right - walk_in_place_fastest_down + walk_in_place_faster_down step_end Route22_Movement_PlayerFaceRival:: @@ -160,7 +151,7 @@ Route22_Movement_PlayerFaceRival:: delay_16 delay_16 delay_8 - walk_in_place_fastest_up + walk_in_place_faster_up step_end Route22_EventScript_LateRivalTriggerTop:: @@ -184,23 +175,17 @@ Route22_EventScript_LateRivalTriggerBottom:: end Route22_EventScript_LateRival:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE playbgm MUS_ENCOUNTER_RIVAL, 0 addobject LOCALID_RIVAL - compare VAR_TEMP_1, 0 - call_if_eq Route22_EventScript_LateRivalApproach - compare VAR_TEMP_1, 1 - call_if_eq Route22_EventScript_LateRivalApproach - compare VAR_TEMP_1, 2 - call_if_eq Route22_EventScript_LateRivalApproachBottom + call_if_eq VAR_TEMP_1, 0, Route22_EventScript_LateRivalApproach + call_if_eq VAR_TEMP_1, 1, Route22_EventScript_LateRivalApproach + call_if_eq VAR_TEMP_1, 2, Route22_EventScript_LateRivalApproachBottom msgbox Route22_Text_LateRivalIntro setvar VAR_LAST_TALKED, LOCALID_RIVAL - compare VAR_STARTER_MON, 2 - call_if_eq Route22_EventScript_LateRivalSquirtle - compare VAR_STARTER_MON, 1 - call_if_eq Route22_EventScript_LateRivalBulbasaur - compare VAR_STARTER_MON, 0 - call_if_eq Route22_EventScript_LateRivalCharmander + call_if_eq VAR_STARTER_MON, 2, Route22_EventScript_LateRivalSquirtle + call_if_eq VAR_STARTER_MON, 1, Route22_EventScript_LateRivalBulbasaur + call_if_eq VAR_STARTER_MON, 0, Route22_EventScript_LateRivalCharmander msgbox Route22_Text_LateRivalPostBattle closemessage delay 10 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/Route24/scripts.inc b/data/maps/Route24/scripts.inc index dbcc621bc..bf8c685da 100644 --- a/data/maps/Route24/scripts.inc +++ b/data/maps/Route24/scripts.inc @@ -6,12 +6,10 @@ Route24_MapScripts:: Route24_EventScript_Rocket:: lock faceplayer - compare VAR_MAP_SCENE_ROUTE24, 1 - goto_if_eq Route24_EventScript_RocketPostBattle + goto_if_eq VAR_MAP_SCENE_ROUTE24, 1, Route24_EventScript_RocketPostBattle msgbox Route24_Text_JustEarnedFabulousPrize - checkitemspace ITEM_NUGGET, 1 - compare VAR_RESULT, FALSE - goto_if_eq Route24_EventScript_NoRoomForNugget + checkitemspace ITEM_NUGGET + goto_if_eq VAR_RESULT, FALSE, Route24_EventScript_NoRoomForNugget call Route24_EventScript_BattleRocket release end @@ -39,17 +37,14 @@ Route24_EventScript_RocketTriggerRight:: end Route24_EventScript_RocketTrigger:: - textcolor 0 - compare VAR_TEMP_1, 0 - call_if_eq Route24_EventScript_RocketApproachPlayer - compare VAR_TEMP_1, 1 - call_if_eq Route24_EventScript_RocketMotionToPlayer - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + textcolor NPC_TEXT_COLOR_MALE + call_if_eq VAR_TEMP_1, 0, Route24_EventScript_RocketApproachPlayer + call_if_eq VAR_TEMP_1, 1, Route24_EventScript_RocketMotionToPlayer + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 msgbox Route24_Text_JustEarnedFabulousPrize - checkitemspace ITEM_NUGGET, 1 - compare VAR_RESULT, FALSE - goto_if_eq Route24_EventScript_NoRoomForNuggetTrigger + checkitemspace ITEM_NUGGET + goto_if_eq VAR_RESULT, FALSE, Route24_EventScript_NoRoomForNuggetTrigger call Route24_EventScript_BattleRocket releaseall end @@ -72,7 +67,7 @@ Route24_EventScript_RocketApproachPlayer:: return Route24_EventScript_RocketMotionToPlayer:: - applymovement LOCALID_ROCKET, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_ROCKET, Movement_WalkInPlaceFasterLeft waitmovement 0 return @@ -81,8 +76,7 @@ Route24_EventScript_NoRoomForNuggetTrigger:: closemessage applymovement OBJ_EVENT_ID_PLAYER, Route24_Movement_WalkDown waitmovement 0 - compare VAR_TEMP_1, 0 - call_if_eq Route24_EventScript_RocketWalkBackToPos + call_if_eq VAR_TEMP_1, 0, Route24_EventScript_RocketWalkBackToPos release end @@ -97,7 +91,7 @@ Route24_Movement_RocketApproachPlayer:: Route24_Movement_RocketWalkBackToPos:: walk_right - walk_in_place_fastest_left + walk_in_place_faster_left step_end Route24_Movement_WalkDown:: diff --git a/data/maps/Route25_SeaCottage/scripts.inc b/data/maps/Route25_SeaCottage/scripts.inc index 83173399c..b8f39b063 100644 --- a/data/maps/Route25_SeaCottage/scripts.inc +++ b/data/maps/Route25_SeaCottage/scripts.inc @@ -29,10 +29,8 @@ Route25_SeaCottage_EventScript_Bill:: goto_if_set FLAG_GOT_SS_TICKET, Route25_SeaCottage_EventScript_BillGoToSSAnne goto_if_set FLAG_HELPED_BILL_IN_SEA_COTTAGE, Route25_SeaCottage_EventScript_BillGiveSSTicket checkplayergender - compare VAR_RESULT, MALE - goto_if_eq Route25_SeaCottage_EventScript_BillAskForHelpMale - compare VAR_RESULT, FEMALE - goto_if_eq Route25_SeaCottage_EventScript_BillAskForHelpFemale + goto_if_eq VAR_RESULT, MALE, Route25_SeaCottage_EventScript_BillAskForHelpMale + goto_if_eq VAR_RESULT, FEMALE, Route25_SeaCottage_EventScript_BillAskForHelpFemale end Route25_SeaCottage_EventScript_BillAskForHelpMale:: @@ -46,19 +44,14 @@ Route25_SeaCottage_EventScript_BillAskForHelpFemale:: end Route25_SeaCottage_EventScript_BillAskForHelp:: - compare VAR_RESULT, NO - call_if_eq Route25_SeaCottage_EventScript_DeclineHelpBill + call_if_eq VAR_RESULT, NO, Route25_SeaCottage_EventScript_DeclineHelpBill msgbox Route25_SeaCottage_Text_RunCellSeparationOnPC closemessage delay 10 - compare VAR_FACING, DIR_SOUTH - call_if_eq Route25_SeaCottage_EventScript_BillWalkToTeleporterSouth - compare VAR_FACING, DIR_NORTH - call_if_eq Route25_SeaCottage_EventScript_BillWalkToTeleporter - compare VAR_FACING, DIR_WEST - call_if_eq Route25_SeaCottage_EventScript_BillWalkToTeleporter - compare VAR_FACING, DIR_EAST - call_if_eq Route25_SeaCottage_EventScript_BillWalkToTeleporter + call_if_eq VAR_FACING, DIR_SOUTH, Route25_SeaCottage_EventScript_BillWalkToTeleporterSouth + call_if_eq VAR_FACING, DIR_NORTH, Route25_SeaCottage_EventScript_BillWalkToTeleporter + call_if_eq VAR_FACING, DIR_WEST, Route25_SeaCottage_EventScript_BillWalkToTeleporter + call_if_eq VAR_FACING, DIR_EAST, Route25_SeaCottage_EventScript_BillWalkToTeleporter opendoor 10, 3 waitdooranim applymovement LOCALID_BILL_CLEFAIRY, Route25_SeaCottage_Movement_BillEnterTeleporter @@ -74,10 +67,8 @@ Route25_SeaCottage_EventScript_BillAskForHelp:: @ Just returns after message, execution continues as if player had said yes Route25_SeaCottage_EventScript_DeclineHelpBill:: checkplayergender - compare VAR_RESULT, MALE - call_if_eq Route25_SeaCottage_EventScript_DeclineHelpBillMale - compare VAR_RESULT, FEMALE - call_if_eq Route25_SeaCottage_EventScript_DeclineHelpBillFemale + call_if_eq VAR_RESULT, MALE, Route25_SeaCottage_EventScript_DeclineHelpBillMale + call_if_eq VAR_RESULT, FEMALE, Route25_SeaCottage_EventScript_DeclineHelpBillFemale return Route25_SeaCottage_EventScript_DeclineHelpBillMale:: @@ -106,13 +97,10 @@ Route25_SeaCottage_EventScript_BillGoToSSAnne:: Route25_SeaCottage_EventScript_BillGiveSSTicket:: famechecker FAMECHECKER_BILL, FCPICKSTATE_COLORED, UpdatePickStateFromSpecialVar8005 checkplayergender - compare VAR_RESULT, MALE - call_if_eq Route25_SeaCottage_EventScript_BillThanksMale - compare VAR_RESULT, FEMALE - call_if_eq Route25_SeaCottage_EventScript_BillThanksFemale - checkitemspace ITEM_SS_TICKET, 1 - compare VAR_RESULT, FALSE - goto_if_eq Route25_SeaCottage_EventScript_NoRoomForSSTicket + call_if_eq VAR_RESULT, MALE, Route25_SeaCottage_EventScript_BillThanksMale + call_if_eq VAR_RESULT, FEMALE, Route25_SeaCottage_EventScript_BillThanksFemale + checkitemspace ITEM_SS_TICKET + goto_if_eq VAR_RESULT, FALSE, Route25_SeaCottage_EventScript_NoRoomForSSTicket giveitem_msg Route25_SeaCottage_Text_ReceivedSSTicketFromBill, ITEM_SS_TICKET, 1, MUS_OBTAIN_KEY_ITEM setflag FLAG_GOT_SS_TICKET_DUP setflag FLAG_HIDE_NUGGET_BRIDGE_ROCKET @@ -149,7 +137,7 @@ Route25_SeaCottage_Movement_BillWalkToTeleporterSouth:: walk_up walk_up walk_left - walk_in_place_fastest_up + walk_in_place_faster_up step_end Route25_SeaCottage_Movement_BillEnterTeleporter:: @@ -258,36 +246,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..40ffb77da 100644 --- a/data/maps/Route2_EastBuilding/scripts.inc +++ b/data/maps/Route2_EastBuilding/scripts.inc @@ -9,18 +9,15 @@ Route2_EastBuilding_EventScript_Aide:: call Route2_EastBuilding_EventScript_GetAideRequestInfo goto_if_set FLAG_GOT_HM05, Route2_EastBuilding_EventScript_AlreadyGotHM05 msgbox Route2_EastBuilding_Text_GiveHM05IfSeen10Mons, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq Aide_EventScript_DeclineCheckMons + goto_if_eq VAR_RESULT, NO, 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 + goto_if_lt VAR_0x8006, REQUIRED_SEEN_MONS, Aide_EventScript_HaventCaughtEnough msgbox Route2_EastBuilding_Text_GreatHereYouGo - checkitemspace ITEM_HM05, 1 - compare VAR_RESULT, FALSE - goto_if_eq Aide_EventScript_NoRoomForItem + checkitemspace ITEM_HM05 + goto_if_eq VAR_RESULT, FALSE, Aide_EventScript_NoRoomForItem giveitem_msg Route2_EastBuilding_Text_ReceivedHM05FromAide, ITEM_HM05 setflag FLAG_GOT_HM05 msgbox Route2_EastBuilding_Text_ExplainHM05 @@ -33,8 +30,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..7ee088f62 100644 --- a/data/maps/Route2_House/scripts.inc +++ b/data/maps/Route2_House/scripts.inc @@ -12,14 +12,11 @@ Route2_House_EventScript_Reyley:: call EventScript_GetInGameTradeSpeciesInfo goto_if_set FLAG_DID_MIMIEN_TRADE, Route2_House_EventScript_AlreadyTraded msgbox Trade_Text_LookingForMonWannaTradeForMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq Route2_House_EventScript_DeclineTrade + goto_if_eq VAR_RESULT, NO, Route2_House_EventScript_DeclineTrade call EventScript_ChooseMonForInGameTrade - compare VAR_0x8004, PARTY_SIZE - goto_if_ge Route2_House_EventScript_DeclineTrade + goto_if_ge VAR_0x8004, PARTY_SIZE, Route2_House_EventScript_DeclineTrade call EventScript_GetInGameTradeSpecies - compare VAR_RESULT, VAR_0x8009 - goto_if_ne Route2_House_EventScript_NotRequestedMon + goto_if_ne VAR_RESULT, VAR_0x8009, Route2_House_EventScript_NotRequestedMon call EventScript_DoInGameTrade msgbox Trade_Text_HeyThanks setflag FLAG_DID_MIMIEN_TRADE @@ -32,7 +29,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..32d2ff660 100644 --- a/data/maps/Route4_PokemonCenter_1F/scripts.inc +++ b/data/maps/Route4_PokemonCenter_1F/scripts.inc @@ -24,12 +24,10 @@ Route4_PokemonCenter_1F_EventScript_MagikarpSalesman:: lock faceplayer goto_if_set FLAG_BOUGHT_MAGIKARP, Route4_PokemonCenter_1F_EventScript_AlreadyBoughtMagikarp - showmoneybox 0, 0, 0 + showmoneybox 0, 0 checkplayergender - compare VAR_RESULT, MALE - goto_if_eq Route4_PokemonCenter_1F_EventScript_AskBuyMagikarpMale - compare VAR_RESULT, FEMALE - goto_if_eq Route4_PokemonCenter_1F_EventScript_AskBuyMagikarpFemale + goto_if_eq VAR_RESULT, MALE, Route4_PokemonCenter_1F_EventScript_AskBuyMagikarpMale + goto_if_eq VAR_RESULT, FEMALE, Route4_PokemonCenter_1F_EventScript_AskBuyMagikarpFemale end Route4_PokemonCenter_1F_EventScript_AskBuyMagikarpMale:: @@ -43,30 +41,24 @@ Route4_PokemonCenter_1F_EventScript_AskBuyMagikarpFemale:: end Route4_PokemonCenter_1F_EventScript_TryBuyMagikarp:: - compare VAR_RESULT, NO - goto_if_eq Route4_PokemonCenter_1F_EventScript_DeclineMagikarp - checkmoney MAGIKARP_PRICE, 0 - compare VAR_RESULT, FALSE - goto_if_eq Route4_PokemonCenter_1F_EventScript_NotEnoughMoney - textcolor 3 + goto_if_eq VAR_RESULT, NO, Route4_PokemonCenter_1F_EventScript_DeclineMagikarp + checkmoney MAGIKARP_PRICE + goto_if_eq VAR_RESULT, FALSE, Route4_PokemonCenter_1F_EventScript_NotEnoughMoney + textcolor NPC_TEXT_COLOR_NEUTRAL setvar VAR_TEMP_1, SPECIES_MAGIKARP - givemon SPECIES_MAGIKARP, 5, ITEM_NONE - compare VAR_RESULT, 0 - goto_if_eq Route4_PokemonCenter_1F_EventScript_BuyMagikarpParty - compare VAR_RESULT, 1 - goto_if_eq Route4_PokemonCenter_1F_EventScript_BuyMagikarpPC - compare VAR_RESULT, 2 - goto_if_eq Route4_PokemonCenter_1F_EventScript_NoRoomForMagikarp + givemon SPECIES_MAGIKARP, 5 + goto_if_eq VAR_RESULT, 0, Route4_PokemonCenter_1F_EventScript_BuyMagikarpParty + goto_if_eq VAR_RESULT, 1, Route4_PokemonCenter_1F_EventScript_BuyMagikarpPC + goto_if_eq VAR_RESULT, 2, Route4_PokemonCenter_1F_EventScript_NoRoomForMagikarp end Route4_PokemonCenter_1F_EventScript_BuyMagikarpParty:: call Route4_PokemonCenter_1F_EventScript_PayForMagikarp msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq Route4_PokemonCenter_1F_EventScript_EndPurchaseMagikarp + goto_if_eq VAR_RESULT, NO, 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 @@ -75,10 +67,9 @@ Route4_PokemonCenter_1F_EventScript_BuyMagikarpParty:: Route4_PokemonCenter_1F_EventScript_BuyMagikarpPC:: call Route4_PokemonCenter_1F_EventScript_PayForMagikarp msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq Route4_PokemonCenter_1F_EventScript_TransferMagikarpCloseMoneyBox + goto_if_eq VAR_RESULT, NO, Route4_PokemonCenter_1F_EventScript_TransferMagikarpCloseMoneyBox fadescreen FADE_TO_BLACK - hidemoneybox 0, 0 + hidemoneybox special ChangeBoxPokemonNickname waitstate lock @@ -97,7 +88,7 @@ Route4_PokemonCenter_1F_EventScript_TransferMagikarp:: end Route4_PokemonCenter_1F_EventScript_EndPurchaseMagikarp:: - hidemoneybox 0, 0 + hidemoneybox goto Route4_PokemonCenter_1F_EventScript_BoughtMagikarp end @@ -107,24 +98,24 @@ Route4_PokemonCenter_1F_EventScript_BoughtMagikarp:: end Route4_PokemonCenter_1F_EventScript_PayForMagikarp:: - removemoney MAGIKARP_PRICE, 0 - updatemoneybox 0, 0, 0 + removemoney MAGIKARP_PRICE + 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 @@ -134,9 +125,9 @@ Route4_PokemonCenter_1F_EventScript_AlreadyBoughtMagikarp:: end Route4_PokemonCenter_1F_EventScript_NoRoomForMagikarp:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox Route4_PokemonCenter_1F_Text_NoRoomForMorePokemon - hidemoneybox 0, 0 + hidemoneybox release end diff --git a/data/maps/Route5_SouthEntrance/scripts.inc b/data/maps/Route5_SouthEntrance/scripts.inc index f9a914e26..fe8e06607 100644 --- a/data/maps/Route5_SouthEntrance/scripts.inc +++ b/data/maps/Route5_SouthEntrance/scripts.inc @@ -24,8 +24,8 @@ Route5_SouthEntrance_EventScript_GuardTriggerRight:: end Route5_SouthEntrance_EventScript_GuardTrigger:: - textcolor 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + textcolor NPC_TEXT_COLOR_MALE + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 goto_if_set FLAG_GOT_TEA, Route5_SouthEntrance_EventScript_GiveTea msgbox Route5_SouthEntrance_Text_ThirstyOnGuardDuty @@ -36,19 +36,16 @@ Route5_SouthEntrance_EventScript_GuardTrigger:: end Route5_SouthEntrance_EventScript_GiveTea:: - removeitem ITEM_TEA, 1 + removeitem ITEM_TEA goto Route5_SouthEntrance_EventScript_GuardDrinkTea end Route5_SouthEntrance_EventScript_GuardDrinkTea:: msgbox Route5_SouthEntrance_Text_ThatTeaLooksTasty closemessage - compare VAR_TEMP_1, 0 - call_if_eq Route5_SouthEntrance_EventScript_WalkToGuardLeft - compare VAR_TEMP_1, 1 - call_if_eq Route5_SouthEntrance_EventScript_WalkToGuardMid - compare VAR_TEMP_1, 2 - call_if_eq Route5_SouthEntrance_EventScript_WalkToGuardRight + call_if_eq VAR_TEMP_1, 0, Route5_SouthEntrance_EventScript_WalkToGuardLeft + call_if_eq VAR_TEMP_1, 1, Route5_SouthEntrance_EventScript_WalkToGuardMid + call_if_eq VAR_TEMP_1, 2, Route5_SouthEntrance_EventScript_WalkToGuardRight msgbox Route5_SouthEntrance_Text_ThanksIllShareTeaWithGuards setvar VAR_MAP_SCENE_ROUTE5_ROUTE6_ROUTE7_ROUTE8_GATES, 1 releaseall diff --git a/data/maps/Route6_NorthEntrance/scripts.inc b/data/maps/Route6_NorthEntrance/scripts.inc index 6fbbfe87d..9f27430d6 100644 --- a/data/maps/Route6_NorthEntrance/scripts.inc +++ b/data/maps/Route6_NorthEntrance/scripts.inc @@ -24,8 +24,8 @@ Route6_NorthEntrance_EventScript_GuardTriggerRight:: end Route6_NorthEntrance_EventScript_GuardTrigger:: - textcolor 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + textcolor NPC_TEXT_COLOR_MALE + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 goto_if_set FLAG_GOT_TEA, Route6_NorthEntrance_EventScript_GiveTea msgbox Route6_NorthEntrance_Text_ThirstyOnGuardDuty @@ -36,19 +36,16 @@ Route6_NorthEntrance_EventScript_GuardTrigger:: end Route6_NorthEntrance_EventScript_GiveTea:: - removeitem ITEM_TEA, 1 + removeitem ITEM_TEA goto Route6_NorthEntrance_EventScript_GuardDrinkTea end Route6_NorthEntrance_EventScript_GuardDrinkTea:: msgbox Route6_NorthEntrance_Text_ThatTeaLooksTasty closemessage - compare VAR_TEMP_1, 0 - call_if_eq Route6_NorthEntrance_EventScript_WalkToGuardLeft - compare VAR_TEMP_1, 1 - call_if_eq Route6_NorthEntrance_EventScript_WalkToGuardMid - compare VAR_TEMP_1, 2 - call_if_eq Route6_NorthEntrance_EventScript_WalkToGuardRight + call_if_eq VAR_TEMP_1, 0, Route6_NorthEntrance_EventScript_WalkToGuardLeft + call_if_eq VAR_TEMP_1, 1, Route6_NorthEntrance_EventScript_WalkToGuardMid + call_if_eq VAR_TEMP_1, 2, Route6_NorthEntrance_EventScript_WalkToGuardRight msgbox Route6_NorthEntrance_Text_ThanksIllShareTeaWithGuards setvar VAR_MAP_SCENE_ROUTE5_ROUTE6_ROUTE7_ROUTE8_GATES, 1 releaseall diff --git a/data/maps/Route7_EastEntrance/scripts.inc b/data/maps/Route7_EastEntrance/scripts.inc index 6786a148b..30c776d0b 100644 --- a/data/maps/Route7_EastEntrance/scripts.inc +++ b/data/maps/Route7_EastEntrance/scripts.inc @@ -24,8 +24,8 @@ Route7_EastEntrance_EventScript_GuardTriggerBottom:: end Route7_EastEntrance_EventScript_GuardTrigger:: - textcolor 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + textcolor NPC_TEXT_COLOR_MALE + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 goto_if_set FLAG_GOT_TEA, Route7_EastEntrance_EventScript_GiveTea msgbox Route7_EastEntrance_Text_ThirstyOnGuardDuty @@ -36,19 +36,16 @@ Route7_EastEntrance_EventScript_GuardTrigger:: end Route7_EastEntrance_EventScript_GiveTea:: - removeitem ITEM_TEA, 1 + removeitem ITEM_TEA goto Route7_EastEntrance_EventScript_GuardDrinkTea end Route7_EastEntrance_EventScript_GuardDrinkTea:: msgbox Route7_EastEntrance_Text_ThatTeaLooksTasty closemessage - compare VAR_TEMP_1, 0 - call_if_eq Route7_EastEntrance_WalkToGuardTop - compare VAR_TEMP_1, 1 - call_if_eq Route7_EastEntrance_WalkToGuardMid - compare VAR_TEMP_1, 2 - call_if_eq Route7_EastEntrance_WalkToGuardBottom + call_if_eq VAR_TEMP_1, 0, Route7_EastEntrance_WalkToGuardTop + call_if_eq VAR_TEMP_1, 1, Route7_EastEntrance_WalkToGuardMid + call_if_eq VAR_TEMP_1, 2, Route7_EastEntrance_WalkToGuardBottom msgbox Route7_EastEntrance_Text_ThanksIllShareTeaWithGuards setvar VAR_MAP_SCENE_ROUTE5_ROUTE6_ROUTE7_ROUTE8_GATES, 1 releaseall diff --git a/data/maps/Route8_WestEntrance/scripts.inc b/data/maps/Route8_WestEntrance/scripts.inc index f9ca6bda5..1ef74df1b 100644 --- a/data/maps/Route8_WestEntrance/scripts.inc +++ b/data/maps/Route8_WestEntrance/scripts.inc @@ -24,8 +24,8 @@ Route8_WestEntrance_EventScript_GuardTriggerBottom:: end Route8_WestEntrance_EventScript_GuardTrigger:: - textcolor 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + textcolor NPC_TEXT_COLOR_MALE + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 goto_if_set FLAG_GOT_TEA, Route8_WestEntrance_EventScript_GiveTea msgbox Route8_WestEntrance_Text_ThirstyOnGuardDuty @@ -36,31 +36,28 @@ Route8_WestEntrance_EventScript_GuardTrigger:: end Route8_WestEntrance_EventScript_GiveTea:: - removeitem ITEM_TEA, 1 + removeitem ITEM_TEA goto Route8_WestEntrance_EventScript_GuardDrinkTea end @ Unused Route8_WestEntrance_EventScript_GiveSodaPop:: - removeitem ITEM_SODA_POP, 1 + removeitem ITEM_SODA_POP goto Route8_WestEntrance_EventScript_GuardDrinkTea end @ Unused Route8_WestEntrance_EventScript_GiveLemonade:: - removeitem ITEM_LEMONADE, 1 + removeitem ITEM_LEMONADE goto Route8_WestEntrance_EventScript_GuardDrinkTea end Route8_WestEntrance_EventScript_GuardDrinkTea:: msgbox Route8_WestEntrance_Text_ThatTeaLooksTasty closemessage - compare VAR_TEMP_1, 0 - call_if_eq Route8_WestEntrance_EventScript_WalkToGuardTop - compare VAR_TEMP_1, 1 - call_if_eq Route8_WestEntrance_EventScript_WalkToGuardMid - compare VAR_TEMP_1, 2 - call_if_eq Route8_WestEntrance_EventScript_WalkToGuardBottom + call_if_eq VAR_TEMP_1, 0, Route8_WestEntrance_EventScript_WalkToGuardTop + call_if_eq VAR_TEMP_1, 1, Route8_WestEntrance_EventScript_WalkToGuardMid + call_if_eq VAR_TEMP_1, 2, Route8_WestEntrance_EventScript_WalkToGuardBottom msgbox Route8_WestEntrance_Text_ThanksIllShareTeaWithGuards setvar VAR_MAP_SCENE_ROUTE5_ROUTE6_ROUTE7_ROUTE8_GATES, 1 releaseall diff --git a/data/maps/SSAnne_1F_Room4/scripts.inc b/data/maps/SSAnne_1F_Room4/scripts.inc index c2fe4a166..2af139b97 100644 --- a/data/maps/SSAnne_1F_Room4/scripts.inc +++ b/data/maps/SSAnne_1F_Room4/scripts.inc @@ -5,8 +5,7 @@ SSAnne_1F_Room4_EventScript_Woman:: lock faceplayer checkplayergender - compare VAR_RESULT, MALE - goto_if_eq SSAnne_1F_Room4_EventScript_WomanPlayerMale + goto_if_eq VAR_RESULT, MALE, SSAnne_1F_Room4_EventScript_WomanPlayerMale msgbox SSAnne_1F_Room4_Text_WaitressCherryPiePlease release end diff --git a/data/maps/SSAnne_1F_Room6/scripts.inc b/data/maps/SSAnne_1F_Room6/scripts.inc index d416dd818..7024b8273 100644 --- a/data/maps/SSAnne_1F_Room6/scripts.inc +++ b/data/maps/SSAnne_1F_Room6/scripts.inc @@ -5,8 +5,7 @@ SSAnne_1F_Room6_EventScript_Woman:: lock faceplayer msgbox SSAnne_1F_Room6_Text_TakeAShortRest, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq SSAnne_1F_Room6_EventScript_DeclineHeal + goto_if_eq VAR_RESULT, NO, SSAnne_1F_Room6_EventScript_DeclineHeal closemessage call EventScript_OutOfCenterPartyHeal msgbox SSAnne_1F_Room6_Text_GladEveryoneIsRefreshed @@ -15,8 +14,7 @@ SSAnne_1F_Room6_EventScript_Woman:: SSAnne_1F_Room6_EventScript_DeclineHeal:: checkplayergender - compare VAR_RESULT, MALE - goto_if_eq SSAnne_1F_Room6_EventScript_DeclineHealMale + goto_if_eq VAR_RESULT, MALE, SSAnne_1F_Room6_EventScript_DeclineHealMale msgbox SSAnne_1F_Room6_Text_SorryYouLookLikeMySister release end diff --git a/data/maps/SSAnne_2F_Corridor/scripts.inc b/data/maps/SSAnne_2F_Corridor/scripts.inc index c2feafdbd..e3d30efe1 100644 --- a/data/maps/SSAnne_2F_Corridor/scripts.inc +++ b/data/maps/SSAnne_2F_Corridor/scripts.inc @@ -22,39 +22,30 @@ SSAnne_2F_Corridor_EventScript_RivalTriggerRight:: end SSAnne_2F_Corridor_EventScript_RivalTrigger:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE playse SE_EXIT delay 5 playbgm MUS_ENCOUNTER_RIVAL, 0 addobject LOCALID_RIVAL delay 10 - applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestDown + applymovement LOCALID_RIVAL, Movement_WalkInPlaceFasterDown waitmovement 0 delay 20 - compare VAR_TEMP_1, 0 - call_if_eq SSAnne_2F_Corridor_EventScript_RivalApproachLeft - compare VAR_TEMP_1, 1 - call_if_eq SSAnne_2F_Corridor_EventScript_RivalApproachMid - compare VAR_TEMP_1, 2 - call_if_eq SSAnne_2F_Corridor_EventScript_RivalApproachRight + call_if_eq VAR_TEMP_1, 0, SSAnne_2F_Corridor_EventScript_RivalApproachLeft + call_if_eq VAR_TEMP_1, 1, SSAnne_2F_Corridor_EventScript_RivalApproachMid + call_if_eq VAR_TEMP_1, 2, SSAnne_2F_Corridor_EventScript_RivalApproachRight msgbox SSAnne_2F_Corridor_Text_RivalIntro setvar VAR_LAST_TALKED, LOCALID_RIVAL - compare VAR_STARTER_MON, 2 - call_if_eq SSAnne_2F_Corridor_EventScript_RivalSquirtle - compare VAR_STARTER_MON, 1 - call_if_eq SSAnne_2F_Corridor_EventScript_RivalBulbasaur - compare VAR_STARTER_MON, 0 - call_if_eq SSAnne_2F_Corridor_EventScript_RivalCharmander + call_if_eq VAR_STARTER_MON, 2, SSAnne_2F_Corridor_EventScript_RivalSquirtle + call_if_eq VAR_STARTER_MON, 1, SSAnne_2F_Corridor_EventScript_RivalBulbasaur + call_if_eq VAR_STARTER_MON, 0, SSAnne_2F_Corridor_EventScript_RivalCharmander msgbox SSAnne_2F_Corridor_Text_RivalPostBattle closemessage delay 10 playbgm MUS_RIVAL_EXIT, 0 - compare VAR_TEMP_1, 0 - call_if_eq SSAnne_2F_Corridor_EventScript_RivalExitLeft - compare VAR_TEMP_1, 1 - call_if_eq SSAnne_2F_Corridor_EventScript_RivalExitMid - compare VAR_TEMP_1, 2 - call_if_eq SSAnne_2F_Corridor_EventScript_RivalExitRight + call_if_eq VAR_TEMP_1, 0, SSAnne_2F_Corridor_EventScript_RivalExitLeft + call_if_eq VAR_TEMP_1, 1, SSAnne_2F_Corridor_EventScript_RivalExitMid + call_if_eq VAR_TEMP_1, 2, SSAnne_2F_Corridor_EventScript_RivalExitRight fadedefaultbgm removeobject LOCALID_RIVAL setvar VAR_MAP_SCENE_S_S_ANNE_2F_CORRIDOR, 1 @@ -110,7 +101,7 @@ SSAnne_2F_Corridor_Movement_PlayerFaceRivalRight:: delay_16 delay_16 delay_16 - walk_in_place_fastest_left + walk_in_place_faster_left step_end SSAnne_2F_Corridor_Movement_PlayerFaceRivalMid:: @@ -118,7 +109,7 @@ SSAnne_2F_Corridor_Movement_PlayerFaceRivalMid:: delay_16 delay_16 delay_16 - walk_in_place_fastest_left + walk_in_place_faster_left step_end SSAnne_2F_Corridor_Movement_RivalApproachLeft:: @@ -132,7 +123,7 @@ SSAnne_2F_Corridor_Movement_RivalApproachMid:: walk_down walk_down walk_down - walk_in_place_fastest_right + walk_in_place_faster_right step_end SSAnne_2F_Corridor_Movement_RivalApproachRight:: 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/SSAnne_CaptainsOffice/scripts.inc b/data/maps/SSAnne_CaptainsOffice/scripts.inc index 95088fcc6..485b93807 100644 --- a/data/maps/SSAnne_CaptainsOffice/scripts.inc +++ b/data/maps/SSAnne_CaptainsOffice/scripts.inc @@ -7,7 +7,7 @@ SSAnne_CaptainsOffice_EventScript_Captain:: lock goto_if_set FLAG_GOT_HM01, SSAnne_CaptainsOffice_EventScript_AlreadyGotCut msgbox SSAnne_CaptainsOffice_Text_CaptainIFeelSeasick - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL message SSAnne_CaptainsOffice_Text_RubbedCaptainsBack waitmessage playfanfare MUS_HEAL diff --git a/data/maps/SSAnne_Exterior/scripts.inc b/data/maps/SSAnne_Exterior/scripts.inc index acd1c6aac..e6043855d 100644 --- a/data/maps/SSAnne_Exterior/scripts.inc +++ b/data/maps/SSAnne_Exterior/scripts.inc @@ -16,10 +16,8 @@ SSAnne_Exterior_OnFrame:: SSAnne_Exterior_ExitSSAnne:: lockall getplayerxy VAR_0x8004, VAR_0x8005 - compare VAR_0x8005, 6 - call_if_le SSAnne_Exterior_WalkDown - compare VAR_0x8005, 7 - call_if_ge SSAnne_Exterior_WalkInPlaceDown + call_if_le VAR_0x8005, 6, SSAnne_Exterior_WalkDown + call_if_ge VAR_0x8005, 7, SSAnne_Exterior_WalkInPlaceDown fadenewbgm MUS_SURF delay 50 special DoSSAnneDepartureCutscene @@ -29,7 +27,7 @@ SSAnne_Exterior_ExitSSAnne:: waitmovement 0 setvar VAR_MAP_SCENE_VERMILION_CITY, 2 setvar VAR_VERMILION_CITY_TICKET_CHECK_TRIGGER, 0 - warp MAP_VERMILION_CITY, 255, 23, 34 + warp MAP_VERMILION_CITY, 23, 34 waitstate releaseall end @@ -40,7 +38,7 @@ SSAnne_Exterior_WalkDown:: return SSAnne_Exterior_WalkInPlaceDown:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown waitmovement 0 return diff --git a/data/maps/SSAnne_Kitchen/scripts.inc b/data/maps/SSAnne_Kitchen/scripts.inc index 7ce4c6a3e..f90554c88 100644 --- a/data/maps/SSAnne_Kitchen/scripts.inc +++ b/data/maps/SSAnne_Kitchen/scripts.inc @@ -19,12 +19,9 @@ SSAnne_Kitchen_EventScript_Chef4:: msgbox SSAnne_Kitchen_Text_IAmLeChefMainCourseIs random 3 copyvar VAR_0x8008, VAR_RESULT - compare VAR_0x8008, 0 - call_if_eq SSAnne_Kitchen_EventScript_SalmonDuSalad - compare VAR_0x8008, 1 - call_if_eq SSAnne_Kitchen_EventScript_EelsAuBarbecue - compare VAR_0x8008, 2 - call_if_eq SSAnne_Kitchen_EventScript_PrimeBeefsteak + call_if_eq VAR_0x8008, 0, SSAnne_Kitchen_EventScript_SalmonDuSalad + call_if_eq VAR_0x8008, 1, SSAnne_Kitchen_EventScript_EelsAuBarbecue + call_if_eq VAR_0x8008, 2, SSAnne_Kitchen_EventScript_PrimeBeefsteak release end diff --git a/data/maps/SafariZone_SecretHouse/scripts.inc b/data/maps/SafariZone_SecretHouse/scripts.inc index 8b3102f82..357359e2d 100644 --- a/data/maps/SafariZone_SecretHouse/scripts.inc +++ b/data/maps/SafariZone_SecretHouse/scripts.inc @@ -6,9 +6,8 @@ SafariZone_SecretHouse_EventScript_Attendant:: faceplayer goto_if_set FLAG_GOT_HM03, SafariZone_SecretHouse_EventScript_ExplainSurf msgbox SafariZone_SecretHouse_Text_CongratsYouveWon - checkitemspace ITEM_HM03, 1 - compare VAR_RESULT, FALSE - goto_if_eq SafariZone_SecretHouse_EventScript_NoRoomForHM03 + checkitemspace ITEM_HM03 + goto_if_eq VAR_RESULT, FALSE, SafariZone_SecretHouse_EventScript_NoRoomForHM03 giveitem_msg SafariZone_SecretHouse_Text_ReceivedHM03FromAttendant, ITEM_HM03 msgbox SafariZone_SecretHouse_Text_ExplainSurf setflag FLAG_GOT_HM03 diff --git a/data/maps/SaffronCity/scripts.inc b/data/maps/SaffronCity/scripts.inc index 44dba429b..530ce140c 100644 --- a/data/maps/SaffronCity/scripts.inc +++ b/data/maps/SaffronCity/scripts.inc @@ -51,7 +51,7 @@ SaffronCity_EventScript_DoorGuardGrunt:: end SaffronCity_EventScript_DoorGuardAsleep:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox SaffronCity_Text_HesTakingASnooze release end diff --git a/data/maps/SaffronCity_CopycatsHouse_2F/scripts.inc b/data/maps/SaffronCity_CopycatsHouse_2F/scripts.inc index e30cb601b..12f8ada3c 100644 --- a/data/maps/SaffronCity_CopycatsHouse_2F/scripts.inc +++ b/data/maps/SaffronCity_CopycatsHouse_2F/scripts.inc @@ -22,14 +22,11 @@ SaffronCity_CopycatsHouse_2F_EventScript_Copycat:: special QuestLog_CutRecording lock faceplayer - checkitem ITEM_POKE_DOLL, 1 - compare VAR_RESULT, TRUE - goto_if_eq EventScript_MimicTutor + checkitem ITEM_POKE_DOLL + goto_if_eq VAR_RESULT, TRUE, EventScript_MimicTutor checkplayergender - compare VAR_RESULT, MALE - call_if_eq SaffronCity_CopycatsHouse_2F_EventScript_MimicPlayerMale - compare VAR_RESULT, FEMALE - call_if_eq SaffronCity_CopycatsHouse_2F_EventScript_MimicPlayerFemale + call_if_eq VAR_RESULT, MALE, SaffronCity_CopycatsHouse_2F_EventScript_MimicPlayerMale + call_if_eq VAR_RESULT, FEMALE, SaffronCity_CopycatsHouse_2F_EventScript_MimicPlayerFemale release end diff --git a/data/maps/SaffronCity_Dojo/scripts.inc b/data/maps/SaffronCity_Dojo/scripts.inc index 2cc0b23bc..680dc871e 100644 --- a/data/maps/SaffronCity_Dojo/scripts.inc +++ b/data/maps/SaffronCity_Dojo/scripts.inc @@ -6,7 +6,7 @@ SaffronCity_Dojo_MapScripts:: SaffronCity_Dojo_EventScript_TriggerMasterBattleLeft:: lockall setvar VAR_MAP_SCENE_SAFFRON_CITY_DOJO, 1 - applymovement LOCALID_KARATE_MASTER, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_KARATE_MASTER, Movement_WalkInPlaceFasterLeft waitmovement 0 releaseall end @@ -14,7 +14,7 @@ SaffronCity_Dojo_EventScript_TriggerMasterBattleLeft:: SaffronCity_Dojo_EventScript_TriggerMasterBattleRight:: lockall setvar VAR_MAP_SCENE_SAFFRON_CITY_DOJO, 1 - applymovement LOCALID_KARATE_MASTER, Movement_WalkInPlaceFastestRight + applymovement LOCALID_KARATE_MASTER, Movement_WalkInPlaceFasterRight waitmovement 0 releaseall end @@ -23,16 +23,15 @@ 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 + applymovement LOCALID_KARATE_MASTER, Movement_WalkInPlaceFasterUp waitmovement 0 - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox SaffronCity_Dojo_Text_YouWantHitmonlee, MSGBOX_YESNO call EventScript_RestorePrevTextColor - compare VAR_RESULT, YES - goto_if_eq SaffronCity_Dojo_EventScript_GiveHitmon - erasemonpic + goto_if_eq VAR_RESULT, YES, SaffronCity_Dojo_EventScript_GiveHitmon + hidemonpic release end @@ -45,42 +44,37 @@ 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 + applymovement LOCALID_KARATE_MASTER, Movement_WalkInPlaceFasterUp waitmovement 0 - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox SaffronCity_Dojo_Text_YouWantHitmonchan, MSGBOX_YESNO call EventScript_RestorePrevTextColor - compare VAR_RESULT, YES - goto_if_eq SaffronCity_Dojo_EventScript_GiveHitmon - erasemonpic + goto_if_eq VAR_RESULT, YES, SaffronCity_Dojo_EventScript_GiveHitmon + hidemonpic release end SaffronCity_Dojo_EventScript_GiveHitmon:: - erasemonpic - givemon VAR_TEMP_1, 25, ITEM_NONE - compare VAR_RESULT, 0 - goto_if_eq SaffronCity_Dojo_EventScript_ReceivedHitmonParty - compare VAR_RESULT, 1 - goto_if_eq SaffronCity_Dojo_EventScript_ReceivedHitmonPC - compare VAR_RESULT, 2 - goto_if_eq EventScript_NoMoreRoomForPokemon + hidemonpic + givemon VAR_TEMP_1, 25 + goto_if_eq VAR_RESULT, 0, SaffronCity_Dojo_EventScript_ReceivedHitmonParty + goto_if_eq VAR_RESULT, 1, SaffronCity_Dojo_EventScript_ReceivedHitmonPC + goto_if_eq VAR_RESULT, 2, EventScript_NoMoreRoomForPokemon release end 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 waitfanfare setflag FLAG_GOT_HITMON_FROM_DOJO msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq SaffronCity_Dojo_EventScript_EndGiveMon + goto_if_eq VAR_RESULT, NO, SaffronCity_Dojo_EventScript_EndGiveMon call EventScript_GetGiftMonPartySlot call EventScript_ChangePokemonNickname goto SaffronCity_Dojo_EventScript_EndGiveMon @@ -88,15 +82,14 @@ 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 waitfanfare setflag FLAG_GOT_HITMON_FROM_DOJO msgbox Text_GiveNicknameToThisMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq SaffronCity_Dojo_EventScript_TransferredHitmonToPC + goto_if_eq VAR_RESULT, NO, SaffronCity_Dojo_EventScript_TransferredHitmonToPC call EventScript_NameReceivedBoxMon goto SaffronCity_Dojo_EventScript_TransferredHitmonToPC end diff --git a/data/maps/SaffronCity_Gym/scripts.inc b/data/maps/SaffronCity_Gym/scripts.inc index c142e9e7c..c9b1873fb 100644 --- a/data/maps/SaffronCity_Gym/scripts.inc +++ b/data/maps/SaffronCity_Gym/scripts.inc @@ -21,9 +21,8 @@ SaffronCity_Gym_EventScript_DefeatedSabrina:: SaffronCity_Gym_EventScript_GiveTM04:: msgbox SaffronCity_Gym_Text_ExplainMarshBadgeTakeThis - checkitemspace ITEM_TM04, 1 - compare VAR_RESULT, FALSE - goto_if_eq SaffronCity_Gym_EventScript_NoRoomForTM04 + checkitemspace ITEM_TM04 + goto_if_eq VAR_RESULT, FALSE, SaffronCity_Gym_EventScript_NoRoomForTM04 giveitem_msg SaffronCity_Gym_Text_ReceivedTM04FromSabrina, ITEM_TM04 setflag FLAG_GOT_TM04_FROM_SABRINA msgbox SaffronCity_Gym_Text_SabrinaPostBattle diff --git a/data/maps/SaffronCity_MrPsychicsHouse/scripts.inc b/data/maps/SaffronCity_MrPsychicsHouse/scripts.inc index 1455945d7..725d92d12 100644 --- a/data/maps/SaffronCity_MrPsychicsHouse/scripts.inc +++ b/data/maps/SaffronCity_MrPsychicsHouse/scripts.inc @@ -6,9 +6,8 @@ SaffronCity_MrPsychicsHouse_EventScript_MrPsychic:: faceplayer goto_if_set FLAG_GOT_TM29_FROM_MR_PSYCHIC, SaffronCity_MrPsychicsHouse_EventScript_AlreadyGotTM29 msgbox SaffronCity_MrPsychicsHouse_Text_YouWantedThis - checkitemspace ITEM_TM29, 1 - compare VAR_RESULT, FALSE - goto_if_eq SaffronCity_MrPsychicsHouse_EventScript_NoRoomForTM29 + checkitemspace ITEM_TM29 + goto_if_eq VAR_RESULT, FALSE, SaffronCity_MrPsychicsHouse_EventScript_NoRoomForTM29 giveitem_msg SaffronCity_MrPsychicsHouse_Text_ReceivedTM29FromMrPsychic, ITEM_TM29 msgbox SaffronCity_MrPsychicsHouse_Text_ExplainTM29 setflag FLAG_GOT_TM29_FROM_MR_PSYCHIC diff --git a/data/maps/SaffronCity_PokemonCenter_1F/scripts.inc b/data/maps/SaffronCity_PokemonCenter_1F/scripts.inc index 24986f8e8..8b4390f0a 100644 --- a/data/maps/SaffronCity_PokemonCenter_1F/scripts.inc +++ b/data/maps/SaffronCity_PokemonCenter_1F/scripts.inc @@ -25,8 +25,7 @@ SaffronCity_PokemonCenter_1F_EventScript_Woman:: SaffronCity_PokemonCenter_1F_EventScript_Youngster:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_eq SaffronCity_PokemonCenter_1F_EventScript_YoungsterRocketsGone + goto_if_eq VAR_MAP_SCENE_SILPH_CO_11F, 1, SaffronCity_PokemonCenter_1F_EventScript_YoungsterRocketsGone msgbox SaffronCity_PokemonCenter_1F_Text_GreatIfEliteFourCameBeatRockets release end diff --git a/data/maps/SaffronCity_PokemonTrainerFanClub/scripts.inc b/data/maps/SaffronCity_PokemonTrainerFanClub/scripts.inc index 4bd8bb684..d4979c25c 100644 --- a/data/maps/SaffronCity_PokemonTrainerFanClub/scripts.inc +++ b/data/maps/SaffronCity_PokemonTrainerFanClub/scripts.inc @@ -18,8 +18,8 @@ SaffronCity_PokemonTrainerFanClub_OnFrame:: SaffronCity_PokemonTrainerFanClub_EventScript_MeetFirstFans:: lockall - textcolor 1 - applymovement LOCALID_BATTLE_GIRL, Movement_WalkInPlaceFastestDown + textcolor NPC_TEXT_COLOR_FEMALE + applymovement LOCALID_BATTLE_GIRL, Movement_WalkInPlaceFasterDown waitmovement 0 playse SE_PIN applymovement LOCALID_BATTLE_GIRL, Movement_ExclamationMark @@ -30,7 +30,7 @@ SaffronCity_PokemonTrainerFanClub_EventScript_MeetFirstFans:: closemessage applymovement LOCALID_BATTLE_GIRL, SaffronCity_PokemonTrainerFanClub_Movement_FanApproachPlayer waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 msgbox SaffronCity_PokemonTrainerFanClub_Text_YourePlayerWereYourFansNow setvar VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 2 @@ -50,7 +50,7 @@ SaffronCity_PokemonTrainerFanClub_Movement_FanApproachPlayer:: @ Unused, leftover from RS LilycoveCity_PokemonTrainerFanClub_Movement_FanApproachPlayer:: delay_8 - walk_in_place_fastest_down + walk_in_place_faster_down walk_down walk_down walk_down @@ -71,7 +71,7 @@ LilycoveCity_PokemonTrainerFanClub_Movement_LittleGirlWatchPlayer:: @ Unused, leftover from RS LilycoveCity_PokemonTrainerFanClub_Movement_LittleGirlMoveCloserToPlayer:: walk_down - walk_in_place_fastest_right + walk_in_place_faster_right step_end @ Unused, leftover from RS @@ -80,50 +80,40 @@ LilycoveCity_PokemonTrainerFanClub_Movement_LittleGirlHideFromPlayer:: walk_fast_up walk_fast_up walk_fast_right - walk_in_place_fastest_down + walk_in_place_faster_down step_end SaffronCity_PokemonTrainerFanClub_OnTransition:: - compare VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 1 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_SetMemberPosForFirstMeeting - compare VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 2 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_UpdateFanMemberPositions + goto_if_eq VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 1, SaffronCity_PokemonTrainerFanClub_EventScript_SetMemberPosForFirstMeeting + goto_if_eq VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 2, SaffronCity_PokemonTrainerFanClub_EventScript_UpdateFanMemberPositions end SaffronCity_PokemonTrainerFanClub_EventScript_UpdateFanMemberPositions:: special Script_TryLoseFansFromPlayTime setvar VAR_0x8004, FANCLUB_MEMBER1 specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, FALSE - call_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember1ToFarTable + call_if_eq VAR_RESULT, FALSE, SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember1ToFarTable setvar VAR_0x8004, FANCLUB_MEMBER2 specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, FALSE - call_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember2ToFarTable + call_if_eq VAR_RESULT, FALSE, SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember2ToFarTable setvar VAR_0x8004, FANCLUB_MEMBER3 specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, FALSE - call_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember3ToFarTable + call_if_eq VAR_RESULT, FALSE, SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember3ToFarTable setvar VAR_0x8004, FANCLUB_MEMBER4 specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, FALSE - call_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember4ToFarTable + call_if_eq VAR_RESULT, FALSE, SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember4ToFarTable setvar VAR_0x8004, FANCLUB_MEMBER5 specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, FALSE - call_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember5ToFarTable + call_if_eq VAR_RESULT, FALSE, SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember5ToFarTable setvar VAR_0x8004, FANCLUB_MEMBER6 specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, FALSE - call_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember6ToFarTable + call_if_eq VAR_RESULT, FALSE, SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember6ToFarTable setvar VAR_0x8004, FANCLUB_MEMBER7 specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, FALSE - call_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember7ToFarTable + call_if_eq VAR_RESULT, FALSE, SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember7ToFarTable setvar VAR_0x8004, FANCLUB_MEMBER8 specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, FALSE - call_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember8ToFarTable + call_if_eq VAR_RESULT, FALSE, SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember8ToFarTable end SaffronCity_PokemonTrainerFanClub_EventScript_MoveMember1ToFarTable:: @@ -179,22 +169,18 @@ SaffronCity_PokemonTrainerFanClub_EventScript_BattleGirl:: faceplayer setvar VAR_0x8004, FANCLUB_MEMBER1 special Script_BufferFanClubTrainerName - compare VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 0 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_BattleGirlPlayerNotChampion + goto_if_eq VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 0, SaffronCity_PokemonTrainerFanClub_EventScript_BattleGirlPlayerNotChampion specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, TRUE - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_BattleGirlPlayersFan + goto_if_eq VAR_RESULT, TRUE, SaffronCity_PokemonTrainerFanClub_EventScript_BattleGirlPlayersFan specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1) - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_BattleGirlOnlyNonFan + goto_if_eq VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1), SaffronCity_PokemonTrainerFanClub_EventScript_BattleGirlOnlyNonFan msgbox SaffronCity_PokemonTrainerFanClub_Text_WasYourFanNotAnymore release end SaffronCity_PokemonTrainerFanClub_EventScript_BattleGirlPlayersFan:: specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, 1 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_BattleGirlOnlyFan + goto_if_eq VAR_RESULT, 1, SaffronCity_PokemonTrainerFanClub_EventScript_BattleGirlOnlyFan msgbox SaffronCity_PokemonTrainerFanClub_Text_AlwaysCheerForYou release end @@ -219,22 +205,18 @@ SaffronCity_PokemonTrainerFanClub_EventScript_LittleGirl:: faceplayer setvar VAR_0x8004, FANCLUB_MEMBER4 special Script_BufferFanClubTrainerName - compare VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 0 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_LittleGirlPlayerNotChampion + goto_if_eq VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 0, SaffronCity_PokemonTrainerFanClub_EventScript_LittleGirlPlayerNotChampion specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, TRUE - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_LittleGirlPlayersFan + goto_if_eq VAR_RESULT, TRUE, SaffronCity_PokemonTrainerFanClub_EventScript_LittleGirlPlayersFan specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1) - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_LittleGirlOnlyNonFan + goto_if_eq VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1), SaffronCity_PokemonTrainerFanClub_EventScript_LittleGirlOnlyNonFan msgbox SaffronCity_PokemonTrainerFanClub_Text_WantToBeLikeSabrina release end SaffronCity_PokemonTrainerFanClub_EventScript_LittleGirlPlayersFan:: specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, 1 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_LittleGirlOnlyFan + goto_if_eq VAR_RESULT, 1, SaffronCity_PokemonTrainerFanClub_EventScript_LittleGirlOnlyFan msgbox SaffronCity_PokemonTrainerFanClub_Text_WantToBeLikeYouOneDay release end @@ -259,22 +241,18 @@ SaffronCity_PokemonTrainerFanClub_EventScript_Youngster:: faceplayer setvar VAR_0x8004, FANCLUB_MEMBER2 special Script_BufferFanClubTrainerName - compare VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 0 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_YoungsterPlayerNotChampion + goto_if_eq VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 0, SaffronCity_PokemonTrainerFanClub_EventScript_YoungsterPlayerNotChampion specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, TRUE - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_YoungsterPlayersFan + goto_if_eq VAR_RESULT, TRUE, SaffronCity_PokemonTrainerFanClub_EventScript_YoungsterPlayersFan specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1) - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_YoungsterOnlyNonFan + goto_if_eq VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1), SaffronCity_PokemonTrainerFanClub_EventScript_YoungsterOnlyNonFan msgbox SaffronCity_PokemonTrainerFanClub_Text_BrocksMyHero release end SaffronCity_PokemonTrainerFanClub_EventScript_YoungsterPlayersFan:: specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, 1 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_YoungsterOnlyFan + goto_if_eq VAR_RESULT, 1, SaffronCity_PokemonTrainerFanClub_EventScript_YoungsterOnlyFan msgbox SaffronCity_PokemonTrainerFanClub_Text_CanYouAutographShorts release end @@ -299,22 +277,18 @@ SaffronCity_PokemonTrainerFanClub_EventScript_Gentleman:: faceplayer setvar VAR_0x8004, FANCLUB_MEMBER3 special Script_BufferFanClubTrainerName - compare VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 0 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_GentlemanPlayerNotChampion + goto_if_eq VAR_MAP_SCENE_SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB, 0, SaffronCity_PokemonTrainerFanClub_EventScript_GentlemanPlayerNotChampion specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, TRUE - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_GentlemanPlayersFan + goto_if_eq VAR_RESULT, TRUE, SaffronCity_PokemonTrainerFanClub_EventScript_GentlemanPlayersFan specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1) - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_GentlemanOnlyNonFan + goto_if_eq VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1), SaffronCity_PokemonTrainerFanClub_EventScript_GentlemanOnlyNonFan msgbox SaffronCity_PokemonTrainerFanClub_Text_HmmAndYouAre release end SaffronCity_PokemonTrainerFanClub_EventScript_GentlemanPlayersFan:: specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, 1 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_GentlemanOnlyFan + goto_if_eq VAR_RESULT, 1, SaffronCity_PokemonTrainerFanClub_EventScript_GentlemanOnlyFan msgbox SaffronCity_PokemonTrainerFanClub_Text_HadPleasureOfWatchingYouBattle release end @@ -340,19 +314,16 @@ SaffronCity_PokemonTrainerFanClub_EventScript_Woman:: setvar VAR_0x8004, FANCLUB_MEMBER6 special Script_BufferFanClubTrainerName specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, TRUE - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_WomanPlayersFan + goto_if_eq VAR_RESULT, TRUE, SaffronCity_PokemonTrainerFanClub_EventScript_WomanPlayersFan specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1) - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_WomanOnlyNonFan + goto_if_eq VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1), SaffronCity_PokemonTrainerFanClub_EventScript_WomanOnlyNonFan msgbox SaffronCity_PokemonTrainerFanClub_Text_TrainerHasBeenOnFire release end SaffronCity_PokemonTrainerFanClub_EventScript_WomanPlayersFan:: specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, 1 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_WomanOnlyFan + goto_if_eq VAR_RESULT, 1, SaffronCity_PokemonTrainerFanClub_EventScript_WomanOnlyFan msgbox SaffronCity_PokemonTrainerFanClub_Text_AdoreWayYouBattle release end @@ -373,19 +344,16 @@ SaffronCity_PokemonTrainerFanClub_EventScript_Rocker:: setvar VAR_0x8004, FANCLUB_MEMBER5 special Script_BufferFanClubTrainerName specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, TRUE - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_RockerPlayersFan + goto_if_eq VAR_RESULT, TRUE, SaffronCity_PokemonTrainerFanClub_EventScript_RockerPlayersFan specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1) - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_RockerOnlyNonFan + goto_if_eq VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1), SaffronCity_PokemonTrainerFanClub_EventScript_RockerOnlyNonFan msgbox SaffronCity_PokemonTrainerFanClub_Text_LoveWayTrainerTalks release end SaffronCity_PokemonTrainerFanClub_EventScript_RockerPlayersFan:: specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, 1 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_RockerOnlyFan + goto_if_eq VAR_RESULT, 1, SaffronCity_PokemonTrainerFanClub_EventScript_RockerOnlyFan msgbox SaffronCity_PokemonTrainerFanClub_Text_TheWayYouBattleIsCool release end @@ -406,19 +374,16 @@ SaffronCity_PokemonTrainerFanClub_EventScript_Beauty:: setvar VAR_0x8004, FANCLUB_MEMBER7 special Script_BufferFanClubTrainerName specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, TRUE - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_BeautyPlayersFan + goto_if_eq VAR_RESULT, TRUE, SaffronCity_PokemonTrainerFanClub_EventScript_BeautyPlayersFan specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1) - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_BeautyOnlyNonFan + goto_if_eq VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1), SaffronCity_PokemonTrainerFanClub_EventScript_BeautyOnlyNonFan msgbox SaffronCity_PokemonTrainerFanClub_Text_WhyCantOthersSeeMastersDignity release end SaffronCity_PokemonTrainerFanClub_EventScript_BeautyPlayersFan:: specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, 1 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_BeautyOnlyFan + goto_if_eq VAR_RESULT, 1, SaffronCity_PokemonTrainerFanClub_EventScript_BeautyOnlyFan msgbox SaffronCity_PokemonTrainerFanClub_Text_YouReallyAreAmazing release end @@ -439,19 +404,16 @@ SaffronCity_PokemonTrainerFanClub_EventScript_BlackBelt:: setvar VAR_0x8004, FANCLUB_MEMBER8 special Script_BufferFanClubTrainerName specialvar VAR_RESULT, Script_IsFanClubMemberFanOfPlayer - compare VAR_RESULT, TRUE - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_BlackBeltPlayersFan + goto_if_eq VAR_RESULT, TRUE, SaffronCity_PokemonTrainerFanClub_EventScript_BlackBeltPlayersFan specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1) - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_BlackBeltOnlyNonFan + goto_if_eq VAR_RESULT, (NUM_TRAINER_FAN_CLUB_MEMBERS - 1), SaffronCity_PokemonTrainerFanClub_EventScript_BlackBeltOnlyNonFan msgbox SaffronCity_PokemonTrainerFanClub_Text_OnlyMasterHasMyRespect release end SaffronCity_PokemonTrainerFanClub_EventScript_BlackBeltPlayersFan:: specialvar VAR_RESULT, Script_GetNumFansOfPlayerInTrainerFanClub - compare VAR_RESULT, 1 - goto_if_eq SaffronCity_PokemonTrainerFanClub_EventScript_BlackBeltOnlyFan + goto_if_eq VAR_RESULT, 1, SaffronCity_PokemonTrainerFanClub_EventScript_BlackBeltOnlyFan msgbox SaffronCity_PokemonTrainerFanClub_Text_YourBattleStyleIsEducational release end diff --git a/data/maps/SeafoamIslands_B3F/scripts.inc b/data/maps/SeafoamIslands_B3F/scripts.inc index e130a05d9..353288d96 100644 --- a/data/maps/SeafoamIslands_B3F/scripts.inc +++ b/data/maps/SeafoamIslands_B3F/scripts.inc @@ -14,8 +14,7 @@ SeafoamIslands_B3F_EventScript_CheckStoppedCurrent:: setvar NUM_BOULDERS_PRESENT, 0 call_if_unset FLAG_HIDE_SEAFOAM_B3F_BOULDER_1, SeafoamIslands_B3F_EventScript_AddBoulderPresent call_if_unset FLAG_HIDE_SEAFOAM_B3F_BOULDER_2, SeafoamIslands_B3F_EventScript_AddBoulderPresent - compare NUM_BOULDERS_PRESENT, 2 - call_if_eq SeafoamIslands_B3F_EventScript_StoppedCurrent + call_if_eq NUM_BOULDERS_PRESENT, 2, SeafoamIslands_B3F_EventScript_StoppedCurrent return SeafoamIslands_B3F_EventScript_StoppedCurrent:: @@ -35,15 +34,12 @@ SeafoamIslands_B3F_EventScript_EnterByFalling:: setvar NUM_BOULDERS_PRESENT, 0 call_if_unset FLAG_HIDE_SEAFOAM_B3F_BOULDER_1, SeafoamIslands_B3F_EventScript_AddBoulderPresent call_if_unset FLAG_HIDE_SEAFOAM_B3F_BOULDER_2, SeafoamIslands_B3F_EventScript_AddBoulderPresent - compare NUM_BOULDERS_PRESENT, 2 - goto_if_eq SeafoamIslands_B3F_EventScript_CurrentBlocked + goto_if_eq NUM_BOULDERS_PRESENT, 2, SeafoamIslands_B3F_EventScript_CurrentBlocked getplayerxy VAR_0x8008, VAR_0x8009 - compare VAR_0x8008, 24 - call_if_lt SeafoamIslands_B3F_EventScript_RideCurrentFar - compare VAR_0x8008, 24 - call_if_ge SeafoamIslands_B3F_EventScript_RideCurrentClose + call_if_lt VAR_0x8008, 24, SeafoamIslands_B3F_EventScript_RideCurrentFar + call_if_ge VAR_0x8008, 24, SeafoamIslands_B3F_EventScript_RideCurrentClose setvar VAR_MAP_SCENE_SEAFOAM_ISLANDS_B4F, 1 - warp MAP_SEAFOAM_ISLANDS_B4F, 255, 27, 21 + warp MAP_SEAFOAM_ISLANDS_B4F, 27, 21 waitstate releaseall end diff --git a/data/maps/SeafoamIslands_B4F/scripts.inc b/data/maps/SeafoamIslands_B4F/scripts.inc index 342c46759..9b25c704a 100644 --- a/data/maps/SeafoamIslands_B4F/scripts.inc +++ b/data/maps/SeafoamIslands_B4F/scripts.inc @@ -14,8 +14,7 @@ SeafoamIslands_B4F_OnResume:: SeafoamIslands_B4F_EventScript_TryRemoveArticuno:: specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_CAUGHT - goto_if_ne EventScript_Return + goto_if_ne VAR_RESULT, B_OUTCOME_CAUGHT, EventScript_Return removeobject VAR_LAST_TALKED return @@ -29,8 +28,7 @@ SeafoamIslands_B4F_EventScript_CheckStoppedCurrent:: setvar NUM_BOULDERS_PRESENT, 0 call_if_unset FLAG_HIDE_SEAFOAM_B4F_BOULDER_1, SeafoamIslands_B4F_EventScript_AddBoulderPresent call_if_unset FLAG_HIDE_SEAFOAM_B4F_BOULDER_2, SeafoamIslands_B4F_EventScript_AddBoulderPresent - compare NUM_BOULDERS_PRESENT, 2 - call_if_eq SeafoamIslands_B4F_EventScript_StoppedCurrent + call_if_eq NUM_BOULDERS_PRESENT, 2, SeafoamIslands_B4F_EventScript_StoppedCurrent return SeafoamIslands_B4F_EventScript_StoppedCurrent:: @@ -49,8 +47,7 @@ SeafoamIslands_B4F_OnLoad:: setvar NUM_BOULDERS_PRESENT, 0 call_if_unset FLAG_HIDE_SEAFOAM_B4F_BOULDER_1, SeafoamIslands_B4F_EventScript_AddBoulderPresent call_if_unset FLAG_HIDE_SEAFOAM_B4F_BOULDER_2, SeafoamIslands_B4F_EventScript_AddBoulderPresent - compare NUM_BOULDERS_PRESENT, 2 - goto_if_eq SeafoamIslands_B4F_EventScript_SetCalmWaterNearStairs + goto_if_eq NUM_BOULDERS_PRESENT, 2, SeafoamIslands_B4F_EventScript_SetCalmWaterNearStairs end SeafoamIslands_B4F_EventScript_SetCalmWaterNearStairs:: @@ -93,13 +90,10 @@ SeafoamIslands_B4F_EventScript_EnterByFalling:: setvar NUM_BOULDERS_PRESENT, 0 call_if_unset FLAG_HIDE_SEAFOAM_B4F_BOULDER_1, SeafoamIslands_B4F_EventScript_AddBoulderPresent call_if_unset FLAG_HIDE_SEAFOAM_B4F_BOULDER_2, SeafoamIslands_B4F_EventScript_AddBoulderPresent - compare NUM_BOULDERS_PRESENT, 2 - goto_if_eq SeafoamIslands_B4F_EventScript_CurrentBlocked + goto_if_eq NUM_BOULDERS_PRESENT, 2, SeafoamIslands_B4F_EventScript_CurrentBlocked getplayerxy VAR_0x8008, VAR_0x8009 - compare VAR_0x8008, 9 - call_if_lt SeafoamIslands_B4F_EventScript_RideCurrentFar - compare VAR_0x8008, 9 - call_if_ge SeafoamIslands_B4F_EventScript_RideCurrentClose + call_if_lt VAR_0x8008, 9, SeafoamIslands_B4F_EventScript_RideCurrentFar + call_if_ge VAR_0x8008, 9, SeafoamIslands_B4F_EventScript_RideCurrentClose special SeafoamIslandsB4F_CurrentDumpsPlayerOnLand setvar VAR_TEMP_1, 0 releaseall @@ -162,7 +156,7 @@ SeafoamIslands_B4F_EventScript_Articuno:: special QuestLog_CutRecording lock faceplayer - setwildbattle SPECIES_ARTICUNO, 50, ITEM_NONE + setwildbattle SPECIES_ARTICUNO, 50 waitse playmoncry SPECIES_ARTICUNO, CRY_MODE_ENCOUNTER message Text_Gyaoo @@ -176,12 +170,9 @@ SeafoamIslands_B4F_EventScript_Articuno:: waitstate clearflag FLAG_SYS_SPECIAL_WILD_BATTLE specialvar VAR_RESULT, GetBattleOutcome - compare VAR_RESULT, B_OUTCOME_WON - goto_if_eq SeafoamIslands_B4F_EventScript_DefeatedArticuno - compare VAR_RESULT, B_OUTCOME_RAN - goto_if_eq SeafoamIslands_B4F_EventScript_RanFromArticuno - compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED - goto_if_eq SeafoamIslands_B4F_EventScript_RanFromArticuno + goto_if_eq VAR_RESULT, B_OUTCOME_WON, SeafoamIslands_B4F_EventScript_DefeatedArticuno + goto_if_eq VAR_RESULT, B_OUTCOME_RAN, SeafoamIslands_B4F_EventScript_RanFromArticuno + goto_if_eq VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED, SeafoamIslands_B4F_EventScript_RanFromArticuno setflag FLAG_FOUGHT_ARTICUNO release end diff --git a/data/maps/SevenIsland_House_Room1/scripts.inc b/data/maps/SevenIsland_House_Room1/scripts.inc index e2e8c4e6b..d9da2eca2 100644 --- a/data/maps/SevenIsland_House_Room1/scripts.inc +++ b/data/maps/SevenIsland_House_Room1/scripts.inc @@ -9,10 +9,8 @@ SevenIsland_House_Room1_MapScripts:: SevenIsland_House_Room1_OnTransition:: special ValidateEReaderTrainer - compare VAR_RESULT, 0 - call_if_eq SevenIsland_House_Room1_EventScript_SetTrainerVisitingLayout - compare VAR_MAP_SCENE_SEVEN_ISLAND_HOUSE_ROOM1, 0 - call_if_ne SevenIsland_House_Room1_EventScript_MoveOldWomanToDoor + call_if_eq VAR_RESULT, 0, SevenIsland_House_Room1_EventScript_SetTrainerVisitingLayout + call_if_ne VAR_MAP_SCENE_SEVEN_ISLAND_HOUSE_ROOM1, 0, SevenIsland_House_Room1_EventScript_MoveOldWomanToDoor end SevenIsland_House_Room1_EventScript_SetTrainerVisitingLayout:: @@ -35,20 +33,17 @@ SevenIsland_House_Room1_OnFrame:: SevenIsland_House_Room1_EventScript_OldWomanCommentOnBattle:: lockall - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE applymovement OBJ_EVENT_ID_PLAYER, SevenIsland_House_Room1_Movement_PlayerReEnterRoom waitmovement 0 applymovement LOCALID_OLD_WOMAN, SevenIsland_House_Room1_Movement_OldWomanWalkBehindPlayer waitmovement 0 - moveobjectoffscreen LOCALID_OLD_WOMAN - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + copyobjectxytoperm LOCALID_OLD_WOMAN + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 - compare VAR_MAP_SCENE_SEVEN_ISLAND_HOUSE_ROOM1, 1 - call_if_eq SevenIsland_House_Room1_EventScript_BattleWonComment - compare VAR_MAP_SCENE_SEVEN_ISLAND_HOUSE_ROOM1, 2 - call_if_eq SevenIsland_House_Room1_EventScript_BattleLostComment - compare VAR_MAP_SCENE_SEVEN_ISLAND_HOUSE_ROOM1, 3 - call_if_eq SevenIsland_House_Room1_EventScript_BattleTiedComment + call_if_eq VAR_MAP_SCENE_SEVEN_ISLAND_HOUSE_ROOM1, 1, SevenIsland_House_Room1_EventScript_BattleWonComment + call_if_eq VAR_MAP_SCENE_SEVEN_ISLAND_HOUSE_ROOM1, 2, SevenIsland_House_Room1_EventScript_BattleLostComment + call_if_eq VAR_MAP_SCENE_SEVEN_ISLAND_HOUSE_ROOM1, 3, SevenIsland_House_Room1_EventScript_BattleTiedComment special LoadPlayerParty setvar VAR_MAP_SCENE_SEVEN_ISLAND_HOUSE_ROOM1, 0 releaseall @@ -72,17 +67,15 @@ SevenIsland_House_Room1_Movement_PlayerReEnterRoom:: SevenIsland_House_Room1_Movement_OldWomanWalkBehindPlayer:: walk_right - walk_in_place_fastest_down + walk_in_place_faster_down step_end SevenIsland_House_Room1_EventScript_OldWoman:: lock faceplayer special ValidateEReaderTrainer - compare VAR_RESULT, 1 - call_if_eq SevenIsland_House_Room1_EventScript_InvalidVisitingTrainer - compare TRAINER_VISITING, TRUE - goto_if_eq SevenIsland_House_Room1_EventScript_TrainerVisiting + call_if_eq VAR_RESULT, 1, SevenIsland_House_Room1_EventScript_InvalidVisitingTrainer + goto_if_eq TRAINER_VISITING, TRUE, SevenIsland_House_Room1_EventScript_TrainerVisiting msgbox SevenIsland_House_Room1_Text_OnlyEnjoymentWatchingBattles release end @@ -96,29 +89,22 @@ SevenIsland_House_Room1_EventScript_TrainerVisiting:: special SavePlayerParty special BufferEReaderTrainerName msgbox SevenIsland_House_Room1_Text_ChallengeVisitingTrainer, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq SevenIsland_House_Room1_EventScript_DeclineBattle + goto_if_eq VAR_RESULT, NO, SevenIsland_House_Room1_EventScript_DeclineBattle call SevenIsland_House_Room1_EventScript_ChooseParty - compare VAR_RESULT, 0 - goto_if_eq SevenIsland_House_Room1_EventScript_DeclineBattle + goto_if_eq VAR_RESULT, 0, SevenIsland_House_Room1_EventScript_DeclineBattle msgbox SevenIsland_House_Room1_Text_SaveProgressBeforeBattle, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq SevenIsland_House_Room1_EventScript_DeclineBattle + goto_if_eq VAR_RESULT, NO, SevenIsland_House_Room1_EventScript_DeclineBattle special LoadPlayerParty call EventScript_AskSaveGame - compare VAR_RESULT, 0 - goto_if_eq SevenIsland_House_Room1_EventScript_DeclineBattle + goto_if_eq VAR_RESULT, 0, SevenIsland_House_Room1_EventScript_DeclineBattle special SavePlayerParty special ReducePlayerPartyToThree msgbox SevenIsland_House_Room1_Text_DontHoldAnythingBack closemessage - compare VAR_FACING, DIR_NORTH - call_if_eq SevenIsland_House_Room1_EventScript_EnterBattleRoomNorth - compare VAR_FACING, DIR_EAST - call_if_eq SevenIsland_House_Room1_EventScript_EnterBattleRoomEast - compare VAR_FACING, DIR_WEST - call_if_eq SevenIsland_House_Room1_EventScript_EnterBattleRoomWest - warp MAP_SEVEN_ISLAND_HOUSE_ROOM2, 255, 3, 1 + call_if_eq VAR_FACING, DIR_NORTH, SevenIsland_House_Room1_EventScript_EnterBattleRoomNorth + call_if_eq VAR_FACING, DIR_EAST, SevenIsland_House_Room1_EventScript_EnterBattleRoomEast + call_if_eq VAR_FACING, DIR_WEST, SevenIsland_House_Room1_EventScript_EnterBattleRoomWest + warp MAP_SEVEN_ISLAND_HOUSE_ROOM2, 3, 1 waitstate release end @@ -174,12 +160,12 @@ SevenIsland_House_Room1_Movement_PlayerEnterBattleRoomWest:: SevenIsland_House_Room1_Movement_OldWomanMoveAsideLeft:: walk_left - walk_in_place_fastest_right + walk_in_place_faster_right step_end SevenIsland_House_Room1_Movement_OldWomanMoveAsideRight:: walk_right - walk_in_place_fastest_left + walk_in_place_faster_left step_end SevenIsland_House_Room1_EventScript_Box:: diff --git a/data/maps/SevenIsland_House_Room2/scripts.inc b/data/maps/SevenIsland_House_Room2/scripts.inc index 2f319eebf..e55eaa2aa 100644 --- a/data/maps/SevenIsland_House_Room2/scripts.inc +++ b/data/maps/SevenIsland_House_Room2/scripts.inc @@ -22,19 +22,16 @@ SevenIsland_House_Room2_EventScript_BattleVisitingTrainer:: setvar VAR_0x8005, 0 special StartSpecialBattle waitstate - compare VAR_RESULT, 3 - call_if_eq SevenIsland_House_Room2_EventScript_BattleTie - compare VAR_RESULT, 1 - call_if_eq SevenIsland_House_Room2_EventScript_BattleWon - compare VAR_RESULT, 2 - call_if_eq SevenIsland_House_Room2_EventScript_BattleLost + call_if_eq VAR_RESULT, 3, SevenIsland_House_Room2_EventScript_BattleTie + call_if_eq VAR_RESULT, 1, SevenIsland_House_Room2_EventScript_BattleWon + call_if_eq VAR_RESULT, 2, SevenIsland_House_Room2_EventScript_BattleLost closemessage special HealPlayerParty applymovement OBJ_EVENT_ID_PLAYER, SevenIsland_House_Room2_Movement_PlayerExitRoom waitmovement 0 special LoadPlayerParty setvar VAR_TEMP_1, 1 - warp MAP_SEVEN_ISLAND_HOUSE_ROOM1, 255, 4, 1 + warp MAP_SEVEN_ISLAND_HOUSE_ROOM1, 4, 1 waitstate releaseall end diff --git a/data/maps/SevenIsland_SevaultCanyon_House/scripts.inc b/data/maps/SevenIsland_SevaultCanyon_House/scripts.inc index e070f409d..f8b966a94 100644 --- a/data/maps/SevenIsland_SevaultCanyon_House/scripts.inc +++ b/data/maps/SevenIsland_SevaultCanyon_House/scripts.inc @@ -14,15 +14,13 @@ SevenIsland_SevaultCanyon_House_EventScript_BaldingMan:: applymovement LOCALID_BALDING_MAN, Movement_FacePlayer waitmovement 0 msgbox SevenIsland_SevaultCanyon_House_Text_ChanseyDanceJoinIn - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox SevenIsland_SevaultCanyon_House_Text_WouldYouLikeToDance, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq SevenIsland_SevaultCanyon_House_EventScript_DeclineDance + goto_if_eq VAR_RESULT, NO, SevenIsland_SevaultCanyon_House_EventScript_DeclineDance msgbox SevenIsland_SevaultCanyon_House_Text_DancedChanseyDance closemessage call EventScript_RestorePrevTextColor - compare VAR_FACING, DIR_SOUTH - call_if_ne SevenIsland_SevaultCanyon_House_EventScript_PlayerFaceDown + call_if_ne VAR_FACING, DIR_SOUTH, SevenIsland_SevaultCanyon_House_EventScript_PlayerFaceDown delay 30 playbgm MUS_SCHOOL, 0 applymovement OBJ_EVENT_ID_PLAYER, SevenIsland_SevaultCanyon_House_Movement_ChanseyDance @@ -36,7 +34,7 @@ SevenIsland_SevaultCanyon_House_EventScript_BaldingMan:: end SevenIsland_SevaultCanyon_House_EventScript_PlayerFaceDown:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown waitmovement 0 return @@ -48,7 +46,7 @@ SevenIsland_SevaultCanyon_House_EventScript_AlreadyDanced:: end SevenIsland_SevaultCanyon_House_EventScript_DeclineDance:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox SevenIsland_SevaultCanyon_House_Text_ComeOnDance release end @@ -62,13 +60,13 @@ SevenIsland_SevaultCanyon_House_Movement_ChanseyDance:: delay_16 walk_in_place_down delay_16 - walk_in_place_fastest_right + walk_in_place_faster_right delay_4 - walk_in_place_fastest_up + walk_in_place_faster_up delay_4 - walk_in_place_fastest_left + walk_in_place_faster_left delay_4 - walk_in_place_fastest_down + walk_in_place_faster_down delay_4 step_end diff --git a/data/maps/SevenIsland_SevaultCanyon_TanobyKey/scripts.inc b/data/maps/SevenIsland_SevaultCanyon_TanobyKey/scripts.inc index f7b0f96e2..d2d059ac1 100644 --- a/data/maps/SevenIsland_SevaultCanyon_TanobyKey/scripts.inc +++ b/data/maps/SevenIsland_SevaultCanyon_TanobyKey/scripts.inc @@ -37,78 +37,64 @@ SevenIsland_SevaultCanyon_TanobyKey_EventScript_MoveBouldersToSolvedPos:: SevenIsland_SevaultCanyon_TanobyKey_EventScript_Switch1:: lockall - compare VAR_TEMP_1, 100 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed + goto_if_eq VAR_TEMP_1, 100, SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed call SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchPressed setvar VAR_TEMP_1, 100 - compare NUM_SWITCHES_PRESSED, 7 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved + goto_if_eq NUM_SWITCHES_PRESSED, 7, SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved releaseall end SevenIsland_SevaultCanyon_TanobyKey_EventScript_Switch2:: lockall - compare VAR_TEMP_2, 100 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed + goto_if_eq VAR_TEMP_2, 100, SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed call SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchPressed setvar VAR_TEMP_2, 100 - compare NUM_SWITCHES_PRESSED, 7 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved + goto_if_eq NUM_SWITCHES_PRESSED, 7, SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved releaseall end SevenIsland_SevaultCanyon_TanobyKey_EventScript_Switch3:: lockall - compare VAR_TEMP_3, 100 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed + goto_if_eq VAR_TEMP_3, 100, SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed call SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchPressed setvar VAR_TEMP_3, 100 - compare NUM_SWITCHES_PRESSED, 7 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved + goto_if_eq NUM_SWITCHES_PRESSED, 7, SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved releaseall end SevenIsland_SevaultCanyon_TanobyKey_EventScript_Switch4:: lockall - compare VAR_TEMP_4, 100 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed + goto_if_eq VAR_TEMP_4, 100, SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed call SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchPressed setvar VAR_TEMP_4, 100 - compare NUM_SWITCHES_PRESSED, 7 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved + goto_if_eq NUM_SWITCHES_PRESSED, 7, SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved releaseall end SevenIsland_SevaultCanyon_TanobyKey_EventScript_Switch5:: lockall - compare VAR_TEMP_5, 100 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed + goto_if_eq VAR_TEMP_5, 100, SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed call SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchPressed setvar VAR_TEMP_5, 100 - compare NUM_SWITCHES_PRESSED, 7 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved + goto_if_eq NUM_SWITCHES_PRESSED, 7, SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved releaseall end SevenIsland_SevaultCanyon_TanobyKey_EventScript_Switch6:: lockall - compare VAR_TEMP_6, 100 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed + goto_if_eq VAR_TEMP_6, 100, SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed call SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchPressed setvar VAR_TEMP_6, 100 - compare NUM_SWITCHES_PRESSED, 7 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved + goto_if_eq NUM_SWITCHES_PRESSED, 7, SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved releaseall end SevenIsland_SevaultCanyon_TanobyKey_EventScript_Switch7:: lockall - compare VAR_TEMP_7, 100 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed + goto_if_eq VAR_TEMP_7, 100, SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchAlreadyPressed call SevenIsland_SevaultCanyon_TanobyKey_EventScript_SwitchPressed setvar VAR_TEMP_7, 100 - compare NUM_SWITCHES_PRESSED, 7 - goto_if_eq SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved + goto_if_eq NUM_SWITCHES_PRESSED, 7, SevenIsland_SevaultCanyon_TanobyKey_EventScript_PuzzleSolved releaseall end diff --git a/data/maps/SilphCo_10F/scripts.inc b/data/maps/SilphCo_10F/scripts.inc index 4df7c880c..789caf5b2 100644 --- a/data/maps/SilphCo_10F/scripts.inc +++ b/data/maps/SilphCo_10F/scripts.inc @@ -9,8 +9,7 @@ SilphCo_10F_OnLoad:: SilphCo_10F_EventScript_WorkerF:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_10F_EventScript_WorkerFRocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_10F_EventScript_WorkerFRocketsGone msgbox SilphCo_10F_Text_WaaaImScared release end diff --git a/data/maps/SilphCo_11F/scripts.inc b/data/maps/SilphCo_11F/scripts.inc index 61d2ef04b..08411f199 100644 --- a/data/maps/SilphCo_11F/scripts.inc +++ b/data/maps/SilphCo_11F/scripts.inc @@ -15,13 +15,10 @@ SilphCo_11F_EventScript_President:: faceplayer goto_if_set FLAG_GOT_MASTER_BALL_FROM_SILPH, SilphCo_11F_EventScript_AlreadyGotMasterBall checkplayergender - compare VAR_RESULT, MALE - call_if_eq SilphCo_11F_EventScript_PresidentThanksMale - compare VAR_RESULT, FEMALE - call_if_eq SilphCo_11F_EventScript_PresidentThanksFemale - checkitemspace ITEM_MASTER_BALL, 1 - compare VAR_RESULT, FALSE - goto_if_eq SilphCo_11F_EventScript_NoRoomForMasterBall + call_if_eq VAR_RESULT, MALE, SilphCo_11F_EventScript_PresidentThanksMale + call_if_eq VAR_RESULT, FEMALE, SilphCo_11F_EventScript_PresidentThanksFemale + checkitemspace ITEM_MASTER_BALL + goto_if_eq VAR_RESULT, FALSE, SilphCo_11F_EventScript_NoRoomForMasterBall giveitem_msg SilphCo_11F_Text_ObtainedMasterBallFromPresident, ITEM_MASTER_BALL, 1, MUS_OBTAIN_KEY_ITEM msgbox SilphCo_11F_Text_ThatsOurSecretPrototype setflag FLAG_GOT_MASTER_BALL_FROM_SILPH @@ -63,16 +60,14 @@ SilphCo_11F_EventScript_GiovanniTriggerRight:: end SilphCo_11F_EventScript_BattleGiovanni:: - textcolor 0 - applymovement LOCALID_GIOVANNI, Movement_WalkInPlaceFastestDown + textcolor NPC_TEXT_COLOR_MALE + applymovement LOCALID_GIOVANNI, Movement_WalkInPlaceFasterDown waitmovement 0 delay 25 msgbox SilphCo_11F_Text_GiovanniIntro closemessage - compare VAR_TEMP_1, 0 - call_if_eq SilphCo_11F_EventScript_GiovanniApproachLeft - compare VAR_TEMP_1, 1 - call_if_eq SilphCo_11F_EventScript_GiovanniApproachRight + call_if_eq VAR_TEMP_1, 0, SilphCo_11F_EventScript_GiovanniApproachLeft + call_if_eq VAR_TEMP_1, 1, SilphCo_11F_EventScript_GiovanniApproachRight setvar VAR_LAST_TALKED, LOCALID_GIOVANNI trainerbattle_no_intro TRAINER_BOSS_GIOVANNI_2, SilphCo_11F_Text_GiovanniDefeat msgbox SilphCo_11F_Text_GiovanniPostBattle @@ -104,7 +99,7 @@ SilphCo_11F_Movement_GiovanniApproachLeft:: walk_down walk_down walk_down - walk_in_place_fastest_left + walk_in_place_faster_left step_end SilphCo_11F_Movement_GiovanniApproachRight:: @@ -119,7 +114,7 @@ SilphCo_11F_Movement_PlayerFaceGiovanni:: delay_16 delay_8 delay_4 - walk_in_place_fastest_right + walk_in_place_faster_right step_end @ Unused diff --git a/data/maps/SilphCo_3F/scripts.inc b/data/maps/SilphCo_3F/scripts.inc index 5a39471e0..1b5510791 100644 --- a/data/maps/SilphCo_3F/scripts.inc +++ b/data/maps/SilphCo_3F/scripts.inc @@ -10,8 +10,7 @@ SilphCo_3F_OnLoad:: SilphCo_3F_EventScript_WorkerM:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_3F_EventScript_WorkerMRocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_3F_EventScript_WorkerMRocketsGone msgbox SilphCo_3F_Text_WhatAmIToDo release end diff --git a/data/maps/SilphCo_4F/scripts.inc b/data/maps/SilphCo_4F/scripts.inc index ab416bc98..9b1b7615f 100644 --- a/data/maps/SilphCo_4F/scripts.inc +++ b/data/maps/SilphCo_4F/scripts.inc @@ -10,8 +10,7 @@ SilphCo_4F_OnLoad:: SilphCo_4F_EventScript_WorkerM:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_4F_EventScript_WorkerMRocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_4F_EventScript_WorkerMRocketsGone msgbox SilphCo_4F_Text_CantYouSeeImHiding release end diff --git a/data/maps/SilphCo_5F/scripts.inc b/data/maps/SilphCo_5F/scripts.inc index c3245a7ca..e8f921d9a 100644 --- a/data/maps/SilphCo_5F/scripts.inc +++ b/data/maps/SilphCo_5F/scripts.inc @@ -11,8 +11,7 @@ SilphCo_5F_OnLoad:: SilphCo_5F_EventScript_WorkerM:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_5F_EventScript_WorkerMRocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_5F_EventScript_WorkerMRocketsGone msgbox SilphCo_5F_Text_RocketsInUproarAboutIntruder release end diff --git a/data/maps/SilphCo_6F/scripts.inc b/data/maps/SilphCo_6F/scripts.inc index 06e2636ea..e19836d27 100644 --- a/data/maps/SilphCo_6F/scripts.inc +++ b/data/maps/SilphCo_6F/scripts.inc @@ -9,8 +9,7 @@ SilphCo_6F_OnLoad:: SilphCo_6F_EventScript_WorkerM2:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_6F_EventScript_WorkerM2RocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_6F_EventScript_WorkerM2RocketsGone msgbox SilphCo_6F_Text_TargetedSilphForOurMonProducts release end @@ -23,8 +22,7 @@ SilphCo_6F_EventScript_WorkerM2RocketsGone:: SilphCo_6F_EventScript_WorkerM3:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_6F_EventScript_WorkerM3RocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_6F_EventScript_WorkerM3RocketsGone msgbox SilphCo_6F_Text_RocketsTookOverBuilding release end @@ -37,8 +35,7 @@ SilphCo_6F_EventScript_WorkerM3RocketsGone:: SilphCo_6F_EventScript_WorkerM1:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_6F_EventScript_WorkerM1RocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_6F_EventScript_WorkerM1RocketsGone msgbox SilphCo_6F_Text_HelpMePlease release end @@ -51,8 +48,7 @@ SilphCo_6F_EventScript_WorkerM1RocketsGone:: SilphCo_6F_EventScript_WorkerF1:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_6F_EventScript_WorkerF1RocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_6F_EventScript_WorkerF1RocketsGone msgbox SilphCo_6F_Text_ThatManIsSuchACoward release end @@ -65,8 +61,7 @@ SilphCo_6F_EventScript_WorkerF1RocketsGone:: SilphCo_6F_EventScript_WorkerF2:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_6F_EventScript_WorkerF2RocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_6F_EventScript_WorkerF2RocketsGone msgbox SilphCo_6F_Text_RocketsTryingToConquerWorld release end diff --git a/data/maps/SilphCo_7F/scripts.inc b/data/maps/SilphCo_7F/scripts.inc index cce9193ae..afa40c8fb 100644 --- a/data/maps/SilphCo_7F/scripts.inc +++ b/data/maps/SilphCo_7F/scripts.inc @@ -13,8 +13,7 @@ SilphCo_7F_OnLoad:: end SilphCo_7F_OnTransition:: - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - call_if_ge SilphCo_7F_EventScript_SetObjRocketsGone + call_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_7F_EventScript_SetObjRocketsGone end SilphCo_7F_EventScript_SetObjRocketsGone:: @@ -34,33 +33,26 @@ SilphCo_7F_EventScript_RivalTriggerBottom:: end SilphCo_7F_EventScript_RivalScene:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE playbgm MUS_ENCOUNTER_RIVAL, 0 applymovement LOCALID_RIVAL, Movement_ExclamationMark waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown applymovement LOCALID_RIVAL, Movement_Delay48 waitmovement 0 msgbox SilphCo_7F_Text_RivalWhatKeptYou - compare VAR_TEMP_1, 0 - call_if_eq SilphCo_7F_EventScript_RivalApproachTop - compare VAR_TEMP_1, 1 - call_if_eq SilphCo_7F_EventScript_RivalApproachBottom + call_if_eq VAR_TEMP_1, 0, SilphCo_7F_EventScript_RivalApproachTop + call_if_eq VAR_TEMP_1, 1, SilphCo_7F_EventScript_RivalApproachBottom msgbox SilphCo_7F_Text_RivalIntro setvar VAR_LAST_TALKED, LOCALID_RIVAL - compare VAR_STARTER_MON, 2 - call_if_eq SilphCo_7F_EventScript_RivalSquirtle - compare VAR_STARTER_MON, 1 - call_if_eq SilphCo_7F_EventScript_RivalBulbasaur - compare VAR_STARTER_MON, 0 - call_if_eq SilphCo_7F_EventScript_RivalCharmander + call_if_eq VAR_STARTER_MON, 2, SilphCo_7F_EventScript_RivalSquirtle + call_if_eq VAR_STARTER_MON, 1, SilphCo_7F_EventScript_RivalBulbasaur + call_if_eq VAR_STARTER_MON, 0, SilphCo_7F_EventScript_RivalCharmander msgbox SilphCo_7F_Text_RivalPostBattle closemessage playbgm MUS_RIVAL_EXIT, 0 - compare VAR_TEMP_1, 0 - call_if_eq SilphCo_7F_EventScript_RivalExitTop - compare VAR_TEMP_1, 1 - call_if_eq SilphCo_7F_EventScript_RivalExitBottom + call_if_eq VAR_TEMP_1, 0, SilphCo_7F_EventScript_RivalExitTop + call_if_eq VAR_TEMP_1, 1, SilphCo_7F_EventScript_RivalExitBottom playse SE_WARP_IN fadedefaultbgm removeobject LOCALID_RIVAL @@ -129,41 +121,36 @@ SilphCo_7F_EventScript_LaprasGuy:: goto_if_set FLAG_GOT_LAPRAS_FROM_SILPH, SilphCo_7F_EventScript_AlreadyGotLapras msgbox SilphCo_7F_Text_HaveMonForSavingUs setvar VAR_TEMP_1, SPECIES_LAPRAS - givemon SPECIES_LAPRAS, 25, ITEM_NONE - compare VAR_RESULT, 0 - goto_if_eq SilphCo_7F_EventScript_ReceiveLaprasParty - compare VAR_RESULT, 1 - goto_if_eq SilphCo_7F_EventScript_ReceiveLaprasPC - compare VAR_RESULT, 2 - goto_if_eq EventScript_NoMoreRoomForPokemon + givemon SPECIES_LAPRAS, 25 + goto_if_eq VAR_RESULT, 0, SilphCo_7F_EventScript_ReceiveLaprasParty + goto_if_eq VAR_RESULT, 1, SilphCo_7F_EventScript_ReceiveLaprasPC + goto_if_eq VAR_RESULT, 2, EventScript_NoMoreRoomForPokemon release end SilphCo_7F_EventScript_ReceiveLaprasParty:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_LEVEL_UP 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 + goto_if_eq VAR_RESULT, NO, SilphCo_7F_EventScript_EndReceiveLapras call EventScript_GetGiftMonPartySlot call EventScript_ChangePokemonNickname goto SilphCo_7F_EventScript_EndReceiveLapras end SilphCo_7F_EventScript_ReceiveLaprasPC:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_LEVEL_UP 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 + goto_if_eq VAR_RESULT, NO, SilphCo_7F_EventScript_LaprasTransferredToPC call EventScript_NameReceivedBoxMon goto SilphCo_7F_EventScript_LaprasTransferredToPC end @@ -174,7 +161,7 @@ SilphCo_7F_EventScript_LaprasTransferredToPC:: end SilphCo_7F_EventScript_EndReceiveLapras:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox SilphCo_7F_Text_ExplainLapras setflag FLAG_GOT_LAPRAS_FROM_SILPH release @@ -188,8 +175,7 @@ SilphCo_7F_EventScript_AlreadyGotLapras:: SilphCo_7F_EventScript_WorkerM1:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_7F_EventScript_WorkerM1RocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_7F_EventScript_WorkerM1RocketsGone msgbox SilphCo_7F_Text_RocketsAfterMasterBall release end @@ -202,8 +188,7 @@ SilphCo_7F_EventScript_WorkerM1RocketsGone:: SilphCo_7F_EventScript_WorkerM2:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_7F_EventScript_WorkerM2RocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_7F_EventScript_WorkerM2RocketsGone msgbox SilphCo_7F_Text_BadIfTeamRocketTookOver release end @@ -216,8 +201,7 @@ SilphCo_7F_EventScript_WorkerM2RocketsGone:: SilphCo_7F_EventScript_WorkerF:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_7F_EventScript_WorkerFRocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_7F_EventScript_WorkerFRocketsGone msgbox SilphCo_7F_Text_ReallyDangerousHere release end diff --git a/data/maps/SilphCo_8F/scripts.inc b/data/maps/SilphCo_8F/scripts.inc index c8605fcac..e27d177e2 100644 --- a/data/maps/SilphCo_8F/scripts.inc +++ b/data/maps/SilphCo_8F/scripts.inc @@ -9,8 +9,7 @@ SilphCo_8F_OnLoad:: SilphCo_8F_EventScript_WorkerM:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_8F_EventScript_WorkerMRocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_8F_EventScript_WorkerMRocketsGone msgbox SilphCo_8F_Text_WonderIfSilphIsFinished release end diff --git a/data/maps/SilphCo_9F/scripts.inc b/data/maps/SilphCo_9F/scripts.inc index 8584190db..a62a85bae 100644 --- a/data/maps/SilphCo_9F/scripts.inc +++ b/data/maps/SilphCo_9F/scripts.inc @@ -12,8 +12,7 @@ SilphCo_9F_OnLoad:: SilphCo_9F_EventScript_HealWoman:: lock faceplayer - compare VAR_MAP_SCENE_SILPH_CO_11F, 1 - goto_if_ge SilphCo_9F_EventScript_HealWomanRocketsGone + goto_if_ge VAR_MAP_SCENE_SILPH_CO_11F, 1, SilphCo_9F_EventScript_HealWomanRocketsGone msgbox SilphCo_9F_Text_YouShouldTakeQuickNap closemessage call EventScript_OutOfCenterPartyHeal diff --git a/data/maps/SilphCo_Elevator/scripts.inc b/data/maps/SilphCo_Elevator/scripts.inc index 6c305e4d5..dc6b5cfee 100644 --- a/data/maps/SilphCo_Elevator/scripts.inc +++ b/data/maps/SilphCo_Elevator/scripts.inc @@ -32,8 +32,7 @@ SilphCo_Elevator_EventScript_FloorSelect:: SilphCo_Elevator_EventScript_To1F:: setvar VAR_0x8006, 4 setdynamicwarp MAP_SILPH_CO_1F, 255, 22, 3 - compare VAR_ELEVATOR_FLOOR, 4 - goto_if_eq SilphCo_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 4, SilphCo_Elevator_EventScript_ExitFloorSelect call SilphCo_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 4 goto SilphCo_Elevator_EventScript_ExitFloorSelect @@ -42,8 +41,7 @@ SilphCo_Elevator_EventScript_To1F:: SilphCo_Elevator_EventScript_To2F:: setvar VAR_0x8006, 5 setdynamicwarp MAP_SILPH_CO_2F, 255, 22, 3 - compare VAR_ELEVATOR_FLOOR, 5 - goto_if_eq SilphCo_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 5, SilphCo_Elevator_EventScript_ExitFloorSelect call SilphCo_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 5 goto SilphCo_Elevator_EventScript_ExitFloorSelect @@ -52,8 +50,7 @@ SilphCo_Elevator_EventScript_To2F:: SilphCo_Elevator_EventScript_To3F:: setvar VAR_0x8006, 6 setdynamicwarp MAP_SILPH_CO_3F, 255, 22, 3 - compare VAR_ELEVATOR_FLOOR, 6 - goto_if_eq SilphCo_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 6, SilphCo_Elevator_EventScript_ExitFloorSelect call SilphCo_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 6 goto SilphCo_Elevator_EventScript_ExitFloorSelect @@ -62,8 +59,7 @@ SilphCo_Elevator_EventScript_To3F:: SilphCo_Elevator_EventScript_To4F:: setvar VAR_0x8006, 7 setdynamicwarp MAP_SILPH_CO_4F, 255, 22, 3 - compare VAR_ELEVATOR_FLOOR, 7 - goto_if_eq SilphCo_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 7, SilphCo_Elevator_EventScript_ExitFloorSelect call SilphCo_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 7 goto SilphCo_Elevator_EventScript_ExitFloorSelect @@ -72,8 +68,7 @@ SilphCo_Elevator_EventScript_To4F:: SilphCo_Elevator_EventScript_To5F:: setvar VAR_0x8006, 8 setdynamicwarp MAP_SILPH_CO_5F, 255, 22, 3 - compare VAR_ELEVATOR_FLOOR, 8 - goto_if_eq SilphCo_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 8, SilphCo_Elevator_EventScript_ExitFloorSelect call SilphCo_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 8 goto SilphCo_Elevator_EventScript_ExitFloorSelect @@ -82,8 +77,7 @@ SilphCo_Elevator_EventScript_To5F:: SilphCo_Elevator_EventScript_To6F:: setvar VAR_0x8006, 9 setdynamicwarp MAP_SILPH_CO_6F, 255, 20, 3 - compare VAR_ELEVATOR_FLOOR, 9 - goto_if_eq SilphCo_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 9, SilphCo_Elevator_EventScript_ExitFloorSelect call SilphCo_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 9 goto SilphCo_Elevator_EventScript_ExitFloorSelect @@ -92,8 +86,7 @@ SilphCo_Elevator_EventScript_To6F:: SilphCo_Elevator_EventScript_To7F:: setvar VAR_0x8006, 10 setdynamicwarp MAP_SILPH_CO_7F, 255, 23, 3 - compare VAR_ELEVATOR_FLOOR, 10 - goto_if_eq SilphCo_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 10, SilphCo_Elevator_EventScript_ExitFloorSelect call SilphCo_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 10 goto SilphCo_Elevator_EventScript_ExitFloorSelect @@ -102,8 +95,7 @@ SilphCo_Elevator_EventScript_To7F:: SilphCo_Elevator_EventScript_To8F:: setvar VAR_0x8006, 11 setdynamicwarp MAP_SILPH_CO_8F, 255, 22, 3 - compare VAR_ELEVATOR_FLOOR, 11 - goto_if_eq SilphCo_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 11, SilphCo_Elevator_EventScript_ExitFloorSelect call SilphCo_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 11 goto SilphCo_Elevator_EventScript_ExitFloorSelect @@ -112,8 +104,7 @@ SilphCo_Elevator_EventScript_To8F:: SilphCo_Elevator_EventScript_To9F:: setvar VAR_0x8006, 12 setdynamicwarp MAP_SILPH_CO_9F, 255, 24, 3 - compare VAR_ELEVATOR_FLOOR, 12 - goto_if_eq SilphCo_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 12, SilphCo_Elevator_EventScript_ExitFloorSelect call SilphCo_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 12 goto SilphCo_Elevator_EventScript_ExitFloorSelect @@ -122,8 +113,7 @@ SilphCo_Elevator_EventScript_To9F:: SilphCo_Elevator_EventScript_To10F:: setvar VAR_0x8006, 13 setdynamicwarp MAP_SILPH_CO_10F, 255, 13, 3 - compare VAR_ELEVATOR_FLOOR, 13 - goto_if_eq SilphCo_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 13, SilphCo_Elevator_EventScript_ExitFloorSelect call SilphCo_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 13 goto SilphCo_Elevator_EventScript_ExitFloorSelect @@ -132,8 +122,7 @@ SilphCo_Elevator_EventScript_To10F:: SilphCo_Elevator_EventScript_To11F:: setvar VAR_0x8006, 14 setdynamicwarp MAP_SILPH_CO_11F, 255, 13, 3 - compare VAR_ELEVATOR_FLOOR, 14 - goto_if_eq SilphCo_Elevator_EventScript_ExitFloorSelect + goto_if_eq VAR_ELEVATOR_FLOOR, 14, SilphCo_Elevator_EventScript_ExitFloorSelect call SilphCo_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 14 goto SilphCo_Elevator_EventScript_ExitFloorSelect diff --git a/data/maps/SixIsland_DottedHole_SapphireRoom/scripts.inc b/data/maps/SixIsland_DottedHole_SapphireRoom/scripts.inc index fa1b9a367..59c3a7e17 100644 --- a/data/maps/SixIsland_DottedHole_SapphireRoom/scripts.inc +++ b/data/maps/SixIsland_DottedHole_SapphireRoom/scripts.inc @@ -7,7 +7,7 @@ SixIsland_DottedHole_SapphireRoom_MapScripts:: SixIsland_DottedHole_SapphireRoom_EventScript_Sapphire:: lock faceplayer - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_OBTAIN_KEY_ITEM message SixIsland_DottedHole_SapphireRoom_Text_FoundSapphire waitmessage @@ -19,58 +19,38 @@ SixIsland_DottedHole_SapphireRoom_EventScript_Sapphire:: applymovement LOCALID_THIEF, SixIsland_DottedHole_SapphireRoom_Movement_ThiefFallIn waitmovement 0 playse SE_M_STRENGTH - compare VAR_FACING, DIR_NORTH - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefLeft - compare VAR_FACING, DIR_SOUTH - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefLeft - compare VAR_FACING, DIR_EAST - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefDown - compare VAR_FACING, DIR_WEST - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefDown + call_if_eq VAR_FACING, DIR_NORTH, SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefLeft + call_if_eq VAR_FACING, DIR_SOUTH, SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefLeft + call_if_eq VAR_FACING, DIR_EAST, SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefDown + call_if_eq VAR_FACING, DIR_WEST, SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefDown setvar VAR_0x8004, 3 setvar VAR_0x8005, 0 setvar VAR_0x8006, 12 setvar VAR_0x8007, 3 special ShakeScreen delay 60 - compare VAR_FACING, DIR_NORTH - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_ThiefLookAtSapphireNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_ThiefLookAtSapphireSouth - compare VAR_FACING, DIR_EAST - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_ThiefLookAtSapphireEast - compare VAR_FACING, DIR_WEST - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_ThiefLookAtSapphireWest - textcolor 0 + call_if_eq VAR_FACING, DIR_NORTH, SixIsland_DottedHole_SapphireRoom_EventScript_ThiefLookAtSapphireNorth + call_if_eq VAR_FACING, DIR_SOUTH, SixIsland_DottedHole_SapphireRoom_EventScript_ThiefLookAtSapphireSouth + call_if_eq VAR_FACING, DIR_EAST, SixIsland_DottedHole_SapphireRoom_EventScript_ThiefLookAtSapphireEast + call_if_eq VAR_FACING, DIR_WEST, SixIsland_DottedHole_SapphireRoom_EventScript_ThiefLookAtSapphireWest + textcolor NPC_TEXT_COLOR_MALE msgbox SixIsland_DottedHole_SapphireRoom_Text_IWasRightInTailingYou closemessage - compare VAR_FACING, DIR_NORTH - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_ThiefGetSapphireNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_ThiefGetSapphireSouth - compare VAR_FACING, DIR_EAST - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_ThiefGetSapphireEast - compare VAR_FACING, DIR_WEST - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_ThiefGetSapphireWest + call_if_eq VAR_FACING, DIR_NORTH, SixIsland_DottedHole_SapphireRoom_EventScript_ThiefGetSapphireNorth + call_if_eq VAR_FACING, DIR_SOUTH, SixIsland_DottedHole_SapphireRoom_EventScript_ThiefGetSapphireSouth + call_if_eq VAR_FACING, DIR_EAST, SixIsland_DottedHole_SapphireRoom_EventScript_ThiefGetSapphireEast + call_if_eq VAR_FACING, DIR_WEST, SixIsland_DottedHole_SapphireRoom_EventScript_ThiefGetSapphireWest removeobject LOCALID_SAPPHIRE - compare VAR_FACING, DIR_NORTH - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefLeft2 - compare VAR_FACING, DIR_SOUTH - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefLeft2 - compare VAR_FACING, DIR_EAST - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefDown2 - compare VAR_FACING, DIR_WEST - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefDown2 + call_if_eq VAR_FACING, DIR_NORTH, SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefLeft2 + call_if_eq VAR_FACING, DIR_SOUTH, SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefLeft2 + call_if_eq VAR_FACING, DIR_EAST, SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefDown2 + call_if_eq VAR_FACING, DIR_WEST, SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefDown2 msgbox SixIsland_DottedHole_SapphireRoom_Text_SellToTeamRocketTellPassword closemessage - compare VAR_FACING, DIR_NORTH - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_ThiefExitNorth - compare VAR_FACING, DIR_SOUTH - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_ThiefExitSouth - compare VAR_FACING, DIR_EAST - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_ThiefExitEast - compare VAR_FACING, DIR_WEST - call_if_eq SixIsland_DottedHole_SapphireRoom_EventScript_ThiefExitWest + call_if_eq VAR_FACING, DIR_NORTH, SixIsland_DottedHole_SapphireRoom_EventScript_ThiefExitNorth + call_if_eq VAR_FACING, DIR_SOUTH, SixIsland_DottedHole_SapphireRoom_EventScript_ThiefExitSouth + call_if_eq VAR_FACING, DIR_EAST, SixIsland_DottedHole_SapphireRoom_EventScript_ThiefExitEast + call_if_eq VAR_FACING, DIR_WEST, SixIsland_DottedHole_SapphireRoom_EventScript_ThiefExitWest playse SE_EXIT delay 35 removeobject LOCALID_THIEF @@ -80,22 +60,22 @@ SixIsland_DottedHole_SapphireRoom_EventScript_Sapphire:: @ Lots of redundant scripts below SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefLeft2:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 return SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefDown2:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown waitmovement 0 return SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefLeft:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 return SixIsland_DottedHole_SapphireRoom_EventScript_PlayerFaceThiefDown:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown waitmovement 0 return @@ -122,28 +102,28 @@ SixIsland_DottedHole_SapphireRoom_EventScript_ThiefLookAtSapphireWest:: SixIsland_DottedHole_SapphireRoom_EventScript_ThiefGetSapphireNorth:: applymovement LOCALID_THIEF, SixIsland_DottedHole_SapphireRoom_Movement_ThiefGetSapphireFromLeft waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 return SixIsland_DottedHole_SapphireRoom_EventScript_ThiefGetSapphireSouth:: applymovement LOCALID_THIEF, SixIsland_DottedHole_SapphireRoom_Movement_ThiefGetSapphireFromLeft waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown waitmovement 0 return SixIsland_DottedHole_SapphireRoom_EventScript_ThiefGetSapphireEast:: applymovement LOCALID_THIEF, SixIsland_DottedHole_SapphireRoom_Movement_ThiefGetSapphireFromBelow waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 return SixIsland_DottedHole_SapphireRoom_EventScript_ThiefGetSapphireWest:: applymovement LOCALID_THIEF, SixIsland_DottedHole_SapphireRoom_Movement_ThiefGetSapphireFromBelow waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 return @@ -174,13 +154,13 @@ SixIsland_DottedHole_SapphireRoom_EventScript_ThiefExitWest:: SixIsland_DottedHole_SapphireRoom_Movement_ThiefLookAtSapphireFromLeft:: walk_up walk_up - walk_in_place_fastest_right + walk_in_place_faster_right step_end SixIsland_DottedHole_SapphireRoom_Movement_ThiefLookAtSapphireFromBelow:: walk_right walk_right - walk_in_place_fastest_up + walk_in_place_faster_up step_end SixIsland_DottedHole_SapphireRoom_Movement_ThiefGetSapphireFromLeft:: @@ -236,7 +216,7 @@ SixIsland_DottedHole_SapphireRoom_Movement_ThiefFallIn:: SixIsland_DottedHole_SapphireRoom_Movement_PlayerWatchThiefExit:: delay_16 - walk_in_place_fastest_right + walk_in_place_faster_right step_end SixIsland_DottedHole_SapphireRoom_EventScript_BrailleMessage:: diff --git a/data/maps/SixIsland_PatternBush/scripts.inc b/data/maps/SixIsland_PatternBush/scripts.inc index d42ed5241..d5f06a183 100644 --- a/data/maps/SixIsland_PatternBush/scripts.inc +++ b/data/maps/SixIsland_PatternBush/scripts.inc @@ -5,10 +5,8 @@ SixIsland_PatternBush_MapScripts:: SixIsland_PatternBush_OnTransition:: setworldmapflag FLAG_WORLD_MAP_SIX_ISLAND_PATTERN_BUSH getplayerxy VAR_TEMP_1, VAR_TEMP_2 - compare VAR_TEMP_1, 50 - call_if_ge SixIsland_PatternBush_EventScript_SetEscapeRightExit - compare VAR_TEMP_1, 49 - call_if_le SixIsland_PatternBush_EventScript_SetEscapeLeftExit + call_if_ge VAR_TEMP_1, 50, SixIsland_PatternBush_EventScript_SetEscapeRightExit + call_if_le VAR_TEMP_1, 49, SixIsland_PatternBush_EventScript_SetEscapeLeftExit end SixIsland_PatternBush_EventScript_SetEscapeRightExit:: diff --git a/data/maps/SixIsland_PokemonCenter_1F/scripts.inc b/data/maps/SixIsland_PokemonCenter_1F/scripts.inc index c67d905e3..3e23e6839 100644 --- a/data/maps/SixIsland_PokemonCenter_1F/scripts.inc +++ b/data/maps/SixIsland_PokemonCenter_1F/scripts.inc @@ -8,8 +8,7 @@ SixIsland_PokemonCenter_1F_MapScripts:: SixIsland_PokemonCenter_1F_OnTransition:: setrespawn SPAWN_SIX_ISLAND - compare VAR_MAP_SCENE_SIX_ISLAND_POKEMON_CENTER_1F, 0 - call_if_eq SixIsland_PokemonCenter_1F_EventScript_ShowRival + call_if_eq VAR_MAP_SCENE_SIX_ISLAND_POKEMON_CENTER_1F, 0, SixIsland_PokemonCenter_1F_EventScript_ShowRival end SixIsland_PokemonCenter_1F_EventScript_ShowRival:: @@ -22,8 +21,8 @@ SixIsland_PokemonCenter_1F_OnFrame:: SixIsland_PokemonCenter_1F_EventScript_RivalScene:: lockall - textcolor 0 - applymovement LOCALID_RIVAL, Movement_WalkInPlaceFastestDown + textcolor NPC_TEXT_COLOR_MALE + applymovement LOCALID_RIVAL, Movement_WalkInPlaceFasterDown waitmovement 0 playbgm MUS_ENCOUNTER_RIVAL, 0 applymovement LOCALID_RIVAL, Movement_ExclamationMark @@ -62,7 +61,7 @@ SixIsland_PokemonCenter_1F_Movement_RivalExit:: SixIsland_PokemonCenter_1F_Movement_PlayerWatchRivalExit:: walk_left - walk_in_place_fastest_right + walk_in_place_faster_right step_end SixIsland_PokemonCenter_1F_EventScript_Nurse:: diff --git a/data/maps/SixIsland_RuinValley/scripts.inc b/data/maps/SixIsland_RuinValley/scripts.inc index 133add073..808bed3d0 100644 --- a/data/maps/SixIsland_RuinValley/scripts.inc +++ b/data/maps/SixIsland_RuinValley/scripts.inc @@ -27,8 +27,7 @@ SixIsland_RuinValley_EventScript_DottedHoleDoor:: lockall goto_if_set FLAG_USED_CUT_ON_RUIN_VALLEY_BRAILLE, SixIsland_RuinValley_EventScript_DottedHoleDoorOpen msgbox SixIsland_RuinValley_Text_CheckDoorMoreThoroughly, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq SixIsland_RuinValley_EventScript_IgnoreDottedHoleDoor + goto_if_eq VAR_RESULT, NO, SixIsland_RuinValley_EventScript_IgnoreDottedHoleDoor msgbox SixIsland_RuinValley_Text_SeveralDotsOnTheDoor braillemessage Braille_Text_Cut waitbuttonpress diff --git a/data/maps/SixIsland_WaterPath_House1/scripts.inc b/data/maps/SixIsland_WaterPath_House1/scripts.inc index eb253ce81..0797724ac 100644 --- a/data/maps/SixIsland_WaterPath_House1/scripts.inc +++ b/data/maps/SixIsland_WaterPath_House1/scripts.inc @@ -8,24 +8,18 @@ SixIsland_WaterPath_House1_EventScript_Beauty:: special QuestLog_CutRecording setvar VAR_0x8004, SPECIES_HERACROSS specialvar VAR_RESULT, DoesPlayerPartyContainSpecies - compare VAR_RESULT, FALSE - goto_if_eq SixIsland_WaterPath_House1_EventScript_NoHeracrossInParty + goto_if_eq VAR_RESULT, FALSE, SixIsland_WaterPath_House1_EventScript_NoHeracrossInParty special GetHeracrossSizeRecordInfo msgbox SixIsland_WaterPath_House1_Text_MayIMeasureHeracross special ChoosePartyMon waitstate copyvar VAR_RESULT, VAR_0x8004 - compare VAR_RESULT, PARTY_SIZE - goto_if_ge SixIsland_WaterPath_House1_EventScript_DontShowMon + goto_if_ge VAR_RESULT, PARTY_SIZE, SixIsland_WaterPath_House1_EventScript_DontShowMon special CompareHeracrossSize - compare VAR_RESULT, 1 - goto_if_eq SixIsland_WaterPath_House1_EventScript_ShownNonHeracross - compare VAR_RESULT, 2 - goto_if_eq SixIsland_WaterPath_House1_EventScript_ShownSmallHeracross - compare VAR_RESULT, 3 - goto_if_eq SixIsland_WaterPath_House1_EventScript_ShownBigHeracross - compare VAR_RESULT, 4 - goto_if_eq SixIsland_WaterPath_House1_EventScript_ShownTiedHeracross + goto_if_eq VAR_RESULT, 1, SixIsland_WaterPath_House1_EventScript_ShownNonHeracross + goto_if_eq VAR_RESULT, 2, SixIsland_WaterPath_House1_EventScript_ShownSmallHeracross + goto_if_eq VAR_RESULT, 3, SixIsland_WaterPath_House1_EventScript_ShownBigHeracross + goto_if_eq VAR_RESULT, 4, SixIsland_WaterPath_House1_EventScript_ShownTiedHeracross release end @@ -59,8 +53,7 @@ SixIsland_WaterPath_House1_EventScript_ShownBigHeracross:: setflag FLAG_GOT_NEST_BALL_FROM_WATER_PATH_HOUSE_1 msgbox SixIsland_WaterPath_House1_Text_ItsXInchesDeserveReward giveitem ITEM_NEST_BALL - compare VAR_RESULT, FALSE - goto_if_eq SixIsland_WaterPath_House1_EventScript_NoRoomForNestBall + goto_if_eq VAR_RESULT, FALSE, SixIsland_WaterPath_House1_EventScript_NoRoomForNestBall msgbox SixIsland_WaterPath_House1_Text_WantToSeeBiggerOne release end diff --git a/data/maps/ThreeIsland/scripts.inc b/data/maps/ThreeIsland/scripts.inc index f75505ea2..c88307195 100644 --- a/data/maps/ThreeIsland/scripts.inc +++ b/data/maps/ThreeIsland/scripts.inc @@ -15,8 +15,7 @@ ThreeIsland_MapScripts:: ThreeIsland_OnTransition:: setworldmapflag FLAG_WORLD_MAP_THREE_ISLAND call_if_set FLAG_RESCUED_LOSTELLE, ThreeIsland_EventScript_HideAntiBikers - compare VAR_MAP_SCENE_THREE_ISLAND, 4 - call_if_eq ThreeIsland_EventScript_SetAntiBikersMovementAfterBikers + call_if_eq VAR_MAP_SCENE_THREE_ISLAND, 4, ThreeIsland_EventScript_SetAntiBikersMovementAfterBikers end ThreeIsland_EventScript_HideAntiBikers:: @@ -38,8 +37,7 @@ ThreeIsland_EventScript_Biker:: ThreeIsland_EventScript_AntiBiker1:: lock goto_if_set FLAG_GOT_FULL_RESTORE_FROM_THREE_ISLAND_DEFENDER, ThreeIsland_EventScript_AntiBiker1GotFullRestore - compare VAR_MAP_SCENE_THREE_ISLAND, 4 - goto_if_eq ThreeIsland_EventScript_GiveFullRestore + goto_if_eq VAR_MAP_SCENE_THREE_ISLAND, 4, ThreeIsland_EventScript_GiveFullRestore setvar VAR_TEMP_1, 0 call ThreeIsland_EventScript_BikerArgumentScene release @@ -56,9 +54,8 @@ ThreeIsland_EventScript_GiveFullRestore:: applymovement LOCALID_ANTIBIKER1, Movement_FacePlayer waitmovement 0 msgbox ThreeIsland_Text_ThankYouOhYourMonGotHurt - checkitemspace ITEM_FULL_RESTORE, 1 - compare VAR_RESULT, FALSE - goto_if_eq ThreeIsland_EventScript_NoRoomForFullRestore + checkitemspace ITEM_FULL_RESTORE + goto_if_eq VAR_RESULT, FALSE, ThreeIsland_EventScript_NoRoomForFullRestore msgreceiveditem ThreeIsland_Text_GivenFullRestore, ITEM_FULL_RESTORE additem ITEM_FULL_RESTORE setflag FLAG_GOT_FULL_RESTORE_FROM_THREE_ISLAND_DEFENDER @@ -72,81 +69,67 @@ ThreeIsland_EventScript_NoRoomForFullRestore:: end ThreeIsland_EventScript_BikerArgumentScene:: - compare VAR_TEMP_1, 1 - call_if_eq ThreeIsland_EventScript_PlayerFaceLeft - compare VAR_TEMP_1, 2 - call_if_eq ThreeIsland_EventScript_PlayerFaceLeft + call_if_eq VAR_TEMP_1, 1, ThreeIsland_EventScript_PlayerFaceLeft + call_if_eq VAR_TEMP_1, 2, ThreeIsland_EventScript_PlayerFaceLeft applymovement LOCALID_ANTIBIKER1, ThreeIsland_Movement_SpeakRight waitmovement 0 msgbox ThreeIsland_Text_GoBackToKanto - compare VAR_TEMP_1, 0 - call_if_eq ThreeIsland_EventScript_PlayerFaceRight - compare VAR_TEMP_1, 1 - call_if_eq ThreeIsland_EventScript_PlayerFaceRight - compare VAR_TEMP_1, 2 - call_if_eq ThreeIsland_EventScript_PlayerFaceBiker + call_if_eq VAR_TEMP_1, 0, ThreeIsland_EventScript_PlayerFaceRight + call_if_eq VAR_TEMP_1, 1, ThreeIsland_EventScript_PlayerFaceRight + call_if_eq VAR_TEMP_1, 2, ThreeIsland_EventScript_PlayerFaceBiker applymovement LOCALID_BIKER1, ThreeIsland_Movement_SpeakLeft waitmovement 0 msgbox ThreeIsland_Text_BossIsOnHisWay - compare VAR_TEMP_1, 0 - call_if_eq ThreeIsland_EventScript_PlayerFaceUp - compare VAR_TEMP_1, 1 - call_if_eq ThreeIsland_EventScript_PlayerFaceUp - compare VAR_TEMP_1, 2 - call_if_eq ThreeIsland_EventScript_PlayerFaceAntiBiker + call_if_eq VAR_TEMP_1, 0, ThreeIsland_EventScript_PlayerFaceUp + call_if_eq VAR_TEMP_1, 1, ThreeIsland_EventScript_PlayerFaceUp + call_if_eq VAR_TEMP_1, 2, ThreeIsland_EventScript_PlayerFaceAntiBiker applymovement LOCALID_ANTIBIKER2, ThreeIsland_Movement_SpeakRight waitmovement 0 msgbox ThreeIsland_Text_GetOffIslandNow - compare VAR_TEMP_1, 0 - call_if_eq ThreeIsland_EventScript_PlayerFaceRight - compare VAR_TEMP_1, 1 - call_if_eq ThreeIsland_EventScript_PlayerFaceRight - compare VAR_TEMP_1, 2 - call_if_eq ThreeIsland_EventScript_PlayerFaceBiker + call_if_eq VAR_TEMP_1, 0, ThreeIsland_EventScript_PlayerFaceRight + call_if_eq VAR_TEMP_1, 1, ThreeIsland_EventScript_PlayerFaceRight + call_if_eq VAR_TEMP_1, 2, ThreeIsland_EventScript_PlayerFaceBiker applymovement LOCALID_BIKER3, ThreeIsland_Movement_SpeakLeft waitmovement 0 msgbox ThreeIsland_Text_WhosGonnaMakeMe return ThreeIsland_EventScript_PlayerFaceUp:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 return @ Unused ThreeIsland_EventScript_PlayerFaceDown:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestDown + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterDown waitmovement 0 return ThreeIsland_EventScript_PlayerFaceLeft:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 return ThreeIsland_EventScript_PlayerFaceRight:: - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 return ThreeIsland_EventScript_PlayerFaceBiker:: getplayerxy VAR_0x8004, VAR_0x8005 - compare VAR_0x8004, 9 - goto_if_ge ThreeIsland_EventScript_PlayerFaceUp + goto_if_ge VAR_0x8004, 9, ThreeIsland_EventScript_PlayerFaceUp goto ThreeIsland_EventScript_PlayerFaceRight end ThreeIsland_EventScript_PlayerFaceAntiBiker:: getplayerxy VAR_0x8004, VAR_0x8005 - compare VAR_0x8004, 9 - goto_if_ge ThreeIsland_EventScript_PlayerFaceLeft + goto_if_ge VAR_0x8004, 9, ThreeIsland_EventScript_PlayerFaceLeft goto ThreeIsland_EventScript_PlayerFaceUp end ThreeIsland_EventScript_AntiBiker2:: lock - compare VAR_MAP_SCENE_THREE_ISLAND, 4 - goto_if_eq ThreeIsland_EventScript_AntiBiker2BikersGone + goto_if_eq VAR_MAP_SCENE_THREE_ISLAND, 4, ThreeIsland_EventScript_AntiBiker2BikersGone setvar VAR_TEMP_1, 1 call ThreeIsland_EventScript_BikerArgumentScene release @@ -161,7 +144,7 @@ ThreeIsland_EventScript_AntiBiker2BikersGone:: ThreeIsland_EventScript_BikerBossIntroTrigger:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE applymovement LOCALID_ANTIBIKER1, ThreeIsland_Movement_SpeakRight waitmovement 0 msgbox ThreeIsland_Text_AreYouBossGoBackToKanto @@ -220,8 +203,8 @@ ThreeIsland_EventScript_BattleBikersTriggerRight:: end ThreeIsland_EventScript_BattleBikersScene:: - textcolor 0 - applymovement LOCALID_BIKER1, Movement_WalkInPlaceFastestDown + textcolor NPC_TEXT_COLOR_MALE + applymovement LOCALID_BIKER1, Movement_WalkInPlaceFasterDown waitmovement 0 playse SE_PIN applymovement LOCALID_BIKER1, Movement_ExclamationMark @@ -232,8 +215,7 @@ ThreeIsland_EventScript_BattleBikersScene:: waitmovement 0 playbgm MUS_ENCOUNTER_BOY, 0 msgbox ThreeIsland_Text_WannaMakeSomethingOfYourStaring, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq ThreeIsland_EventScript_LeaveBikersAlone + goto_if_eq VAR_RESULT, NO, ThreeIsland_EventScript_LeaveBikersAlone msgbox ThreeIsland_Text_Biker1Intro setvar VAR_LAST_TALKED, LOCALID_BIKER1 trainerbattle_no_intro TRAINER_BIKER_GOON, ThreeIsland_Text_Biker1Defeat @@ -257,24 +239,19 @@ ThreeIsland_EventScript_BattleBikersScene:: msgbox ThreeIsland_Text_Biker3Intro setvar VAR_LAST_TALKED, LOCALID_BIKER3 trainerbattle_no_intro TRAINER_BIKER_GOON_3, ThreeIsland_Text_Biker3Defeat - applymovement LOCALID_BIKER3, Movement_WalkInPlaceFastestLeft + applymovement LOCALID_BIKER3, Movement_WalkInPlaceFasterLeft waitmovement 0 - applymovement LOCALID_BIKER4, Movement_WalkInPlaceFastestDown - applymovement LOCALID_BIKER5, Movement_WalkInPlaceFastestDown + applymovement LOCALID_BIKER4, Movement_WalkInPlaceFasterDown + applymovement LOCALID_BIKER5, Movement_WalkInPlaceFasterDown waitmovement 0 msgbox ThreeIsland_Text_Biker3PostBattle closemessage delay 45 - compare VAR_TEMP_1, 0 - call_if_eq ThreeIsland_EventScript_PaxtonApproachLeft - compare VAR_TEMP_1, 1 - call_if_eq ThreeIsland_EventScript_PaxtonApproachMidLeft - compare VAR_TEMP_1, 2 - call_if_eq ThreeIsland_EventScript_PaxtonApproachMid - compare VAR_TEMP_1, 3 - call_if_eq ThreeIsland_EventScript_PaxtonApproachMidRight - compare VAR_TEMP_1, 4 - call_if_eq ThreeIsland_EventScript_PaxtonApproachRight + call_if_eq VAR_TEMP_1, 0, ThreeIsland_EventScript_PaxtonApproachLeft + call_if_eq VAR_TEMP_1, 1, ThreeIsland_EventScript_PaxtonApproachMidLeft + call_if_eq VAR_TEMP_1, 2, ThreeIsland_EventScript_PaxtonApproachMid + call_if_eq VAR_TEMP_1, 3, ThreeIsland_EventScript_PaxtonApproachMidRight + call_if_eq VAR_TEMP_1, 4, ThreeIsland_EventScript_PaxtonApproachRight playbgm MUS_ENCOUNTER_BOY, 0 msgbox ThreeIsland_Text_PaxtonIntro setvar VAR_LAST_TALKED, LOCALID_PAXTON @@ -295,33 +272,33 @@ ThreeIsland_EventScript_BattleBikersScene:: end ThreeIsland_EventScript_PaxtonApproachLeft:: - applymovement LOCALID_BIKER3, Movement_WalkInPlaceFastestDown + applymovement LOCALID_BIKER3, Movement_WalkInPlaceFasterDown applymovement LOCALID_PAXTON, ThreeIsland_Movement_PaxtonApproachLeft waitmovement 0 return ThreeIsland_EventScript_PaxtonApproachMidLeft:: - applymovement LOCALID_BIKER3, Movement_WalkInPlaceFastestDown + applymovement LOCALID_BIKER3, Movement_WalkInPlaceFasterDown applymovement LOCALID_PAXTON, ThreeIsland_Movement_PaxtonApproachMidLeft waitmovement 0 return ThreeIsland_EventScript_PaxtonApproachMid:: - applymovement LOCALID_BIKER3, Movement_WalkInPlaceFastestDown + applymovement LOCALID_BIKER3, Movement_WalkInPlaceFasterDown applymovement LOCALID_PAXTON, ThreeIsland_Movement_PaxtonApproachMid applymovement OBJ_EVENT_ID_PLAYER, ThreeIsland_Movement_PlayerFacePaxton waitmovement 0 return ThreeIsland_EventScript_PaxtonApproachMidRight:: - applymovement LOCALID_BIKER3, Movement_WalkInPlaceFastestDown + applymovement LOCALID_BIKER3, Movement_WalkInPlaceFasterDown applymovement OBJ_EVENT_ID_PLAYER, ThreeIsland_Movement_PlayerFacePaxton applymovement LOCALID_PAXTON, ThreeIsland_Movement_PaxtonApproachMidRight waitmovement 0 return ThreeIsland_EventScript_PaxtonApproachRight:: - applymovement LOCALID_BIKER3, Movement_WalkInPlaceFastestDown + applymovement LOCALID_BIKER3, Movement_WalkInPlaceFasterDown applymovement OBJ_EVENT_ID_PLAYER, ThreeIsland_Movement_PlayerFacePaxton applymovement LOCALID_PAXTON, ThreeIsland_Movement_PaxtonApproachRight waitmovement 0 @@ -348,7 +325,7 @@ ThreeIsland_Movement_BikerApproach:: ThreeIsland_Movement_Biker1ReturnToPack:: walk_up - walk_in_place_fastest_left + walk_in_place_faster_left step_end ThreeIsland_Movement_BikerSpeak:: @@ -358,7 +335,7 @@ ThreeIsland_Movement_BikerSpeak:: ThreeIsland_Movement_PaxtonApproachLeft:: walk_down walk_left - walk_in_place_fastest_down + walk_in_place_faster_down step_end ThreeIsland_Movement_PaxtonApproachMidLeft:: @@ -368,20 +345,20 @@ ThreeIsland_Movement_PaxtonApproachMidLeft:: ThreeIsland_Movement_PaxtonApproachMid:: walk_down walk_down - walk_in_place_fastest_right + walk_in_place_faster_right step_end ThreeIsland_Movement_PlayerFacePaxton:: delay_16 delay_16 - walk_in_place_fastest_left + walk_in_place_faster_left step_end ThreeIsland_Movement_PaxtonApproachMidRight:: walk_down walk_down walk_right - walk_in_place_fastest_right + walk_in_place_faster_right step_end ThreeIsland_Movement_PaxtonApproachRight:: @@ -389,7 +366,7 @@ ThreeIsland_Movement_PaxtonApproachRight:: walk_down walk_right walk_right - walk_in_place_fastest_right + walk_in_place_faster_right step_end ThreeIsland_EventScript_Woman:: diff --git a/data/maps/ThreeIsland_BerryForest/scripts.inc b/data/maps/ThreeIsland_BerryForest/scripts.inc index 8f5210dec..c5e8841de 100644 --- a/data/maps/ThreeIsland_BerryForest/scripts.inc +++ b/data/maps/ThreeIsland_BerryForest/scripts.inc @@ -6,7 +6,7 @@ ThreeIsland_BerryForest_MapScripts:: ThreeIsland_BerryForest_OnTransition:: setworldmapflag FLAG_WORLD_MAP_THREE_ISLAND_BERRY_FOREST - setescapewarp MAP_THREE_ISLAND_BOND_BRIDGE, 255, 12, 6 + setescapewarp MAP_THREE_ISLAND_BOND_BRIDGE, 12, 6 end ThreeIsland_BerryForest_EventScript_Lostelle:: @@ -23,15 +23,14 @@ ThreeIsland_BerryForest_EventScript_Lostelle:: waitse playmoncry SPECIES_HYPNO, CRY_MODE_ENCOUNTER waitmoncry - setwildbattle SPECIES_HYPNO, 30, ITEM_NONE + setwildbattle SPECIES_HYPNO, 30 dowildbattle special QuestLog_CutRecording applymovement LOCALID_LOSTELLE, Movement_FacePlayer waitmovement 0 msgbox ThreeIsland_BerryForest_Text_ThankYouHaveThis giveitem ITEM_IAPAPA_BERRY - compare VAR_RESULT, FALSE - call_if_eq ThreeIsland_BerryForest_EventScript_NoRoomForBerry + call_if_eq VAR_RESULT, FALSE, ThreeIsland_BerryForest_EventScript_NoRoomForBerry special BufferBigGuyOrBigGirlString msgbox ThreeIsland_BerryForest_Text_LetsGoHome closemessage @@ -39,7 +38,7 @@ ThreeIsland_BerryForest_EventScript_Lostelle:: setflag FLAG_HIDE_LOSTELLE_IN_BERRY_FOREST setvar VAR_MAP_SCENE_TWO_ISLAND_JOYFUL_GAME_CORNER, 2 clearflag FLAG_HIDE_TWO_ISLAND_GAME_CORNER_LOSTELLE - warp MAP_TWO_ISLAND_JOYFUL_GAME_CORNER, 255, 6, 6 + warp MAP_TWO_ISLAND_JOYFUL_GAME_CORNER, 6, 6 waitstate release end @@ -49,11 +48,11 @@ ThreeIsland_BerryForest_EventScript_NoRoomForBerry:: return ThreeIsland_BerryForest_Movement_LostelleLookAround:: - walk_in_place_fastest_left + walk_in_place_faster_left delay_16 - walk_in_place_fastest_right + walk_in_place_faster_right delay_8 - walk_in_place_fastest_left + walk_in_place_faster_left step_end ThreeIsland_BerryForest_EventScript_WelcomeSign:: diff --git a/data/maps/ThreeIsland_DunsparceTunnel/scripts.inc b/data/maps/ThreeIsland_DunsparceTunnel/scripts.inc index 52493703a..20826c539 100644 --- a/data/maps/ThreeIsland_DunsparceTunnel/scripts.inc +++ b/data/maps/ThreeIsland_DunsparceTunnel/scripts.inc @@ -8,10 +8,8 @@ ThreeIsland_DunsparceTunnel_OnTransition:: setworldmapflag FLAG_WORLD_MAP_THREE_ISLAND_DUNSPARCE_TUNNEL specialvar VAR_RESULT, IsNationalPokedexEnabled copyvar VAR_0x8008, VAR_RESULT - compare VAR_0x8008, TRUE - call_if_eq ThreeIsland_DunsparceTunnel_EventScript_SetLayoutDugOut - compare VAR_0x8008, FALSE - call_if_eq ThreeIsland_DunsparceTunnel_EventScript_MoveProspectorToWall + call_if_eq VAR_0x8008, TRUE, ThreeIsland_DunsparceTunnel_EventScript_SetLayoutDugOut + call_if_eq VAR_0x8008, FALSE, ThreeIsland_DunsparceTunnel_EventScript_MoveProspectorToWall end ThreeIsland_DunsparceTunnel_EventScript_SetLayoutDugOut:: @@ -28,8 +26,7 @@ ThreeIsland_DunsparceTunnel_EventScript_Prospector:: faceplayer goto_if_set FLAG_GOT_NUGGET_FROM_DUNSPARCE_TUNNEL, ThreeIsland_DunsparceTunnel_EventScript_ProspectorAlreadyGaveNugget specialvar VAR_RESULT, IsNationalPokedexEnabled - compare VAR_RESULT, TRUE - goto_if_eq ThreeIsland_DunsparceTunnel_EventScript_ProspectorStruckGold + goto_if_eq VAR_RESULT, TRUE, ThreeIsland_DunsparceTunnel_EventScript_ProspectorStruckGold msgbox ThreeIsland_DunsparceTunnel_Text_ProspectingForGold closemessage applymovement LOCALID_PROSPECTOR, Movement_FaceOriginalDirection @@ -40,8 +37,7 @@ ThreeIsland_DunsparceTunnel_EventScript_Prospector:: ThreeIsland_DunsparceTunnel_EventScript_ProspectorStruckGold:: msgbox ThreeIsland_DunsparceTunnel_Text_StruckGoldThisIsForYou giveitem ITEM_NUGGET - compare VAR_RESULT, FALSE - goto_if_eq ThreeIsland_DunsparceTunnel_EventScript_NoRoomForNugget + goto_if_eq VAR_RESULT, FALSE, ThreeIsland_DunsparceTunnel_EventScript_NoRoomForNugget setflag FLAG_GOT_NUGGET_FROM_DUNSPARCE_TUNNEL goto ThreeIsland_DunsparceTunnel_EventScript_ProspectorAlreadyGaveNugget end diff --git a/data/maps/ThreeIsland_Port/scripts.inc b/data/maps/ThreeIsland_Port/scripts.inc index d48609a81..bd28d7905 100644 --- a/data/maps/ThreeIsland_Port/scripts.inc +++ b/data/maps/ThreeIsland_Port/scripts.inc @@ -10,10 +10,8 @@ ThreeIsland_Port_OnTransition:: ThreeIsland_Port_EventScript_Woman:: lock faceplayer - compare VAR_MAP_SCENE_TWO_ISLAND_JOYFUL_GAME_CORNER, 2 - goto_if_ge ThreeIsland_Port_EventScript_WomanLostelleFound - compare VAR_MAP_SCENE_THREE_ISLAND, 4 - goto_if_ge ThreeIsland_Port_EventScript_WomanBikersGone + goto_if_ge VAR_MAP_SCENE_TWO_ISLAND_JOYFUL_GAME_CORNER, 2, ThreeIsland_Port_EventScript_WomanLostelleFound + goto_if_ge VAR_MAP_SCENE_THREE_ISLAND, 4, ThreeIsland_Port_EventScript_WomanBikersGone msgbox ThreeIsland_Port_Text_IllCallThePolice release end diff --git a/data/maps/TrainerTower_Elevator/scripts.inc b/data/maps/TrainerTower_Elevator/scripts.inc index eb871699e..07dd791f3 100644 --- a/data/maps/TrainerTower_Elevator/scripts.inc +++ b/data/maps/TrainerTower_Elevator/scripts.inc @@ -38,16 +38,15 @@ TrainerTower_Elevator_EventScript_ChooseFloor:: TrainerTower_Elevator_EventScript_SelectLobby:: setvar VAR_0x8006, 3 - setdynamicwarp MAP_TRAINER_TOWER_LOBBY, 255, 17, 8 - compare VAR_ELEVATOR_FLOOR, 3 - goto_if_eq TrainerTower_Elevator_EventScript_CloseFloorSelect + setdynamicwarp MAP_TRAINER_TOWER_LOBBY, 17, 8 + goto_if_eq VAR_ELEVATOR_FLOOR, 3, TrainerTower_Elevator_EventScript_CloseFloorSelect call TrainerTower_Elevator_EventScript_MoveElevator setvar VAR_ELEVATOR_FLOOR, 3 special CloseElevatorCurrentFloorWindow delay 25 applymovement OBJ_EVENT_ID_PLAYER, TrainerTower_Elevator_Movement_ExitElevator waitmovement 0 - warp MAP_TRAINER_TOWER_LOBBY, 255, 17, 8 + warp MAP_TRAINER_TOWER_LOBBY, 17, 8 waitstate releaseall end @@ -71,7 +70,7 @@ TrainerTower_Elevator_EventScript_MoveElevator:: return TrainerTower_Elevator_Movement_ExitElevator:: - walk_in_place_fastest_down + walk_in_place_faster_down delay_16 walk_down walk_right diff --git a/data/maps/TrainerTower_Lobby/scripts.inc b/data/maps/TrainerTower_Lobby/scripts.inc index 15a1bbb44..19dc390ae 100644 --- a/data/maps/TrainerTower_Lobby/scripts.inc +++ b/data/maps/TrainerTower_Lobby/scripts.inc @@ -16,8 +16,7 @@ TrainerTower_Lobby_OnResume:: setvar VAR_TEMP_2, 0 ttower_resumetimer ttower_shouldexit - compare VAR_RESULT, FALSE - goto_if_eq TrainerTower_Lobby_OnResumeEnd + goto_if_eq VAR_RESULT, FALSE, TrainerTower_Lobby_OnResumeEnd @ Never reached, above always FALSE setvar VAR_TEMP_0, 0 setobjectxy OBJ_EVENT_ID_PLAYER, 9, 7 @@ -34,8 +33,7 @@ TrainerTower_Lobby_OnReturnToField:: end TrainerTower_Lobby_OnLoad:: - compare VAR_TEMP_D, 17 - call_if_eq TrainerTower_Lobby_OpenCounterBarrier + call_if_eq VAR_TEMP_D, 17, TrainerTower_Lobby_OpenCounterBarrier end TrainerTower_Lobby_OpenCounterBarrier:: @@ -81,7 +79,7 @@ TrainerTower_Lobby_EventScript_LostChallenge:: lock faceplayer applymovement OBJ_EVENT_ID_PLAYER, TrainerTower_Lobby_Movement_FaceReceptionist - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox TrainerTower_Lobby_Text_TooBadComeBackTryAgain goto TrainerTower_Lobby_EventScript_ExitChallenge @@ -90,7 +88,7 @@ TrainerTower_Lobby_EventScript_164938:: lock faceplayer applymovement OBJ_EVENT_ID_PLAYER, TrainerTower_Lobby_Movement_FaceReceptionist - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox TrainerTower_Lobby_Text_MoveCounterHereWhenTrainersSwitch TrainerTower_Lobby_EventScript_ExitChallenge:: closemessage @@ -112,8 +110,7 @@ TrainerTower_Lobby_EventScript_Receptionist:: lock faceplayer ttower_getbeatchallenge - compare VAR_RESULT, TRUE - goto_if_eq TrainerTower_Lobby_EventScript_ThanksForCompeting + goto_if_eq VAR_RESULT, TRUE, TrainerTower_Lobby_EventScript_ThanksForCompeting msgbox TrainerTower_Lobby_Text_GiveItYourBest goto TrainerTower_Lobby_EventScript_ReceptionistEnd @@ -152,11 +149,10 @@ TrainerTower_Lobby_Mart_Items:: TrainerTower_Lobby_EventScript_EntryTrigger:: lockall applymovement OBJ_EVENT_ID_PLAYER, TrainerTower_Lobby_Movement_FaceReceptionist - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox TrainerTower_Lobby_Text_WelcomeToTrainerTower ttower_getnumfloors - compare VAR_RESULT, FALSE - goto_if_eq TrainerTower_Lobby_EventScript_AllFloorsUsed + goto_if_eq VAR_RESULT, FALSE, TrainerTower_Lobby_EventScript_AllFloorsUsed msgbox TrainerTower_Lobby_Text_TrainersUpToFloorNum goto TrainerTower_Lobby_EventScript_AskEnterChallenge diff --git a/data/maps/TwoIsland/scripts.inc b/data/maps/TwoIsland/scripts.inc index 591cb7368..5e8a768d7 100644 --- a/data/maps/TwoIsland/scripts.inc +++ b/data/maps/TwoIsland/scripts.inc @@ -61,12 +61,9 @@ TwoIsland_EventScript_Clerk:: goto_if_questlog EventScript_ReleaseEnd lock faceplayer - compare VAR_MAP_SCENE_TWO_ISLAND, 4 - goto_if_eq TwoIsland_EventScript_ClerkShopExpanded3 - compare VAR_MAP_SCENE_TWO_ISLAND, 3 - goto_if_eq TwoIsland_EventScript_ClerkShopExpanded2 - compare VAR_MAP_SCENE_TWO_ISLAND, 2 - goto_if_eq TwoIsland_EventScript_ClerkShopExpanded1 + goto_if_eq VAR_MAP_SCENE_TWO_ISLAND, 4, TwoIsland_EventScript_ClerkShopExpanded3 + goto_if_eq VAR_MAP_SCENE_TWO_ISLAND, 3, TwoIsland_EventScript_ClerkShopExpanded2 + goto_if_eq VAR_MAP_SCENE_TWO_ISLAND, 2, TwoIsland_EventScript_ClerkShopExpanded1 goto TwoIsland_EventScript_ClerkShopInitial end @@ -105,12 +102,9 @@ TwoIsland_EventScript_ClerkShopInitial:: TwoIsland_EventScript_ClerkShopSkipIntro:: message Text_MayIHelpYou waitmessage - compare VAR_MAP_SCENE_TWO_ISLAND, 4 - goto_if_eq TwoIsland_EventScript_ShopExpanded3 - compare VAR_MAP_SCENE_TWO_ISLAND, 3 - goto_if_eq TwoIsland_EventScript_ShopExpanded2 - compare VAR_MAP_SCENE_TWO_ISLAND, 2 - goto_if_eq TwoIsland_EventScript_ShopExpanded1 + goto_if_eq VAR_MAP_SCENE_TWO_ISLAND, 4, TwoIsland_EventScript_ShopExpanded3 + goto_if_eq VAR_MAP_SCENE_TWO_ISLAND, 3, TwoIsland_EventScript_ShopExpanded2 + goto_if_eq VAR_MAP_SCENE_TWO_ISLAND, 2, TwoIsland_EventScript_ShopExpanded1 goto TwoIsland_EventScript_ShopInitial end diff --git a/data/maps/TwoIsland_House/scripts.inc b/data/maps/TwoIsland_House/scripts.inc index 024c61f15..010f0fa10 100644 --- a/data/maps/TwoIsland_House/scripts.inc +++ b/data/maps/TwoIsland_House/scripts.inc @@ -21,12 +21,10 @@ TwoIsland_House_EventScript_MoveManiac:: end TwoIsland_House_EventScript_CheckPlayerHasMushrooms:: - checkitem ITEM_BIG_MUSHROOM, 1 - compare VAR_RESULT, TRUE - call_if_eq TwoIsland_House_EventScript_SetHasBigMushroom + checkitem ITEM_BIG_MUSHROOM + call_if_eq VAR_RESULT, TRUE, TwoIsland_House_EventScript_SetHasBigMushroom checkitem ITEM_TINY_MUSHROOM, 2 - compare VAR_RESULT, TRUE - call_if_eq TwoIsland_House_EventScript_SetHasTinyMushrooms + call_if_eq VAR_RESULT, TRUE, TwoIsland_House_EventScript_SetHasTinyMushrooms goto_if_set HAS_BIG_MUSHROOM, TwoIsland_House_EventScript_CheckAlsoHasTinyMushrooms goto_if_set HAS_TINY_MUSHROOMS, TwoIsland_House_EventScript_CheckAlsoHasBigMushroom goto TwoIsland_House_EventScript_EndTutorMove @@ -44,8 +42,7 @@ TwoIsland_House_EventScript_CheckAlsoHasBigMushroom:: TwoIsland_House_EventScript_AskTutorMon:: msgbox TwoIsland_House_Text_WantMeToTeachMove, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq TwoIsland_House_EventScript_EndTutorMove + goto_if_eq VAR_RESULT, NO, TwoIsland_House_EventScript_EndTutorMove goto TwoIsland_House_EventScript_ChooseMonToTutor end @@ -53,13 +50,10 @@ TwoIsland_House_EventScript_ChooseMonToTutor:: msgbox TwoIsland_House_Text_TutorWhichMon special SelectMoveTutorMon waitstate - compare VAR_0x8004, PARTY_SIZE - goto_if_ge TwoIsland_House_EventScript_EndTutorMove + goto_if_ge VAR_0x8004, PARTY_SIZE, TwoIsland_House_EventScript_EndTutorMove special IsSelectedMonEgg - compare VAR_RESULT, TRUE - goto_if_eq TwoIsland_House_EventScript_CantTutorEgg - compare VAR_0x8005, 0 - goto_if_eq TwoIsland_House_EventScript_NoMoveToTutorMon + goto_if_eq VAR_RESULT, TRUE, TwoIsland_House_EventScript_CantTutorEgg + goto_if_eq VAR_0x8005, 0, TwoIsland_House_EventScript_NoMoveToTutorMon goto TwoIsland_House_EventScript_ChooseMoveToTeach end @@ -67,16 +61,15 @@ TwoIsland_House_EventScript_ChooseMoveToTeach:: msgbox TwoIsland_House_Text_TeachWhichMove special DisplayMoveTutorMenu waitstate - compare VAR_0x8004, 0 - goto_if_eq TwoIsland_House_EventScript_ChooseMonToTutor + goto_if_eq VAR_0x8004, 0, TwoIsland_House_EventScript_ChooseMonToTutor goto_if_set HAS_BOTH_MUSHROOMS, TwoIsland_House_EventScript_ChooseMushroom goto_if_set HAS_BIG_MUSHROOM, TwoIsland_House_EventScript_GiveBigMushroom goto_if_set HAS_TINY_MUSHROOMS, TwoIsland_House_EventScript_GiveTinyMushrooms end TwoIsland_House_EventScript_GiveBigMushroom:: - removeitem ITEM_BIG_MUSHROOM, 1 - textcolor 3 + removeitem ITEM_BIG_MUSHROOM + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox TwoIsland_House_Text_HandedOverOneBigMushroom call EventScript_RestorePrevTextColor goto TwoIsland_House_EventScript_EndTutorMove @@ -84,7 +77,7 @@ TwoIsland_House_EventScript_GiveBigMushroom:: TwoIsland_House_EventScript_GiveTinyMushrooms:: removeitem ITEM_TINY_MUSHROOM, 2 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox TwoIsland_House_Text_HandedOverTwoTinyMushrooms call EventScript_RestorePrevTextColor goto TwoIsland_House_EventScript_EndTutorMove diff --git a/data/maps/TwoIsland_JoyfulGameCorner/scripts.inc b/data/maps/TwoIsland_JoyfulGameCorner/scripts.inc index e2a5cdf02..ab2e4a8bf 100644 --- a/data/maps/TwoIsland_JoyfulGameCorner/scripts.inc +++ b/data/maps/TwoIsland_JoyfulGameCorner/scripts.inc @@ -37,13 +37,13 @@ TwoIsland_JoyfulGameCorner_OnFrame:: TwoIsland_JoyfulGameCorner_EventScript_FoundLostelleScene:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox TwoIsland_JoyfulGameCorner_Text_YouRescuedLostelle - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE special BufferBigGuyOrBigGirlString msgbox TwoIsland_JoyfulGameCorner_Text_LostelleItsOkayDaddy closemessage - applymovement LOCALID_LOSTELLE, Movement_WalkInPlaceFastestDown + applymovement LOCALID_LOSTELLE, Movement_WalkInPlaceFasterDown waitmovement 0 setvar VAR_MAP_SCENE_TWO_ISLAND_JOYFUL_GAME_CORNER, 3 releaseall @@ -51,12 +51,12 @@ TwoIsland_JoyfulGameCorner_EventScript_FoundLostelleScene:: TwoIsland_JoyfulGameCorner_EventScript_HelpFindLostelleScene:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE applymovement LOCALID_DADDY, Movement_171520 waitmovement 0 msgbox TwoIsland_JoyfulGameCorner_Text_WhereHasLostelleGottenTo closemessage - applymovement LOCALID_DADDY, Movement_WalkInPlaceFastestDown + applymovement LOCALID_DADDY, Movement_WalkInPlaceFasterDown waitmovement 0 playse SE_PIN applymovement LOCALID_DADDY, Movement_ExclamationMark @@ -65,7 +65,7 @@ TwoIsland_JoyfulGameCorner_EventScript_HelpFindLostelleScene:: waitmovement 0 applymovement LOCALID_DADDY, Movement_171527 waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 msgbox TwoIsland_JoyfulGameCorner_Text_PleaseHelpFindLostelle closemessage @@ -78,12 +78,12 @@ TwoIsland_JoyfulGameCorner_EventScript_HelpFindLostelleScene:: applymovement LOCALID_BIKER, TwoIsland_JoyfulGameCorner_Movement_BikerLookAround waitmovement 0 msgbox TwoIsland_JoyfulGameCorner_Text_IsThisOnlyThreeIsland - applymovement LOCALID_BIKER, Movement_WalkInPlaceFastestRight + applymovement LOCALID_BIKER, Movement_WalkInPlaceFasterRight waitmovement 0 msgbox TwoIsland_JoyfulGameCorner_Text_ThisIsTwoIslandMoveIt msgbox TwoIsland_JoyfulGameCorner_Text_TheseIslandsAreConfusing closemessage - applymovement LOCALID_BIKER, Movement_WalkInPlaceFastestDown + applymovement LOCALID_BIKER, Movement_WalkInPlaceFasterDown waitmovement 0 playse SE_EXIT removeobject LOCALID_BIKER @@ -101,7 +101,7 @@ Movement_171520:: walk_right walk_right delay_8 - walk_in_place_fastest_up + walk_in_place_faster_up delay_16 step_end @@ -109,27 +109,26 @@ Movement_171527:: walk_down walk_down walk_down - walk_in_place_fastest_left + walk_in_place_faster_left step_end Movement_17152C:: walk_left - walk_in_place_fastest_right + walk_in_place_faster_right step_end TwoIsland_JoyfulGameCorner_Movement_BikerLookAround:: - walk_in_place_fastest_left + walk_in_place_faster_left delay_8 - walk_in_place_fastest_right + walk_in_place_faster_right delay_8 - walk_in_place_fastest_up + walk_in_place_faster_up step_end TwoIsland_JoyfulGameCorner_EventScript_InfoMan:: lock faceplayer - compare VAR_MAP_SCENE_TWO_ISLAND_JOYFUL_GAME_CORNER, 4 - goto_if_eq JoyfulGameCorner_EventScript_InfoMan2 + goto_if_eq VAR_MAP_SCENE_TWO_ISLAND_JOYFUL_GAME_CORNER, 4, JoyfulGameCorner_EventScript_InfoMan2 goto_if_set FLAG_RESCUED_LOSTELLE, TwoIsland_JoyfulGameCorner_EventScript_GetGamesGoingSoon msgbox TwoIsland_JoyfulGameCorner_Text_NotRunningAnyGamesToday release @@ -144,11 +143,9 @@ TwoIsland_JoyfulGameCorner_EventScript_GetGamesGoingSoon:: TwoIsland_JoyfulGameCorner_EventScript_LostellesDaddy:: lock faceplayer - compare VAR_MAP_SCENE_TWO_ISLAND_JOYFUL_GAME_CORNER, 4 - goto_if_eq JoyfulGameCorner_EventScript_MinigameAttendant + goto_if_eq VAR_MAP_SCENE_TWO_ISLAND_JOYFUL_GAME_CORNER, 4, JoyfulGameCorner_EventScript_MinigameAttendant goto_if_set FLAG_GOT_MOON_STONE_FROM_JOYFUL_GAME_CORNER, TwoIsland_JoyfulGameCorner_EventScript_GetGameCornerRunning - compare VAR_MAP_SCENE_TWO_ISLAND_JOYFUL_GAME_CORNER, 3 - goto_if_eq TwoIsland_JoyfulGameCorner_EventScript_GiveDaddyMeteorite + goto_if_eq VAR_MAP_SCENE_TWO_ISLAND_JOYFUL_GAME_CORNER, 3, TwoIsland_JoyfulGameCorner_EventScript_GiveDaddyMeteorite msgbox TwoIsland_JoyfulGameCorner_Text_PleaseGoToThreeIsland release end @@ -157,21 +154,20 @@ TwoIsland_JoyfulGameCorner_EventScript_GiveDaddyMeteorite:: goto_if_set FLAG_NO_ROOM_FOR_JOYFUL_GAME_CORNER_MOON_STONE, TwoIsland_JoyfulGameCorner_EventScript_ReceiveMoonStone msgbox TwoIsland_JoyfulGameCorner_Text_ThisIsForMe setvar VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 2 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_OBTAIN_TMHM message TwoIsland_JoyfulGameCorner_Text_HandedMeteoriteToLostellesDaddy waitmessage waitfanfare call EventScript_RestorePrevTextColor - removeitem ITEM_METEORITE, 1 + removeitem ITEM_METEORITE msgbox TwoIsland_JoyfulGameCorner_Text_OhThisIsFromBill goto TwoIsland_JoyfulGameCorner_EventScript_ReceiveMoonStone end TwoIsland_JoyfulGameCorner_EventScript_ReceiveMoonStone:: - checkitemspace ITEM_MOON_STONE, 1 - compare VAR_RESULT, FALSE - goto_if_eq TwoIsland_JoyfulGameCorner_EventScript_NoRoomForMoonStone + checkitemspace ITEM_MOON_STONE + goto_if_eq VAR_RESULT, FALSE, TwoIsland_JoyfulGameCorner_EventScript_NoRoomForMoonStone additem ITEM_MOON_STONE setflag FLAG_GOT_MOON_STONE_FROM_JOYFUL_GAME_CORNER msgreceiveditem TwoIsland_JoyfulGameCorner_Text_ReceivedMoonStoneFromLostellesDaddy, ITEM_MOON_STONE diff --git a/data/maps/UndergroundPath_NorthEntrance/scripts.inc b/data/maps/UndergroundPath_NorthEntrance/scripts.inc index 207055dc7..671948449 100644 --- a/data/maps/UndergroundPath_NorthEntrance/scripts.inc +++ b/data/maps/UndergroundPath_NorthEntrance/scripts.inc @@ -8,14 +8,11 @@ UndergroundPath_NorthEntrance_EventScript_Saige:: call EventScript_GetInGameTradeSpeciesInfo goto_if_set FLAG_DID_MS_NIDO_TRADE, UndergroundPath_NorthEntrance_EventScript_AlreadyTraded msgbox Trade_Text_DoYouHaveMonWantToTradeForMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq UndergroundPath_NorthEntrance_EventScript_DeclineTrade + goto_if_eq VAR_RESULT, NO, UndergroundPath_NorthEntrance_EventScript_DeclineTrade call EventScript_ChooseMonForInGameTrade - compare VAR_0x8004, PARTY_SIZE - goto_if_ge UndergroundPath_NorthEntrance_EventScript_DeclineTrade + goto_if_ge VAR_0x8004, PARTY_SIZE, UndergroundPath_NorthEntrance_EventScript_DeclineTrade call EventScript_GetInGameTradeSpecies - compare VAR_RESULT, VAR_0x8009 - goto_if_ne UndergroundPath_NorthEntrance_EventScript_NotRequestedMon + goto_if_ne VAR_RESULT, VAR_0x8009, UndergroundPath_NorthEntrance_EventScript_NotRequestedMon call EventScript_DoInGameTrade msgbox Trade_Text_ThanksYoureAPal setflag FLAG_DID_MS_NIDO_TRADE @@ -28,7 +25,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/scripts.inc b/data/maps/VermilionCity/scripts.inc index 128850f03..9b7028145 100644 --- a/data/maps/VermilionCity/scripts.inc +++ b/data/maps/VermilionCity/scripts.inc @@ -38,8 +38,7 @@ VermilionCity_EventScript_Woman:: VermilionCity_EventScript_OldMan1:: lock faceplayer - compare VAR_MAP_SCENE_VERMILION_CITY, 3 - goto_if_eq VermilionCity_EventScript_OldMan1SSAnneLeft + goto_if_eq VAR_MAP_SCENE_VERMILION_CITY, 3, VermilionCity_EventScript_OldMan1SSAnneLeft msgbox VermilionCity_Text_DidYouSeeSSAnneInHarbor release end @@ -52,34 +51,29 @@ VermilionCity_EventScript_OldMan1SSAnneLeft:: VermilionCity_EventScript_FerrySailor:: lock faceplayer - compare VAR_MAP_SCENE_VERMILION_CITY, 3 - goto_if_eq VermilionCity_EventScript_CheckSeagallopPresent + goto_if_eq VAR_MAP_SCENE_VERMILION_CITY, 3, VermilionCity_EventScript_CheckSeagallopPresent msgbox VermilionCity_Text_WelcomeToTheSSAnne release end VermilionCity_EventScript_CheckHasMysticTicket:: goto_if_unset FLAG_ENABLE_SHIP_NAVEL_ROCK, EventScript_SetResultFalse - checkitem ITEM_MYSTIC_TICKET, 1 - compare VAR_RESULT, FALSE - goto_if_eq EventScript_SetResultFalse + checkitem ITEM_MYSTIC_TICKET + goto_if_eq VAR_RESULT, FALSE, EventScript_SetResultFalse goto EventScript_SetResultTrue end VermilionCity_EventScript_CheckHasAuroraTicket:: goto_if_unset FLAG_ENABLE_SHIP_BIRTH_ISLAND, EventScript_SetResultFalse - checkitem ITEM_AURORA_TICKET, 1 - compare VAR_RESULT, FALSE - goto_if_eq EventScript_SetResultFalse + checkitem ITEM_AURORA_TICKET + goto_if_eq VAR_RESULT, FALSE, EventScript_SetResultFalse goto EventScript_SetResultTrue end VermilionCity_EventScript_CheckSeagallopPresent:: setvar VAR_0x8004, SEAGALLOP_VERMILION_CITY - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5 - goto_if_ge VermilionCity_EventScript_ChooseSeagallopDestRainbowPass - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 1 - goto_if_ge VermilionCity_EventScript_ChooseSeagallopDestTriPass + goto_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5, VermilionCity_EventScript_ChooseSeagallopDestRainbowPass + goto_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 1, VermilionCity_EventScript_ChooseSeagallopDestTriPass msgbox VermilionCity_Text_TheShipSetSail release end @@ -88,11 +82,9 @@ VermilionCity_EventScript_ChooseSeagallopDestRainbowPass:: goto_if_questlog EventScript_ReleaseEnd special QuestLog_CutRecording call VermilionCity_EventScript_CheckHasMysticTicket - compare VAR_RESULT, TRUE - goto_if_eq VermilionCity_EventScript_HasMysticTicket + goto_if_eq VAR_RESULT, TRUE, VermilionCity_EventScript_HasMysticTicket call VermilionCity_EventScript_CheckHasAuroraTicket - compare VAR_RESULT, TRUE - goto_if_eq VermilionCity_EventScript_HasAuroraTicket + goto_if_eq VAR_RESULT, TRUE, VermilionCity_EventScript_HasAuroraTicket setvar VAR_0x8004, SEAGALLOP_VERMILION_CITY message VermilionCity_Text_BoardSeagallopRainbowPass waitmessage @@ -101,8 +93,7 @@ VermilionCity_EventScript_ChooseSeagallopDestRainbowPass:: VermilionCity_EventScript_HasMysticTicket:: call VermilionCity_EventScript_CheckHasAuroraTicket - compare VAR_RESULT, TRUE - goto_if_eq VermilionCity_EventScript_HasMysticAndAuroraTickets + goto_if_eq VAR_RESULT, TRUE, VermilionCity_EventScript_HasMysticAndAuroraTickets call_if_unset FLAG_SHOWN_MYSTIC_TICKET, VermilionCity_EventScript_ShowMysticTicket message VermilionCity_Text_BoardSeagallopFerry waitmessage @@ -199,12 +190,11 @@ VermilionCity_EventScript_ExitedTicketCheck:: end VermilionCity_EventScript_CheckTicket:: - textcolor 0 - applymovement LOCALID_FERRY_SAILOR, Movement_WalkInPlaceFastestLeft - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + textcolor NPC_TEXT_COLOR_MALE + applymovement LOCALID_FERRY_SAILOR, Movement_WalkInPlaceFasterLeft + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 - compare VAR_MAP_SCENE_VERMILION_CITY, 3 - goto_if_eq VermilionCity_EventScript_CheckSeagallopPresentTrigger + goto_if_eq VAR_MAP_SCENE_VERMILION_CITY, 3, VermilionCity_EventScript_CheckSeagallopPresentTrigger msgbox VermilionCity_Text_DoYouHaveATicket goto_if_unset FLAG_GOT_SS_TICKET, VermilionCity_EventScript_DontHaveSSTicket msgbox VermilionCity_Text_FlashedSSTicket @@ -220,10 +210,8 @@ VermilionCity_EventScript_DontHaveSSTicket:: VermilionCity_EventScript_CheckSeagallopPresentTrigger:: setvar VAR_0x8004, SEAGALLOP_VERMILION_CITY - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5 - goto_if_ge VermilionCity_EventScript_ChooseSeagallopDestRainbowPass - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 1 - goto_if_ge VermilionCity_EventScript_ChooseSeagallopDestTriPass + goto_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5, VermilionCity_EventScript_ChooseSeagallopDestRainbowPass + goto_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 1, VermilionCity_EventScript_ChooseSeagallopDestTriPass msgbox VermilionCity_Text_TheShipSetSail closemessage goto VermilionCity_EventScript_WalkUpPier diff --git a/data/maps/VermilionCity_Gym/scripts.inc b/data/maps/VermilionCity_Gym/scripts.inc index 5e1ad744b..844201b07 100644 --- a/data/maps/VermilionCity_Gym/scripts.inc +++ b/data/maps/VermilionCity_Gym/scripts.inc @@ -147,8 +147,7 @@ VermilionCity_Gym_EventScript_TrashCan:: copyvar SWITCH2_ID, VAR_TEMP_1 goto_if_set FLAG_FOUND_BOTH_VERMILION_GYM_SWITCHES, VermilionCity_Gym_EventScript_LocksAlreadyOpen goto_if_set FOUND_FIRST_SWITCH, VermilionCity_Gym_EventScript_TrySwitchTwo - compare SWITCH1_ID, TRASH_CAN_ID - goto_if_eq VermilionCity_Gym_EventScript_FoundSwitchOne + goto_if_eq SWITCH1_ID, TRASH_CAN_ID, VermilionCity_Gym_EventScript_FoundSwitchOne msgbox VermilionCity_Gym_Text_NopeOnlyTrashHere releaseall end @@ -164,8 +163,7 @@ VermilionCity_Gym_EventScript_FoundSwitchOne:: end VermilionCity_Gym_EventScript_TrySwitchTwo:: - compare SWITCH2_ID, TRASH_CAN_ID - goto_if_eq VermilionCity_Gym_EventScript_FoundSwitchTwo + goto_if_eq SWITCH2_ID, TRASH_CAN_ID, VermilionCity_Gym_EventScript_FoundSwitchTwo msgbox VermilionCity_Gym_Text_OnlyTrashLocksWereReset clearflag FOUND_FIRST_SWITCH special SetVermilionTrashCans @@ -229,9 +227,8 @@ VermilionCity_Gym_EventScript_ShowOaksAide:: VermilionCity_Gym_EventScript_GiveTM34:: msgbox VermilionCity_Gym_Text_ExplainThunderBadgeTakeThis - checkitemspace ITEM_TM34, 1 - compare VAR_RESULT, FALSE - goto_if_eq VermilionCity_Gym_EventScript_NoRoomForTM34 + checkitemspace ITEM_TM34 + goto_if_eq VAR_RESULT, FALSE, VermilionCity_Gym_EventScript_NoRoomForTM34 giveitem_msg VermilionCity_Gym_Text_ReceivedTM34FromLtSurge, ITEM_TM34 setflag FLAG_GOT_TM34_FROM_SURGE msgbox VermilionCity_Gym_Text_ExplainTM34 diff --git a/data/maps/VermilionCity_House1/scripts.inc b/data/maps/VermilionCity_House1/scripts.inc index e4194b549..e4afccb20 100644 --- a/data/maps/VermilionCity_House1/scripts.inc +++ b/data/maps/VermilionCity_House1/scripts.inc @@ -6,8 +6,7 @@ VermilionCity_House1_EventScript_FishingGuru:: faceplayer goto_if_set FLAG_GOT_OLD_ROD, VermilionCity_House1_EventScript_AlreadyGotOldRod msgbox VermilionCity_House1_Text_ImFishingGuruDoYouLikeToFish, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq VermilionCity_House1_EventScript_GiveOldRod + goto_if_eq VAR_RESULT, YES, VermilionCity_House1_EventScript_GiveOldRod msgbox VermilionCity_House1_Text_OhThatsSoDisappointing release end @@ -18,9 +17,8 @@ VermilionCity_House1_EventScript_AlreadyGotOldRod:: end VermilionCity_House1_EventScript_GiveOldRod:: - checkitemspace ITEM_OLD_ROD, 1 - compare VAR_RESULT, FALSE - goto_if_eq VermilionCity_House1_EventScript_NoRoomForOldRod + checkitemspace ITEM_OLD_ROD + goto_if_eq VAR_RESULT, FALSE, VermilionCity_House1_EventScript_NoRoomForOldRod additem ITEM_OLD_ROD msgbox VermilionCity_House1_Text_TakeThisAndFish msgreceiveditem VermilionCity_House1_Text_ReceivedOldRodFromFishingGuru, ITEM_OLD_ROD diff --git a/data/maps/VermilionCity_House2/scripts.inc b/data/maps/VermilionCity_House2/scripts.inc index 51ff9a355..2bd2400be 100644 --- a/data/maps/VermilionCity_House2/scripts.inc +++ b/data/maps/VermilionCity_House2/scripts.inc @@ -8,14 +8,11 @@ VermilionCity_House2_EventScript_Elyssa:: call EventScript_GetInGameTradeSpeciesInfo goto_if_set FLAG_DID_CH_DING_TRADE, VermilionCity_House2_EventScript_AlreadyTraded msgbox VermilionCity_House2_Text_DoYouHaveMonWantToTradeForMyMon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq VermilionCity_House2_EventScript_DeclineTrade + goto_if_eq VAR_RESULT, NO, VermilionCity_House2_EventScript_DeclineTrade call EventScript_ChooseMonForInGameTrade - compare VAR_0x8004, PARTY_SIZE - goto_if_ge VermilionCity_House2_EventScript_DeclineTrade + goto_if_ge VAR_0x8004, PARTY_SIZE, VermilionCity_House2_EventScript_DeclineTrade call EventScript_GetInGameTradeSpecies - compare VAR_RESULT, VAR_0x8009 - goto_if_ne VermilionCity_House2_EventScript_NotRequestedMon + goto_if_ne VAR_RESULT, VAR_0x8009, VermilionCity_House2_EventScript_NotRequestedMon call EventScript_DoInGameTrade msgbox VermilionCity_House2_Text_ThankYou setflag FLAG_DID_CH_DING_TRADE @@ -28,7 +25,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/VermilionCity_PokemonFanClub/scripts.inc b/data/maps/VermilionCity_PokemonFanClub/scripts.inc index 6c0efe151..1ef77430e 100644 --- a/data/maps/VermilionCity_PokemonFanClub/scripts.inc +++ b/data/maps/VermilionCity_PokemonFanClub/scripts.inc @@ -12,8 +12,7 @@ VermilionCity_PokemonFanClub_EventScript_Chairman:: faceplayer goto_if_set FLAG_GOT_BIKE_VOUCHER, VermilionCity_PokemonFanClub_EventScript_AlreadyHeardStory msgbox VermilionCity_PokemonFanClub_Text_DidYouComeToHearAboutMyMons, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq VermilionCity_PokemonFanClub_EventScript_ChairmanStory + goto_if_eq VAR_RESULT, YES, VermilionCity_PokemonFanClub_EventScript_ChairmanStory msgbox VermilionCity_PokemonFanClub_Text_ComeBackToHearStory release end @@ -25,9 +24,8 @@ VermilionCity_PokemonFanClub_EventScript_AlreadyHeardStory:: VermilionCity_PokemonFanClub_EventScript_ChairmanStory:: msgbox VermilionCity_PokemonFanClub_Text_ChairmansStory - checkitemspace ITEM_BIKE_VOUCHER, 1 - compare VAR_RESULT, FALSE - goto_if_eq VermilionCity_PokemonFanClub_EventScript_NoRoomForBikeVoucher + checkitemspace ITEM_BIKE_VOUCHER + goto_if_eq VAR_RESULT, FALSE, VermilionCity_PokemonFanClub_EventScript_NoRoomForBikeVoucher setflag FLAG_GOT_BIKE_VOUCHER giveitem_msg VermilionCity_PokemonFanClub_Text_ReceivedBikeVoucherFromChairman, ITEM_BIKE_VOUCHER, 1, MUS_OBTAIN_KEY_ITEM msgbox VermilionCity_PokemonFanClub_Text_ExplainBikeVoucher diff --git a/data/maps/VictoryRoad_1F/scripts.inc b/data/maps/VictoryRoad_1F/scripts.inc index 9c3f748bb..c7db0fc69 100644 --- a/data/maps/VictoryRoad_1F/scripts.inc +++ b/data/maps/VictoryRoad_1F/scripts.inc @@ -1,11 +1,12 @@ +.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 .byte 0 VictoryRoad_1F_OnLoad:: - compare VAR_MAP_SCENE_VICTORY_ROAD_1F, 100 - call_if_ne VictoryRoad_1F_EventScript_SetRockBarrier + call_if_ne VAR_MAP_SCENE_VICTORY_ROAD_1F, 100, VictoryRoad_1F_EventScript_SetRockBarrier end VictoryRoad_1F_EventScript_SetRockBarrier:: @@ -19,14 +20,13 @@ VictoryRoad_1F_OnTransition:: VictoryRoad_1F_EventScript_FloorSwitch:: lockall - compare VAR_MAP_SCENE_VICTORY_ROAD_1F, 100 - goto_if_eq VictoryRoad_1F_EventScript_FloorSwitchAlreadyPressed + goto_if_eq VAR_MAP_SCENE_VICTORY_ROAD_1F, 100, VictoryRoad_1F_EventScript_FloorSwitchAlreadyPressed setmetatile 12, 14, METATILE_Cave_Floor_Ledge_Top, 0 setmetatile 12, 15, METATILE_Cave_Floor_Ledge_Bottom, 0 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..7e8140e29 100644 --- a/data/maps/VictoryRoad_2F/scripts.inc +++ b/data/maps/VictoryRoad_2F/scripts.inc @@ -1,12 +1,13 @@ +.set LOCALID_BOULDER1, 11 +.set LOCALID_BOULDER2, 12 + VictoryRoad_2F_MapScripts:: map_script MAP_SCRIPT_ON_LOAD, VictoryRoad_2F_OnLoad .byte 0 VictoryRoad_2F_OnLoad:: - compare VAR_MAP_SCENE_VICTORY_ROAD_2F_BOULDER1, 100 - call_if_ne VictoryRoad_2F_EventScript_SetRockBarrier1 - compare VAR_MAP_SCENE_VICTORY_ROAD_2F_BOULDER2, 100 - call_if_ne VictoryRoad_2F_EventScript_SetRockBarrier2 + call_if_ne VAR_MAP_SCENE_VICTORY_ROAD_2F_BOULDER1, 100, VictoryRoad_2F_EventScript_SetRockBarrier1 + call_if_ne VAR_MAP_SCENE_VICTORY_ROAD_2F_BOULDER2, 100, VictoryRoad_2F_EventScript_SetRockBarrier2 end VictoryRoad_2F_EventScript_SetRockBarrier1:: @@ -21,14 +22,13 @@ VictoryRoad_2F_EventScript_SetRockBarrier2:: VictoryRoad_2F_EventScript_FloorSwitch1:: lockall - compare VAR_MAP_SCENE_VICTORY_ROAD_2F_BOULDER1, 100 - goto_if_eq VictoryRoad_2F_EventScript_FloorSwitch1AlreadyPressed + goto_if_eq VAR_MAP_SCENE_VICTORY_ROAD_2F_BOULDER1, 100, VictoryRoad_2F_EventScript_FloorSwitch1AlreadyPressed setmetatile 13, 10, METATILE_Cave_Floor_Ledge_Top, 0 setmetatile 13, 11, METATILE_Cave_Floor_Ledge_Bottom, 0 playse SE_ICE_BREAK special DrawWholeMapView waitse - moveobjectoffscreen 11 + copyobjectxytoperm LOCALID_BOULDER1 setvar VAR_MAP_SCENE_VICTORY_ROAD_2F_BOULDER1, 100 releaseall end @@ -39,14 +39,13 @@ VictoryRoad_2F_EventScript_FloorSwitch1AlreadyPressed:: VictoryRoad_2F_EventScript_FloorSwitch2:: lockall - compare VAR_MAP_SCENE_VICTORY_ROAD_2F_BOULDER2, 100 - goto_if_eq VictoryRoad_2F_EventScript_FloorSwitch2AlreadyPressed + goto_if_eq VAR_MAP_SCENE_VICTORY_ROAD_2F_BOULDER2, 100, VictoryRoad_2F_EventScript_FloorSwitch2AlreadyPressed setmetatile 33, 16, METATILE_Cave_Floor_Ledge_Top, 0 setmetatile 33, 17, METATILE_Cave_Floor_Ledge_Bottom, 0 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..23350fb8b 100644 --- a/data/maps/VictoryRoad_3F/scripts.inc +++ b/data/maps/VictoryRoad_3F/scripts.inc @@ -1,10 +1,12 @@ +.set LOCALID_BOULDER1, 7 +.set LOCALID_BOULDER2, 10 + VictoryRoad_3F_MapScripts:: map_script MAP_SCRIPT_ON_LOAD, VictoryRoad_3F_OnLoad .byte 0 VictoryRoad_3F_OnLoad:: - compare VAR_MAP_SCENE_VICTORY_ROAD_3F, 100 - call_if_ne VictoryRoad_3F_EventScript_SetRockBarrier + call_if_ne VAR_MAP_SCENE_VICTORY_ROAD_3F, 100, VictoryRoad_3F_EventScript_SetRockBarrier end VictoryRoad_3F_EventScript_SetRockBarrier:: @@ -14,15 +16,14 @@ VictoryRoad_3F_EventScript_SetRockBarrier:: VictoryRoad_3F_EventScript_FloorSwitch:: lockall - compare VAR_MAP_SCENE_VICTORY_ROAD_3F, 100 - goto_if_eq VictoryRoad_3F_EventScript_FloorSwitchAlreadyPressed + goto_if_eq VAR_MAP_SCENE_VICTORY_ROAD_3F, 100, VictoryRoad_3F_EventScript_FloorSwitchAlreadyPressed setmetatile 12, 12, METATILE_Cave_Floor_Ledge_Top, 0 setmetatile 12, 13, METATILE_Cave_Floor_Ledge_Bottom, 0 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/maps/ViridianCity/scripts.inc b/data/maps/ViridianCity/scripts.inc index c1b735a6d..85edc6686 100644 --- a/data/maps/ViridianCity/scripts.inc +++ b/data/maps/ViridianCity/scripts.inc @@ -8,14 +8,10 @@ ViridianCity_MapScripts:: ViridianCity_OnTransition:: setworldmapflag FLAG_WORLD_MAP_VIRIDIAN_CITY - compare VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 0 - call_if_eq ViridianCity_EventScript_SetOldManBlockingRoad - compare VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 1 - call_if_eq ViridianCity_EventScript_SetOldManStandingByRoad - compare VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 2 - call_if_ge ViridianCity_EventScript_SetOldManNormal - compare VAR_MAP_SCENE_VIRIDIAN_CITY_GYM_DOOR, 0 - call_if_eq ViridianCity_EventScript_TryUnlockGym + call_if_eq VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 0, ViridianCity_EventScript_SetOldManBlockingRoad + call_if_eq VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 1, ViridianCity_EventScript_SetOldManStandingByRoad + call_if_ge VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 2, ViridianCity_EventScript_SetOldManNormal + call_if_eq VAR_MAP_SCENE_VIRIDIAN_CITY_GYM_DOOR, 0, ViridianCity_EventScript_TryUnlockGym end ViridianCity_EventScript_SetOldManNormal:: @@ -46,8 +42,8 @@ ViridianCity_EventScript_TryUnlockGym:: ViridianCity_EventScript_GymDoorLocked:: lockall - textcolor 3 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + textcolor NPC_TEXT_COLOR_NEUTRAL + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 delay 20 msgbox ViridianCity_Text_GymDoorsAreLocked @@ -89,8 +85,7 @@ ViridianCity_EventScript_Boy:: ViridianCity_EventScript_OldMan:: lock faceplayer - compare VAR_MAP_SCENE_VIRIDIAN_CITY_GYM_DOOR, 1 - goto_if_eq ViridianCity_EventScript_OldManGymLeaderReturned + goto_if_eq VAR_MAP_SCENE_VIRIDIAN_CITY_GYM_DOOR, 1, ViridianCity_EventScript_OldManGymLeaderReturned msgbox ViridianCity_Text_GymClosedWonderWhoLeaderIs closemessage applymovement LOCALID_OLD_MAN, Movement_FaceOriginalDirection @@ -107,18 +102,14 @@ ViridianCity_EventScript_TutorialOldMan:: lock faceplayer goto_if_set FLAG_BADGE01_GET, ViridianCity_EventScript_AskIfTeachyTVHelpful - compare VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 2 - goto_if_ge ViridianCity_EventScript_TutorialCompleted - compare VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 1 - goto_if_eq ViridianCity_EventScript_TutorialStart - compare VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 0 - goto_if_eq ViridianCity_EventScript_TutorialNotReady + goto_if_ge VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 2, ViridianCity_EventScript_TutorialCompleted + goto_if_eq VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 1, ViridianCity_EventScript_TutorialStart + goto_if_eq VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 0, ViridianCity_EventScript_TutorialNotReady end ViridianCity_EventScript_AskIfTeachyTVHelpful:: msgbox ViridianCity_Text_HowsTeachyTVHelping, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq ViridianCity_EventScript_TeachyTVNotHelpful + goto_if_eq VAR_RESULT, NO, ViridianCity_EventScript_TeachyTVNotHelpful msgbox ViridianCity_Text_MyGrandsonOnTheShow release end @@ -164,10 +155,8 @@ ViridianCity_EventScript_Youngster:: lock faceplayer msgbox ViridianCity_Text_WantToKnowAboutCaterpillarMons, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq ViridianCity_EventScript_YoungsterExplainCaterpillars - compare VAR_RESULT, NO - goto_if_eq ViridianCity_EventScript_YoungsterDeclineExplanation + goto_if_eq VAR_RESULT, YES, ViridianCity_EventScript_YoungsterExplainCaterpillars + goto_if_eq VAR_RESULT, NO, ViridianCity_EventScript_YoungsterDeclineExplanation end ViridianCity_EventScript_YoungsterExplainCaterpillars:: @@ -183,8 +172,7 @@ ViridianCity_EventScript_YoungsterDeclineExplanation:: ViridianCity_EventScript_Woman:: lock faceplayer - compare VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 0 - goto_if_eq ViridianCity_EventScript_WomanRoadBlocked + goto_if_eq VAR_MAP_SCENE_VIRIDIAN_CITY_OLD_MAN, 0, ViridianCity_EventScript_WomanRoadBlocked msgbox ViridianCity_Text_GoShoppingInPewterOccasionally release end @@ -203,7 +191,7 @@ ViridianCity_EventScript_DreamEaterTutor:: ViridianCity_EventScript_RoadBlocked:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox ViridianCity_Text_ThisIsPrivateProperty closemessage applymovement OBJ_EVENT_ID_PLAYER, ViridianCity_Movement_WalkDown @@ -217,10 +205,10 @@ ViridianCity_Movement_WalkDown:: ViridianCity_EventScript_TutorialTriggerLeft:: lockall - textcolor 0 - applymovement LOCALID_TUTORIAL_MAN, Movement_WalkInPlaceFastestLeft + textcolor NPC_TEXT_COLOR_MALE + applymovement LOCALID_TUTORIAL_MAN, Movement_WalkInPlaceFasterLeft waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestRight + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterRight waitmovement 0 call ViridianCity_EventScript_DoTutorialBattle release @@ -228,10 +216,10 @@ ViridianCity_EventScript_TutorialTriggerLeft:: ViridianCity_EventScript_TutorialTriggerRight:: lockall - textcolor 0 - applymovement LOCALID_TUTORIAL_MAN, Movement_WalkInPlaceFastestRight + textcolor NPC_TEXT_COLOR_MALE + applymovement LOCALID_TUTORIAL_MAN, Movement_WalkInPlaceFasterRight waitmovement 0 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestLeft + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterLeft waitmovement 0 call ViridianCity_EventScript_DoTutorialBattle release diff --git a/data/maps/ViridianCity_Gym/scripts.inc b/data/maps/ViridianCity_Gym/scripts.inc index a7fad40be..c1ca590e0 100644 --- a/data/maps/ViridianCity_Gym/scripts.inc +++ b/data/maps/ViridianCity_Gym/scripts.inc @@ -27,9 +27,8 @@ ViridianCity_Gym_EventScript_DefeatedGiovanni:: ViridianCity_Gym_EventScript_GiveTM26:: msgbox ViridianCity_Gym_Text_ExplainEarthBadgeTakeThis - checkitemspace ITEM_TM26, 1 - compare VAR_RESULT, FALSE - goto_if_eq ViridianCity_Gym_EventScript_NoRoomForTM26 + checkitemspace ITEM_TM26 + goto_if_eq VAR_RESULT, FALSE, ViridianCity_Gym_EventScript_NoRoomForTM26 giveitem_msg ViridianCity_Gym_Text_ReceivedTM26FromGiovanni, ITEM_TM26 setflag FLAG_GOT_TM26_FROM_GIOVANNI msgbox ViridianCity_Gym_Text_ExplainTM26 diff --git a/data/maps/ViridianCity_Mart/scripts.inc b/data/maps/ViridianCity_Mart/scripts.inc index 3142b0500..6ff805858 100644 --- a/data/maps/ViridianCity_Mart/scripts.inc +++ b/data/maps/ViridianCity_Mart/scripts.inc @@ -20,8 +20,8 @@ ViridianCity_Mart_OnFrame:: ViridianCity_Mart_EventScript_ParcelScene:: lockall - textcolor 0 - applymovement LOCALID_CLERK, Movement_WalkInPlaceFastestDown + textcolor NPC_TEXT_COLOR_MALE + applymovement LOCALID_CLERK, Movement_WalkInPlaceFasterDown waitmovement 0 msgbox ViridianCity_Mart_Text_YouCameFromPallet closemessage @@ -40,7 +40,7 @@ ViridianCity_Mart_Movement_ApproachCounter:: walk_up walk_up walk_up - walk_in_place_fastest_left + walk_in_place_faster_left step_end ViridianCity_Mart_Movement_FacePlayer:: @@ -48,14 +48,13 @@ ViridianCity_Mart_Movement_FacePlayer:: delay_16 delay_16 delay_16 - walk_in_place_fastest_right + walk_in_place_faster_right step_end ViridianCity_Mart_EventScript_Clerk:: lock faceplayer - compare VAR_MAP_SCENE_VIRIDIAN_CITY_MART, 1 - goto_if_eq ViridianCity_Mart_EventScript_SayHiToOak + goto_if_eq VAR_MAP_SCENE_VIRIDIAN_CITY_MART, 1, ViridianCity_Mart_EventScript_SayHiToOak goto_if_questlog EventScript_ReleaseEnd message Text_MayIHelpYou waitmessage diff --git a/data/maps/ViridianCity_School/scripts.inc b/data/maps/ViridianCity_School/scripts.inc index 9b4cbcbf2..658dfdf0c 100644 --- a/data/maps/ViridianCity_School/scripts.inc +++ b/data/maps/ViridianCity_School/scripts.inc @@ -9,7 +9,7 @@ ViridianCity_School_EventScript_Lass:: faceplayer msgbox ViridianCity_School_Text_TryingToMemorizeNotes closemessage - applymovement LOCALID_LASS, Movement_WalkInPlaceFastestUp + applymovement LOCALID_LASS, Movement_WalkInPlaceFasterUp waitmovement 0 release end @@ -28,20 +28,17 @@ ViridianCity_School_EventScript_Notebook:: lockall msgbox ViridianCity_School_Text_NotebookFirstPage msgbox ViridianCity_School_Text_TurnThePage, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq ViridianCity_School_EventScript_StopReadingNotebook + goto_if_eq VAR_RESULT, NO, ViridianCity_School_EventScript_StopReadingNotebook msgbox ViridianCity_School_Text_NotebookSecondPage msgbox ViridianCity_School_Text_TurnThePage, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq ViridianCity_School_EventScript_StopReadingNotebook + goto_if_eq VAR_RESULT, NO, ViridianCity_School_EventScript_StopReadingNotebook msgbox ViridianCity_School_Text_NotebookThirdPage msgbox ViridianCity_School_Text_TurnThePage, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq ViridianCity_School_EventScript_StopReadingNotebook + goto_if_eq VAR_RESULT, NO, ViridianCity_School_EventScript_StopReadingNotebook msgbox ViridianCity_School_Text_NotebookFourthPage - applymovement LOCALID_LASS, Movement_WalkInPlaceFastestUp + applymovement LOCALID_LASS, Movement_WalkInPlaceFasterUp waitmovement 0 - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox ViridianCity_School_Text_HeyDontLookAtMyNotes releaseall end diff --git a/data/mystery_event_msg.s b/data/mystery_event_msg.s index af7048be3..26048ca52 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,12 +39,11 @@ 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 - compare VAR_EVENT_PICHU_SLOT, PARTY_SIZE - vgoto_if_eq SurfPichu_FullParty + vgoto_if_eq VAR_EVENT_PICHU_SLOT, PARTY_SIZE, SurfPichu_FullParty setflag FLAG_MYSTERY_GIFT_DONE vcall SurfPichu_GiveEgg lock @@ -70,16 +69,11 @@ SurfPichu_GiveEgg: giveegg SPECIES_PICHU setmoneventlegal VAR_EVENT_PICHU_SLOT setmonmetlocation VAR_EVENT_PICHU_SLOT, 0xff - compare VAR_EVENT_PICHU_SLOT, 1 - vgoto_if_eq SurfPichu_Slot1 - compare VAR_EVENT_PICHU_SLOT, 2 - vgoto_if_eq SurfPichu_Slot2 - compare VAR_EVENT_PICHU_SLOT, 3 - vgoto_if_eq SurfPichu_Slot3 - compare VAR_EVENT_PICHU_SLOT, 4 - vgoto_if_eq SurfPichu_Slot4 - compare VAR_EVENT_PICHU_SLOT, 5 - vgoto_if_eq SurfPichu_Slot5 + vgoto_if_eq VAR_EVENT_PICHU_SLOT, 1, SurfPichu_Slot1 + vgoto_if_eq VAR_EVENT_PICHU_SLOT, 2, SurfPichu_Slot2 + vgoto_if_eq VAR_EVENT_PICHU_SLOT, 3, SurfPichu_Slot3 + vgoto_if_eq VAR_EVENT_PICHU_SLOT, 4, SurfPichu_Slot4 + vgoto_if_eq VAR_EVENT_PICHU_SLOT, 5, SurfPichu_Slot5 return SurfPichu_Slot1: @@ -118,8 +112,7 @@ sText_FullParty: MysteryEventScript_VisitingTrainer:: setvaddress MysteryEventScript_VisitingTrainer special ValidateEReaderTrainer - compare VAR_RESULT, 0 - vgoto_if_eq MysteryEventScript_VisitingTrainerArrived + vgoto_if_eq VAR_RESULT, 0, MysteryEventScript_VisitingTrainerArrived lock faceplayer vmessage sText_MysteryGiftVisitingTrainer @@ -170,8 +163,7 @@ MysteryEventScript_BattleCard:: vgoto_if_set FLAG_MYSTERY_GIFT_DONE, MysteryEventScript_BattleCardInfo setorcopyvar VAR_RESULT, 2 specialvar VAR_0x8008, BattleCardAction - compare VAR_0x8008, 3 - vgoto_if_ne MysteryEventScript_BattleCardInfo + vgoto_if_ne VAR_0x8008, 3, MysteryEventScript_BattleCardInfo lock faceplayer vmessage sText_MysteryGiftBattleCountCard_2 @@ -219,14 +211,12 @@ MysteryEventScript_AuroraTicket:: vgoto_if_set FLAG_GOT_AURORA_TICKET, AuroraTicket_Obtained vgoto_if_set FLAG_FOUGHT_DEOXYS, AuroraTicket_Obtained checkitem ITEM_AURORA_TICKET, 1 - compare VAR_RESULT, TRUE - vgoto_if_eq AuroraTicket_Obtained + vgoto_if_eq VAR_RESULT, TRUE, AuroraTicket_Obtained vmessage sText_AuroraTicket1 waitmessage waitbuttonpress checkitemspace ITEM_AURORA_TICKET, 1 - compare VAR_RESULT, FALSE - vgoto_if_eq AuroraTicket_NoBagSpace + vgoto_if_eq VAR_RESULT, FALSE, AuroraTicket_NoBagSpace giveitem ITEM_AURORA_TICKET setflag FLAG_ENABLE_SHIP_BIRTH_ISLAND setflag FLAG_GOT_AURORA_TICKET @@ -280,14 +270,12 @@ MysteryEventScript_MysticTicket:: vgoto_if_set FLAG_FOUGHT_LUGIA, MysticTicket_Obtained vgoto_if_set FLAG_FOUGHT_HO_OH, MysticTicket_Obtained checkitem ITEM_MYSTIC_TICKET, 1 - compare VAR_RESULT, TRUE - vgoto_if_eq MysticTicket_Obtained + vgoto_if_eq VAR_RESULT, TRUE, MysticTicket_Obtained vmessage sText_MysticTicket2 waitmessage waitbuttonpress checkitemspace ITEM_MYSTIC_TICKET, 1 - compare VAR_RESULT, FALSE - vgoto_if_eq MysticTicket_NoBagSpace + vgoto_if_eq VAR_RESULT, FALSE, MysticTicket_NoBagSpace giveitem ITEM_MYSTIC_TICKET setflag FLAG_ENABLE_SHIP_NAVEL_ROCK setflag FLAG_GOT_MYSTIC_TICKET @@ -336,8 +324,7 @@ sText_MysticTicketNoPlace: MysteryEventScript_AlteringCave:: setvaddress MysteryEventScript_AlteringCave addvar VAR_ALTERING_CAVE_WILD_SET, 1 - compare VAR_ALTERING_CAVE_WILD_SET, 10 - vgoto_if_ne MysteryEventScript_AlteringCave_ + vgoto_if_ne VAR_ALTERING_CAVE_WILD_SET, 10, MysteryEventScript_AlteringCave_ setvar VAR_ALTERING_CAVE_WILD_SET, 0 MysteryEventScript_AlteringCave_: lock diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc index 11449b86f..c73c0bb87 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_comparestat @ 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/bag_full.inc b/data/scripts/bag_full.inc index 7ce421e78..eaf65c775 100644 --- a/data/scripts/bag_full.inc +++ b/data/scripts/bag_full.inc @@ -1,5 +1,5 @@ EventScript_BagIsFull:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox Text_TooBadBagFull release end diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index 4774025e8..b225958a3 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -4,8 +4,7 @@ CableClub_OnTransition:: CableClub_EventScript_HideOrShowMysteryGiftMan:: specialvar VAR_RESULT, ValidateReceivedWonderCard - compare VAR_RESULT, FALSE - goto_if_eq EventScript_HideMysteryGiftMan + goto_if_eq VAR_RESULT, FALSE, EventScript_HideMysteryGiftMan clearflag FLAG_HIDE_MG_DELIVERYMEN return @@ -16,7 +15,7 @@ EventScript_HideMysteryGiftMan:: CableClub_EventScript_MysteryGiftMan:: goto_if_questlog EventScript_ReleaseEnd special QuestLog_CutRecording - execram + trywondercardscript @ Unused EventScript_MysteryGiftThankYou:: @@ -34,27 +33,19 @@ CableClub_OnWarp:: .2byte 0 EventScript_CheckTurnAttendant:: - compare VAR_0x8007, 0 - goto_if_eq EventScript_CheckTurnAttendantEnd + goto_if_eq VAR_0x8007, 0, EventScript_CheckTurnAttendantEnd turnobject VAR_0x8007, DIR_WEST EventScript_CheckTurnAttendantEnd: end CableClub_OnLoad:: - compare VAR_CABLE_CLUB_STATE, USING_SINGLE_BATTLE - goto_if_eq EventScript_OnLoadFromColosseum - compare VAR_CABLE_CLUB_STATE, USING_DOUBLE_BATTLE - goto_if_eq EventScript_OnLoadFromColosseum - compare VAR_CABLE_CLUB_STATE, USING_MULTI_BATTLE - goto_if_eq EventScript_OnLoadFromColosseum - compare VAR_CABLE_CLUB_STATE, USING_TRADE_CENTER - goto_if_eq EventScript_OnLoadFromTradeCenter - compare VAR_CABLE_CLUB_STATE, USING_UNION_ROOM - goto_if_eq EventScript_OnLoadFromUnionRoom - compare VAR_CABLE_CLUB_STATE, USING_BERRY_CRUSH - goto_if_eq EventScript_OnLoadFromBerryCrush - compare VAR_CABLE_CLUB_STATE, USING_MINIGAME - goto_if_eq EventScript_OnLoadFromGameCorner + goto_if_eq VAR_CABLE_CLUB_STATE, USING_SINGLE_BATTLE, EventScript_OnLoadFromColosseum + goto_if_eq VAR_CABLE_CLUB_STATE, USING_DOUBLE_BATTLE, EventScript_OnLoadFromColosseum + goto_if_eq VAR_CABLE_CLUB_STATE, USING_MULTI_BATTLE, EventScript_OnLoadFromColosseum + goto_if_eq VAR_CABLE_CLUB_STATE, USING_TRADE_CENTER, EventScript_OnLoadFromTradeCenter + goto_if_eq VAR_CABLE_CLUB_STATE, USING_UNION_ROOM, EventScript_OnLoadFromUnionRoom + goto_if_eq VAR_CABLE_CLUB_STATE, USING_BERRY_CRUSH, EventScript_OnLoadFromBerryCrush + goto_if_eq VAR_CABLE_CLUB_STATE, USING_MINIGAME, EventScript_OnLoadFromGameCorner end EventScript_OnLoadFromColosseum:: @@ -113,9 +104,8 @@ CableClub_EventScript_CloseLinkAndExitLinkRoom:: special HelpSystem_Enable special QuestLog_StartRecordingInputsAfterDeferredEvent setvar VAR_CABLE_CLUB_STATE, 0 - textcolor 1 - compare VAR_0x8007, 0 - goto_if_eq CableClub_EventScript_PlayerExitLinkRoom + textcolor NPC_TEXT_COLOR_FEMALE + goto_if_eq VAR_0x8007, 0, CableClub_EventScript_PlayerExitLinkRoom applymovement VAR_0x8007, Movement_AttendantFaceLeft waitmovement 0 applymovement OBJ_EVENT_ID_PLAYER, Movement_PlayerExitLinkRoom @@ -139,9 +129,8 @@ CableClub_EventScript_PlayerExitTradeCenter:: special HelpSystem_Enable special QuestLog_StartRecordingInputsAfterDeferredEvent setvar VAR_CABLE_CLUB_STATE, 0 - textcolor 1 - compare VAR_0x8007, 0 - goto_if_eq CableClub_EventScript_PlayerExitLinkRoom + textcolor NPC_TEXT_COLOR_FEMALE + goto_if_eq VAR_0x8007, 0, CableClub_EventScript_PlayerExitLinkRoom applymovement OBJ_EVENT_ID_PLAYER, Movement_PlayerFaceAttendantRight waitmovement 0 applymovement VAR_0x8007, Movement_AttendantFaceLeft @@ -163,9 +152,8 @@ CableClub_EventScript_PlayerExitUnionRoom:: special HelpSystem_Enable special QuestLog_StartRecordingInputsAfterDeferredEvent setvar VAR_CABLE_CLUB_STATE, 0 - textcolor 1 - compare VAR_0x8007, 0 - goto_if_eq CableClub_EventScript_PlayerExitLinkRoom + textcolor NPC_TEXT_COLOR_FEMALE + goto_if_eq VAR_0x8007, 0, CableClub_EventScript_PlayerExitLinkRoom applymovement OBJ_EVENT_ID_PLAYER, Movement_PlayerFaceAttendantRight waitmovement 0 applymovement VAR_0x8007, Movement_AttendantFaceLeft @@ -192,8 +180,8 @@ CableClub_EventScript_PlayerExitLinkRoom:: CableClub_EventScript_Tutorial:: lockall - textcolor 1 - applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFastestUp + textcolor NPC_TEXT_COLOR_FEMALE + applymovement OBJ_EVENT_ID_PLAYER, Movement_WalkInPlaceFasterUp waitmovement 0 msgbox CableClub_Text_FirstTimeRightThisWay closemessage @@ -262,8 +250,7 @@ CableClub_EventScript_SingleBattleMode:: CableClub_EventScript_DoubleBattleMode:: special HasEnoughMonsForDoubleBattle - compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS - goto_if_ne CableClub_EventScript_NeedTwoMonsForDoubleBattle + goto_if_ne VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS, CableClub_EventScript_NeedTwoMonsForDoubleBattle setvar VAR_0x8004, USING_DOUBLE_BATTLE goto CableClub_EventScript_TryEnterColosseum end @@ -280,27 +267,20 @@ CableClub_EventScript_MultiBattleMode:: CableClub_EventScript_TryEnterColosseum:: call EventScript_AskSaveGame - compare VAR_RESULT, 0 - goto_if_eq CableClub_EventScript_AbortLink + goto_if_eq VAR_RESULT, 0, CableClub_EventScript_AbortLink message CableClub_Text_PleaseWaitBCancel waitmessage special HelpSystem_Disable - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special TryBattleLinkup waitstate call EventScript_RestorePrevTextColor - compare VAR_RESULT, 1 - goto_if_eq CableClub_EventScript_EnterColosseum - compare VAR_RESULT, 2 - goto_if_eq CableClub_EventScript_AbortLinkSomeoneNotReady - compare VAR_RESULT, 3 - goto_if_eq CableClub_EventScript_AbortLinkDifferentSelections - compare VAR_RESULT, 4 - goto_if_eq CableClub_EventScript_AbortLinkIncorrectNumberOfBattlers - compare VAR_RESULT, 5 - goto_if_eq CableClub_EventScript_AbortLink - compare VAR_RESULT, 6 - goto_if_eq CableClub_EventScript_AbortLinkConnectionError + goto_if_eq VAR_RESULT, 1, CableClub_EventScript_EnterColosseum + goto_if_eq VAR_RESULT, 2, CableClub_EventScript_AbortLinkSomeoneNotReady + goto_if_eq VAR_RESULT, 3, CableClub_EventScript_AbortLinkDifferentSelections + goto_if_eq VAR_RESULT, 4, CableClub_EventScript_AbortLinkIncorrectNumberOfBattlers + goto_if_eq VAR_RESULT, 5, CableClub_EventScript_AbortLink + goto_if_eq VAR_RESULT, 6, CableClub_EventScript_AbortLinkConnectionError end CableClub_EventScript_EnterColosseum:: @@ -323,14 +303,13 @@ 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 - compare VAR_0x8004, USING_MULTI_BATTLE - goto_if_eq CableClub_EventScript_WarpTo4PColosseum + goto_if_eq VAR_0x8004, USING_MULTI_BATTLE, CableClub_EventScript_WarpTo4PColosseum special SetCableClubWarp - warp MAP_BATTLE_COLOSSEUM_2P, 255, 6, 8 + warp MAP_BATTLE_COLOSSEUM_2P, 6, 8 special DoCableClubWarp waitstate end @@ -343,7 +322,7 @@ CableClub_EventScript_PlayerApproachLinkRoomRight:: CableClub_EventScript_WarpTo4PColosseum:: special SetCableClubWarp - warp MAP_BATTLE_COLOSSEUM_4P, 255, 5, 8 + warp MAP_BATTLE_COLOSSEUM_4P, 5, 8 special DoCableClubWarp waitstate end @@ -384,34 +363,24 @@ CableClub_EventScript_ConfirmNumberAndRestart:: CableClub_EventScript_TradeCenter:: copyvar VAR_0x8007, VAR_LAST_TALKED call CableClub_EventScript_CheckPartyTradeRequirements - compare VAR_RESULT, 0 - goto_if_eq CableClub_EventScript_AbortLink + goto_if_eq VAR_RESULT, 0, CableClub_EventScript_AbortLink call EventScript_AskSaveGame - compare VAR_RESULT, 0 - goto_if_eq CableClub_EventScript_AbortLink + goto_if_eq VAR_RESULT, 0, CableClub_EventScript_AbortLink message CableClub_Text_PleaseWaitBCancel waitmessage special HelpSystem_Disable - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special TryTradeLinkup waitstate call EventScript_RestorePrevTextColor - compare VAR_RESULT, 1 - goto_if_eq CableClub_EventScript_EnterTradeCenter - compare VAR_RESULT, 2 - goto_if_eq CableClub_EventScript_AbortLinkSomeoneNotReady - compare VAR_RESULT, 3 - goto_if_eq CableClub_EventScript_AbortLinkDifferentSelections - compare VAR_RESULT, 4 - goto_if_eq CableClub_EventScript_AbortLinkIncorrectNumberOfParticipants - compare VAR_RESULT, 5 - goto_if_eq CableClub_EventScript_AbortLink - compare VAR_RESULT, 6 - goto_if_eq CableClub_EventScript_AbortLinkConnectionError - compare VAR_RESULT, 7 - goto_if_eq CableClub_EventScript_AbortLinkPlayerNotReady - compare VAR_RESULT, 9 - goto_if_eq CableClub_EventScript_AbortLinkOtherTrainerNotReady + goto_if_eq VAR_RESULT, 1, CableClub_EventScript_EnterTradeCenter + goto_if_eq VAR_RESULT, 2, CableClub_EventScript_AbortLinkSomeoneNotReady + goto_if_eq VAR_RESULT, 3, CableClub_EventScript_AbortLinkDifferentSelections + goto_if_eq VAR_RESULT, 4, CableClub_EventScript_AbortLinkIncorrectNumberOfParticipants + goto_if_eq VAR_RESULT, 5, CableClub_EventScript_AbortLink + goto_if_eq VAR_RESULT, 6, CableClub_EventScript_AbortLinkConnectionError + goto_if_eq VAR_RESULT, 7, CableClub_EventScript_AbortLinkPlayerNotReady + goto_if_eq VAR_RESULT, 9, CableClub_EventScript_AbortLinkOtherTrainerNotReady end CableClub_EventScript_EnterTradeCenter:: @@ -432,23 +401,21 @@ 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 special SetCableClubWarp - setwarp MAP_TRADE_CENTER, 255, 5, 8 + setwarp MAP_TRADE_CENTER, 5, 8 special DoCableClubWarp waitstate end CableClub_EventScript_CheckPartyTradeRequirements:: specialvar VAR_RESULT, CalculatePlayerPartyCount - compare VAR_RESULT, 2 - goto_if_lt CableClub_EventScript_NeedTwoMonsToTrade + goto_if_lt VAR_RESULT, 2, CableClub_EventScript_NeedTwoMonsToTrade specialvar VAR_RESULT, DoesPartyHaveEnigmaBerry - compare VAR_RESULT, TRUE - goto_if_eq CableClub_EventScript_CantTradeEnigmaBerry + goto_if_eq VAR_RESULT, TRUE, CableClub_EventScript_CantTradeEnigmaBerry setvar VAR_RESULT, TRUE return @@ -608,14 +575,14 @@ CableClub_EventScript_ShowBattleRecords:: BattleColosseum_2P_EventScript_PlayerSpot0:: setvar VAR_0x8005, 0 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special EnterColosseumPlayerSpot waitstate end BattleColosseum_2P_EventScript_PlayerSpot1:: setvar VAR_0x8005, 1 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special EnterColosseumPlayerSpot waitstate end @@ -624,10 +591,9 @@ BattleColosseum_4P_EventScript_PlayerSpot0:: fadescreen FADE_TO_BLACK special ChooseHalfPartyForBattle waitstate - compare VAR_RESULT, 0 - goto_if_eq BattleColosseum_4P_EventScript_CancelSpotTrigger + goto_if_eq VAR_RESULT, 0, BattleColosseum_4P_EventScript_CancelSpotTrigger setvar VAR_0x8005, 0 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special EnterColosseumPlayerSpot waitstate end @@ -636,10 +602,9 @@ BattleColosseum_4P_EventScript_PlayerSpot1:: fadescreen FADE_TO_BLACK special ChooseHalfPartyForBattle waitstate - compare VAR_RESULT, 0 - goto_if_eq BattleColosseum_4P_EventScript_CancelSpotTrigger + goto_if_eq VAR_RESULT, 0, BattleColosseum_4P_EventScript_CancelSpotTrigger setvar VAR_0x8005, 1 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special EnterColosseumPlayerSpot waitstate end @@ -648,10 +613,9 @@ BattleColosseum_4P_EventScript_PlayerSpot2:: fadescreen FADE_TO_BLACK special ChooseHalfPartyForBattle waitstate - compare VAR_RESULT, 0 - goto_if_eq BattleColosseum_4P_EventScript_CancelSpotTrigger + goto_if_eq VAR_RESULT, 0, BattleColosseum_4P_EventScript_CancelSpotTrigger setvar VAR_0x8005, 2 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special EnterColosseumPlayerSpot waitstate end @@ -660,10 +624,9 @@ BattleColosseum_4P_EventScript_PlayerSpot3:: fadescreen FADE_TO_BLACK special ChooseHalfPartyForBattle waitstate - compare VAR_RESULT, 0 - goto_if_eq BattleColosseum_4P_EventScript_CancelSpotTrigger + goto_if_eq VAR_RESULT, 0, BattleColosseum_4P_EventScript_CancelSpotTrigger setvar VAR_0x8005, 3 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special EnterColosseumPlayerSpot waitstate end @@ -673,14 +636,14 @@ BattleColosseum_4P_EventScript_CancelSpotTrigger:: TradeCenter_EventScript_Chair0:: setvar VAR_0x8005, 0 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special EnterTradeSeat waitstate end TradeCenter_EventScript_Chair1:: setvar VAR_0x8005, 1 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special EnterTradeSeat waitstate end @@ -688,7 +651,7 @@ TradeCenter_EventScript_Chair1:: @ Unused TradeCenter_EventScript_Chair2:: setvar VAR_0x8005, 2 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special EnterTradeSeat waitstate end @@ -696,7 +659,7 @@ TradeCenter_EventScript_Chair2:: @ Unused TradeCenter_EventScript_Chair3:: setvar VAR_0x8005, 3 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special EnterTradeSeat waitstate end @@ -710,7 +673,7 @@ RecordCorner_EventScript_Spot3:: end CableClub_EventScript_ReadTrainerCard:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox Text_LookedAtPlayersTrainerCard fadescreen FADE_TO_BLACK special Script_ShowLinkTrainerCard @@ -718,7 +681,7 @@ CableClub_EventScript_ReadTrainerCard:: end CableClub_EventScript_ReadTrainerCardColored:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox Text_LookedAtPlayersTrainerCardColored fadescreen FADE_TO_BLACK special Script_ShowLinkTrainerCard @@ -726,13 +689,13 @@ CableClub_EventScript_ReadTrainerCardColored:: end CableClub_EventScript_TooBusyToNotice:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox Text_TrainerTooBusyToNotice closemessage end BattleColosseum_2P_EventScript_Attendant:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special Script_FacePlayer msgbox Text_TakeSeatStartBattle special Script_ClearHeldMovement @@ -740,7 +703,7 @@ BattleColosseum_2P_EventScript_Attendant:: end TradeCenter_EventScript_Attendant:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special Script_FacePlayer msgbox Text_TakeSeatStartTrade special Script_ClearHeldMovement @@ -752,16 +715,15 @@ RecordCorner_EventScript_Attendant:: end TradeCenter_ConfirmLeaveRoom:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox Text_TerminateLinkIfYouLeaveRoom, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq TradeCenter_TerminateLink + goto_if_eq VAR_RESULT, YES, TradeCenter_TerminateLink erasebox 0, 0, 29, 19 releaseall end TradeCenter_TerminateLink:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL messageautoscroll Text_TerminateLinkConfirmation waitmessage special ExitLinkRoom @@ -780,12 +742,10 @@ CableClub_EventScript_UnionRoomAttendant:: faceplayer goto_if_unset FLAG_SYS_POKEDEX_GET, CableClub_EventScript_WirelessClubAdjustements specialvar VAR_RESULT, IsBadEggInParty - compare VAR_RESULT, TRUE - goto_if_eq CableClub_EventScript_AbortLinkPlayerHasBadEgg + goto_if_eq VAR_RESULT, TRUE, CableClub_EventScript_AbortLinkPlayerHasBadEgg copyvar VAR_0x8007, VAR_LAST_TALKED specialvar VAR_RESULT, IsWirelessAdapterConnected - compare VAR_RESULT, FALSE - goto_if_eq CableClub_EventScript_UnionRoomAdapterNotConnected + goto_if_eq VAR_RESULT, FALSE, CableClub_EventScript_UnionRoomAdapterNotConnected message CableClub_Text_WelcomeUnionRoomEnter waitmessage goto CableClub_EventScript_AskEnterUnionRoom @@ -808,11 +768,9 @@ CableClub_EventScript_UnionRoomInfo:: CableClub_EventScript_EnterUnionRoom:: call CableClub_EventScript_CheckPartyUnionRoomRequirements - compare VAR_RESULT, FALSE - goto_if_eq CableClub_EventScript_AbortLink + goto_if_eq VAR_RESULT, FALSE, CableClub_EventScript_AbortLink call EventScript_AskSaveGame - compare VAR_RESULT, 0 - goto_if_eq CableClub_EventScript_AbortLink + goto_if_eq VAR_RESULT, 0, CableClub_EventScript_AbortLink msgbox CableClub_Text_EnjoyUnionRoom closemessage special HealPlayerParty @@ -831,12 +789,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, 7, 11 waitstate special UnionRoomSpecial waitstate @@ -844,11 +802,9 @@ CableClub_EventScript_EnterUnionRoom:: CableClub_EventScript_CheckPartyUnionRoomRequirements:: specialvar VAR_RESULT, CountPartyNonEggMons - compare VAR_RESULT, 2 - goto_if_lt CableClub_EventScript_NeedTwoMonsForUnionRoom + goto_if_lt VAR_RESULT, 2, CableClub_EventScript_NeedTwoMonsForUnionRoom specialvar VAR_RESULT, DoesPartyHaveEnigmaBerry - compare VAR_RESULT, TRUE - goto_if_eq CableClub_EventScript_NoEnigmaBerryInUnionRoom + goto_if_eq VAR_RESULT, TRUE, CableClub_EventScript_NoEnigmaBerryInUnionRoom setvar VAR_RESULT, TRUE return @@ -872,8 +828,7 @@ CableClub_EventScript_WirelessClubAttendant:: faceplayer goto_if_unset FLAG_SYS_POKEDEX_GET, CableClub_EventScript_WirelessClubAdjustements msgbox CableClub_Text_AskAboutLinking, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CableClub_EventScript_DontAskAboutLinking + goto_if_eq VAR_RESULT, NO, CableClub_EventScript_DontAskAboutLinking msgbox CableClub_Text_ExplainWirelessClub release return @@ -890,11 +845,9 @@ CableClub_EventScript_DirectCornerAttendant:: faceplayer goto_if_unset FLAG_SYS_POKEDEX_GET, CableClub_EventScript_WirelessClubAdjustements specialvar VAR_RESULT, IsBadEggInParty - compare VAR_RESULT, TRUE - goto_if_eq CableClub_EventScript_AbortLinkPlayerHasBadEgg + goto_if_eq VAR_RESULT, TRUE, CableClub_EventScript_AbortLinkPlayerHasBadEgg specialvar VAR_RESULT, IsWirelessAdapterConnected - compare VAR_RESULT, FALSE - goto_if_eq CableClub_EventScript_WelcomeToCableClub + goto_if_eq VAR_RESULT, FALSE, CableClub_EventScript_WelcomeToCableClub message CableClub_Text_WelcomeWhichDirectCornerRoom waitmessage delay 15 @@ -923,11 +876,9 @@ CableClub_EventScript_DirectCornerNoBerry:: CableClub_EventScript_WirelessTrade:: msgbox CableClub_Text_TradePokemon, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CableClub_EventScript_AbortLink + goto_if_eq VAR_RESULT, NO, CableClub_EventScript_AbortLink call CableClub_EventScript_CheckPartyTradeRequirements - compare VAR_RESULT, FALSE - goto_if_eq CableClub_EventScript_AbortLink + goto_if_eq VAR_RESULT, FALSE, CableClub_EventScript_AbortLink setvar VAR_0x8004, LINK_GROUP_TRADE goto CableClub_EventScript_SaveAndChooseLinkLeader end @@ -952,8 +903,7 @@ CableClub_EventScript_WirelessSingleBattle:: CableClub_EventScript_WirelessDoubleBattle:: special HasEnoughMonsForDoubleBattle - compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS - goto_if_ne CableClub_EventScript_TwoMonsNeededForWirelessDoubleBattle + goto_if_ne VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS, CableClub_EventScript_TwoMonsNeededForWirelessDoubleBattle setvar VAR_0x8004, LINK_GROUP_DOUBLE_BATTLE goto CableClub_EventScript_SaveAndChooseLinkLeader end @@ -975,11 +925,9 @@ CableClub_EventScript_WirelessBattleInfo:: CableClub_EventScript_WirelessBerryCrush:: msgbox CableClub_Text_UseBerryCrush, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CableClub_EventScript_AbortLink + goto_if_eq VAR_RESULT, NO, CableClub_EventScript_AbortLink special HasAtLeastOneBerry - compare VAR_RESULT, FALSE - goto_if_eq CableClub_EventScript_NeedBerryForBerryCrush + goto_if_eq VAR_RESULT, FALSE, CableClub_EventScript_NeedBerryForBerryCrush setvar VAR_0x8004, LINK_GROUP_BERRY_CRUSH goto CableClub_EventScript_SaveAndChooseLinkLeader end @@ -991,8 +939,7 @@ CableClub_EventScript_NeedBerryForBerryCrush:: CableClub_EventScript_SaveAndChooseLinkLeader:: call EventScript_AskSaveGame - compare VAR_RESULT, 0 - goto_if_eq CableClub_EventScript_AbortLink + goto_if_eq VAR_RESULT, 0, CableClub_EventScript_AbortLink switch VAR_0x8004 case LINK_GROUP_TRADE, CableClub_EventScript_ChooseLinkLeaderFrom2 case LINK_GROUP_SINGLE_BATTLE, CableClub_EventScript_ChooseLinkLeaderFrom2 @@ -1002,7 +949,7 @@ CableClub_EventScript_SaveAndChooseLinkLeader:: end CableClub_EventScript_ChooseLinkLeaderFrom2:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL message CableClub_Text_ChooseGroupLeaderOfTwo waitmessage call EventScript_RestorePrevTextColor @@ -1016,28 +963,22 @@ CableClub_EventScript_ChooseLinkLeaderFrom2:: CableClub_EventScript_TryLeadGroup2Players:: call CableClub_EventScript_TryBecomeLinkLeader - compare VAR_RESULT, 1 - goto_if_eq CableClub_EventScript_EnterWirelessLinkRoom - compare VAR_RESULT, 5 - goto_if_eq CableClub_EventScript_ChooseLinkLeaderFrom2 - compare VAR_RESULT, 8 - goto_if_eq CableClub_EventScript_TryLeadGroup2Players + goto_if_eq VAR_RESULT, 1, CableClub_EventScript_EnterWirelessLinkRoom + goto_if_eq VAR_RESULT, 5, CableClub_EventScript_ChooseLinkLeaderFrom2 + goto_if_eq VAR_RESULT, 8, CableClub_EventScript_TryLeadGroup2Players release return CableClub_EventScript_TryJoinGroup2Players:: call CableClub_EventScript_TryJoinLinkGroup - compare VAR_RESULT, 1 - goto_if_eq CableClub_EventScript_EnterWirelessLinkRoom - compare VAR_RESULT, 5 - goto_if_eq CableClub_EventScript_ChooseLinkLeaderFrom2 - compare VAR_RESULT, 8 - goto_if_eq CableClub_EventScript_TryJoinGroup2Players + goto_if_eq VAR_RESULT, 1, CableClub_EventScript_EnterWirelessLinkRoom + goto_if_eq VAR_RESULT, 5, CableClub_EventScript_ChooseLinkLeaderFrom2 + goto_if_eq VAR_RESULT, 8, CableClub_EventScript_TryJoinGroup2Players release return CableClub_EventScript_ChooseLinkLeaderFrom4:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL message CableClub_Text_ChooseGroupLeaderOfFour waitmessage call EventScript_RestorePrevTextColor @@ -1051,28 +992,22 @@ CableClub_EventScript_ChooseLinkLeaderFrom4:: CableClub_EventScript_TryLeadGroup4Players:: call CableClub_EventScript_TryBecomeLinkLeader - compare VAR_RESULT, 1 - goto_if_eq CableClub_EventScript_EnterWirelessLinkRoom - compare VAR_RESULT, 5 - goto_if_eq CableClub_EventScript_ChooseLinkLeaderFrom4 - compare VAR_RESULT, 8 - goto_if_eq CableClub_EventScript_TryLeadGroup4Players + goto_if_eq VAR_RESULT, 1, CableClub_EventScript_EnterWirelessLinkRoom + goto_if_eq VAR_RESULT, 5, CableClub_EventScript_ChooseLinkLeaderFrom4 + goto_if_eq VAR_RESULT, 8, CableClub_EventScript_TryLeadGroup4Players release return CableClub_EventScript_TryJoinGroup4Players:: call CableClub_EventScript_TryJoinLinkGroup - compare VAR_RESULT, 1 - goto_if_eq CableClub_EventScript_EnterWirelessLinkRoom - compare VAR_RESULT, 5 - goto_if_eq CableClub_EventScript_ChooseLinkLeaderFrom4 - compare VAR_RESULT, 8 - goto_if_eq CableClub_EventScript_TryJoinGroup4Players + goto_if_eq VAR_RESULT, 1, CableClub_EventScript_EnterWirelessLinkRoom + goto_if_eq VAR_RESULT, 5, CableClub_EventScript_ChooseLinkLeaderFrom4 + goto_if_eq VAR_RESULT, 8, CableClub_EventScript_TryJoinGroup4Players release return CableClub_EventScript_ChooseLinkLeader:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL message CableClub_Text_ChooseGroupLeader waitmessage call EventScript_RestorePrevTextColor @@ -1086,23 +1021,17 @@ CableClub_EventScript_ChooseLinkLeader:: CableClub_EventScript_TryLeadGroupXPlayers:: call CableClub_EventScript_TryBecomeLinkLeader - compare VAR_RESULT, 1 - goto_if_eq CableClub_EventScript_EnterWirelessLinkRoom - compare VAR_RESULT, 5 - goto_if_eq CableClub_EventScript_ChooseLinkLeader - compare VAR_RESULT, 8 - goto_if_eq CableClub_EventScript_TryLeadGroupXPlayers + goto_if_eq VAR_RESULT, 1, CableClub_EventScript_EnterWirelessLinkRoom + goto_if_eq VAR_RESULT, 5, CableClub_EventScript_ChooseLinkLeader + goto_if_eq VAR_RESULT, 8, CableClub_EventScript_TryLeadGroupXPlayers release return CableClub_EventScript_TryJoinGroupXPlayers:: call CableClub_EventScript_TryJoinLinkGroup - compare VAR_RESULT, 1 - goto_if_eq CableClub_EventScript_EnterWirelessLinkRoom - compare VAR_RESULT, 5 - goto_if_eq CableClub_EventScript_ChooseLinkLeader - compare VAR_RESULT, 8 - goto_if_eq CableClub_EventScript_TryJoinGroupXPlayers + goto_if_eq VAR_RESULT, 1, CableClub_EventScript_EnterWirelessLinkRoom + goto_if_eq VAR_RESULT, 5, CableClub_EventScript_ChooseLinkLeader + goto_if_eq VAR_RESULT, 8, CableClub_EventScript_TryJoinGroupXPlayers release return @@ -1137,7 +1066,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 @@ -1149,8 +1078,7 @@ CableClub_EventScript_ShowWirelessCommunicationScreen:: lockall goto_if_unset FLAG_SYS_POKEDEX_GET, CableClub_EventScript_NotReadyYet specialvar VAR_RESULT, IsWirelessAdapterConnected - compare VAR_RESULT, FALSE - goto_if_eq CableClub_EventScript_AdapterNotConnected + goto_if_eq VAR_RESULT, FALSE, CableClub_EventScript_AdapterNotConnected special HelpSystem_Disable fadescreen FADE_TO_BLACK special ShowWirelessCommunicationScreen @@ -1231,8 +1159,7 @@ JoyfulGameCorner_EventScript_MinigameAttendant:: message Text_WelcomeCanYouWait waitmessage specialvar VAR_RESULT, IsWirelessAdapterConnected - compare VAR_RESULT, FALSE - goto_if_eq CableClub_EventScript_AdapterNotConnectedMinigame + goto_if_eq VAR_RESULT, FALSE, CableClub_EventScript_AdapterNotConnectedMinigame delay 60 special HelpSystem_Disable message Text_PlayWhichGame @@ -1248,17 +1175,14 @@ JoyfulGameCorner_EventScript_MinigameAttendant:: CableClub_EventScript_PlayPokemonJump:: setvar VAR_0x8005, 0 special IsPokemonJumpSpeciesInParty - compare VAR_RESULT, FALSE - goto_if_eq CableClub_EventScript_NoEligiblePkmn + goto_if_eq VAR_RESULT, FALSE, CableClub_EventScript_NoEligiblePkmn msgbox Text_EnterWhichPokemon setvar VAR_0x8005, 0 special ChooseMonForWirelessMinigame waitstate - compare VAR_0x8004, PARTY_SIZE - goto_if_ge CableClub_EventScript_AbortMinigame + goto_if_ge VAR_0x8004, PARTY_SIZE, CableClub_EventScript_AbortMinigame call EventScript_AskSaveGame - compare VAR_RESULT, 0 - goto_if_eq CableClub_EventScript_AbortMinigame + goto_if_eq VAR_RESULT, 0, CableClub_EventScript_AbortMinigame setvar VAR_0x8004, LINK_GROUP_POKEMON_JUMP goto CableClub_EventScript_ChooseLinkLeaderMinigame end @@ -1266,23 +1190,20 @@ CableClub_EventScript_PlayPokemonJump:: CableClub_EventScript_PlayDodrioBerryPicking:: setvar VAR_0x8005, 1 special IsDodrioInParty - compare VAR_RESULT, 0 - goto_if_eq CableClub_EventScript_NoEligiblePkmn + goto_if_eq VAR_RESULT, 0, CableClub_EventScript_NoEligiblePkmn msgbox Text_EnterWhichPokemon setvar VAR_0x8005, 1 special ChooseMonForWirelessMinigame waitstate - compare VAR_0x8004, PARTY_SIZE - goto_if_ge CableClub_EventScript_AbortMinigame + goto_if_ge VAR_0x8004, PARTY_SIZE, CableClub_EventScript_AbortMinigame call EventScript_AskSaveGame - compare VAR_RESULT, 0 - goto_if_eq CableClub_EventScript_AbortMinigame + goto_if_eq VAR_RESULT, 0, CableClub_EventScript_AbortMinigame setvar VAR_0x8004, LINK_GROUP_BERRY_PICKING goto CableClub_EventScript_ChooseLinkLeaderMinigame end CableClub_EventScript_ChooseLinkLeaderMinigame:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL message CableClub_Text_ChooseGroupLeader waitmessage call EventScript_RestorePrevTextColor @@ -1296,23 +1217,17 @@ CableClub_EventScript_ChooseLinkLeaderMinigame:: CableClub_EventScript_TryBecomeMinigameLinkLeader:: call CableClub_EventScript_TryBecomeLinkLeader - compare VAR_RESULT, 1 - goto_if_eq CableClub_EventScript_EnterMinigame - compare VAR_RESULT, 5 - goto_if_eq CableClub_EventScript_ChooseLinkLeaderMinigame - compare VAR_RESULT, 8 - goto_if_eq CableClub_EventScript_TryBecomeMinigameLinkLeader + goto_if_eq VAR_RESULT, 1, CableClub_EventScript_EnterMinigame + goto_if_eq VAR_RESULT, 5, CableClub_EventScript_ChooseLinkLeaderMinigame + goto_if_eq VAR_RESULT, 8, CableClub_EventScript_TryBecomeMinigameLinkLeader release return CableClub_EventScript_TryJoinMinigameLinkGroup:: call CableClub_EventScript_TryJoinLinkGroup - compare VAR_RESULT, 1 - goto_if_eq CableClub_EventScript_EnterMinigame - compare VAR_RESULT, 5 - goto_if_eq CableClub_EventScript_ChooseLinkLeaderMinigame - compare VAR_RESULT, 8 - goto_if_eq CableClub_EventScript_TryJoinMinigameLinkGroup + goto_if_eq VAR_RESULT, 1, CableClub_EventScript_EnterMinigame + goto_if_eq VAR_RESULT, 5, CableClub_EventScript_ChooseLinkLeaderMinigame + goto_if_eq VAR_RESULT, 8, CableClub_EventScript_TryJoinMinigameLinkGroup release return @@ -1331,7 +1246,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 @@ -1343,12 +1258,9 @@ CableClub_EventScript_AdapterNotConnectedMinigame:: CableClub_EventScript_NoEligiblePkmn:: msgbox EventScript_ExplainPokemonJumpRequirements, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CableClub_EventScript_AbortMinigame - compare VAR_0x8005, 0 - call_if_eq CableClub_EventScript_ExplainPokemonJumpRequirements - compare VAR_0x8005, 1 - call_if_eq CableClub_EventScript_ExplainDodrioBerryPickingRequirements + goto_if_eq VAR_RESULT, NO, CableClub_EventScript_AbortMinigame + call_if_eq VAR_0x8005, 0, CableClub_EventScript_ExplainPokemonJumpRequirements + call_if_eq VAR_0x8005, 1, CableClub_EventScript_ExplainDodrioBerryPickingRequirements goto CableClub_EventScript_AbortMinigame end diff --git a/data/scripts/day_care.inc b/data/scripts/day_care.inc index febf7aa28..a0b15678c 100644 --- a/data/scripts/day_care.inc +++ b/data/scripts/day_care.inc @@ -2,32 +2,27 @@ Route5_PokemonDayCare_EventScript_DaycareMan:: goto_if_questlog EventScript_ReleaseEnd lock faceplayer - showmoneybox 0, 0, 0 + showmoneybox 0, 0 specialvar VAR_RESULT, IsThereMonInRoute5Daycare - compare VAR_RESULT, TRUE - goto_if_eq Route5_PokemonDayCare_EventScript_CheckOnMon + goto_if_eq VAR_RESULT, TRUE, Route5_PokemonDayCare_EventScript_CheckOnMon msgbox Route5_PokemonDayCare_Text_WantMeToRaiseMon, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq Route5_PokemonDayCare_EventScript_TryGiveMon + goto_if_eq VAR_RESULT, YES, Route5_PokemonDayCare_EventScript_TryGiveMon msgbox Route5_PokemonDayCare_Text_ComeAgain goto Route5_PokemonDayCare_EventScript_CloseMoneyBox end Route5_PokemonDayCare_EventScript_TryGiveMon:: specialvar VAR_RESULT, CountPartyNonEggMons - compare VAR_RESULT, 1 - goto_if_eq Route5_PokemonDayCare_EventScript_OnlyOneMonInParty + goto_if_eq VAR_RESULT, 1, Route5_PokemonDayCare_EventScript_OnlyOneMonInParty msgbox Route5_PokemonDayCare_Text_WhichMonShouldIRaise fadescreen FADE_TO_BLACK - hidemoneybox 0, 0 + hidemoneybox special ChooseSendDaycareMon waitstate - showmoneybox 0, 0, 0 - compare VAR_0x8004, PARTY_SIZE - goto_if_ge Route5_PokemonDayCare_EventScript_ComeAgain + showmoneybox 0, 0 + goto_if_ge VAR_0x8004, PARTY_SIZE, Route5_PokemonDayCare_EventScript_ComeAgain specialvar VAR_RESULT, CountPartyAliveNonEggMons_IgnoreVar0x8004Slot - compare VAR_RESULT, 0 - goto_if_eq Route5_PokemonDayCare_EventScript_OnlyOneAliveMonInParty + goto_if_eq VAR_RESULT, 0, Route5_PokemonDayCare_EventScript_OnlyOneAliveMonInParty specialvar VAR_0x8005, GetSelectedMonNicknameAndSpecies msgbox Route5_PokemonDayCare_Text_LookAfterMonForAWhile waitse @@ -57,14 +52,11 @@ Route5_PokemonDayCare_EventScript_OnlyOneAliveMonInParty:: Route5_PokemonDayCare_EventScript_CheckOnMon:: setvar VAR_0x8004, 0 specialvar VAR_RESULT, GetNumLevelsGainedForRoute5DaycareMon - compare VAR_RESULT, 0 - call_if_ne Route5_PokemonDayCare_EventScript_MonHasGrownByXLevels - compare VAR_RESULT, 0 - call_if_eq Route5_PokemonDayCare_EventScript_NotEnoughTime + call_if_ne VAR_RESULT, 0, Route5_PokemonDayCare_EventScript_MonHasGrownByXLevels + call_if_eq VAR_RESULT, 0, Route5_PokemonDayCare_EventScript_NotEnoughTime special GetCostToWithdrawRoute5DaycareMon msgbox Route5_PokemonDayCare_Text_OweMeXForMonsReturn, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq Route5_PokemonDayCare_EventScript_TryRetrieveMon + goto_if_eq VAR_RESULT, YES, Route5_PokemonDayCare_EventScript_TryRetrieveMon goto Route5_PokemonDayCare_EventScript_ComeAgain end @@ -78,11 +70,9 @@ Route5_PokemonDayCare_EventScript_NotEnoughTime:: Route5_PokemonDayCare_EventScript_TryRetrieveMon:: specialvar VAR_RESULT, CalculatePlayerPartyCount - compare VAR_RESULT, PARTY_SIZE - goto_if_eq Route5_PokemonDayCare_EventScript_NoRoomInParty + goto_if_eq VAR_RESULT, PARTY_SIZE, Route5_PokemonDayCare_EventScript_NoRoomInParty specialvar VAR_RESULT, IsEnoughForCostInVar0x8005 - compare VAR_RESULT, TRUE - goto_if_eq Route5_PokemonDayCare_EventScript_RetrieveMon + goto_if_eq VAR_RESULT, TRUE, Route5_PokemonDayCare_EventScript_RetrieveMon msgbox Route5_PokemonDayCare_Text_DontHaveEnoughMoney goto Route5_PokemonDayCare_EventScript_CloseMoneyBox end @@ -91,14 +81,14 @@ 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 + textcolor NPC_TEXT_COLOR_NEUTRAL waitse playmoncry VAR_RESULT, CRY_MODE_NORMAL msgbox Route5_PokemonDayCare_Text_PlayerGotMonBack @@ -113,7 +103,7 @@ Route5_PokemonDayCare_EventScript_NoRoomInParty:: end Route5_PokemonDayCare_EventScript_CloseMoneyBox:: - hidemoneybox 0, 0 + hidemoneybox release end diff --git a/data/scripts/fame_checker.inc b/data/scripts/fame_checker.inc index 4950fd73d..c15a88101 100644 --- a/data/scripts/fame_checker.inc +++ b/data/scripts/fame_checker.inc @@ -3,7 +3,7 @@ ViridianCity_School_EventScript_PokemonJournal:: faceplayer famechecker FAMECHECKER_OAK, 3 famechecker FAMECHECKER_DAISY, 3 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureProfOak release end @@ -13,7 +13,7 @@ EventScript_PokemonJournalUnused1:: faceplayer famechecker FAMECHECKER_DAISY, 1 famechecker FAMECHECKER_OAK, 4 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureProfOak release end @@ -22,7 +22,7 @@ EventScript_PokemonJournalUnused2:: lock faceplayer famechecker FAMECHECKER_DAISY, 4 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureProfOak release end @@ -30,7 +30,7 @@ EventScript_PokemonJournalUnused2:: FourIsland_PokemonCenter_1F_EventScript_PokemonJournal:: lockall famechecker FAMECHECKER_DAISY, 5 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureDaisyOak releaseall end @@ -54,7 +54,7 @@ MtMoon_1F_EventScript_BaldingMan:: PewterCity_Museum_1F_EventScript_PokemonJournalBrock:: lockall famechecker FAMECHECKER_BROCK, 5 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureBrock releaseall end @@ -79,7 +79,7 @@ CeruleanCity_PokemonCenter_1F_EventScript_PokemonJournalMisty:: lock faceplayer famechecker FAMECHECKER_MISTY, 5 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureMisty release end @@ -87,7 +87,7 @@ CeruleanCity_PokemonCenter_1F_EventScript_PokemonJournalMisty:: VermilionCity_PokemonCenter_1F_EventScript_PokemonJournalLtSurge:: lockall famechecker FAMECHECKER_LTSURGE, 5 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureLtSurge releaseall end @@ -96,7 +96,7 @@ CeladonCity_Condominiums_2F_EventScript_PokemonJournalErika:: lock faceplayer famechecker FAMECHECKER_ERIKA, 5 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureErika release end @@ -105,7 +105,7 @@ FuchsiaCity_WardensHouse_EventScript_PokemonJournalKoga:: lock faceplayer famechecker FAMECHECKER_KOGA, 4 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureKoga release end @@ -122,7 +122,7 @@ SaffronCity_PokemonCenter_1F_EventScript_PokemonJournalSabrina:: lock faceplayer famechecker FAMECHECKER_SABRINA, 4 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureSabrina release end @@ -138,7 +138,7 @@ CinnabarIsland_Gym_EventScript_BlaineFujiPhoto:: FiveIsland_ResortGorgeous_House_EventScript_PokemonJournal:: lockall famechecker FAMECHECKER_BLAINE, 5 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureBlaine releaseall end @@ -155,7 +155,7 @@ FiveIsland_PokemonCenter_1F_EventScript_PokemonJournal:: lock faceplayer famechecker FAMECHECKER_LORELEI, 3 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureLorelei release end @@ -164,7 +164,7 @@ SaffronCity_PokemonTrainerFanClub_EventScript_PokemonJournalBruno:: lock faceplayer famechecker FAMECHECKER_BRUNO, 2 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureBruno release end @@ -190,7 +190,7 @@ SevenIsland_PokemonCenter_1F_EventScript_PokemonJournal:: lock faceplayer famechecker FAMECHECKER_AGATHA, 3 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureAgatha release end @@ -239,7 +239,7 @@ IndigoPlateau_PokemonCenter_1F_EventScript_PokemonJournal:: lock faceplayer famechecker FAMECHECKER_LANCE, 4 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureLance release end @@ -264,7 +264,7 @@ CinnabarIsland_PokemonCenter_1F_EventScript_PokemonJournalMrFuji:: lock faceplayer famechecker FAMECHECKER_MRFUJI, 5 - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox PokemonJournal_Text_SpecialFeatureMrFuji release end diff --git a/data/scripts/field_moves.inc b/data/scripts/field_moves.inc index 74a93e8af..fc2998f1a 100644 --- a/data/scripts/field_moves.inc +++ b/data/scripts/field_moves.inc @@ -3,14 +3,12 @@ EventScript_CutTree:: lockall goto_if_unset FLAG_BADGE02_GET, EventScript_CantCutTree 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 + goto_if_eq VAR_RESULT, PARTY_SIZE, EventScript_CantCutTree + 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 + goto_if_eq VAR_RESULT, NO, EventScript_DontCutTree msgbox Text_MonUsedMove closemessage dofieldeffect FLDEFF_USE_CUT_ON_TREE @@ -63,14 +61,12 @@ EventScript_RockSmash:: lockall goto_if_unset FLAG_BADGE06_GET, EventScript_CantSmashRock 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 + goto_if_eq VAR_RESULT, PARTY_SIZE, EventScript_CantSmashRock + 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 + goto_if_eq VAR_RESULT, NO, EventScript_DontSmashRock msgbox Text_MonUsedMove closemessage dofieldeffect FLDEFF_USE_ROCK_SMASH @@ -90,8 +86,7 @@ EventScript_UseRockSmash:: waitmovement 0 removeobject VAR_LAST_TALKED special RockSmashWildEncounter - compare VAR_RESULT, FALSE - goto_if_eq EventScript_RockSmashNoEncounter + goto_if_eq VAR_RESULT, FALSE, EventScript_RockSmashNoEncounter waitstate releaseall end @@ -127,12 +122,10 @@ EventScript_StrengthBoulder:: goto_if_unset FLAG_BADGE04_GET, EventScript_CantMoveBoulder goto_if_set FLAG_SYS_USE_STRENGTH, EventScript_AlreadyUsedStrength checkpartymove MOVE_STRENGTH - compare VAR_RESULT, PARTY_SIZE - goto_if_eq EventScript_CantMoveBoulder - setfieldeffectarg 0, VAR_RESULT + goto_if_eq VAR_RESULT, PARTY_SIZE, EventScript_CantMoveBoulder + setfieldeffectargument 0, VAR_RESULT msgbox Text_UseStrength, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_DontUseStrength + goto_if_eq VAR_RESULT, NO, EventScript_DontUseStrength closemessage dofieldeffect FLDEFF_USE_STRENGTH waitstate @@ -186,13 +179,11 @@ EventScript_Waterfall:: goto_if_questlog EventScript_ReleaseEnd lockall checkpartymove MOVE_WATERFALL - compare VAR_RESULT, PARTY_SIZE - goto_if_eq EventScript_WaterCrashingDown - getpartymonname 0, VAR_RESULT - setfieldeffectarg 0, VAR_RESULT + goto_if_eq VAR_RESULT, PARTY_SIZE, EventScript_WaterCrashingDown + bufferpartymonnick STR_VAR_1, VAR_RESULT + setfieldeffectargument 0, VAR_RESULT msgbox Text_UseWaterfall, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_EndWaterfall + goto_if_eq VAR_RESULT, NO, EventScript_EndWaterfall msgbox Text_MonUsedWaterfall dofieldeffect FLDEFF_USE_WATERFALL goto EventScript_EndWaterfall @@ -220,14 +211,12 @@ Text_MonUsedWaterfall:: EventScript_DeepWater:: lockall checkpartymove MOVE_DIVE - compare VAR_RESULT, PARTY_SIZE - goto_if_eq EventScript_MayGoUnderwater - getpartymonname 0, VAR_RESULT - setfieldeffectarg 0, VAR_RESULT - setfieldeffectarg 1, 1 + goto_if_eq VAR_RESULT, PARTY_SIZE, EventScript_MayGoUnderwater + 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 + goto_if_eq VAR_RESULT, NO, EventScript_EndDive msgbox Text_MonUsedDive dofieldeffect FLDEFF_USE_DIVE goto EventScript_EndDive @@ -243,14 +232,12 @@ EventScript_EndDive: EventScript_TrySurface:: lockall checkpartymove MOVE_DIVE - compare VAR_RESULT, PARTY_SIZE - goto_if_eq EventScript_CantSurface - getpartymonname 0, VAR_RESULT - setfieldeffectarg 0, VAR_RESULT - setfieldeffectarg 1, 1 + goto_if_eq VAR_RESULT, PARTY_SIZE, EventScript_CantSurface + 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 + goto_if_eq VAR_RESULT, NO, EventScript_EndSurface msgbox Text_MonUsedDive dofieldeffect FLDEFF_USE_DIVE goto 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/hall_of_fame.inc b/data/scripts/hall_of_fame.inc index d34a8766f..7fede6987 100644 --- a/data/scripts/hall_of_fame.inc +++ b/data/scripts/hall_of_fame.inc @@ -3,8 +3,7 @@ EventScript_SetDefeatedEliteFourFlagsVars:: call EventScript_ResetEliteFour special Script_UpdateTrainerFanClubGameClear specialvar VAR_RESULT, IsNationalPokedexEnabled - compare VAR_RESULT, FALSE - call_if_eq EventScript_SetReadyTryGiveNationalDexScene + call_if_eq VAR_RESULT, FALSE, EventScript_SetReadyTryGiveNationalDexScene call EventScript_ResetLegendaries return diff --git a/data/scripts/hole.inc b/data/scripts/hole.inc index 6ca793691..ae64ccf5f 100644 --- a/data/scripts/hole.inc +++ b/data/scripts/hole.inc @@ -15,7 +15,7 @@ EventScript_FallDownHole:: waitmovement 0 playse SE_FALL delay 60 - warphole 0xFFFF + warphole MAP_UNDEFINED waitstate end diff --git a/data/scripts/itemfinder.inc b/data/scripts/itemfinder.inc index d4b96cd76..1647364ce 100644 --- a/data/scripts/itemfinder.inc +++ b/data/scripts/itemfinder.inc @@ -1,12 +1,10 @@ EventScript_ItemfinderDigUpUnderfootItem:: lockall - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL waitse call EventScript_TryPickUpHiddenItem - compare VAR_0x8007, TRUE - goto_if_eq EventScript_DigUpItemPutInPocket - compare VAR_0x8007, FALSE - goto_if_eq EventScript_DigUpItemBagIsFull + goto_if_eq VAR_0x8007, TRUE, EventScript_DigUpItemPutInPocket + goto_if_eq VAR_0x8007, FALSE, EventScript_DigUpItemBagIsFull end EventScript_DigUpItemPutInPocket:: diff --git a/data/scripts/move_tutors.inc b/data/scripts/move_tutors.inc index c1b5e4bab..fa56be624 100644 --- a/data/scripts/move_tutors.inc +++ b/data/scripts/move_tutors.inc @@ -3,16 +3,13 @@ VictoryRoad_2F_EventScript_DoubleEdgeTutor:: faceplayer goto_if_set FLAG_TUTOR_DOUBLE_EDGE, EventScript_DoubleEdgeTaught msgbox Text_DoubleEdgeTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_DoubleEdgeDeclined + goto_if_eq VAR_RESULT, NO, EventScript_DoubleEdgeDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_DoubleEdgeDeclined + goto_if_eq VAR_RESULT, NO, EventScript_DoubleEdgeDeclined msgbox Text_DoubleEdgeWhichMon setvar VAR_0x8005, MOVETUTOR_DOUBLE_EDGE call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_DoubleEdgeDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_DoubleEdgeDeclined setflag FLAG_TUTOR_DOUBLE_EDGE goto EventScript_DoubleEdgeTaught end @@ -32,16 +29,13 @@ EventScript_ThunderWaveTutor:: faceplayer goto_if_set FLAG_TUTOR_THUNDER_WAVE, EventScript_ThunderWaveTaught msgbox Text_ThunderWaveTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_ThunderWaveDeclined + goto_if_eq VAR_RESULT, NO, EventScript_ThunderWaveDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_ThunderWaveDeclined + goto_if_eq VAR_RESULT, NO, EventScript_ThunderWaveDeclined msgbox Text_ThunderWaveWhichMon setvar VAR_0x8005, MOVETUTOR_THUNDER_WAVE call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_ThunderWaveDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_ThunderWaveDeclined setflag FLAG_TUTOR_THUNDER_WAVE goto EventScript_ThunderWaveTaught end @@ -61,16 +55,13 @@ RockTunnel_B1F_EventScript_RockSlideTutor:: faceplayer goto_if_set FLAG_TUTOR_ROCK_SLIDE, EventScript_RockSlideTaught msgbox Text_RockSlideTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_RockSlideDeclined + goto_if_eq VAR_RESULT, NO, EventScript_RockSlideDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_RockSlideDeclined + goto_if_eq VAR_RESULT, NO, EventScript_RockSlideDeclined msgbox Text_RockSlideWhichMon setvar VAR_0x8005, MOVETUTOR_ROCK_SLIDE call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_RockSlideDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_RockSlideDeclined setflag FLAG_TUTOR_ROCK_SLIDE goto EventScript_RockSlideTaught end @@ -90,16 +81,13 @@ MtEmber_Exterior_EventScript_ExplosionTutor:: faceplayer goto_if_set FLAG_TUTOR_EXPLOSION, EventScript_ExplosionTaught msgbox Text_ExplosionTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_ExplosionDeclined + goto_if_eq VAR_RESULT, NO, EventScript_ExplosionDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_ExplosionDeclined + goto_if_eq VAR_RESULT, NO, EventScript_ExplosionDeclined msgbox Text_ExplosionWhichMon setvar VAR_0x8005, MOVETUTOR_EXPLOSION call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_ExplosionDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_ExplosionDeclined setflag FLAG_TUTOR_EXPLOSION goto EventScript_ExplosionTaught end @@ -119,16 +107,13 @@ Route4_EventScript_MegaPunchTutor:: faceplayer goto_if_set FLAG_TUTOR_MEGA_PUNCH, EventScript_MegaPunchTaught msgbox Text_MegaPunchTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_MegaPunchDeclined + goto_if_eq VAR_RESULT, NO, EventScript_MegaPunchDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_MegaPunchDeclined + goto_if_eq VAR_RESULT, NO, EventScript_MegaPunchDeclined msgbox Text_MegaPunchWhichMon setvar VAR_0x8005, MOVETUTOR_MEGA_PUNCH call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_MegaPunchDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_MegaPunchDeclined setflag FLAG_TUTOR_MEGA_PUNCH goto EventScript_MegaPunchTaught end @@ -148,16 +133,13 @@ Route4_EventScript_MegaKickTutor:: faceplayer goto_if_set FLAG_TUTOR_MEGA_KICK, EventScript_MegaKickTaught msgbox Text_MegaKickTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_MegaKickDeclined + goto_if_eq VAR_RESULT, NO, EventScript_MegaKickDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_MegaKickDeclined + goto_if_eq VAR_RESULT, NO, EventScript_MegaKickDeclined msgbox Text_MegaKickWhichMon setvar VAR_0x8005, MOVETUTOR_MEGA_KICK call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_MegaKickDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_MegaKickDeclined setflag FLAG_TUTOR_MEGA_KICK goto EventScript_MegaKickTaught end @@ -177,16 +159,13 @@ EventScript_DreamEaterTutor:: faceplayer goto_if_set FLAG_TUTOR_DREAM_EATER, EventScript_DreamEaterTaught msgbox Text_DreamEaterTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_DreamEaterDeclined + goto_if_eq VAR_RESULT, NO, EventScript_DreamEaterDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_DreamEaterDeclined + goto_if_eq VAR_RESULT, NO, EventScript_DreamEaterDeclined msgbox Text_DreamEaterWhichMon setvar VAR_0x8005, MOVETUTOR_DREAM_EATER call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_DreamEaterDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_DreamEaterDeclined setflag FLAG_TUTOR_DREAM_EATER goto EventScript_DreamEaterTaught end @@ -206,16 +185,13 @@ EventScript_SoftboiledTutor:: faceplayer goto_if_set FLAG_TUTOR_SOFT_BOILED, EventScript_SoftboiledTaught msgbox Text_SoftboiledTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_SoftboiledDeclined + goto_if_eq VAR_RESULT, NO, EventScript_SoftboiledDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_SoftboiledDeclined + goto_if_eq VAR_RESULT, NO, EventScript_SoftboiledDeclined msgbox Text_SoftboiledWhichMon setvar VAR_0x8005, MOVETUTOR_SOFT_BOILED call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_SoftboiledDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_SoftboiledDeclined setflag FLAG_TUTOR_SOFT_BOILED goto EventScript_SoftboiledTaught end @@ -235,16 +211,13 @@ FuchsiaCity_EventScript_SubstituteTutor:: faceplayer goto_if_set FLAG_TUTOR_SUBSTITUTE, EventScript_SubstituteTaught msgbox Text_SubstituteTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_SubstituteDeclined + goto_if_eq VAR_RESULT, NO, EventScript_SubstituteDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_SubstituteDeclined + goto_if_eq VAR_RESULT, NO, EventScript_SubstituteDeclined msgbox Text_SubstituteWhichMon setvar VAR_0x8005, MOVETUTOR_SUBSTITUTE call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_SubstituteDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_SubstituteDeclined setflag FLAG_TUTOR_SUBSTITUTE goto EventScript_SubstituteTaught end @@ -264,16 +237,13 @@ SevenIsland_EventScript_SwordsDanceTutor:: faceplayer goto_if_set FLAG_TUTOR_SWORDS_DANCE, EventScript_SwordsDanceTaught msgbox Text_SwordsDanceTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_SwordsDanceDeclined + goto_if_eq VAR_RESULT, NO, EventScript_SwordsDanceDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_SwordsDanceDeclined + goto_if_eq VAR_RESULT, NO, EventScript_SwordsDanceDeclined msgbox Text_SwordsDanceWhichMon setvar VAR_0x8005, MOVETUTOR_SWORDS_DANCE call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_SwordsDanceDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_SwordsDanceDeclined setflag FLAG_TUTOR_SWORDS_DANCE goto EventScript_SwordsDanceTaught end @@ -293,16 +263,13 @@ PewterCity_Museum_1F_EventScript_SeismicTossTutor:: faceplayer goto_if_set FLAG_TUTOR_SEISMIC_TOSS, EventScript_SeismicTossTaught msgbox Text_SeismicTossTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_SeismicTossDeclined + goto_if_eq VAR_RESULT, NO, EventScript_SeismicTossDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_SeismicTossDeclined + goto_if_eq VAR_RESULT, NO, EventScript_SeismicTossDeclined msgbox Text_SeismicTossWhichMon setvar VAR_0x8005, MOVETUTOR_SEISMIC_TOSS call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_SeismicTossDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_SeismicTossDeclined setflag FLAG_TUTOR_SEISMIC_TOSS goto EventScript_SeismicTossTaught end @@ -322,16 +289,13 @@ EventScript_CounterTutor:: faceplayer goto_if_set FLAG_TUTOR_COUNTER, EventScript_CounterTaught msgbox Text_CounterTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_CounterDeclined + goto_if_eq VAR_RESULT, NO, EventScript_CounterDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_CounterDeclined + goto_if_eq VAR_RESULT, NO, EventScript_CounterDeclined msgbox Text_CounterWhichMon setvar VAR_0x8005, MOVETUTOR_COUNTER call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_CounterDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_CounterDeclined setflag FLAG_TUTOR_COUNTER goto EventScript_CounterTaught end @@ -351,16 +315,13 @@ EventScript_MetronomeTutor:: faceplayer goto_if_set FLAG_TUTOR_METRONOME, EventScript_MetronomeTaught msgbox Text_MetronomeTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_MetronomeDeclined + goto_if_eq VAR_RESULT, NO, EventScript_MetronomeDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_MetronomeDeclined + goto_if_eq VAR_RESULT, NO, EventScript_MetronomeDeclined msgbox Text_MetronomeWhichMon setvar VAR_0x8005, MOVETUTOR_METRONOME call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_MetronomeDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_MetronomeDeclined setflag FLAG_TUTOR_METRONOME goto EventScript_MetronomeTaught end @@ -378,19 +339,16 @@ EventScript_MetronomeTaught:: EventScript_MimicTutor:: goto_if_set FLAG_TUTOR_MIMIC, EventScript_MimicTaught msgbox Text_MimicTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_MimicDeclined + goto_if_eq VAR_RESULT, NO, EventScript_MimicDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_MimicDeclined + goto_if_eq VAR_RESULT, NO, EventScript_MimicDeclined msgbox Text_MimicWhichMon setvar VAR_0x8005, MOVETUTOR_MIMIC call EventScript_ChooseMoveTutorMon lock faceplayer - compare VAR_RESULT, 0 - goto_if_eq EventScript_MimicDeclined - removeitem ITEM_POKE_DOLL, 1 + goto_if_eq VAR_RESULT, 0, EventScript_MimicDeclined + removeitem ITEM_POKE_DOLL setflag FLAG_TUTOR_MIMIC goto EventScript_MimicTaught end @@ -402,10 +360,8 @@ EventScript_MimicDeclined:: EventScript_MimicTaught:: checkplayergender - compare VAR_RESULT, MALE - call_if_eq EventScript_MimicTaughtMale - compare VAR_RESULT, FEMALE - call_if_eq EventScript_MimicTaughtFemale + call_if_eq VAR_RESULT, MALE, EventScript_MimicTaughtMale + call_if_eq VAR_RESULT, FEMALE, EventScript_MimicTaughtFemale release end @@ -422,16 +378,13 @@ FourIsland_House1_EventScript_BodySlamTutor:: faceplayer goto_if_set FLAG_TUTOR_BODY_SLAM, EventScript_BodySlamTaught msgbox Text_BodySlamTeach, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_BodySlamDeclined + goto_if_eq VAR_RESULT, NO, EventScript_BodySlamDeclined call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq EventScript_BodySlamDeclined + goto_if_eq VAR_RESULT, NO, EventScript_BodySlamDeclined msgbox Text_BodySlamWhichMon setvar VAR_0x8005, MOVETUTOR_BODY_SLAM call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq EventScript_BodySlamDeclined + goto_if_eq VAR_RESULT, FALSE, EventScript_BodySlamDeclined setflag FLAG_TUTOR_BODY_SLAM goto EventScript_BodySlamTaught end @@ -455,26 +408,19 @@ 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 - goto_if_eq CapeBrinkTutor_EventScript_NoLeadStarter + goto_if_eq VAR_RESULT, FALSE, CapeBrinkTutor_EventScript_NoLeadStarter copyvar VAR_0x8009, VAR_0x8005 - compare VAR_FACING, DIR_NORTH - call_if_eq CapeBrinkTutor_EventScript_JumpInPlaceDown - compare VAR_FACING, DIR_SOUTH - call_if_eq CapeBrinkTutor_EventScript_JumpInPlaceUp - compare VAR_FACING, DIR_EAST - call_if_eq CapeBrinkTutor_EventScript_JumpInPlaceLeft - compare VAR_FACING, DIR_WEST - call_if_eq CapeBrinkTutor_EventScript_JumpInPlaceRight + call_if_eq VAR_FACING, DIR_NORTH, CapeBrinkTutor_EventScript_JumpInPlaceDown + call_if_eq VAR_FACING, DIR_SOUTH, CapeBrinkTutor_EventScript_JumpInPlaceUp + call_if_eq VAR_FACING, DIR_EAST, CapeBrinkTutor_EventScript_JumpInPlaceLeft + call_if_eq VAR_FACING, DIR_WEST, CapeBrinkTutor_EventScript_JumpInPlaceRight msgbox Text_AllowMeToTeachMonUltimateMove, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CapeBrinkTutor_EventScript_DeclineMove + goto_if_eq VAR_RESULT, NO, CapeBrinkTutor_EventScript_DeclineMove call EventScript_CanOnlyBeLearnedOnce - compare VAR_RESULT, NO - goto_if_eq CapeBrinkTutor_EventScript_DeclineMove + goto_if_eq VAR_RESULT, NO, CapeBrinkTutor_EventScript_DeclineMove msgbox Text_LetMeConferUltimateMove closemessage fadescreen FADE_TO_BLACK @@ -499,8 +445,7 @@ CapeBrinkTutor_EventScript_TaughtAllMoves:: CapeBrinkTutor_EventScript_TaughtMove:: copyvar VAR_0x8005, VAR_0x8009 specialvar VAR_RESULT, HasLearnedAllMovesFromCapeBrinkTutor - compare VAR_RESULT, TRUE - goto_if_eq CapeBrinkTutor_EventScript_LearnedAllMoves + goto_if_eq VAR_RESULT, TRUE, CapeBrinkTutor_EventScript_LearnedAllMoves msgbox Text_TaughtMove setflag FLAG_TEMP_2 release @@ -514,8 +459,7 @@ CapeBrinkTutor_EventScript_LearnedAllMoves:: CapeBrinkTutor_EventScript_ChooseMon:: call EventScript_ChooseMoveTutorMon - compare VAR_RESULT, FALSE - goto_if_eq CapeBrinkTutor_EventScript_DeclineMove + goto_if_eq VAR_RESULT, FALSE, CapeBrinkTutor_EventScript_DeclineMove goto CapeBrinkTutor_EventScript_TaughtMove end @@ -557,7 +501,7 @@ EventScript_ChooseMoveTutorMon:: return EventScript_CanOnlyBeLearnedOnce:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special DisableMsgBoxWalkaway signmsg msgbox Text_MoveCanOnlyBeLearnedOnce, MSGBOX_YESNO diff --git a/data/scripts/movement.inc b/data/scripts/movement.inc index 61960d26a..52e5a2c96 100644 --- a/data/scripts/movement.inc +++ b/data/scripts/movement.inc @@ -25,20 +25,20 @@ Movement_FaceOriginalDirection:: face_original_direction step_end -Movement_WalkInPlaceFastestLeft:: - walk_in_place_fastest_left +Movement_WalkInPlaceFasterLeft:: + walk_in_place_faster_left step_end -Movement_WalkInPlaceFastestUp:: - walk_in_place_fastest_up +Movement_WalkInPlaceFasterUp:: + walk_in_place_faster_up step_end -Movement_WalkInPlaceFastestRight:: - walk_in_place_fastest_right +Movement_WalkInPlaceFasterRight:: + walk_in_place_faster_right step_end -Movement_WalkInPlaceFastestDown:: - walk_in_place_fastest_down +Movement_WalkInPlaceFasterDown:: + walk_in_place_faster_down step_end Movement_FaceRight:: diff --git a/data/scripts/mystery_event_club.inc b/data/scripts/mystery_event_club.inc index 46e96956a..a9cb1958f 100644 --- a/data/scripts/mystery_event_club.inc +++ b/data/scripts/mystery_event_club.inc @@ -3,8 +3,7 @@ MysteryEventClub_EventScript_Woman:: lock faceplayer - compare GAVE_PROFILE, TRUE - goto_if_eq EventScript_AlreadyGaveProfile + goto_if_eq GAVE_PROFILE, TRUE, EventScript_AlreadyGaveProfile goto_if_set FLAG_SYS_SET_TRAINER_CARD_PROFILE, EventScript_GivenProfileBefore msgbox Text_IdLoveToHearYourProfile goto EventScript_AskForProfile @@ -104,12 +103,9 @@ EventScript_GiveProfile: call Common_ShowEasyChatScreen lock faceplayer - compare VAR_0x8004, 0 - goto_if_eq EventScript_GaveSpecialProfile - compare VAR_RESULT, FALSE - goto_if_eq EventScript_CancelGiveProfile - compare VAR_RESULT, TRUE - goto_if_eq EventScript_GaveProfile + goto_if_eq VAR_0x8004, 0, EventScript_GaveSpecialProfile + goto_if_eq VAR_RESULT, FALSE, EventScript_CancelGiveProfile + goto_if_eq VAR_RESULT, TRUE, EventScript_GaveProfile end Text_IdLoveToHearYourProfile: diff --git a/data/scripts/obtain_item.inc b/data/scripts/obtain_item.inc index e4f49c9f6..c904278ae 100644 --- a/data/scripts/obtain_item.inc +++ b/data/scripts/obtain_item.inc @@ -9,7 +9,7 @@ EventScript_RestorePrevTextColor:: Std_ObtainItem:: copyvar VAR_PREV_TEXT_COLOR, VAR_TEXT_COLOR - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL additem VAR_0x8000, VAR_0x8001 copyvar VAR_0x8007, VAR_RESULT call EventScript_ObtainItemMessage @@ -17,13 +17,11 @@ 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 - call_if_eq EventScript_ObtainedItem - compare VAR_0x8007, FALSE - call_if_eq EventScript_NoRoomForItem + call_if_eq VAR_0x8007, TRUE, EventScript_ObtainedItem + call_if_eq VAR_0x8007, FALSE, EventScript_NoRoomForItem return EventScript_BufferPocketNameTryFanfare:: @@ -36,33 +34,28 @@ EventScript_BufferPocketNameTryFanfare:: end EventScript_BufferItemsPocket:: - getstdstring 2, STDSTRING_ITEMS_POCKET - compare VAR_0x8007, TRUE - call_if_eq EventScript_PlayFanfareObtainedItem + bufferstdstring STR_VAR_3, STDSTRING_ITEMS_POCKET + call_if_eq VAR_0x8007, TRUE, EventScript_PlayFanfareObtainedItem return EventScript_BufferKeyItemsPocket:: - getstdstring 2, STDSTRING_KEY_ITEMS_POCKET - compare VAR_0x8007, TRUE - call_if_eq EventScript_PlayFanfareObtainedItem + bufferstdstring STR_VAR_3, STDSTRING_KEY_ITEMS_POCKET + call_if_eq VAR_0x8007, TRUE, EventScript_PlayFanfareObtainedItem return EventScript_BufferPokeBallsPocket:: - getstdstring 2, STDSTRING_POKEBALLS_POCKET - compare VAR_0x8007, TRUE - call_if_eq EventScript_PlayFanfareObtainedItem + bufferstdstring STR_VAR_3, STDSTRING_POKEBALLS_POCKET + call_if_eq VAR_0x8007, TRUE, EventScript_PlayFanfareObtainedItem return EventScript_BufferTMCase:: - getstdstring 2, STDSTRING_TM_CASE - compare VAR_0x8007, TRUE - call_if_eq EventScript_PlayFanfareObtainedTMHM + bufferstdstring STR_VAR_3, STDSTRING_TM_CASE + call_if_eq VAR_0x8007, TRUE, EventScript_PlayFanfareObtainedTMHM return EventScript_BufferBerryPouch:: - getstdstring 2, STDSTRING_BERRY_POUCH - compare VAR_0x8007, TRUE - call_if_eq EventScript_PlayFanfareObtainedItem + bufferstdstring STR_VAR_3, STDSTRING_BERRY_POUCH + call_if_eq VAR_0x8007, TRUE, EventScript_PlayFanfareObtainedItem return EventScript_ObtainedItem:: @@ -86,17 +79,15 @@ 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 - compare VAR_0x8007, TRUE - call_if_eq EventScript_ObtainedDecor - compare VAR_0x8007, FALSE - call_if_eq EventScript_NoRoomForDecor + bufferdecorationname STR_VAR_2, VAR_0x8000 + call_if_eq VAR_0x8007, TRUE, EventScript_ObtainedDecor + call_if_eq VAR_0x8007, FALSE, EventScript_NoRoomForDecor return EventScript_ObtainedDecor:: @@ -120,13 +111,11 @@ 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 - call_if_eq EventScript_PickUpItem - compare VAR_0x8007, FALSE - call_if_eq EventScript_NoRoomToPickUpItem + call_if_eq VAR_0x8007, TRUE, EventScript_PickUpItem + call_if_eq VAR_0x8007, FALSE, EventScript_NoRoomToPickUpItem release return @@ -135,10 +124,8 @@ EventScript_PickUpItem:: additem VAR_0x8004, VAR_0x8005 specialvar VAR_RESULT, BufferTMHMMoveName copyvar VAR_0x8008, VAR_RESULT - compare VAR_0x8008, TRUE - call_if_eq EventScript_FoundTMHM - compare VAR_0x8008, FALSE - call_if_eq EventScript_FoundItem + call_if_eq VAR_0x8008, TRUE, EventScript_FoundTMHM + call_if_eq VAR_0x8008, FALSE, EventScript_FoundItem waitfanfare waitmessage msgbox Text_PutItemAway @@ -160,30 +147,25 @@ EventScript_NoRoomToPickUpItem:: EventScript_HiddenItemScript:: lockall - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL waitse - compare VAR_0x8005, 0 - goto_if_eq EventScript_TryPickUpHiddenCoins + goto_if_eq VAR_0x8005, 0, EventScript_TryPickUpHiddenCoins call EventScript_TryPickUpHiddenItem - compare VAR_0x8007, TRUE - goto_if_eq EventScript_PickedUpHiddenItem - compare VAR_0x8007, FALSE - goto_if_eq EventScript_NoRoomForHiddenItem + goto_if_eq VAR_0x8007, TRUE, EventScript_PickedUpHiddenItem + goto_if_eq VAR_0x8007, FALSE, EventScript_NoRoomForHiddenItem end 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 EventScript_PickedUpHiddenItem:: - compare VAR_0x8006, 1 - call_if_eq EventScript_FoundSingleItem - compare VAR_0x8006, 1 - call_if_ne EventScript_FoundMultipleItems + call_if_eq VAR_0x8006, 1, EventScript_FoundSingleItem + call_if_ne VAR_0x8006, 1, EventScript_FoundMultipleItems waitfanfare waitmessage msgbox Text_PutItemAway @@ -196,12 +178,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 @@ -216,10 +198,9 @@ EventScript_TryPickUpHiddenCoins:: goto_if_unset FLAG_GOT_COIN_CASE, EventScript_NoCaseForHiddenCoins checkcoins VAR_RESULT specialvar VAR_RESULT, CheckAddCoins - compare VAR_RESULT, FALSE - goto_if_eq EventScript_HiddenCoinsButCaseIsFull + goto_if_eq VAR_RESULT, FALSE, EventScript_HiddenCoinsButCaseIsFull addcoins VAR_0x8006 - getstdstring 1, STDSTRING_COINS + bufferstdstring STR_VAR_2, STDSTRING_COINS call EventScript_PlayFanfareObtainedItem call EventScript_FoundCoins waitfanfare @@ -230,8 +211,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 +220,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.inc b/data/scripts/pc.inc index dedcd041e..77cf55e6f 100644 --- a/data/scripts/pc.inc +++ b/data/scripts/pc.inc @@ -88,8 +88,7 @@ EventScript_AccessProfOaksPC:: playse SE_PC_LOGIN msgbox Text_AccessedProfOaksPC msgbox Text_HavePokedexRated, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_ExitOaksPC + goto_if_eq VAR_RESULT, NO, EventScript_ExitOaksPC setflag FLAG_OAKS_RATING_IS_VIA_PC call PokedexRating_EventScript_Rate clearflag FLAG_OAKS_RATING_IS_VIA_PC diff --git a/data/scripts/pc_transfer.inc b/data/scripts/pc_transfer.inc index 76df5f0ed..1a71b1136 100644 --- a/data/scripts/pc_transfer.inc +++ b/data/scripts/pc_transfer.inc @@ -13,34 +13,32 @@ 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 EventScript_TransferredSomeonesPC:: specialvar VAR_RESULT, ShouldShowBoxWasFullMessage - compare VAR_RESULT, TRUE - goto_if_eq EventScript_TransferredSomeonesPCBoxFull + goto_if_eq VAR_RESULT, TRUE, EventScript_TransferredSomeonesPCBoxFull msgbox Text_MonSentToBoxInSomeonesPC return EventScript_TransferredSomeonesPCBoxFull:: specialvar VAR_RESULT, GetPCBoxToSendMon - bufferboxname 2, VAR_RESULT + bufferboxname STR_VAR_3, VAR_RESULT msgbox Text_MonSentToBoxSomeonesBoxFull return EventScript_TransferredBillsPC:: specialvar VAR_RESULT, ShouldShowBoxWasFullMessage - compare VAR_RESULT, TRUE - goto_if_eq EventScript_TransferredBillsPCBoxFull + goto_if_eq VAR_RESULT, TRUE, EventScript_TransferredBillsPCBoxFull msgbox Text_MonSentToBoxInBillsPC return 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/pkmn_center_nurse.inc b/data/scripts/pkmn_center_nurse.inc index 3c0e6b56e..bec40c40c 100644 --- a/data/scripts/pkmn_center_nurse.inc +++ b/data/scripts/pkmn_center_nurse.inc @@ -19,25 +19,22 @@ EventScript_PkmnCenterNurse_HealPkmn:: end EventScript_PkmnCenterNurse_TakeAndHealPkmn:: - applymovement VAR_LAST_TALKED, Movement_WalkInPlaceFastestLeft + applymovement VAR_LAST_TALKED, Movement_WalkInPlaceFasterLeft waitmovement 0 dofieldeffect FLDEFF_POKECENTER_HEAL waitfieldeffect FLDEFF_POKECENTER_HEAL - applymovement VAR_LAST_TALKED, Movement_WalkInPlaceFastestDown + applymovement VAR_LAST_TALKED, Movement_WalkInPlaceFasterDown waitmovement 0 special HealPlayerParty return EventScript_PkmnCenterNurse_CheckTrainerTowerAndUnionRoom:: specialvar VAR_RESULT, IsPlayerNotInTrainerTowerLobby - compare VAR_RESULT, FALSE - goto_if_eq EventScript_PkmnCenterNurse_ReturnPkmn + goto_if_eq VAR_RESULT, FALSE, EventScript_PkmnCenterNurse_ReturnPkmn specialvar VAR_RESULT, BufferUnionRoomPlayerName copyvar VAR_0x8008, VAR_RESULT - compare VAR_0x8008, 0 - goto_if_eq EventScript_PkmnCenterNurse_ReturnPkmn - compare VAR_0x8008, 1 - goto_if_eq EventScript_PkmnCenterNurse_PlayerWaitingInUionRoom + goto_if_eq VAR_0x8008, 0, EventScript_PkmnCenterNurse_ReturnPkmn + goto_if_eq VAR_0x8008, 1, EventScript_PkmnCenterNurse_PlayerWaitingInUionRoom end EventScript_PkmnCenterNurse_ReturnPkmn:: diff --git a/data/scripts/pokedex_rating.inc b/data/scripts/pokedex_rating.inc index 1e537f131..6a4ed0751 100644 --- a/data/scripts/pokedex_rating.inc +++ b/data/scripts/pokedex_rating.inc @@ -18,10 +18,8 @@ PokedexRating_EventScript_ShowRatingMsg:: copyvar VAR_0x8004, VAR_0x8009 special GetProfOaksRatingMessage waitmessage - compare VAR_RESULT, FALSE - call_if_eq PokedexRating_EventScript_NormalFanfare - compare VAR_RESULT, TRUE - call_if_eq PokedexRating_EventScript_DexCompleteFanfare + call_if_eq VAR_RESULT, FALSE, PokedexRating_EventScript_NormalFanfare + call_if_eq VAR_RESULT, TRUE, PokedexRating_EventScript_DexCompleteFanfare waitfanfare waitbuttonpress return @@ -43,29 +41,26 @@ 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 - compare VAR_0x800A, FALSE - goto_if_eq PokedexRating_EventScript_EndRating @ National Dex not enabled + goto_if_eq VAR_0x800A, FALSE, PokedexRating_EventScript_EndRating @ National Dex not enabled setvar VAR_0x8004, 1 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 - goto_if_eq PokedexRating_EventScript_DexIncomplete - compare VAR_RESULT, TRUE - goto_if_eq PokedexRating_EventScript_DexComplete + goto_if_eq VAR_RESULT, FALSE, PokedexRating_EventScript_DexIncomplete + goto_if_eq VAR_RESULT, TRUE, PokedexRating_EventScript_DexComplete end PokedexRating_EventScript_SetTextColor:: - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE return PokedexRating_EventScript_DexIncomplete:: diff --git a/data/scripts/pokemon_league.inc b/data/scripts/pokemon_league.inc index d30251746..03295279e 100644 --- a/data/scripts/pokemon_league.inc +++ b/data/scripts/pokemon_league.inc @@ -23,7 +23,7 @@ PokemonLeague_EventScript_SetDoorOpen:: PokemonLeague_EventScript_PreventExit:: lockall - textcolor 0 + textcolor NPC_TEXT_COLOR_MALE msgbox Text_VoiceRangOutDontRunAway closemessage applymovement OBJ_EVENT_ID_PLAYER, PokemonLeague_Movement_ForcePlayerIn diff --git a/data/scripts/pokemon_mansion.inc b/data/scripts/pokemon_mansion.inc index b750ae1cf..3c648dbfd 100644 --- a/data/scripts/pokemon_mansion.inc +++ b/data/scripts/pokemon_mansion.inc @@ -1,7 +1,6 @@ PokemonMansion_EventScript_SecretSwitch:: msgbox PokemonMansion_Text_PressSecretSwitch, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq PokemonMansion_EventScript_DontPressSwitch + goto_if_eq VAR_RESULT, NO, PokemonMansion_EventScript_DontPressSwitch msgbox PokemonMansion_Text_WhoWouldnt goto_if_set FLAG_POKEMON_MANSION_SWITCH_STATE, PokemonMansion_EventScript_ResetSwitch setflag FLAG_POKEMON_MANSION_SWITCH_STATE diff --git a/data/scripts/questionnaire.inc b/data/scripts/questionnaire.inc index da618572d..f3bb76a3b 100644 --- a/data/scripts/questionnaire.inc +++ b/data/scripts/questionnaire.inc @@ -1,21 +1,17 @@ EventScript_Questionnaire:: lockall - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL msgbox Text_FillOutQuestionnaire, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_DeclineQuestionnaire + goto_if_eq VAR_RESULT, NO, EventScript_DeclineQuestionnaire setvar VAR_0x8004, EASY_CHAT_TYPE_QUESTIONNAIRE call Common_ShowEasyChatScreen lock faceplayer specialvar VAR_0x8008, GetMartClerkObjectId - textcolor 0 - compare VAR_0x8004, 0 - goto_if_eq EventScript_EnableMysteryGift - compare VAR_RESULT, 0 - goto_if_eq EventScript_DeclineQuestionnaire - compare VAR_RESULT, 1 - goto_if_eq EventScript_TookQuestionnaire + textcolor NPC_TEXT_COLOR_MALE + goto_if_eq VAR_0x8004, 0, EventScript_EnableMysteryGift + goto_if_eq VAR_RESULT, 0, EventScript_DeclineQuestionnaire + goto_if_eq VAR_RESULT, 1, EventScript_TookQuestionnaire end EventScript_EnableMysteryGift:: @@ -28,7 +24,7 @@ EventScript_EnableMysteryGift:: waitmovement 0 msgbox Text_YouKnowThoseWords setflag FLAG_SYS_MYSTERY_GIFT_ENABLED - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special DisableMsgBoxWalkaway signmsg msgbox Text_YouCanAccessMysteryGift diff --git a/data/scripts/route23.inc b/data/scripts/route23.inc index 3d88bc272..7a7b838a0 100644 --- a/data/scripts/route23.inc +++ b/data/scripts/route23.inc @@ -31,8 +31,7 @@ Route23_EventScript_AlreadyRecognizedBadge:: @ Duplicate of the below, only used for Boulder Badge Route22_NorthEntrance_EventScript_BadgeGuard:: - compare VAR_MAP_SCENE_ROUTE23, VAR_TEMP_1 - goto_if_ge Route23_EventScript_AlreadyRecognizedBoulderBadge + goto_if_ge VAR_MAP_SCENE_ROUTE23, VAR_TEMP_1, Route23_EventScript_AlreadyRecognizedBoulderBadge switch VAR_TEMP_1 case 1, Route23_EventScript_CheckBoulderBadge case 2, Route23_EventScript_CheckCascadeBadge @@ -45,8 +44,7 @@ Route22_NorthEntrance_EventScript_BadgeGuard:: end Route23_EventScript_BadgeGuard:: - compare VAR_MAP_SCENE_ROUTE23, VAR_TEMP_1 - goto_if_ge Route23_EventScript_AlreadyRecognizedBadge + goto_if_ge VAR_MAP_SCENE_ROUTE23, VAR_TEMP_1, Route23_EventScript_AlreadyRecognizedBadge switch VAR_TEMP_1 case 1, Route23_EventScript_CheckBoulderBadge case 2, Route23_EventScript_CheckCascadeBadge @@ -115,8 +113,8 @@ Route23_EventScript_RecognizeBadge:: end Route23_EventScript_BadgeGuardTrigger:: - textcolor 0 - applymovement VAR_0x8009, Movement_WalkInPlaceFastestLeft + textcolor NPC_TEXT_COLOR_MALE + applymovement VAR_0x8009, Movement_WalkInPlaceFasterLeft waitmovement 0 switch VAR_TEMP_1 case 1, Route23_EventScript_CheckBoulderBadgeTrigger @@ -175,7 +173,7 @@ Route23_EventScript_MissingBoulderBadgeTrigger:: msgbox Text_CantLetYouPass closemessage applymovement OBJ_EVENT_ID_PLAYER, Route23_Movement_WalkDown - applymovement VAR_0x8009, Movement_WalkInPlaceFastestDown + applymovement VAR_0x8009, Movement_WalkInPlaceFasterDown waitmovement 0 releaseall end @@ -188,7 +186,7 @@ Route23_EventScript_MissingBadgeTrigger:: closemessage waitse applymovement OBJ_EVENT_ID_PLAYER, Route23_Movement_WalkDown - applymovement VAR_0x8009, Movement_WalkInPlaceFastestDown + applymovement VAR_0x8009, Movement_WalkInPlaceFasterDown waitmovement 0 releaseall end diff --git a/data/scripts/safari_zone.inc b/data/scripts/safari_zone.inc index 96d8be444..a973b6a38 100644 --- a/data/scripts/safari_zone.inc +++ b/data/scripts/safari_zone.inc @@ -1,21 +1,20 @@ SafariZone_EventScript_OutOfBallsMidBattle:: setvar VAR_MAP_SCENE_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE, 3 special ExitSafariMode - setwarp MAP_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE, 255, 4, 1 + setwarp MAP_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE, 4, 1 end SafariZone_EventScript_Exit:: setvar VAR_MAP_SCENE_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE, 1 special ExitSafariMode - warp MAP_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE, 255, 4, 1 + warp MAP_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE, 4, 1 waitstate end SafariZone_EventScript_RetirePrompt:: lockall msgbox SafariZone_Text_WouldYouLikeToExit, MSGBOX_YESNO - compare VAR_RESULT, YES - goto_if_eq SafariZone_EventScript_Retire + goto_if_eq VAR_RESULT, YES, SafariZone_EventScript_Retire releaseall end diff --git a/data/scripts/seagallop.inc b/data/scripts/seagallop.inc index fc82f71e3..9cbd502b6 100644 --- a/data/scripts/seagallop.inc +++ b/data/scripts/seagallop.inc @@ -1,206 +1,197 @@ @ Separate selection menus for before the Rainbow Pass is obtained EventScript_ChooseDestFromOneIsland:: - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5 - goto_if_ge EventScript_SeviiDestinationsPage1 - compare VAR_MAP_SCENE_CINNABAR_ISLAND, 4 - goto_if_ge EventScript_ChooseDestFromOneIslandVermilionAllowed - multichoice 19, 6, MULTICHOICE_ISLAND_23, FALSE - switch VAR_RESULT - case 0, EventScript_SailToTwoIsland2 - case 1, EventScript_SailToThreeIsland2 - case 2, EventScript_CancelSail - case SCR_MENU_CANCEL, EventScript_CancelSail - end + goto_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5, EventScript_SeviiDestinationsPage1 + goto_if_ge VAR_MAP_SCENE_CINNABAR_ISLAND, 4, EventScript_ChooseDestFromOneIslandVermilionAllowed + multichoice 19, 6, MULTICHOICE_ISLAND_23, FALSE + switch VAR_RESULT + case 0, EventScript_SailToTwoIsland2 + case 1, EventScript_SailToThreeIsland2 + case 2, EventScript_CancelSail + case SCR_MENU_CANCEL, EventScript_CancelSail + end EventScript_ChooseDestFromOneIslandVermilionAllowed:: - multichoice 19, 5, MULTICHOICE_SEAGALLOP_V23, FALSE - switch VAR_RESULT - case 0, EventScript_SailToVermilion2 - case 1, EventScript_SailToTwoIsland2 - case 2, EventScript_SailToThreeIsland2 - case 3, EventScript_CancelSail - case SCR_MENU_CANCEL, EventScript_CancelSail - end + multichoice 19, 5, MULTICHOICE_SEAGALLOP_V23, FALSE + switch VAR_RESULT + case 0, EventScript_SailToVermilion2 + case 1, EventScript_SailToTwoIsland2 + case 2, EventScript_SailToThreeIsland2 + case 3, EventScript_CancelSail + case SCR_MENU_CANCEL, EventScript_CancelSail + end EventScript_ChooseDestFromTwoIsland:: - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5 - goto_if_ge EventScript_SeviiDestinationsPage1 - compare VAR_MAP_SCENE_CINNABAR_ISLAND, 4 - goto_if_ge EventScript_ChooseDestFromTwoIslandVermilionAllowed - multichoice 19, 6, MULTICHOICE_ISLAND_13, FALSE - switch VAR_RESULT - case 0, EventScript_SailToOneIsland2 - case 1, EventScript_SailToThreeIsland2 - case 2, EventScript_CancelSail - case SCR_MENU_CANCEL, EventScript_CancelSail - end + goto_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5, EventScript_SeviiDestinationsPage1 + goto_if_ge VAR_MAP_SCENE_CINNABAR_ISLAND, 4, EventScript_ChooseDestFromTwoIslandVermilionAllowed + multichoice 19, 6, MULTICHOICE_ISLAND_13, FALSE + switch VAR_RESULT + case 0, EventScript_SailToOneIsland2 + case 1, EventScript_SailToThreeIsland2 + case 2, EventScript_CancelSail + case SCR_MENU_CANCEL, EventScript_CancelSail + end EventScript_ChooseDestFromTwoIslandVermilionAllowed:: - multichoice 19, 5, MULTICHOICE_SEAGALLOP_V13, FALSE - switch VAR_RESULT - case 0, EventScript_SailToVermilion2 - case 1, EventScript_SailToOneIsland2 - case 2, EventScript_SailToThreeIsland2 - case 3, EventScript_CancelSail - case SCR_MENU_CANCEL, EventScript_CancelSail - end + multichoice 19, 5, MULTICHOICE_SEAGALLOP_V13, FALSE + switch VAR_RESULT + case 0, EventScript_SailToVermilion2 + case 1, EventScript_SailToOneIsland2 + case 2, EventScript_SailToThreeIsland2 + case 3, EventScript_CancelSail + case SCR_MENU_CANCEL, EventScript_CancelSail + end EventScript_SailToVermilion2:: - setvar VAR_0x8006, SEAGALLOP_VERMILION_CITY - goto EventScript_SailToDest - end + setvar VAR_0x8006, SEAGALLOP_VERMILION_CITY + goto EventScript_SailToDest + end EventScript_SailToOneIsland2:: - setvar VAR_0x8006, SEAGALLOP_ONE_ISLAND - goto EventScript_SailToDest - end + setvar VAR_0x8006, SEAGALLOP_ONE_ISLAND + goto EventScript_SailToDest + end EventScript_SailToTwoIsland2:: - setvar VAR_0x8006, SEAGALLOP_TWO_ISLAND - goto EventScript_SailToDest - end + setvar VAR_0x8006, SEAGALLOP_TWO_ISLAND + goto EventScript_SailToDest + end EventScript_SailToThreeIsland2:: - setvar VAR_0x8006, SEAGALLOP_THREE_ISLAND - goto EventScript_SailToDest - end + setvar VAR_0x8006, SEAGALLOP_THREE_ISLAND + goto EventScript_SailToDest + end EventScript_ChooseDestFromIsland:: - compare VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5 - goto_if_ge EventScript_SeviiDestinationsPage1 - compare VAR_MAP_SCENE_CINNABAR_ISLAND, 4 - goto_if_ge EventScript_ChooseDestFromIslandVermilionAllowed - multichoice 19, 6, MULTICHOICE_ISLAND_12, FALSE - switch VAR_RESULT - case 0, EventScript_SailToOneIsland2 - case 1, EventScript_SailToTwoIsland2 - case 2, EventScript_CancelSail - case SCR_MENU_CANCEL, EventScript_CancelSail - end + goto_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5, EventScript_SeviiDestinationsPage1 + goto_if_ge VAR_MAP_SCENE_CINNABAR_ISLAND, 4, EventScript_ChooseDestFromIslandVermilionAllowed + multichoice 19, 6, MULTICHOICE_ISLAND_12, FALSE + switch VAR_RESULT + case 0, EventScript_SailToOneIsland2 + case 1, EventScript_SailToTwoIsland2 + case 2, EventScript_CancelSail + case SCR_MENU_CANCEL, EventScript_CancelSail + end EventScript_ChooseDestFromIslandVermilionAllowed:: - multichoice 19, 5, MULTICHOICE_SEAGALLOP_V12, FALSE - switch VAR_RESULT - case 0, EventScript_SailToVermilion2 - case 1, EventScript_SailToOneIsland2 - case 2, EventScript_SailToTwoIsland2 - case 3, EventScript_CancelSail - case SCR_MENU_CANCEL, EventScript_CancelSail - end + multichoice 19, 5, MULTICHOICE_SEAGALLOP_V12, FALSE + switch VAR_RESULT + case 0, EventScript_SailToVermilion2 + case 1, EventScript_SailToOneIsland2 + case 2, EventScript_SailToTwoIsland2 + case 3, EventScript_CancelSail + case SCR_MENU_CANCEL, EventScript_CancelSail + end EventScript_SailToDest:: - specialvar VAR_RESULT, GetSeagallopNumber - getnumberstring 0, VAR_RESULT - compare VAR_0x8004, SEAGALLOP_VERMILION_CITY - goto_if_eq EventScript_DepartingVermilion - compare VAR_0x8004, SEAGALLOP_VERMILION_CITY - goto_if_ne EventScript_DepartingNotVermilion - end + specialvar VAR_RESULT, GetSeagallopNumber + buffernumberstring STR_VAR_1, VAR_RESULT + goto_if_eq VAR_0x8004, SEAGALLOP_VERMILION_CITY, EventScript_DepartingVermilion + goto_if_ne VAR_0x8004, SEAGALLOP_VERMILION_CITY, EventScript_DepartingNotVermilion + end EventScript_DepartingVermilion:: - msgbox VermilionCity_Text_Seagallop7Departing - goto EventScript_SetSail - end + msgbox VermilionCity_Text_Seagallop7Departing + goto EventScript_SetSail + end EventScript_DepartingNotVermilion:: - msgbox Text_AllAboardSeagallopNum - goto EventScript_SetSail - end + msgbox Text_AllAboardSeagallopNum + goto EventScript_SetSail + end EventScript_SetSail:: - closemessage - delay 20 - goto_if_questlog EventScript_ReleaseEnd - special QuestLog_CutRecording - fadescreen FADE_TO_BLACK - special DoSeagallopFerryScene - waitstate - end + closemessage + delay 20 + goto_if_questlog EventScript_ReleaseEnd + special QuestLog_CutRecording + fadescreen FADE_TO_BLACK + special DoSeagallopFerryScene + waitstate + end EventScript_CancelSail:: - specialvar VAR_RESULT, IsPlayerLeftOfVermilionSailor - compare VAR_RESULT, TRUE - goto_if_eq VermilionCity_EventScript_WalkUpPier - release - end + specialvar VAR_RESULT, IsPlayerLeftOfVermilionSailor + goto_if_eq VAR_RESULT, TRUE, VermilionCity_EventScript_WalkUpPier + release + end VermilionCity_EventScript_WalkUpPier:: - closemessage - applymovement LOCALID_FERRY_SAILOR, Movement_FaceOriginalDirection - applymovement OBJ_EVENT_ID_PLAYER, VermilionCity_Movement_WalkUp - waitmovement 0 - releaseall - end + closemessage + applymovement LOCALID_FERRY_SAILOR, Movement_FaceOriginalDirection + applymovement OBJ_EVENT_ID_PLAYER, VermilionCity_Movement_WalkUp + waitmovement 0 + releaseall + end VermilionCity_Movement_WalkUp:: - walk_up - step_end + walk_up + step_end EventScript_SeviiDestinationsPage1:: - setvar VAR_0x8005, 0 - special DrawSeagallopDestinationMenu - waitstate - specialvar VAR_0x8006, GetSelectedSeagallopDestination - switch VAR_0x8006 - case SEAGALLOP_VERMILION_CITY, EventScript_SailToVermilionCity - case SEAGALLOP_ONE_ISLAND, EventScript_SailToOneIsland - case SEAGALLOP_TWO_ISLAND, EventScript_SailToTwoIsland - case SEAGALLOP_THREE_ISLAND, EventScript_SailToThreeIsland - case SEAGALLOP_FOUR_ISLAND, EventScript_SailToFourIsland - case SEAGALLOP_MORE, EventScript_SeviiDestinationsPage2 - case SCR_MENU_CANCEL, EventScript_CancelSail - end + setvar VAR_0x8005, 0 + special DrawSeagallopDestinationMenu + waitstate + specialvar VAR_0x8006, GetSelectedSeagallopDestination + switch VAR_0x8006 + case SEAGALLOP_VERMILION_CITY, EventScript_SailToVermilionCity + case SEAGALLOP_ONE_ISLAND, EventScript_SailToOneIsland + case SEAGALLOP_TWO_ISLAND, EventScript_SailToTwoIsland + case SEAGALLOP_THREE_ISLAND, EventScript_SailToThreeIsland + case SEAGALLOP_FOUR_ISLAND, EventScript_SailToFourIsland + case SEAGALLOP_MORE, EventScript_SeviiDestinationsPage2 + case SCR_MENU_CANCEL, EventScript_CancelSail + end EventScript_SeviiDestinationsPage2:: - setvar VAR_0x8005, 1 - special DrawSeagallopDestinationMenu - waitstate - specialvar VAR_0x8006, GetSelectedSeagallopDestination - switch VAR_0x8006 - case SEAGALLOP_FOUR_ISLAND, EventScript_SailToFourIsland - case SEAGALLOP_FIVE_ISLAND, EventScript_SailToFiveIsland - case SEAGALLOP_SIX_ISLAND, EventScript_SailToSixIsland - case SEAGALLOP_SEVEN_ISLAND, EventScript_SailToSevenIsland - case SEAGALLOP_MORE, EventScript_SeviiDestinationsPage1 - case SCR_MENU_CANCEL, EventScript_CancelSail - end + setvar VAR_0x8005, 1 + special DrawSeagallopDestinationMenu + waitstate + specialvar VAR_0x8006, GetSelectedSeagallopDestination + switch VAR_0x8006 + case SEAGALLOP_FOUR_ISLAND, EventScript_SailToFourIsland + case SEAGALLOP_FIVE_ISLAND, EventScript_SailToFiveIsland + case SEAGALLOP_SIX_ISLAND, EventScript_SailToSixIsland + case SEAGALLOP_SEVEN_ISLAND, EventScript_SailToSevenIsland + case SEAGALLOP_MORE, EventScript_SeviiDestinationsPage1 + case SCR_MENU_CANCEL, EventScript_CancelSail + end EventScript_SailToVermilionCity:: - setvar VAR_0x8006, SEAGALLOP_VERMILION_CITY - goto EventScript_SailToDest - end + setvar VAR_0x8006, SEAGALLOP_VERMILION_CITY + goto EventScript_SailToDest + end EventScript_SailToOneIsland:: - setvar VAR_0x8006, SEAGALLOP_ONE_ISLAND - goto EventScript_SailToDest - end + setvar VAR_0x8006, SEAGALLOP_ONE_ISLAND + goto EventScript_SailToDest + end EventScript_SailToTwoIsland:: - setvar VAR_0x8006, SEAGALLOP_TWO_ISLAND - goto EventScript_SailToDest - end + setvar VAR_0x8006, SEAGALLOP_TWO_ISLAND + goto EventScript_SailToDest + end EventScript_SailToThreeIsland:: - setvar VAR_0x8006, SEAGALLOP_THREE_ISLAND - goto EventScript_SailToDest - end + setvar VAR_0x8006, SEAGALLOP_THREE_ISLAND + goto EventScript_SailToDest + end EventScript_SailToFourIsland:: - setvar VAR_0x8006, SEAGALLOP_FOUR_ISLAND - goto EventScript_SailToDest - end + setvar VAR_0x8006, SEAGALLOP_FOUR_ISLAND + goto EventScript_SailToDest + end EventScript_SailToFiveIsland:: - setvar VAR_0x8006, SEAGALLOP_FIVE_ISLAND - goto EventScript_SailToDest - end + setvar VAR_0x8006, SEAGALLOP_FIVE_ISLAND + goto EventScript_SailToDest + end EventScript_SailToSixIsland:: - setvar VAR_0x8006, SEAGALLOP_SIX_ISLAND - goto EventScript_SailToDest - end + setvar VAR_0x8006, SEAGALLOP_SIX_ISLAND + goto EventScript_SailToDest + end EventScript_SailToSevenIsland:: - setvar VAR_0x8006, SEAGALLOP_SEVEN_ISLAND - goto EventScript_SailToDest - end + setvar VAR_0x8006, SEAGALLOP_SEVEN_ISLAND + goto EventScript_SailToDest + end diff --git a/data/scripts/silphco_doors.inc b/data/scripts/silphco_doors.inc index 4486001e5..47abd97cf 100644 --- a/data/scripts/silphco_doors.inc +++ b/data/scripts/silphco_doors.inc @@ -1,564 +1,544 @@ EventScript_NeedCardKey:: - msgbox Text_ItNeedsCardKey - releaseall - end + msgbox Text_ItNeedsCardKey + releaseall + end EventScript_DoorUnlocked:: - msgbox Text_TheDoorIsOpen - releaseall - end + msgbox Text_TheDoorIsOpen + releaseall + end EventScript_Close2FDoor1:: - setmetatile 5, 8, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 - setmetatile 6, 8, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 - setmetatile 5, 9, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 - setmetatile 6, 9, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 - setmetatile 6, 10, METATILE_SilphCo_Floor_ShadeFull, 0 - return + setmetatile 5, 8, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 + setmetatile 6, 8, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 + setmetatile 5, 9, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 + setmetatile 6, 9, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 + setmetatile 6, 10, METATILE_SilphCo_Floor_ShadeFull, 0 + return EventScript_Close2FDoor2:: - setmetatile 5, 15, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 - setmetatile 6, 15, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 - setmetatile 5, 16, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 - setmetatile 6, 16, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 - setmetatile 6, 17, METATILE_SilphCo_Floor_ShadeFull, 0 - return + setmetatile 5, 15, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 + setmetatile 6, 15, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 + setmetatile 5, 16, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 + setmetatile 6, 16, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 + setmetatile 6, 17, METATILE_SilphCo_Floor_ShadeFull, 0 + return EventScript_Close3FDoor1:: - setmetatile 9, 11, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 - setmetatile 10, 11, METATILE_SilphCo_VerticalBarrier_TopRight, 1 - setmetatile 9, 12, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 - setmetatile 10, 12, METATILE_SilphCo_VerticalBarrier_MidRight, 1 - setmetatile 9, 13, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 - setmetatile 10, 13, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 - return + setmetatile 9, 11, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 + setmetatile 10, 11, METATILE_SilphCo_VerticalBarrier_TopRight, 1 + setmetatile 9, 12, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 + setmetatile 10, 12, METATILE_SilphCo_VerticalBarrier_MidRight, 1 + setmetatile 9, 13, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 + setmetatile 10, 13, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 + return EventScript_Close3FDoor2:: - setmetatile 20, 11, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 - setmetatile 21, 11, METATILE_SilphCo_VerticalBarrier_TopRight, 1 - setmetatile 20, 12, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 - setmetatile 21, 12, METATILE_SilphCo_VerticalBarrier_MidRight, 1 - setmetatile 20, 13, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 - setmetatile 21, 13, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 - return + setmetatile 20, 11, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 + setmetatile 21, 11, METATILE_SilphCo_VerticalBarrier_TopRight, 1 + setmetatile 20, 12, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 + setmetatile 21, 12, METATILE_SilphCo_VerticalBarrier_MidRight, 1 + setmetatile 20, 13, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 + setmetatile 21, 13, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 + return EventScript_Close4FDoor1:: - setmetatile 3, 16, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 - setmetatile 4, 16, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 - setmetatile 3, 17, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 - setmetatile 4, 17, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 - setmetatile 4, 18, METATILE_SilphCo_Floor_ShadeFull, 0 - return + setmetatile 3, 16, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 + setmetatile 4, 16, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 + setmetatile 3, 17, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 + setmetatile 4, 17, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 + setmetatile 4, 18, METATILE_SilphCo_Floor_ShadeFull, 0 + return EventScript_Close4FDoor2:: - setmetatile 14, 11, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 - setmetatile 15, 11, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 - setmetatile 14, 12, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 - setmetatile 15, 12, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 - setmetatile 15, 13, METATILE_SilphCo_Floor_ShadeFull, 0 - return + setmetatile 14, 11, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 + setmetatile 15, 11, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 + setmetatile 14, 12, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 + setmetatile 15, 12, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 + setmetatile 15, 13, METATILE_SilphCo_Floor_ShadeFull, 0 + return EventScript_Close5FDoor1:: @ 81AMETATILE_SilphCo_Floor_WallRightCornerF - setmetatile 7, 8, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 - setmetatile 8, 8, METATILE_SilphCo_VerticalBarrier_TopRight, 1 - setmetatile 7, 9, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 - setmetatile 8, 9, METATILE_SilphCo_VerticalBarrier_MidRight, 1 - setmetatile 7, 10, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 - setmetatile 8, 10, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 - return + setmetatile 7, 8, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 + setmetatile 8, 8, METATILE_SilphCo_VerticalBarrier_TopRight, 1 + setmetatile 7, 9, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 + setmetatile 8, 9, METATILE_SilphCo_VerticalBarrier_MidRight, 1 + setmetatile 7, 10, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 + setmetatile 8, 10, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 + return EventScript_Close5FDoor2:: - setmetatile 7, 17, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 - setmetatile 8, 17, METATILE_SilphCo_VerticalBarrier_TopRight, 1 - setmetatile 7, 18, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 - setmetatile 8, 18, METATILE_SilphCo_VerticalBarrier_MidRight, 1 - setmetatile 7, 19, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 - setmetatile 8, 19, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 - return + setmetatile 7, 17, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 + setmetatile 8, 17, METATILE_SilphCo_VerticalBarrier_TopRight, 1 + setmetatile 7, 18, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 + setmetatile 8, 18, METATILE_SilphCo_VerticalBarrier_MidRight, 1 + setmetatile 7, 19, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 + setmetatile 8, 19, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 + return EventScript_Close5FDoor3:: - setmetatile 18, 12, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 - setmetatile 19, 12, METATILE_SilphCo_VerticalBarrier_TopRight, 1 - setmetatile 18, 13, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 - setmetatile 19, 13, METATILE_SilphCo_VerticalBarrier_MidRight, 1 - setmetatile 18, 14, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 - setmetatile 19, 14, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 - return + setmetatile 18, 12, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 + setmetatile 19, 12, METATILE_SilphCo_VerticalBarrier_TopRight, 1 + setmetatile 18, 13, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 + setmetatile 19, 13, METATILE_SilphCo_VerticalBarrier_MidRight, 1 + setmetatile 18, 14, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 + setmetatile 19, 14, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 + return EventScript_Close6FDoor:: - setmetatile 5, 14, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 - setmetatile 6, 14, METATILE_SilphCo_VerticalBarrier_TopRight, 1 - setmetatile 5, 15, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 - setmetatile 6, 15, METATILE_SilphCo_VerticalBarrier_MidRight, 1 - setmetatile 5, 16, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 - setmetatile 6, 16, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 - return + setmetatile 5, 14, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 + setmetatile 6, 14, METATILE_SilphCo_VerticalBarrier_TopRight, 1 + setmetatile 5, 15, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 + setmetatile 6, 15, METATILE_SilphCo_VerticalBarrier_MidRight, 1 + setmetatile 5, 16, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 + setmetatile 6, 16, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 + return EventScript_Close7FDoor1:: - setmetatile 11, 8, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 - setmetatile 12, 8, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 - setmetatile 11, 9, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 - setmetatile 12, 9, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 - setmetatile 12, 10, METATILE_SilphCo_Floor_ShadeFull, 0 - return + setmetatile 11, 8, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 + setmetatile 12, 8, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 + setmetatile 11, 9, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 + setmetatile 12, 9, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 + setmetatile 12, 10, METATILE_SilphCo_Floor_ShadeFull, 0 + return EventScript_Close7FDoor2:: - setmetatile 24, 7, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 - setmetatile 25, 7, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 - setmetatile 24, 8, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 - setmetatile 25, 8, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 - setmetatile 25, 9, METATILE_SilphCo_Floor_ShadeFull, 0 - return + setmetatile 24, 7, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 + setmetatile 25, 7, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 + setmetatile 24, 8, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 + setmetatile 25, 8, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 + setmetatile 25, 9, METATILE_SilphCo_Floor_ShadeFull, 0 + return EventScript_Close7FDoor3:: - setmetatile 25, 13, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 - setmetatile 26, 13, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 - setmetatile 25, 14, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 - setmetatile 26, 14, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 - setmetatile 26, 15, METATILE_SilphCo_Floor_ShadeFull, 0 - return + setmetatile 25, 13, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 + setmetatile 26, 13, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 + setmetatile 25, 14, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 + setmetatile 26, 14, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 + setmetatile 26, 15, METATILE_SilphCo_Floor_ShadeFull, 0 + return EventScript_Close8FDoor:: - setmetatile 5, 9, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 - setmetatile 6, 9, METATILE_SilphCo_VerticalBarrier_TopRight, 1 - setmetatile 5, 10, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 - setmetatile 6, 10, METATILE_SilphCo_VerticalBarrier_MidRight, 1 - setmetatile 5, 11, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 - setmetatile 6, 11, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 - return + setmetatile 5, 9, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 + setmetatile 6, 9, METATILE_SilphCo_VerticalBarrier_TopRight, 1 + setmetatile 5, 10, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 + setmetatile 6, 10, METATILE_SilphCo_VerticalBarrier_MidRight, 1 + setmetatile 5, 11, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 + setmetatile 6, 11, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 + return EventScript_Close9FDoor1:: - setmetatile 2, 9, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 - setmetatile 3, 9, METATILE_SilphCo_VerticalBarrier_TopRight, 1 - setmetatile 2, 10, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 - setmetatile 3, 10, METATILE_SilphCo_VerticalBarrier_MidRight, 1 - setmetatile 2, 11, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 - setmetatile 3, 11, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 - return + setmetatile 2, 9, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 + setmetatile 3, 9, METATILE_SilphCo_VerticalBarrier_TopRight, 1 + setmetatile 2, 10, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 + setmetatile 3, 10, METATILE_SilphCo_VerticalBarrier_MidRight, 1 + setmetatile 2, 11, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 + setmetatile 3, 11, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 + return EventScript_Close9FDoor2:: - setmetatile 12, 15, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 - setmetatile 13, 15, METATILE_SilphCo_VerticalBarrier_TopRight, 1 - setmetatile 12, 16, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 - setmetatile 13, 16, METATILE_SilphCo_VerticalBarrier_MidRight, 1 - setmetatile 12, 17, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 - setmetatile 13, 17, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 - return + setmetatile 12, 15, METATILE_SilphCo_VerticalBarrier_TopLeft, 1 + setmetatile 13, 15, METATILE_SilphCo_VerticalBarrier_TopRight, 1 + setmetatile 12, 16, METATILE_SilphCo_VerticalBarrier_MidLeft, 1 + setmetatile 13, 16, METATILE_SilphCo_VerticalBarrier_MidRight, 1 + setmetatile 12, 17, METATILE_SilphCo_VerticalBarrier_BottomLeft, 1 + setmetatile 13, 17, METATILE_SilphCo_VerticalBarrier_BottomRight, 1 + return EventScript_Close9FDoor3:: - setmetatile 21, 6, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 - setmetatile 22, 6, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 - setmetatile 21, 7, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 - setmetatile 22, 7, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 - setmetatile 22, 8, METATILE_SilphCo_Floor_ShadeFull, 0 - return + setmetatile 21, 6, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 + setmetatile 22, 6, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 + setmetatile 21, 7, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 + setmetatile 22, 7, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 + setmetatile 22, 8, METATILE_SilphCo_Floor_ShadeFull, 0 + return EventScript_Close9FDoor4:: - setmetatile 21, 12, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 - setmetatile 22, 12, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 - setmetatile 21, 13, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 - setmetatile 22, 13, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 - setmetatile 22, 14, METATILE_SilphCo_Floor_ShadeFull, 0 - return + setmetatile 21, 12, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 + setmetatile 22, 12, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 + setmetatile 21, 13, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 + setmetatile 22, 13, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 + setmetatile 22, 14, METATILE_SilphCo_Floor_ShadeFull, 0 + return EventScript_Close10FDoor:: - setmetatile 12, 11, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 - setmetatile 13, 11, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 - setmetatile 12, 12, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 - setmetatile 13, 12, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 - setmetatile 13, 13, METATILE_SilphCo_Floor_ShadeFull, 0 - return + setmetatile 12, 11, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 + setmetatile 13, 11, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 + setmetatile 12, 12, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 + setmetatile 13, 12, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 + setmetatile 13, 13, METATILE_SilphCo_Floor_ShadeFull, 0 + return EventScript_Close11FDoor:: - setmetatile 5, 16, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 - setmetatile 6, 16, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 - setmetatile 5, 17, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 - setmetatile 6, 17, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 - setmetatile 6, 18, METATILE_SilphCo_Floor_ShadeFull, 0 - return + setmetatile 5, 16, METATILE_SilphCo_HorizontalBarrier_TopLeft, 1 + setmetatile 6, 16, METATILE_SilphCo_HorizontalBarrier_TopRight, 1 + setmetatile 5, 17, METATILE_SilphCo_HorizontalBarrier_BottomLeft, 1 + setmetatile 6, 17, METATILE_SilphCo_HorizontalBarrier_BottomRight, 1 + setmetatile 6, 18, METATILE_SilphCo_Floor_ShadeFull, 0 + return EventScript_Open2FDoor1:: - setmetatile 5, 8, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 6, 8, METATILE_SilphCo_Floor, 0 - setmetatile 5, 9, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 6, 9, METATILE_SilphCo_Floor, 0 - setmetatile 6, 10, METATILE_SilphCo_Floor, 0 - return + setmetatile 5, 8, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 6, 8, METATILE_SilphCo_Floor, 0 + setmetatile 5, 9, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 6, 9, METATILE_SilphCo_Floor, 0 + setmetatile 6, 10, METATILE_SilphCo_Floor, 0 + return EventScript_Open2FDoor2:: - setmetatile 5, 15, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 6, 15, METATILE_SilphCo_Floor, 0 - setmetatile 5, 16, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 6, 16, METATILE_SilphCo_Floor, 0 - setmetatile 6, 17, METATILE_SilphCo_Floor, 0 - return + setmetatile 5, 15, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 6, 15, METATILE_SilphCo_Floor, 0 + setmetatile 5, 16, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 6, 16, METATILE_SilphCo_Floor, 0 + setmetatile 6, 17, METATILE_SilphCo_Floor, 0 + return EventScript_Open3FDoor1:: - setmetatile 9, 11, METATILE_SilphCo_Wall_LeftEdge, 1 - setmetatile 10, 11, METATILE_SilphCo_Wall_RightEdge, 1 - setmetatile 9, 12, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 10, 12, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 9, 13, METATILE_SilphCo_Floor_WallLeftCorner, 0 - setmetatile 10, 13, METATILE_SilphCo_Floor_WallRightCorner, 0 - return + setmetatile 9, 11, METATILE_SilphCo_Wall_LeftEdge, 1 + setmetatile 10, 11, METATILE_SilphCo_Wall_RightEdge, 1 + setmetatile 9, 12, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 10, 12, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 9, 13, METATILE_SilphCo_Floor_WallLeftCorner, 0 + setmetatile 10, 13, METATILE_SilphCo_Floor_WallRightCorner, 0 + return EventScript_Open3FDoor2:: - setmetatile 20, 11, METATILE_SilphCo_Wall_LeftEdge, 1 - setmetatile 21, 11, METATILE_SilphCo_Wall_RightEdge, 1 - setmetatile 20, 12, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 21, 12, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 20, 13, METATILE_SilphCo_Floor_WallLeftCorner, 0 - setmetatile 21, 13, METATILE_SilphCo_Floor_WallRightCorner, 0 - return + setmetatile 20, 11, METATILE_SilphCo_Wall_LeftEdge, 1 + setmetatile 21, 11, METATILE_SilphCo_Wall_RightEdge, 1 + setmetatile 20, 12, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 21, 12, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 20, 13, METATILE_SilphCo_Floor_WallLeftCorner, 0 + setmetatile 21, 13, METATILE_SilphCo_Floor_WallRightCorner, 0 + return EventScript_Open4FDoor1:: - setmetatile 3, 16, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 4, 16, METATILE_SilphCo_Floor, 0 - setmetatile 3, 17, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 4, 17, METATILE_SilphCo_Floor, 0 - setmetatile 4, 18, METATILE_SilphCo_Floor, 0 - return + setmetatile 3, 16, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 4, 16, METATILE_SilphCo_Floor, 0 + setmetatile 3, 17, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 4, 17, METATILE_SilphCo_Floor, 0 + setmetatile 4, 18, METATILE_SilphCo_Floor, 0 + return EventScript_Open4FDoor2:: - setmetatile 14, 11, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 15, 11, METATILE_SilphCo_Floor, 0 - setmetatile 14, 12, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 15, 12, METATILE_SilphCo_Floor, 0 - setmetatile 15, 13, METATILE_SilphCo_Floor, 0 - return + setmetatile 14, 11, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 15, 11, METATILE_SilphCo_Floor, 0 + setmetatile 14, 12, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 15, 12, METATILE_SilphCo_Floor, 0 + setmetatile 15, 13, METATILE_SilphCo_Floor, 0 + return EventScript_Open5FDoor1:: - setmetatile 7, 8, METATILE_SilphCo_Wall_LeftEdge, 1 - setmetatile 8, 8, METATILE_SilphCo_Wall_RightEdge, 1 - setmetatile 7, 9, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 8, 9, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 7, 10, METATILE_SilphCo_Floor_WallLeftCorner, 0 - setmetatile 8, 10, METATILE_SilphCo_Floor_WallRightCorner, 0 - return + setmetatile 7, 8, METATILE_SilphCo_Wall_LeftEdge, 1 + setmetatile 8, 8, METATILE_SilphCo_Wall_RightEdge, 1 + setmetatile 7, 9, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 8, 9, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 7, 10, METATILE_SilphCo_Floor_WallLeftCorner, 0 + setmetatile 8, 10, METATILE_SilphCo_Floor_WallRightCorner, 0 + return EventScript_Open5FDoor2:: - setmetatile 7, 17, METATILE_SilphCo_Wall_LeftEdge, 1 - setmetatile 8, 17, METATILE_SilphCo_Wall_RightEdge, 1 - setmetatile 7, 18, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 8, 18, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 7, 19, METATILE_SilphCo_Floor_WallLeftCorner, 0 - setmetatile 8, 19, METATILE_SilphCo_Floor_WallRightCorner, 0 - return + setmetatile 7, 17, METATILE_SilphCo_Wall_LeftEdge, 1 + setmetatile 8, 17, METATILE_SilphCo_Wall_RightEdge, 1 + setmetatile 7, 18, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 8, 18, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 7, 19, METATILE_SilphCo_Floor_WallLeftCorner, 0 + setmetatile 8, 19, METATILE_SilphCo_Floor_WallRightCorner, 0 + return EventScript_Open5FDoor3:: - setmetatile 18, 12, METATILE_SilphCo_Wall_LeftEdge, 1 - setmetatile 19, 12, METATILE_SilphCo_Wall_RightEdge, 1 - setmetatile 18, 13, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 19, 13, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 18, 14, METATILE_SilphCo_Floor_WallLeftCorner, 0 - setmetatile 19, 14, METATILE_SilphCo_Floor_WallRightCorner, 0 - return + setmetatile 18, 12, METATILE_SilphCo_Wall_LeftEdge, 1 + setmetatile 19, 12, METATILE_SilphCo_Wall_RightEdge, 1 + setmetatile 18, 13, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 19, 13, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 18, 14, METATILE_SilphCo_Floor_WallLeftCorner, 0 + setmetatile 19, 14, METATILE_SilphCo_Floor_WallRightCorner, 0 + return EventScript_Open6FDoor:: - setmetatile 5, 14, METATILE_SilphCo_Wall_LeftEdge, 1 - setmetatile 6, 14, METATILE_SilphCo_Wall_RightEdge, 1 - setmetatile 5, 15, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 6, 15, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 5, 16, METATILE_SilphCo_Floor_WallLeftCorner, 0 - setmetatile 6, 16, METATILE_SilphCo_Floor_WallRightCorner, 0 - return + setmetatile 5, 14, METATILE_SilphCo_Wall_LeftEdge, 1 + setmetatile 6, 14, METATILE_SilphCo_Wall_RightEdge, 1 + setmetatile 5, 15, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 6, 15, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 5, 16, METATILE_SilphCo_Floor_WallLeftCorner, 0 + setmetatile 6, 16, METATILE_SilphCo_Floor_WallRightCorner, 0 + return EventScript_Open7FDoor1:: - setmetatile 11, 8, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 12, 8, METATILE_SilphCo_Floor, 0 - setmetatile 11, 9, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 12, 9, METATILE_SilphCo_Floor, 0 - setmetatile 12, 10, METATILE_SilphCo_Floor, 0 - return + setmetatile 11, 8, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 12, 8, METATILE_SilphCo_Floor, 0 + setmetatile 11, 9, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 12, 9, METATILE_SilphCo_Floor, 0 + setmetatile 12, 10, METATILE_SilphCo_Floor, 0 + return EventScript_Open7FDoor2:: - setmetatile 24, 7, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 25, 7, METATILE_SilphCo_Floor, 0 - setmetatile 24, 8, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 25, 8, METATILE_SilphCo_Floor, 0 - setmetatile 25, 9, METATILE_SilphCo_Floor, 0 - return + setmetatile 24, 7, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 25, 7, METATILE_SilphCo_Floor, 0 + setmetatile 24, 8, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 25, 8, METATILE_SilphCo_Floor, 0 + setmetatile 25, 9, METATILE_SilphCo_Floor, 0 + return EventScript_Open7FDoor3:: - setmetatile 25, 13, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 26, 13, METATILE_SilphCo_Floor, 0 - setmetatile 25, 14, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 26, 14, METATILE_SilphCo_Floor, 0 - setmetatile 26, 15, METATILE_SilphCo_Floor, 0 - return + setmetatile 25, 13, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 26, 13, METATILE_SilphCo_Floor, 0 + setmetatile 25, 14, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 26, 14, METATILE_SilphCo_Floor, 0 + setmetatile 26, 15, METATILE_SilphCo_Floor, 0 + return EventScript_Open8FDoor:: - setmetatile 5, 9, METATILE_SilphCo_Wall_LeftEdge, 1 - setmetatile 6, 9, METATILE_SilphCo_Wall_RightEdge, 1 - setmetatile 5, 10, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 6, 10, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 5, 11, METATILE_SilphCo_Floor_WallLeftCorner, 0 - setmetatile 6, 11, METATILE_SilphCo_Floor_WallRightCorner, 0 - return + setmetatile 5, 9, METATILE_SilphCo_Wall_LeftEdge, 1 + setmetatile 6, 9, METATILE_SilphCo_Wall_RightEdge, 1 + setmetatile 5, 10, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 6, 10, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 5, 11, METATILE_SilphCo_Floor_WallLeftCorner, 0 + setmetatile 6, 11, METATILE_SilphCo_Floor_WallRightCorner, 0 + return EventScript_Open9FDoor1:: - setmetatile 2, 9, METATILE_SilphCo_Wall_LeftEdge, 1 - setmetatile 3, 9, METATILE_SilphCo_Wall_RightEdge, 1 - setmetatile 2, 10, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 3, 10, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 2, 11, METATILE_SilphCo_Floor_WallLeftCorner, 0 - setmetatile 3, 11, METATILE_SilphCo_Floor_WallRightCorner, 0 - return + setmetatile 2, 9, METATILE_SilphCo_Wall_LeftEdge, 1 + setmetatile 3, 9, METATILE_SilphCo_Wall_RightEdge, 1 + setmetatile 2, 10, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 3, 10, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 2, 11, METATILE_SilphCo_Floor_WallLeftCorner, 0 + setmetatile 3, 11, METATILE_SilphCo_Floor_WallRightCorner, 0 + return EventScript_Open9FDoor2:: - setmetatile 12, 15, METATILE_SilphCo_Wall_LeftEdge, 1 - setmetatile 13, 15, METATILE_SilphCo_Wall_RightEdge, 1 - setmetatile 12, 16, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 13, 16, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 12, 17, METATILE_SilphCo_Floor_WallLeftCorner, 0 - setmetatile 13, 17, METATILE_SilphCo_Floor_WallRightCorner, 0 - return + setmetatile 12, 15, METATILE_SilphCo_Wall_LeftEdge, 1 + setmetatile 13, 15, METATILE_SilphCo_Wall_RightEdge, 1 + setmetatile 12, 16, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 13, 16, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 12, 17, METATILE_SilphCo_Floor_WallLeftCorner, 0 + setmetatile 13, 17, METATILE_SilphCo_Floor_WallRightCorner, 0 + return EventScript_Open9FDoor3:: - setmetatile 21, 6, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 22, 6, METATILE_SilphCo_Floor, 0 - setmetatile 21, 7, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 22, 7, METATILE_SilphCo_Floor, 0 - setmetatile 22, 8, METATILE_SilphCo_Floor, 0 - return + setmetatile 21, 6, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 22, 6, METATILE_SilphCo_Floor, 0 + setmetatile 21, 7, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 22, 7, METATILE_SilphCo_Floor, 0 + setmetatile 22, 8, METATILE_SilphCo_Floor, 0 + return EventScript_Open9FDoor4:: - setmetatile 21, 12, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 22, 12, METATILE_SilphCo_Floor, 0 - setmetatile 21, 13, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 22, 13, METATILE_SilphCo_Floor, 0 - setmetatile 22, 14, METATILE_SilphCo_Floor, 0 - return + setmetatile 21, 12, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 22, 12, METATILE_SilphCo_Floor, 0 + setmetatile 21, 13, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 22, 13, METATILE_SilphCo_Floor, 0 + setmetatile 22, 14, METATILE_SilphCo_Floor, 0 + return EventScript_Open10FDoor:: - setmetatile 12, 11, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 13, 11, METATILE_SilphCo_Floor, 0 - setmetatile 12, 12, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 13, 12, METATILE_SilphCo_Floor, 0 - setmetatile 13, 13, METATILE_SilphCo_Floor, 0 - return + setmetatile 12, 11, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 13, 11, METATILE_SilphCo_Floor, 0 + setmetatile 12, 12, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 13, 12, METATILE_SilphCo_Floor, 0 + setmetatile 13, 13, METATILE_SilphCo_Floor, 0 + return EventScript_Open11FDoor:: - setmetatile 5, 16, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 6, 16, METATILE_SilphCo_Floor, 0 - setmetatile 5, 17, METATILE_SilphCo_Floor_ShadeFull, 0 - setmetatile 6, 17, METATILE_SilphCo_Floor, 0 - setmetatile 6, 18, METATILE_SilphCo_Floor, 0 - return + setmetatile 5, 16, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 6, 16, METATILE_SilphCo_Floor, 0 + setmetatile 5, 17, METATILE_SilphCo_Floor_ShadeFull, 0 + setmetatile 6, 17, METATILE_SilphCo_Floor, 0 + setmetatile 6, 18, METATILE_SilphCo_Floor, 0 + return SilphCo_2F_EventScript_Door1:: - lockall - setvar VAR_TEMP_1, 1 - setvar VAR_0x8004, FLAG_SILPH_2F_DOOR_1 - goto_if_set FLAG_SILPH_2F_DOOR_1, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 1 + setvar VAR_0x8004, FLAG_SILPH_2F_DOOR_1 + goto_if_set FLAG_SILPH_2F_DOOR_1, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_2F_EventScript_Door2:: - lockall - setvar VAR_TEMP_1, 2 - setvar VAR_0x8004, FLAG_SILPH_2F_DOOR_2 - goto_if_set FLAG_SILPH_2F_DOOR_2, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 2 + setvar VAR_0x8004, FLAG_SILPH_2F_DOOR_2 + goto_if_set FLAG_SILPH_2F_DOOR_2, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_3F_EventScript_Door1:: - lockall - setvar VAR_TEMP_1, 3 - setvar VAR_0x8004, FLAG_SILPH_3F_DOOR_1 - goto_if_set FLAG_SILPH_3F_DOOR_1, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 3 + setvar VAR_0x8004, FLAG_SILPH_3F_DOOR_1 + goto_if_set FLAG_SILPH_3F_DOOR_1, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_3F_EventScript_Door2:: - lockall - setvar VAR_TEMP_1, 4 - setvar VAR_0x8004, FLAG_SILPH_3F_DOOR_2 - goto_if_set FLAG_SILPH_3F_DOOR_2, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 4 + setvar VAR_0x8004, FLAG_SILPH_3F_DOOR_2 + goto_if_set FLAG_SILPH_3F_DOOR_2, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_4F_EventScript_Door1:: - lockall - setvar VAR_TEMP_1, 5 - setvar VAR_0x8004, FLAG_SILPH_4F_DOOR_1 - goto_if_set FLAG_SILPH_4F_DOOR_1, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 5 + setvar VAR_0x8004, FLAG_SILPH_4F_DOOR_1 + goto_if_set FLAG_SILPH_4F_DOOR_1, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_4F_EventScript_Door2:: - lockall - setvar VAR_TEMP_1, 6 - setvar VAR_0x8004, FLAG_SILPH_4F_DOOR_2 - goto_if_set FLAG_SILPH_4F_DOOR_2, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 6 + setvar VAR_0x8004, FLAG_SILPH_4F_DOOR_2 + goto_if_set FLAG_SILPH_4F_DOOR_2, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_5F_EventScript_Door1:: - lockall - setvar VAR_TEMP_1, 7 - setvar VAR_0x8004, FLAG_SILPH_5F_DOOR_1 - goto_if_set FLAG_SILPH_5F_DOOR_1, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 7 + setvar VAR_0x8004, FLAG_SILPH_5F_DOOR_1 + goto_if_set FLAG_SILPH_5F_DOOR_1, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_5F_EventScript_Door2:: - lockall - setvar VAR_TEMP_1, 8 - setvar VAR_0x8004, FLAG_SILPH_5F_DOOR_2 - goto_if_set FLAG_SILPH_5F_DOOR_2, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 8 + setvar VAR_0x8004, FLAG_SILPH_5F_DOOR_2 + goto_if_set FLAG_SILPH_5F_DOOR_2, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_5F_EventScript_Door3:: - lockall - setvar VAR_TEMP_1, 9 - setvar VAR_0x8004, FLAG_SILPH_5F_DOOR_3 - goto_if_set FLAG_SILPH_5F_DOOR_3, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 9 + setvar VAR_0x8004, FLAG_SILPH_5F_DOOR_3 + goto_if_set FLAG_SILPH_5F_DOOR_3, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_6F_EventScript_Door:: - lockall - setvar VAR_TEMP_1, 10 - setvar VAR_0x8004, FLAG_SILPH_6F_DOOR - goto_if_set FLAG_SILPH_6F_DOOR, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 10 + setvar VAR_0x8004, FLAG_SILPH_6F_DOOR + goto_if_set FLAG_SILPH_6F_DOOR, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_7F_EventScript_Door1:: - lockall - setvar VAR_TEMP_1, 11 - setvar VAR_0x8004, FLAG_SILPH_7F_DOOR_1 - goto_if_set FLAG_SILPH_7F_DOOR_1, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 11 + setvar VAR_0x8004, FLAG_SILPH_7F_DOOR_1 + goto_if_set FLAG_SILPH_7F_DOOR_1, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_7F_EventScript_Door2:: - lockall - setvar VAR_TEMP_1, 12 - setvar VAR_0x8004, FLAG_SILPH_7F_DOOR_2 - goto_if_set FLAG_SILPH_7F_DOOR_2, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 12 + setvar VAR_0x8004, FLAG_SILPH_7F_DOOR_2 + goto_if_set FLAG_SILPH_7F_DOOR_2, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_7F_EventScript_Door3:: - lockall - setvar VAR_TEMP_1, 13 - setvar VAR_0x8004, FLAG_SILPH_7F_DOOR_3 - goto_if_set FLAG_SILPH_7F_DOOR_3, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 13 + setvar VAR_0x8004, FLAG_SILPH_7F_DOOR_3 + goto_if_set FLAG_SILPH_7F_DOOR_3, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_8F_EventScript_Door:: - lockall - setvar VAR_TEMP_1, 14 - setvar VAR_0x8004, FLAG_SILPH_8F_DOOR - goto_if_set FLAG_SILPH_8F_DOOR, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 14 + setvar VAR_0x8004, FLAG_SILPH_8F_DOOR + goto_if_set FLAG_SILPH_8F_DOOR, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_9F_EventScript_Door1:: - lockall - setvar VAR_TEMP_1, 15 - setvar VAR_0x8004, FLAG_SILPH_9F_DOOR_1 - goto_if_set FLAG_SILPH_9F_DOOR_1, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 15 + setvar VAR_0x8004, FLAG_SILPH_9F_DOOR_1 + goto_if_set FLAG_SILPH_9F_DOOR_1, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_9F_EventScript_Door2:: - lockall - setvar VAR_TEMP_1, 16 - setvar VAR_0x8004, FLAG_SILPH_9F_DOOR_2 - goto_if_set FLAG_SILPH_9F_DOOR_2, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 16 + setvar VAR_0x8004, FLAG_SILPH_9F_DOOR_2 + goto_if_set FLAG_SILPH_9F_DOOR_2, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_9F_EventScript_Door3:: - lockall - setvar VAR_TEMP_1, 17 - setvar VAR_0x8004, FLAG_SILPH_9F_DOOR_3 - goto_if_set FLAG_SILPH_9F_DOOR_3, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 17 + setvar VAR_0x8004, FLAG_SILPH_9F_DOOR_3 + goto_if_set FLAG_SILPH_9F_DOOR_3, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_9F_EventScript_Door4:: - lockall - setvar VAR_TEMP_1, 18 - setvar VAR_0x8004, FLAG_SILPH_9F_DOOR_4 - goto_if_set FLAG_SILPH_9F_DOOR_4, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 18 + setvar VAR_0x8004, FLAG_SILPH_9F_DOOR_4 + goto_if_set FLAG_SILPH_9F_DOOR_4, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_10F_EventScript_Door:: - lockall - setvar VAR_TEMP_1, 19 - setvar VAR_0x8004, FLAG_SILPH_10F_DOOR - goto_if_set FLAG_SILPH_10F_DOOR, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 19 + setvar VAR_0x8004, FLAG_SILPH_10F_DOOR + goto_if_set FLAG_SILPH_10F_DOOR, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end SilphCo_11F_EventScript_Door:: - lockall - setvar VAR_TEMP_1, 20 - setvar VAR_0x8004, FLAG_SILPH_11F_DOOR - goto_if_set FLAG_SILPH_11F_DOOR, EventScript_DoorUnlocked - goto EventScript_TryUnlockDoor - end + lockall + setvar VAR_TEMP_1, 20 + setvar VAR_0x8004, FLAG_SILPH_11F_DOOR + goto_if_set FLAG_SILPH_11F_DOOR, EventScript_DoorUnlocked + goto EventScript_TryUnlockDoor + end EventScript_TryUnlockDoor:: - goto_if_set FLAG_HIDE_SILPH_CO_5F_CARD_KEY, EventScript_OpenDoor - goto EventScript_NeedCardKey - end + goto_if_set FLAG_HIDE_SILPH_CO_5F_CARD_KEY, EventScript_OpenDoor + goto EventScript_NeedCardKey + end EventScript_OpenDoor:: - playfanfare MUS_LEVEL_UP - msgbox Text_CardKeyOpenedDoor - waitfanfare - compare VAR_TEMP_1, 1 - call_if_eq EventScript_Open2FDoor1 - compare VAR_TEMP_1, 2 - call_if_eq EventScript_Open2FDoor2 - compare VAR_TEMP_1, 3 - call_if_eq EventScript_Open3FDoor1 - compare VAR_TEMP_1, 4 - call_if_eq EventScript_Open3FDoor2 - compare VAR_TEMP_1, 5 - call_if_eq EventScript_Open4FDoor1 - compare VAR_TEMP_1, 6 - call_if_eq EventScript_Open4FDoor2 - compare VAR_TEMP_1, 7 - call_if_eq EventScript_Open5FDoor1 - compare VAR_TEMP_1, 8 - call_if_eq EventScript_Open5FDoor2 - compare VAR_TEMP_1, 9 - call_if_eq EventScript_Open5FDoor3 - compare VAR_TEMP_1, 10 - call_if_eq EventScript_Open6FDoor - compare VAR_TEMP_1, 11 - call_if_eq EventScript_Open7FDoor1 - compare VAR_TEMP_1, 12 - call_if_eq EventScript_Open7FDoor2 - compare VAR_TEMP_1, 13 - call_if_eq EventScript_Open7FDoor3 - compare VAR_TEMP_1, 14 - call_if_eq EventScript_Open8FDoor - compare VAR_TEMP_1, 15 - call_if_eq EventScript_Open9FDoor1 - compare VAR_TEMP_1, 16 - call_if_eq EventScript_Open9FDoor2 - compare VAR_TEMP_1, 17 - call_if_eq EventScript_Open9FDoor3 - compare VAR_TEMP_1, 18 - call_if_eq EventScript_Open9FDoor4 - compare VAR_TEMP_1, 19 - call_if_eq EventScript_Open10FDoor - compare VAR_TEMP_1, 20 - call_if_eq EventScript_Open11FDoor - waitse - playse SE_UNLOCK - special DrawWholeMapView - waitse - special SetHiddenItemFlag - releaseall - end + playfanfare MUS_LEVEL_UP + msgbox Text_CardKeyOpenedDoor + waitfanfare + call_if_eq VAR_TEMP_1, 1, EventScript_Open2FDoor1 + call_if_eq VAR_TEMP_1, 2, EventScript_Open2FDoor2 + call_if_eq VAR_TEMP_1, 3, EventScript_Open3FDoor1 + call_if_eq VAR_TEMP_1, 4, EventScript_Open3FDoor2 + call_if_eq VAR_TEMP_1, 5, EventScript_Open4FDoor1 + call_if_eq VAR_TEMP_1, 6, EventScript_Open4FDoor2 + call_if_eq VAR_TEMP_1, 7, EventScript_Open5FDoor1 + call_if_eq VAR_TEMP_1, 8, EventScript_Open5FDoor2 + call_if_eq VAR_TEMP_1, 9, EventScript_Open5FDoor3 + call_if_eq VAR_TEMP_1, 10, EventScript_Open6FDoor + call_if_eq VAR_TEMP_1, 11, EventScript_Open7FDoor1 + call_if_eq VAR_TEMP_1, 12, EventScript_Open7FDoor2 + call_if_eq VAR_TEMP_1, 13, EventScript_Open7FDoor3 + call_if_eq VAR_TEMP_1, 14, EventScript_Open8FDoor + call_if_eq VAR_TEMP_1, 15, EventScript_Open9FDoor1 + call_if_eq VAR_TEMP_1, 16, EventScript_Open9FDoor2 + call_if_eq VAR_TEMP_1, 17, EventScript_Open9FDoor3 + call_if_eq VAR_TEMP_1, 18, EventScript_Open9FDoor4 + call_if_eq VAR_TEMP_1, 19, EventScript_Open10FDoor + call_if_eq VAR_TEMP_1, 20, EventScript_Open11FDoor + waitse + playse SE_UNLOCK + special DrawWholeMapView + waitse + special SetHiddenItemFlag + releaseall + end 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/std_msgbox.inc b/data/scripts/std_msgbox.inc index e7feabfa6..18ad553c8 100644 --- a/data/scripts/std_msgbox.inc +++ b/data/scripts/std_msgbox.inc @@ -28,16 +28,13 @@ Std_MsgboxYesNo:: return Std_ReceivedItem:: - textcolor 3 - compare VAR_0x8002, MUS_LEVEL_UP - call_if_eq EventScript_ReceivedItemFanfare1 - compare VAR_0x8002, MUS_OBTAIN_KEY_ITEM - call_if_eq EventScript_ReceivedItemFanfare2 + textcolor NPC_TEXT_COLOR_NEUTRAL + call_if_eq VAR_0x8002, MUS_LEVEL_UP, EventScript_ReceivedItemFanfare1 + call_if_eq VAR_0x8002, MUS_OBTAIN_KEY_ITEM, EventScript_ReceivedItemFanfare2 message 0x0 waitmessage waitfanfare - compare VAR_0x8002, MUS_LEVEL_UP - call_if_eq EventScript_ReceivedItemWaitFanfare + call_if_eq VAR_0x8002, MUS_LEVEL_UP, EventScript_ReceivedItemWaitFanfare putitemaway VAR_0x8000, VAR_0x8001 call EventScript_RestorePrevTextColor return diff --git a/data/scripts/surf.inc b/data/scripts/surf.inc index 13d46e028..e7bf85ec7 100644 --- a/data/scripts/surf.inc +++ b/data/scripts/surf.inc @@ -1,14 +1,12 @@ EventScript_UseSurf:: goto_if_questlog EventScript_UseSurfEnd checkpartymove MOVE_SURF - compare VAR_RESULT, PARTY_SIZE - goto_if_eq EventScript_UseSurfEnd - getpartymonname 0, VAR_RESULT - setfieldeffectarg 0, VAR_RESULT + goto_if_eq VAR_RESULT, PARTY_SIZE, EventScript_UseSurfEnd + bufferpartymonnick STR_VAR_1, VAR_RESULT + setfieldeffectargument 0, VAR_RESULT lockall msgbox Text_WantToSurf, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq EventScript_UseSurfRelease + goto_if_eq VAR_RESULT, NO, EventScript_UseSurfRelease msgbox Text_UsedSurf dofieldeffect FLDEFF_USE_SURF EventScript_UseSurfRelease: diff --git a/data/scripts/trainer_battle.inc b/data/scripts/trainer_battle.inc index 657b56b96..c3e437196 100644 --- a/data/scripts/trainer_battle.inc +++ b/data/scripts/trainer_battle.inc @@ -11,25 +11,22 @@ EventScript_TryDoNormalTrainerBattle:: applymovement VAR_LAST_TALKED, Movement_RevealTrainer waitmovement 0 specialvar VAR_RESULT, Script_HasTrainerBeenFought - compare VAR_RESULT, FALSE - goto_if_ne EventScript_NoTrainerBattle + goto_if_ne VAR_RESULT, FALSE, EventScript_NoTrainerBattle special PlayTrainerEncounterMusic special SetUpTrainerMovement goto EventScript_DoTrainerBattle EventScript_NoTrainerBattle:: - ontrainerbattleend + gotopostbattlescript EventScript_TryDoDoubleTrainerBattle:: lock faceplayer call EventScript_RevealTrainer specialvar VAR_RESULT, Script_HasTrainerBeenFought - compare VAR_RESULT, FALSE - goto_if_ne EventScript_NoDoubleTrainerBattle + goto_if_ne VAR_RESULT, FALSE, EventScript_NoDoubleTrainerBattle special HasEnoughMonsForDoubleBattle - compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS - goto_if_ne EventScript_NotEnoughMonsForDoubleBattle + goto_if_ne VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS, EventScript_NotEnoughMonsForDoubleBattle special PlayTrainerEncounterMusic special SetUpTrainerMovement goto EventScript_DoTrainerBattle @@ -42,21 +39,20 @@ 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 specialvar VAR_RESULT, IsTrainerReadyForRematch - compare VAR_RESULT, FALSE - goto_if_eq EventScript_NoRematchBattle + goto_if_eq VAR_RESULT, FALSE, EventScript_NoRematchBattle special PlayTrainerEncounterMusic special SetUpTrainerMovement special ShowTrainerIntroSpeech @@ -69,15 +65,13 @@ EventScript_TryDoRematchBattle:: end EventScript_NoRematchBattle:: - ontrainerbattleend + gotopostbattlescript EventScript_TryDoDoubleRematchBattle:: specialvar VAR_RESULT, IsTrainerReadyForRematch - compare VAR_RESULT, FALSE - goto_if_eq EventScript_NoDoubleRematchBattle + goto_if_eq VAR_RESULT, FALSE, EventScript_NoDoubleRematchBattle special HasEnoughMonsForDoubleBattle - compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS - goto_if_ne EventScript_NotEnoughMonsForDoubleRematchBattle + goto_if_ne VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS, EventScript_NotEnoughMonsForDoubleRematchBattle special PlayTrainerEncounterMusic special SetUpTrainerMovement special ShowTrainerIntroSpeech @@ -90,7 +84,7 @@ EventScript_TryDoDoubleRematchBattle:: end EventScript_NoDoubleRematchBattle:: - ontrainerbattleend + gotopostbattlescript EventScript_NotEnoughMonsForDoubleRematchBattle:: special ShowTrainerCantBattleSpeech @@ -117,24 +111,19 @@ 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 - compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT - goto_if_eq EventScript_EndTrainerBattleContinueScript - compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC - goto_if_eq EventScript_EndTrainerBattleContinueScript - compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE - goto_if_eq EventScript_EndTrainerBattleContinueScript - compare VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC - goto_if_eq EventScript_EndTrainerBattleContinueScript + goto_if_eq VAR_RESULT, TRAINER_BATTLE_SINGLE, EventScript_EndTrainerBattle + goto_if_eq VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT, EventScript_EndTrainerBattleContinueScript + goto_if_eq VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC, EventScript_EndTrainerBattleContinueScript + goto_if_eq VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE, EventScript_EndTrainerBattleContinueScript + goto_if_eq VAR_RESULT, TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC, EventScript_EndTrainerBattleContinueScript EventScript_EndTrainerBattle:: releaseall 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..09a4c38f5 100644 --- a/data/scripts/trainer_card.inc +++ b/data/scripts/trainer_card.inc @@ -2,16 +2,14 @@ CeladonCity_GameCorner_EventScript_PhotoPrinter:: lockall - showmoneybox 0, 0, 0 + showmoneybox 0, 0 msgbox CeladonCity_GameCorner_Text_TryPokemonPrinter, MSGBOX_YESNO - compare VAR_RESULT, NO - goto_if_eq CeladonCity_GameCorner_EventScript_DeclinePhoto - checkmoney 50, 0 - compare VAR_RESULT, FALSE - goto_if_eq CeladonCity_GameCorner_EventScript_NotEnoughMoneyForPhoto + goto_if_eq VAR_RESULT, NO, CeladonCity_GameCorner_EventScript_DeclinePhoto + checkmoney 50 + goto_if_eq VAR_RESULT, FALSE, CeladonCity_GameCorner_EventScript_NotEnoughMoneyForPhoto playse SE_SHOP - removemoney 50, 0 - updatemoneybox 0, 0, 0 + removemoney 50 + updatemoneybox waitse message CeladonCity_GameCorner_Text_ChoosePrintType waitmessage @@ -51,18 +49,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 @@ -83,8 +81,7 @@ FourIsland_House2_EventScript_MeetStickerMan:: waitmovement 0 applymovement LOCALID_STICKER_MAN, Movement_Delay48 waitmovement 0 - compare VAR_0x8008, 0 - goto_if_eq FourIsland_House2_EventScript_StickerManNothingToBrag + goto_if_eq VAR_0x8008, 0, FourIsland_House2_EventScript_StickerManNothingToBrag message FourIsland_House2_Text_GiveYouStickerIfYouBrag waitmessage goto FourIsland_House2_EventScript_ChooseBrag @@ -95,8 +92,7 @@ FourIsland_House2_EventScript_StickerManAskForBrag:: waitmovement 0 goto_if_questlog EventScript_ReleaseEnd special QuestLog_CutRecording - compare VAR_0x8008, 0 - goto_if_eq FourIsland_House2_EventScript_NothingToBragAbout + goto_if_eq VAR_0x8008, 0, FourIsland_House2_EventScript_NothingToBragAbout message FourIsland_House2_Text_BragAboutWhatToday waitmessage goto FourIsland_House2_EventScript_ChooseBrag @@ -185,43 +181,35 @@ FourIsland_House2_EventScript_StickerManNothingToBrag:: end FourIsland_House2_EventScript_BragHoF:: - compare VAR_0x8004, 39 - goto_if_le FourIsland_House2_EventScript_BragHoFLowest - compare VAR_0x8004, 99 - goto_if_le FourIsland_House2_EventScript_BragHoFLow - compare VAR_0x8004, 199 - goto_if_le FourIsland_House2_EventScript_BragHoFHigh - compare VAR_0x8004, 200 - goto_if_ge FourIsland_House2_EventScript_BragHoFHighest + goto_if_le VAR_0x8004, 39, FourIsland_House2_EventScript_BragHoFLowest + goto_if_le VAR_0x8004, 99, FourIsland_House2_EventScript_BragHoFLow + goto_if_le VAR_0x8004, 199, FourIsland_House2_EventScript_BragHoFHigh + goto_if_ge VAR_0x8004, 200, FourIsland_House2_EventScript_BragHoFHighest end FourIsland_House2_EventScript_BragHoFLowest:: - compare VAR_HOF_BRAG_STATE, 1 - goto_if_eq FourIsland_House2_EventScript_AlreadyBraggedHoF + goto_if_eq VAR_HOF_BRAG_STATE, 1, FourIsland_House2_EventScript_AlreadyBraggedHoF setvar VAR_HOF_BRAG_STATE, 1 msgbox FourIsland_House2_Text_WowHoFLowest goto FourIsland_House2_EventScript_BraggedHoF end FourIsland_House2_EventScript_BragHoFLow:: - compare VAR_HOF_BRAG_STATE, 2 - goto_if_eq FourIsland_House2_EventScript_AlreadyBraggedHoF + goto_if_eq VAR_HOF_BRAG_STATE, 2, FourIsland_House2_EventScript_AlreadyBraggedHoF setvar VAR_HOF_BRAG_STATE, 2 msgbox FourIsland_House2_Text_WowHoFLow goto FourIsland_House2_EventScript_BraggedHoF end FourIsland_House2_EventScript_BragHoFHigh:: - compare VAR_HOF_BRAG_STATE, 3 - goto_if_eq FourIsland_House2_EventScript_AlreadyBraggedHoF + goto_if_eq VAR_HOF_BRAG_STATE, 3, FourIsland_House2_EventScript_AlreadyBraggedHoF setvar VAR_HOF_BRAG_STATE, 3 msgbox FourIsland_House2_Text_WowHoFHigh goto FourIsland_House2_EventScript_BraggedHoF end FourIsland_House2_EventScript_BragHoFHighest:: - compare VAR_HOF_BRAG_STATE, 4 - goto_if_eq FourIsland_House2_EventScript_AlreadyBraggedHoFMax + goto_if_eq VAR_HOF_BRAG_STATE, 4, FourIsland_House2_EventScript_AlreadyBraggedHoFMax setvar VAR_HOF_BRAG_STATE, 4 msgbox FourIsland_House2_Text_WowHoFHighest goto FourIsland_House2_EventScript_BraggedHoF @@ -238,7 +226,7 @@ FourIsland_House2_EventScript_AlreadyBraggedHoFMax:: end FourIsland_House2_EventScript_BraggedHoF:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_LEVEL_UP message FourIsland_House2_Text_HoFStickerApplied waitmessage @@ -248,43 +236,35 @@ FourIsland_House2_EventScript_BraggedHoF:: end FourIsland_House2_EventScript_BragEggs:: - compare VAR_0x8005, 99 - goto_if_le FourIsland_House2_EventScript_BragEggsLowest - compare VAR_0x8005, 199 - goto_if_le FourIsland_House2_EventScript_BragEggsLow - compare VAR_0x8005, 299 - goto_if_le FourIsland_House2_EventScript_BragEggsHigh - compare VAR_0x8005, 300 - goto_if_ge FourIsland_House2_EventScript_BragEggsHighest + goto_if_le VAR_0x8005, 99, FourIsland_House2_EventScript_BragEggsLowest + goto_if_le VAR_0x8005, 199, FourIsland_House2_EventScript_BragEggsLow + goto_if_le VAR_0x8005, 299, FourIsland_House2_EventScript_BragEggsHigh + goto_if_ge VAR_0x8005, 300, FourIsland_House2_EventScript_BragEggsHighest end FourIsland_House2_EventScript_BragEggsLowest:: - compare VAR_EGG_BRAG_STATE, 1 - goto_if_eq FourIsland_House2_EventScript_AlreadyBraggedEggs + goto_if_eq VAR_EGG_BRAG_STATE, 1, FourIsland_House2_EventScript_AlreadyBraggedEggs setvar VAR_EGG_BRAG_STATE, 1 msgbox FourIsland_House2_Text_WowEggsLowest goto FourIsland_House2_EventScript_BraggedEggs end FourIsland_House2_EventScript_BragEggsLow:: - compare VAR_EGG_BRAG_STATE, 2 - goto_if_eq FourIsland_House2_EventScript_AlreadyBraggedEggs + goto_if_eq VAR_EGG_BRAG_STATE, 2, FourIsland_House2_EventScript_AlreadyBraggedEggs setvar VAR_EGG_BRAG_STATE, 2 msgbox FourIsland_House2_Text_WowEggsLow goto FourIsland_House2_EventScript_BraggedEggs end FourIsland_House2_EventScript_BragEggsHigh:: - compare VAR_EGG_BRAG_STATE, 3 - goto_if_eq FourIsland_House2_EventScript_AlreadyBraggedEggs + goto_if_eq VAR_EGG_BRAG_STATE, 3, FourIsland_House2_EventScript_AlreadyBraggedEggs setvar VAR_EGG_BRAG_STATE, 3 msgbox FourIsland_House2_Text_WowEggsHigh goto FourIsland_House2_EventScript_BraggedEggs end FourIsland_House2_EventScript_BragEggsHighest:: - compare VAR_EGG_BRAG_STATE, 4 - goto_if_eq FourIsland_House2_EventScript_AlreadyBraggedEggsMax + goto_if_eq VAR_EGG_BRAG_STATE, 4, FourIsland_House2_EventScript_AlreadyBraggedEggsMax setvar VAR_EGG_BRAG_STATE, 4 msgbox FourIsland_House2_Text_WowEggsHighest goto FourIsland_House2_EventScript_BraggedEggs @@ -301,7 +281,7 @@ FourIsland_House2_EventScript_AlreadyBraggedEggsMax:: end FourIsland_House2_EventScript_BraggedEggs:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_LEVEL_UP message FourIsland_House2_Text_EggStickerApplied waitmessage @@ -311,43 +291,35 @@ FourIsland_House2_EventScript_BraggedEggs:: end FourIsland_House2_EventScript_BragLinkWins:: - compare VAR_0x8006, 19 - goto_if_le FourIsland_House2_EventScript_BragLinkWinsLowest - compare VAR_0x8006, 49 - goto_if_le FourIsland_House2_EventScript_BragLinkWinsLow - compare VAR_0x8006, 99 - goto_if_le FourIsland_House2_EventScript_BragLinkWinsHigh - compare VAR_0x8006, 100 - goto_if_ge FourIsland_House2_EventScript_BragLinkWinsHighest + goto_if_le VAR_0x8006, 19, FourIsland_House2_EventScript_BragLinkWinsLowest + goto_if_le VAR_0x8006, 49, FourIsland_House2_EventScript_BragLinkWinsLow + goto_if_le VAR_0x8006, 99, FourIsland_House2_EventScript_BragLinkWinsHigh + goto_if_ge VAR_0x8006, 100, FourIsland_House2_EventScript_BragLinkWinsHighest end FourIsland_House2_EventScript_BragLinkWinsLowest:: - compare VAR_LINK_WIN_BRAG_STATE, 1 - goto_if_eq FourIsland_House2_EventScript_AlreadyBraggedLinkWins + goto_if_eq VAR_LINK_WIN_BRAG_STATE, 1, FourIsland_House2_EventScript_AlreadyBraggedLinkWins setvar VAR_LINK_WIN_BRAG_STATE, 1 msgbox FourIsland_House2_Text_WowLinkWinsLowest goto FourIsland_House2_EventScript_BraggedLinkWins end FourIsland_House2_EventScript_BragLinkWinsLow:: - compare VAR_LINK_WIN_BRAG_STATE, 2 - goto_if_eq FourIsland_House2_EventScript_AlreadyBraggedLinkWins + goto_if_eq VAR_LINK_WIN_BRAG_STATE, 2, FourIsland_House2_EventScript_AlreadyBraggedLinkWins setvar VAR_LINK_WIN_BRAG_STATE, 2 msgbox FourIsland_House2_Text_WowLinkWinsLow goto FourIsland_House2_EventScript_BraggedLinkWins end FourIsland_House2_EventScript_BragLinkWinsHigh:: - compare VAR_LINK_WIN_BRAG_STATE, 3 - goto_if_eq FourIsland_House2_EventScript_AlreadyBraggedLinkWins + goto_if_eq VAR_LINK_WIN_BRAG_STATE, 3, FourIsland_House2_EventScript_AlreadyBraggedLinkWins setvar VAR_LINK_WIN_BRAG_STATE, 3 msgbox FourIsland_House2_Text_WowLinkWinsHigh goto FourIsland_House2_EventScript_BraggedLinkWins end FourIsland_House2_EventScript_BragLinkWinsHighest:: - compare VAR_LINK_WIN_BRAG_STATE, 4 - goto_if_eq FourIsland_House2_EventScript_AlreadyBraggedLinkWinsMax + goto_if_eq VAR_LINK_WIN_BRAG_STATE, 4, FourIsland_House2_EventScript_AlreadyBraggedLinkWinsMax setvar VAR_LINK_WIN_BRAG_STATE, 4 msgbox FourIsland_House2_Text_WowLinkWinsHighest goto FourIsland_House2_EventScript_BraggedLinkWins @@ -364,7 +336,7 @@ FourIsland_House2_EventScript_AlreadyBraggedLinkWinsMax:: end FourIsland_House2_EventScript_BraggedLinkWins:: - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_LEVEL_UP message FourIsland_House2_Text_VictoryStickerApplied waitmessage diff --git a/data/scripts/trainer_tower.inc b/data/scripts/trainer_tower.inc index 70a15b3ec..fe239dd1d 100644 --- a/data/scripts/trainer_tower.inc +++ b/data/scripts/trainer_tower.inc @@ -49,8 +49,7 @@ TrainerTower_EventScript_SetObjectsDoubles:: setflag HIDE_TRAINER_KNOCKOUT setvar DISABLE_SINGLES_TRIGGER, TRUE ttower_isfloorcleared - compare VAR_RESULT, TRUE - goto_if_eq TrainerTower_EventScript_SetObjectsDoublesAlreadyBeaten + goto_if_eq VAR_RESULT, TRUE, TrainerTower_EventScript_SetObjectsDoublesAlreadyBeaten setobjectxyperm LOCALID_TRAINER_DOUBLES1, 10, 12 setobjectmovementtype LOCALID_TRAINER_DOUBLES1, MOVEMENT_TYPE_FACE_LEFT setobjectxyperm LOCALID_TRAINER_DOUBLES2, 10, 13 @@ -85,19 +84,17 @@ TrainerTower_OnFrame:: TrainerTower_EventScript_EnterFloor:: setvar VAR_TEMP_2, 1 ttower_isfloorcleared - compare VAR_RESULT, FALSE - goto_if_eq TrainerTower_EventScript_EndEnterFloor + goto_if_eq VAR_RESULT, FALSE, TrainerTower_EventScript_EndEnterFloor setvar DISABLE_SINGLES_TRIGGER, TRUE setvar DISABLE_DOUBLES_TRIGGER, TRUE TrainerTower_EventScript_EndEnterFloor: ttower_shouldexit - compare VAR_RESULT, TRUE - goto_if_eq TrainerTower_EventScript_WarpToLobby + goto_if_eq VAR_RESULT, TRUE, TrainerTower_EventScript_WarpToLobby end @ Never reached TrainerTower_EventScript_WarpToLobby:: - warp MAP_TRAINER_TOWER_LOBBY, 255, 9, 7 + warp MAP_TRAINER_TOWER_LOBBY, 9, 7 waitstate @@ -130,8 +127,7 @@ TrainerTower_EventScript_DoDoubleBattle:: setvar VAR_0x8004, TRAINER_TOWER_FUNC_GET_SPEECH setvar VAR_0x8005, TRAINER_TOWER_TEXT_INTRO addvar VAR_TEMP_3, 1 - compare VAR_TEMP_3, 1 - goto_if_eq TrainerTower_EventScript_DoSecondTrainerIntro + goto_if_eq VAR_TEMP_3, 1, TrainerTower_EventScript_DoSecondTrainerIntro setvar VAR_TEMP_3, 0 TrainerTower_EventScript_DoSecondTrainerIntro: copyvar VAR_0x8006, VAR_TEMP_3 @@ -221,7 +217,7 @@ TrainerTower_EventScript_SetFloorCleared: TrainerTower_EventScript_WarpToLobbyLost:: special HealPlayerParty ttower_setlost - warp MAP_TRAINER_TOWER_LOBBY, 255, 9, 7 + warp MAP_TRAINER_TOWER_LOBBY, 9, 7 waitstate @@ -292,12 +288,12 @@ TrainerTower_Roof_EventScript_GivePrize: TrainerTower_Roof_EventScript_ReceivePrize: msgbox TrainerTower_Roof_Text_ThisIsForYou - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL playfanfare MUS_LEVEL_UP 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 @@ -341,8 +337,7 @@ TrainerTower_EventScript_SingleBattleTrigger:: TrainerTower_EventScript_DoubleBattleTriggerTop:: setvar VAR_TEMP_3, 0 ttower_checkdoubles - compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS - goto_if_ne TrainerTower_EventScript_IneligibleForDoubleBattle + goto_if_ne VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS, TrainerTower_EventScript_IneligibleForDoubleBattle ttower_encountermusic applymovement LOCALID_TRAINER_DOUBLES1, Movement_ExclamationMark waitmovement 0 @@ -352,8 +347,7 @@ TrainerTower_EventScript_DoubleBattleTriggerTop:: TrainerTower_EventScript_DoubleBattleTriggerBottom:: setvar VAR_TEMP_3, 1 ttower_checkdoubles - compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS - goto_if_ne TrainerTower_EventScript_IneligibleForDoubleBattle + goto_if_ne VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS, TrainerTower_EventScript_IneligibleForDoubleBattle ttower_encountermusic applymovement LOCALID_TRAINER_DOUBLES2, Movement_ExclamationMark waitmovement 0 diff --git a/data/scripts/trainers.inc b/data/scripts/trainers.inc index c6c66c751..5ec6ef8f4 100644 --- a/data/scripts/trainers.inc +++ b/data/scripts/trainers.inc @@ -1,8 +1,7 @@ Route3_EventScript_Ben:: trainerbattle_single TRAINER_YOUNGSTER_BEN, Route3_Text_BenIntro, Route3_Text_BenDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route3_EventScript_BenRematch + goto_if_eq VAR_RESULT, TRUE, Route3_EventScript_BenRematch msgbox Route3_Text_BenPostBattle, MSGBOX_AUTOCLOSE end @@ -14,8 +13,7 @@ Route3_EventScript_BenRematch:: Route3_EventScript_Calvin:: trainerbattle_single TRAINER_YOUNGSTER_CALVIN, Route3_Text_CalvinIntro, Route3_Text_CalvinDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route3_EventScript_CalvinRematch + goto_if_eq VAR_RESULT, TRUE, Route3_EventScript_CalvinRematch msgbox Route3_Text_CalvinPostBattle, MSGBOX_AUTOCLOSE end @@ -27,8 +25,7 @@ Route3_EventScript_CalvinRematch:: Route3_EventScript_Colton:: trainerbattle_single TRAINER_BUG_CATCHER_COLTON, Route3_Text_ColtonIntro, Route3_Text_ColtonDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route3_EventScript_ColtonRematch + goto_if_eq VAR_RESULT, TRUE, Route3_EventScript_ColtonRematch msgbox Route3_Text_ColtonPostBattle, MSGBOX_AUTOCLOSE end @@ -40,8 +37,7 @@ Route3_EventScript_ColtonRematch:: Route3_EventScript_Greg:: trainerbattle_single TRAINER_BUG_CATCHER_GREG, Route3_Text_GregIntro, Route3_Text_GregDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route3_EventScript_GregRematch + goto_if_eq VAR_RESULT, TRUE, Route3_EventScript_GregRematch msgbox Route3_Text_GregPostBattle, MSGBOX_AUTOCLOSE end @@ -53,8 +49,7 @@ Route3_EventScript_GregRematch:: Route3_EventScript_James:: trainerbattle_single TRAINER_BUG_CATCHER_JAMES, Route3_Text_JamesIntro, Route3_Text_JamesDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route3_EventScript_JamesRematch + goto_if_eq VAR_RESULT, TRUE, Route3_EventScript_JamesRematch msgbox Route3_Text_JamesPostBattle, MSGBOX_AUTOCLOSE end @@ -66,8 +61,7 @@ Route3_EventScript_JamesRematch:: Route3_EventScript_Janice:: trainerbattle_single TRAINER_LASS_JANICE, Route3_Text_JaniceIntro, Route3_Text_JaniceDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route3_EventScript_JaniceRematch + goto_if_eq VAR_RESULT, TRUE, Route3_EventScript_JaniceRematch msgbox Route3_Text_JanicePostBattle, MSGBOX_AUTOCLOSE end @@ -79,8 +73,7 @@ Route3_EventScript_JaniceRematch:: Route3_EventScript_Sally:: trainerbattle_single TRAINER_LASS_SALLY, Route3_Text_SallyIntro, Route3_Text_SallyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route3_EventScript_SallyRematch + goto_if_eq VAR_RESULT, TRUE, Route3_EventScript_SallyRematch msgbox Route3_Text_SallyPostBattle, MSGBOX_AUTOCLOSE end @@ -92,8 +85,7 @@ Route3_EventScript_SallyRematch:: Route3_EventScript_Robin:: trainerbattle_single TRAINER_LASS_ROBIN, Route3_Text_RobinIntro, Route3_Text_RobinDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route3_EventScript_RobinRematch + goto_if_eq VAR_RESULT, TRUE, Route3_EventScript_RobinRematch msgbox Route3_Text_RobinPostBattle, MSGBOX_AUTOCLOSE end @@ -105,8 +97,7 @@ Route3_EventScript_RobinRematch:: Route4_EventScript_Crissy:: trainerbattle_single TRAINER_LASS_CRISSY, Route4_Text_CrissyIntro, Route4_Text_CrissyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route4_EventScript_CrissyRematch + goto_if_eq VAR_RESULT, TRUE, Route4_EventScript_CrissyRematch msgbox Route4_Text_CrissyPostBattle, MSGBOX_AUTOCLOSE end @@ -118,8 +109,7 @@ Route4_EventScript_CrissyRematch:: Route24_EventScript_Timmy:: trainerbattle_single TRAINER_YOUNGSTER_TIMMY, Route24_Text_TimmyIntro, Route24_Text_TimmyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route24_EventScript_TimmyRematch + goto_if_eq VAR_RESULT, TRUE, Route24_EventScript_TimmyRematch msgbox Route24_Text_TimmyPostBattle, MSGBOX_AUTOCLOSE end @@ -131,8 +121,7 @@ Route24_EventScript_TimmyRematch:: Route24_EventScript_Cale:: trainerbattle_single TRAINER_BUG_CATCHER_CALE, Route24_Text_CaleIntro, Route24_Text_CaleDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route24_EventScript_CaleRematch + goto_if_eq VAR_RESULT, TRUE, Route24_EventScript_CaleRematch msgbox Route24_Text_CalePostBattle, MSGBOX_AUTOCLOSE end @@ -144,8 +133,7 @@ Route24_EventScript_CaleRematch:: Route24_EventScript_Reli:: trainerbattle_single TRAINER_LASS_RELI, Route24_Text_ReliIntro, Route24_Text_ReliDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route24_EventScript_ReliRematch + goto_if_eq VAR_RESULT, TRUE, Route24_EventScript_ReliRematch msgbox Route24_Text_ReliPostBattle, MSGBOX_AUTOCLOSE end @@ -157,8 +145,7 @@ Route24_EventScript_ReliRematch:: Route24_EventScript_Ali:: trainerbattle_single TRAINER_LASS_ALI, Route24_Text_AliIntro, Route24_Text_AliDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route24_EventScript_AliRematch + goto_if_eq VAR_RESULT, TRUE, Route24_EventScript_AliRematch msgbox Route24_Text_AliPostBattle, MSGBOX_AUTOCLOSE end @@ -170,8 +157,7 @@ Route24_EventScript_AliRematch:: Route24_EventScript_Shane:: trainerbattle_single TRAINER_CAMPER_SHANE, Route24_Text_ShaneIntro, Route24_Text_ShaneDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route24_EventScript_ShaneRematch + goto_if_eq VAR_RESULT, TRUE, Route24_EventScript_ShaneRematch msgbox Route24_Text_ShanePostBattle, MSGBOX_AUTOCLOSE end @@ -183,8 +169,7 @@ Route24_EventScript_ShaneRematch:: Route24_EventScript_Ethan:: trainerbattle_single TRAINER_CAMPER_ETHAN, Route24_Text_EthanIntro, Route24_Text_EthanDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route24_EventScript_EthanRematch + goto_if_eq VAR_RESULT, TRUE, Route24_EventScript_EthanRematch msgbox Route24_Text_EthanPostBattle, MSGBOX_AUTOCLOSE end @@ -196,8 +181,7 @@ Route24_EventScript_EthanRematch:: Route25_EventScript_Joey:: trainerbattle_single TRAINER_YOUNGSTER_JOEY, Route25_Text_JoeyIntro, Route25_Text_JoeyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route25_EventScript_JoeyRematch + goto_if_eq VAR_RESULT, TRUE, Route25_EventScript_JoeyRematch msgbox Route25_Text_JoeyPostBattle, MSGBOX_AUTOCLOSE end @@ -209,8 +193,7 @@ Route25_EventScript_JoeyRematch:: Route25_EventScript_Dan:: trainerbattle_single TRAINER_YOUNGSTER_DAN, Route25_Text_DanIntro, Route25_Text_DanDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route25_EventScript_DanRematch + goto_if_eq VAR_RESULT, TRUE, Route25_EventScript_DanRematch msgbox Route25_Text_DanPostBattle, MSGBOX_AUTOCLOSE end @@ -222,8 +205,7 @@ Route25_EventScript_DanRematch:: Route25_EventScript_Chad:: trainerbattle_single TRAINER_YOUNGSTER_CHAD, Route25_Text_ChadIntro, Route25_Text_ChadDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route25_EventScript_ChadRematch + goto_if_eq VAR_RESULT, TRUE, Route25_EventScript_ChadRematch msgbox Route25_Text_ChadPostBattle, MSGBOX_AUTOCLOSE end @@ -235,8 +217,7 @@ Route25_EventScript_ChadRematch:: Route25_EventScript_Kelsey:: trainerbattle_single TRAINER_PICNICKER_KELSEY, Route25_Text_KelseyIntro, Route25_Text_KelseyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route25_EventScript_KelseyRematch + goto_if_eq VAR_RESULT, TRUE, Route25_EventScript_KelseyRematch msgbox Route25_Text_KelseyPostBattle, MSGBOX_AUTOCLOSE end @@ -248,8 +229,7 @@ Route25_EventScript_KelseyRematch:: Route25_EventScript_Haley:: trainerbattle_single TRAINER_LASS_HALEY, Route25_Text_HaleyIntro, Route25_Text_HaleyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route25_EventScript_HaleyRematch + goto_if_eq VAR_RESULT, TRUE, Route25_EventScript_HaleyRematch msgbox Route25_Text_HaleyPostBattle, MSGBOX_AUTOCLOSE end @@ -261,8 +241,7 @@ Route25_EventScript_HaleyRematch:: Route25_EventScript_Franklin:: trainerbattle_single TRAINER_HIKER_FRANKLIN, Route25_Text_FranklinIntro, Route25_Text_FranklinDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route25_EventScript_FranklinRematch + goto_if_eq VAR_RESULT, TRUE, Route25_EventScript_FranklinRematch msgbox Route25_Text_FranklinPostBattle, MSGBOX_AUTOCLOSE end @@ -274,8 +253,7 @@ Route25_EventScript_FranklinRematch:: Route25_EventScript_Nob:: trainerbattle_single TRAINER_HIKER_NOB, Route25_Text_NobIntro, Route25_Text_NobDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route25_EventScript_NobRematch + goto_if_eq VAR_RESULT, TRUE, Route25_EventScript_NobRematch msgbox Route25_Text_NobPostBattle, MSGBOX_AUTOCLOSE end @@ -287,8 +265,7 @@ Route25_EventScript_NobRematch:: Route25_EventScript_Wayne:: trainerbattle_single TRAINER_HIKER_WAYNE, Route25_Text_WayneIntro, Route25_Text_WayneDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route25_EventScript_WayneRematch + goto_if_eq VAR_RESULT, TRUE, Route25_EventScript_WayneRematch msgbox Route25_Text_WaynePostBattle, MSGBOX_AUTOCLOSE end @@ -300,8 +277,7 @@ Route25_EventScript_WayneRematch:: Route25_EventScript_Flint:: trainerbattle_single TRAINER_CAMPER_FLINT, Route25_Text_FlintIntro, Route25_Text_FlintDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route25_EventScript_FlintRematch + goto_if_eq VAR_RESULT, TRUE, Route25_EventScript_FlintRematch msgbox Route25_Text_FlintPostBattle, MSGBOX_AUTOCLOSE end @@ -313,8 +289,7 @@ Route25_EventScript_FlintRematch:: Route6_EventScript_Keigo:: trainerbattle_single TRAINER_BUG_CATCHER_KEIGO, Route6_Text_KeigoIntro, Route6_Text_KeigoDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route6_EventScript_KeigoRematch + goto_if_eq VAR_RESULT, TRUE, Route6_EventScript_KeigoRematch msgbox Route6_Text_KeigoPostBattle, MSGBOX_AUTOCLOSE end @@ -326,8 +301,7 @@ Route6_EventScript_KeigoRematch:: Route6_EventScript_Elijah:: trainerbattle_single TRAINER_BUG_CATCHER_ELIJAH, Route6_Text_ElijahIntro, Route6_Text_ElijahDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route6_EventScript_ElijahRematch + goto_if_eq VAR_RESULT, TRUE, Route6_EventScript_ElijahRematch msgbox Route6_Text_ElijahPostBattle, MSGBOX_AUTOCLOSE end @@ -339,8 +313,7 @@ Route6_EventScript_ElijahRematch:: Route6_EventScript_Ricky:: trainerbattle_single TRAINER_CAMPER_RICKY, Route6_Text_RickyIntro, Route6_Text_RickyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route6_EventScript_RickyRematch + goto_if_eq VAR_RESULT, TRUE, Route6_EventScript_RickyRematch msgbox Route6_Text_RickyPostBattle, MSGBOX_AUTOCLOSE end @@ -352,8 +325,7 @@ Route6_EventScript_RickyRematch:: Route6_EventScript_Jeff:: trainerbattle_single TRAINER_CAMPER_JEFF, Route6_Text_JeffIntro, Route6_Text_JeffDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route6_EventScript_JeffRematch + goto_if_eq VAR_RESULT, TRUE, Route6_EventScript_JeffRematch msgbox Route6_Text_JeffPostBattle, MSGBOX_AUTOCLOSE end @@ -365,8 +337,7 @@ Route6_EventScript_JeffRematch:: Route6_EventScript_Nancy:: trainerbattle_single TRAINER_PICNICKER_NANCY, Route6_Text_NancyIntro, Route6_Text_NancyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route6_EventScript_NancyRematch + goto_if_eq VAR_RESULT, TRUE, Route6_EventScript_NancyRematch msgbox Route6_Text_NancyPostBattle, MSGBOX_AUTOCLOSE end @@ -378,8 +349,7 @@ Route6_EventScript_NancyRematch:: Route6_EventScript_Isabelle:: trainerbattle_single TRAINER_PICNICKER_ISABELLE, Route6_Text_IsabelleIntro, Route6_Text_IsabelleDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route6_EventScript_IsabelleRematch + goto_if_eq VAR_RESULT, TRUE, Route6_EventScript_IsabelleRematch msgbox Route6_Text_IsabellePostBattle, MSGBOX_AUTOCLOSE end @@ -391,8 +361,7 @@ Route6_EventScript_IsabelleRematch:: Route11_EventScript_Eddie:: trainerbattle_single TRAINER_YOUNGSTER_EDDIE, Route11_Text_EddieIntro, Route11_Text_EddieDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route11_EventScript_EddieRematch + goto_if_eq VAR_RESULT, TRUE, Route11_EventScript_EddieRematch msgbox Route11_Text_EddiePostBattle, MSGBOX_AUTOCLOSE end @@ -404,8 +373,7 @@ Route11_EventScript_EddieRematch:: Route11_EventScript_Dillon:: trainerbattle_single TRAINER_YOUNGSTER_DILLON, Route11_Text_DillonIntro, Route11_Text_DillonDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route11_EventScript_DillonRematch + goto_if_eq VAR_RESULT, TRUE, Route11_EventScript_DillonRematch msgbox Route11_Text_DillonPostBattle, MSGBOX_AUTOCLOSE end @@ -417,8 +385,7 @@ Route11_EventScript_DillonRematch:: Route11_EventScript_Yasu:: trainerbattle_single TRAINER_YOUNGSTER_YASU, Route11_Text_YasuIntro, Route11_Text_YasuDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route11_EventScript_YasuRematch + goto_if_eq VAR_RESULT, TRUE, Route11_EventScript_YasuRematch msgbox Route11_Text_YasuPostBattle, MSGBOX_AUTOCLOSE end @@ -430,8 +397,7 @@ Route11_EventScript_YasuRematch:: Route11_EventScript_Dave:: trainerbattle_single TRAINER_YOUNGSTER_DAVE, Route11_Text_DaveIntro, Route11_Text_DaveDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route11_EventScript_DaveRematch + goto_if_eq VAR_RESULT, TRUE, Route11_EventScript_DaveRematch msgbox Route11_Text_DavePostBattle, MSGBOX_AUTOCLOSE end @@ -443,8 +409,7 @@ Route11_EventScript_DaveRematch:: Route11_EventScript_Braxton:: trainerbattle_single TRAINER_ENGINEER_BRAXTON, Route11_Text_BraxtonIntro, Route11_Text_BraxtonDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route11_EventScript_BraxtonRematch + goto_if_eq VAR_RESULT, TRUE, Route11_EventScript_BraxtonRematch msgbox Route11_Text_BraxtonPostBattle, MSGBOX_AUTOCLOSE end @@ -456,8 +421,7 @@ Route11_EventScript_BraxtonRematch:: Route11_EventScript_Bernie:: trainerbattle_single TRAINER_ENGINEER_BERNIE, Route11_Text_BernieIntro, Route11_Text_BernieDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route11_EventScript_BernieRematch + goto_if_eq VAR_RESULT, TRUE, Route11_EventScript_BernieRematch msgbox Route11_Text_BerniePostBattle, MSGBOX_AUTOCLOSE end @@ -469,8 +433,7 @@ Route11_EventScript_BernieRematch:: Route11_EventScript_Hugo:: trainerbattle_single TRAINER_GAMER_HUGO, Route11_Text_HugoIntro, Route11_Text_HugoDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route11_EventScript_HugoRematch + goto_if_eq VAR_RESULT, TRUE, Route11_EventScript_HugoRematch msgbox Route11_Text_HugoPostBattle, MSGBOX_AUTOCLOSE end @@ -482,8 +445,7 @@ Route11_EventScript_HugoRematch:: Route11_EventScript_Jasper:: trainerbattle_single TRAINER_GAMER_JASPER, Route11_Text_JasperIntro, Route11_Text_JasperDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route11_EventScript_JasperRematch + goto_if_eq VAR_RESULT, TRUE, Route11_EventScript_JasperRematch msgbox Route11_Text_JasperPostBattle, MSGBOX_AUTOCLOSE end @@ -495,8 +457,7 @@ Route11_EventScript_JasperRematch:: Route11_EventScript_Dirk:: trainerbattle_single TRAINER_GAMER_DIRK, Route11_Text_DirkIntro, Route11_Text_DirkDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route11_EventScript_DirkRematch + goto_if_eq VAR_RESULT, TRUE, Route11_EventScript_DirkRematch msgbox Route11_Text_DirkPostBattle, MSGBOX_AUTOCLOSE end @@ -508,8 +469,7 @@ Route11_EventScript_DirkRematch:: Route11_EventScript_Darian:: trainerbattle_single TRAINER_GAMER_DARIAN, Route11_Text_DarianIntro, Route11_Text_DarianDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route11_EventScript_DarianRematch + goto_if_eq VAR_RESULT, TRUE, Route11_EventScript_DarianRematch msgbox Route11_Text_DarianPostBattle, MSGBOX_AUTOCLOSE end @@ -521,8 +481,7 @@ Route11_EventScript_DarianRematch:: Route9_EventScript_Brent:: trainerbattle_single TRAINER_BUG_CATCHER_BRENT, Route9_Text_BrentIntro, Route9_Text_BrentDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route9_EventScript_BrentRematch + goto_if_eq VAR_RESULT, TRUE, Route9_EventScript_BrentRematch msgbox Route9_Text_BrentPostBattle, MSGBOX_AUTOCLOSE end @@ -534,8 +493,7 @@ Route9_EventScript_BrentRematch:: Route9_EventScript_Conner:: trainerbattle_single TRAINER_BUG_CATCHER_CONNER, Route9_Text_ConnerIntro, Route9_Text_ConnerDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route9_EventScript_ConnerRematch + goto_if_eq VAR_RESULT, TRUE, Route9_EventScript_ConnerRematch msgbox Route9_Text_ConnerPostBattle, MSGBOX_AUTOCLOSE end @@ -547,8 +505,7 @@ Route9_EventScript_ConnerRematch:: Route9_EventScript_Chris:: trainerbattle_single TRAINER_CAMPER_CHRIS, Route9_Text_ChrisIntro, Route9_Text_ChrisDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route9_EventScript_ChrisRematch + goto_if_eq VAR_RESULT, TRUE, Route9_EventScript_ChrisRematch msgbox Route9_Text_ChrisPostBattle, MSGBOX_AUTOCLOSE end @@ -560,8 +517,7 @@ Route9_EventScript_ChrisRematch:: Route9_EventScript_Drew:: trainerbattle_single TRAINER_CAMPER_DREW, Route9_Text_DrewIntro, Route9_Text_DrewDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route9_EventScript_DrewRematch + goto_if_eq VAR_RESULT, TRUE, Route9_EventScript_DrewRematch msgbox Route9_Text_DrewPostBattle, MSGBOX_AUTOCLOSE end @@ -573,8 +529,7 @@ Route9_EventScript_DrewRematch:: Route9_EventScript_Alicia:: trainerbattle_single TRAINER_PICNICKER_ALICIA, Route9_Text_AliciaIntro, Route9_Text_AliciaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route9_EventScript_AliciaRematch + goto_if_eq VAR_RESULT, TRUE, Route9_EventScript_AliciaRematch msgbox Route9_Text_AliciaPostBattle, MSGBOX_AUTOCLOSE end @@ -586,8 +541,7 @@ Route9_EventScript_AliciaRematch:: Route9_EventScript_Caitlin:: trainerbattle_single TRAINER_PICNICKER_CAITLIN, Route9_Text_CaitlinIntro, Route9_Text_CaitlinDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route9_EventScript_CaitlinRematch + goto_if_eq VAR_RESULT, TRUE, Route9_EventScript_CaitlinRematch msgbox Route9_Text_CaitlinPostBattle, MSGBOX_AUTOCLOSE end @@ -599,8 +553,7 @@ Route9_EventScript_CaitlinRematch:: Route9_EventScript_Alan:: trainerbattle_single TRAINER_HIKER_ALAN, Route9_Text_AlanIntro, Route9_Text_AlanDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route9_EventScript_AlanRematch + goto_if_eq VAR_RESULT, TRUE, Route9_EventScript_AlanRematch msgbox Route9_Text_AlanPostBattle, MSGBOX_AUTOCLOSE end @@ -612,8 +565,7 @@ Route9_EventScript_AlanRematch:: Route9_EventScript_Brice:: trainerbattle_single TRAINER_HIKER_BRICE, Route9_Text_BriceIntro, Route9_Text_BriceDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route9_EventScript_BriceRematch + goto_if_eq VAR_RESULT, TRUE, Route9_EventScript_BriceRematch msgbox Route9_Text_BricePostBattle, MSGBOX_AUTOCLOSE end @@ -625,8 +577,7 @@ Route9_EventScript_BriceRematch:: Route9_EventScript_Jeremy:: trainerbattle_single TRAINER_HIKER_JEREMY, Route9_Text_JeremyIntro, Route9_Text_JeremyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route9_EventScript_JeremyRematch + goto_if_eq VAR_RESULT, TRUE, Route9_EventScript_JeremyRematch msgbox Route9_Text_JeremyPostBattle, MSGBOX_AUTOCLOSE end @@ -638,8 +589,7 @@ Route9_EventScript_JeremyRematch:: Route10_EventScript_Heidi:: trainerbattle_single TRAINER_PICNICKER_HEIDI, Route10_Text_HeidiIntro, Route10_Text_HeidiDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route10_EventScript_HeidiRematch + goto_if_eq VAR_RESULT, TRUE, Route10_EventScript_HeidiRematch msgbox Route10_Text_HeidiPostBattle, MSGBOX_AUTOCLOSE end @@ -651,8 +601,7 @@ Route10_EventScript_HeidiRematch:: Route10_EventScript_Carol:: trainerbattle_single TRAINER_PICNICKER_CAROL, Route10_Text_CarolIntro, Route10_Text_CarolDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route10_EventScript_CarolRematch + goto_if_eq VAR_RESULT, TRUE, Route10_EventScript_CarolRematch msgbox Route10_Text_CarolPostBattle, MSGBOX_AUTOCLOSE end @@ -664,8 +613,7 @@ Route10_EventScript_CarolRematch:: Route10_EventScript_Mark:: trainerbattle_single TRAINER_POKEMANIAC_MARK, Route10_Text_MarkIntro, Route10_Text_MarkDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route10_EventScript_MarkRematch + goto_if_eq VAR_RESULT, TRUE, Route10_EventScript_MarkRematch msgbox Route10_Text_MarkPostBattle, MSGBOX_AUTOCLOSE end @@ -677,8 +625,7 @@ Route10_EventScript_MarkRematch:: Route10_EventScript_Herman:: trainerbattle_single TRAINER_POKEMANIAC_HERMAN, Route10_Text_HermanIntro, Route10_Text_HermanDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route10_EventScript_HermanRematch + goto_if_eq VAR_RESULT, TRUE, Route10_EventScript_HermanRematch msgbox Route10_Text_HermanPostBattle, MSGBOX_AUTOCLOSE end @@ -690,8 +637,7 @@ Route10_EventScript_HermanRematch:: Route10_EventScript_Clark:: trainerbattle_single TRAINER_HIKER_CLARK, Route10_Text_ClarkIntro, Route10_Text_ClarkDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route10_EventScript_ClarkRematch + goto_if_eq VAR_RESULT, TRUE, Route10_EventScript_ClarkRematch msgbox Route10_Text_ClarkPostBattle, MSGBOX_AUTOCLOSE end @@ -703,8 +649,7 @@ Route10_EventScript_ClarkRematch:: Route10_EventScript_Trent:: trainerbattle_single TRAINER_HIKER_TRENT, Route10_Text_TrentIntro, Route10_Text_TrentDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route10_EventScript_TrentRematch + goto_if_eq VAR_RESULT, TRUE, Route10_EventScript_TrentRematch msgbox Route10_Text_TrentPostBattle, MSGBOX_AUTOCLOSE end @@ -716,8 +661,7 @@ Route10_EventScript_TrentRematch:: Route8_EventScript_Paige:: trainerbattle_single TRAINER_LASS_PAIGE, Route8_Text_PaigeIntro, Route8_Text_PaigeDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_PaigeRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_PaigeRematch msgbox Route8_Text_PaigePostBattle, MSGBOX_AUTOCLOSE end @@ -729,8 +673,7 @@ Route8_EventScript_PaigeRematch:: Route8_EventScript_Andrea:: trainerbattle_single TRAINER_LASS_ANDREA, Route8_Text_AndreaIntro, Route8_Text_AndreaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_AndreaRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_AndreaRematch msgbox Route8_Text_AndreaPostBattle, MSGBOX_AUTOCLOSE end @@ -742,8 +685,7 @@ Route8_EventScript_AndreaRematch:: Route8_EventScript_Megan:: trainerbattle_single TRAINER_LASS_MEGAN, Route8_Text_MeganIntro, Route8_Text_MeganDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_MeganRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_MeganRematch msgbox Route8_Text_MeganPostBattle, MSGBOX_AUTOCLOSE end @@ -755,8 +697,7 @@ Route8_EventScript_MeganRematch:: Route8_EventScript_Julia:: trainerbattle_single TRAINER_LASS_JULIA, Route8_Text_JuliaIntro, Route8_Text_JuliaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_JuliaRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_JuliaRematch msgbox Route8_Text_JuliaPostBattle, MSGBOX_AUTOCLOSE end @@ -768,8 +709,7 @@ Route8_EventScript_JuliaRematch:: Route8_EventScript_Aidan:: trainerbattle_single TRAINER_SUPER_NERD_AIDAN, Route8_Text_AidanIntro, Route8_Text_AidanDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_AidanRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_AidanRematch msgbox Route8_Text_AidanPostBattle, MSGBOX_AUTOCLOSE end @@ -781,8 +721,7 @@ Route8_EventScript_AidanRematch:: Route8_EventScript_Glenn:: trainerbattle_single TRAINER_SUPER_NERD_GLENN, Route8_Text_GlennIntro, Route8_Text_GlennDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_GlennRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_GlennRematch msgbox Route8_Text_GlennPostBattle, MSGBOX_AUTOCLOSE end @@ -794,8 +733,7 @@ Route8_EventScript_GlennRematch:: Route8_EventScript_Leslie:: trainerbattle_single TRAINER_SUPER_NERD_LESLIE, Route8_Text_LeslieIntro, Route8_Text_LeslieDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_LeslieRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_LeslieRematch msgbox Route8_Text_LesliePostBattle, MSGBOX_AUTOCLOSE end @@ -807,8 +745,7 @@ Route8_EventScript_LeslieRematch:: Route8_EventScript_Stan:: trainerbattle_single TRAINER_GAMER_STAN, Route8_Text_StanIntro, Route8_Text_StanDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_StanRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_StanRematch msgbox Route8_Text_StanPostBattle, MSGBOX_AUTOCLOSE end @@ -820,8 +757,7 @@ Route8_EventScript_StanRematch:: Route8_EventScript_Rich:: trainerbattle_single TRAINER_GAMER_RICH, Route8_Text_RichIntro, Route8_Text_RichDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_RichRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_RichRematch msgbox Route8_Text_RichPostBattle, MSGBOX_AUTOCLOSE end @@ -833,8 +769,7 @@ Route8_EventScript_RichRematch:: Route8_EventScript_Eli:: trainerbattle_double TRAINER_TWINS_ELI_ANNE, Route8_Text_EliIntro, Route8_Text_EliDefeat, Route8_Text_EliNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_EliRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_EliRematch msgbox Route8_Text_EliPostBattle, MSGBOX_AUTOCLOSE end @@ -846,8 +781,7 @@ Route8_EventScript_EliRematch:: Route8_EventScript_Anne:: trainerbattle_double TRAINER_TWINS_ELI_ANNE, Route8_Text_AnneIntro, Route8_Text_AnneDefeat, Route8_Text_AnneNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_AnneRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_AnneRematch msgbox Route8_Text_AnnePostBattle, MSGBOX_AUTOCLOSE end @@ -859,8 +793,7 @@ Route8_EventScript_AnneRematch:: Route8_EventScript_Ricardo:: trainerbattle_single TRAINER_BIKER_RICARDO, Route8_Text_RicardoIntro, Route8_Text_RicardoDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_RicardoRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_RicardoRematch msgbox Route8_Text_RicardoPostBattle, MSGBOX_AUTOCLOSE end @@ -872,8 +805,7 @@ Route8_EventScript_RicardoRematch:: Route8_EventScript_Jaren:: trainerbattle_single TRAINER_BIKER_JAREN, Route8_Text_JarenIntro, Route8_Text_JarenDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route8_EventScript_JarenRematch + goto_if_eq VAR_RESULT, TRUE, Route8_EventScript_JarenRematch msgbox Route8_Text_JarenPostBattle, MSGBOX_AUTOCLOSE end @@ -885,8 +817,7 @@ Route8_EventScript_JarenRematch:: Route12_EventScript_Ned:: trainerbattle_single TRAINER_FISHERMAN_NED, Route12_Text_NedIntro, Route12_Text_NedDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route12_EventScript_NedRematch + goto_if_eq VAR_RESULT, TRUE, Route12_EventScript_NedRematch msgbox Route12_Text_NedPostBattle, MSGBOX_AUTOCLOSE end @@ -898,8 +829,7 @@ Route12_EventScript_NedRematch:: Route12_EventScript_Chip:: trainerbattle_single TRAINER_FISHERMAN_CHIP, Route12_Text_ChipIntro, Route12_Text_ChipDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route12_EventScript_ChipRematch + goto_if_eq VAR_RESULT, TRUE, Route12_EventScript_ChipRematch msgbox Route12_Text_ChipPostBattle, MSGBOX_AUTOCLOSE end @@ -911,8 +841,7 @@ Route12_EventScript_ChipRematch:: Route12_EventScript_Hank:: trainerbattle_single TRAINER_FISHERMAN_HANK, Route12_Text_HankIntro, Route12_Text_HankDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route12_EventScript_HankRematch + goto_if_eq VAR_RESULT, TRUE, Route12_EventScript_HankRematch msgbox Route12_Text_HankPostBattle, MSGBOX_AUTOCLOSE end @@ -924,8 +853,7 @@ Route12_EventScript_HankRematch:: Route12_EventScript_Elliot:: trainerbattle_single TRAINER_FISHERMAN_ELLIOT, Route12_Text_ElliotIntro, Route12_Text_ElliotDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route12_EventScript_ElliotRematch + goto_if_eq VAR_RESULT, TRUE, Route12_EventScript_ElliotRematch msgbox Route12_Text_ElliotPostBattle, MSGBOX_AUTOCLOSE end @@ -937,8 +865,7 @@ Route12_EventScript_ElliotRematch:: Route12_EventScript_Andrew:: trainerbattle_single TRAINER_FISHERMAN_ANDREW, Route12_Text_AndrewIntro, Route12_Text_AndrewDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route12_EventScript_AndrewRematch + goto_if_eq VAR_RESULT, TRUE, Route12_EventScript_AndrewRematch msgbox Route12_Text_AndrewPostBattle, MSGBOX_AUTOCLOSE end @@ -950,8 +877,7 @@ Route12_EventScript_AndrewRematch:: Route12_EventScript_Luca:: trainerbattle_single TRAINER_ROCKER_LUCA, Route12_Text_LucaIntro, Route12_Text_LucaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route12_EventScript_LucaRematch + goto_if_eq VAR_RESULT, TRUE, Route12_EventScript_LucaRematch msgbox Route12_Text_LucaPostBattle, MSGBOX_AUTOCLOSE end @@ -963,8 +889,7 @@ Route12_EventScript_LucaRematch:: Route12_EventScript_Justin:: trainerbattle_single TRAINER_CAMPER_JUSTIN, Route12_Text_JustinIntro, Route12_Text_JustinDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route12_EventScript_JustinRematch + goto_if_eq VAR_RESULT, TRUE, Route12_EventScript_JustinRematch msgbox Route12_Text_JustinPostBattle, MSGBOX_AUTOCLOSE end @@ -976,8 +901,7 @@ Route12_EventScript_JustinRematch:: Route12_EventScript_Jes:: trainerbattle_double TRAINER_YOUNG_COUPLE_GIA_JES, Route12_Text_JesIntro, Route12_Text_JesDefeat, Route12_Text_JesNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route12_EventScript_JesRematch + goto_if_eq VAR_RESULT, TRUE, Route12_EventScript_JesRematch msgbox Route12_Text_JesPostBattle, MSGBOX_AUTOCLOSE end @@ -989,8 +913,7 @@ Route12_EventScript_JesRematch:: Route12_EventScript_Gia:: trainerbattle_double TRAINER_YOUNG_COUPLE_GIA_JES, Route12_Text_GiaIntro, Route12_Text_GiaDefeat, Route12_Text_GiaNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route12_EventScript_GiaRematch + goto_if_eq VAR_RESULT, TRUE, Route12_EventScript_GiaRematch msgbox Route12_Text_GiaPostBattle, MSGBOX_AUTOCLOSE end @@ -1002,8 +925,7 @@ Route12_EventScript_GiaRematch:: Route13_EventScript_Jared:: trainerbattle_single TRAINER_BIKER_JARED, Route13_Text_JaredIntro, Route13_Text_JaredDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route13_EventScript_JaredRematch + goto_if_eq VAR_RESULT, TRUE, Route13_EventScript_JaredRematch msgbox Route13_Text_JaredPostBattle, MSGBOX_AUTOCLOSE end @@ -1015,8 +937,7 @@ Route13_EventScript_JaredRematch:: Route13_EventScript_Lola:: trainerbattle_single TRAINER_BEAUTY_LOLA, Route13_Text_LolaIntro, Route13_Text_LolaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route13_EventScript_LolaRematch + goto_if_eq VAR_RESULT, TRUE, Route13_EventScript_LolaRematch msgbox Route13_Text_LolaPostBattle, MSGBOX_AUTOCLOSE end @@ -1028,8 +949,7 @@ Route13_EventScript_LolaRematch:: Route13_EventScript_Sheila:: trainerbattle_single TRAINER_BEAUTY_SHEILA, Route13_Text_SheilaIntro, Route13_Text_SheilaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route13_EventScript_SheilaRematch + goto_if_eq VAR_RESULT, TRUE, Route13_EventScript_SheilaRematch msgbox Route13_Text_SheilaPostBattle, MSGBOX_AUTOCLOSE end @@ -1041,8 +961,7 @@ Route13_EventScript_SheilaRematch:: Route13_EventScript_Sebastian:: trainerbattle_single TRAINER_BIRD_KEEPER_SEBASTIAN, Route13_Text_SebastianIntro, Route13_Text_SebastianDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route13_EventScript_SebastianRematch + goto_if_eq VAR_RESULT, TRUE, Route13_EventScript_SebastianRematch msgbox Route13_Text_SebastianPostBattle, MSGBOX_AUTOCLOSE end @@ -1054,8 +973,7 @@ Route13_EventScript_SebastianRematch:: Route13_EventScript_Perry:: trainerbattle_single TRAINER_BIRD_KEEPER_PERRY, Route13_Text_PerryIntro, Route13_Text_PerryDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route13_EventScript_PerryRematch + goto_if_eq VAR_RESULT, TRUE, Route13_EventScript_PerryRematch msgbox Route13_Text_PerryPostBattle, MSGBOX_AUTOCLOSE end @@ -1067,8 +985,7 @@ Route13_EventScript_PerryRematch:: Route13_EventScript_Robert:: trainerbattle_single TRAINER_BIRD_KEEPER_ROBERT, Route13_Text_RobertIntro, Route13_Text_RobertDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route13_EventScript_RobertRematch + goto_if_eq VAR_RESULT, TRUE, Route13_EventScript_RobertRematch msgbox Route13_Text_RobertPostBattle, MSGBOX_AUTOCLOSE end @@ -1080,8 +997,7 @@ Route13_EventScript_RobertRematch:: Route13_EventScript_Alma:: trainerbattle_single TRAINER_PICNICKER_ALMA, Route13_Text_AlmaIntro, Route13_Text_AlmaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route13_EventScript_AlmaRematch + goto_if_eq VAR_RESULT, TRUE, Route13_EventScript_AlmaRematch msgbox Route13_Text_AlmaPostBattle, MSGBOX_AUTOCLOSE end @@ -1093,8 +1009,7 @@ Route13_EventScript_AlmaRematch:: Route13_EventScript_Susie:: trainerbattle_single TRAINER_PICNICKER_SUSIE, Route13_Text_SusieIntro, Route13_Text_SusieDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route13_EventScript_SusieRematch + goto_if_eq VAR_RESULT, TRUE, Route13_EventScript_SusieRematch msgbox Route13_Text_SusiePostBattle, MSGBOX_AUTOCLOSE end @@ -1106,8 +1021,7 @@ Route13_EventScript_SusieRematch:: Route13_EventScript_Valerie:: trainerbattle_single TRAINER_PICNICKER_VALERIE, Route13_Text_ValerieIntro, Route13_Text_ValerieDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route13_EventScript_ValerieRematch + goto_if_eq VAR_RESULT, TRUE, Route13_EventScript_ValerieRematch msgbox Route13_Text_ValeriePostBattle, MSGBOX_AUTOCLOSE end @@ -1119,8 +1033,7 @@ Route13_EventScript_ValerieRematch:: Route13_EventScript_Gwen:: trainerbattle_single TRAINER_PICNICKER_GWEN, Route13_Text_GwenIntro, Route13_Text_GwenDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route13_EventScript_GwenRematch + goto_if_eq VAR_RESULT, TRUE, Route13_EventScript_GwenRematch msgbox Route13_Text_GwenPostBattle, MSGBOX_AUTOCLOSE end @@ -1132,8 +1045,7 @@ Route13_EventScript_GwenRematch:: Route14_EventScript_Malik:: trainerbattle_single TRAINER_BIKER_MALIK, Route14_Text_MalikIntro, Route14_Text_MalikDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route14_EventScript_MalikRematch + goto_if_eq VAR_RESULT, TRUE, Route14_EventScript_MalikRematch msgbox Route14_Text_MalikPostBattle, MSGBOX_AUTOCLOSE end @@ -1145,8 +1057,7 @@ Route14_EventScript_MalikRematch:: Route14_EventScript_Lukas:: trainerbattle_single TRAINER_BIKER_LUKAS, Route14_Text_LukasIntro, Route14_Text_LukasDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route14_EventScript_LukasRematch + goto_if_eq VAR_RESULT, TRUE, Route14_EventScript_LukasRematch msgbox Route14_Text_LukasPostBattle, MSGBOX_AUTOCLOSE end @@ -1158,8 +1069,7 @@ Route14_EventScript_LukasRematch:: Route14_EventScript_Isaac:: trainerbattle_single TRAINER_BIKER_ISAAC, Route14_Text_IsaacIntro, Route14_Text_IsaacDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route14_EventScript_IsaacRematch + goto_if_eq VAR_RESULT, TRUE, Route14_EventScript_IsaacRematch msgbox Route14_Text_IsaacPostBattle, MSGBOX_AUTOCLOSE end @@ -1171,8 +1081,7 @@ Route14_EventScript_IsaacRematch:: Route14_EventScript_Gerald:: trainerbattle_single TRAINER_BIKER_GERALD, Route14_Text_GeraldIntro, Route14_Text_GeraldDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route14_EventScript_GeraldRematch + goto_if_eq VAR_RESULT, TRUE, Route14_EventScript_GeraldRematch msgbox Route14_Text_GeraldPostBattle, MSGBOX_AUTOCLOSE end @@ -1184,8 +1093,7 @@ Route14_EventScript_GeraldRematch:: Route14_EventScript_Donald:: trainerbattle_single TRAINER_BIRD_KEEPER_DONALD, Route14_Text_DonaldIntro, Route14_Text_DonaldDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route14_EventScript_DonaldRematch + goto_if_eq VAR_RESULT, TRUE, Route14_EventScript_DonaldRematch msgbox Route14_Text_DonaldPostBattle, MSGBOX_AUTOCLOSE end @@ -1197,8 +1105,7 @@ Route14_EventScript_DonaldRematch:: Route14_EventScript_Benny:: trainerbattle_single TRAINER_BIRD_KEEPER_BENNY, Route14_Text_BennyIntro, Route14_Text_BennyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route14_EventScript_BennyRematch + goto_if_eq VAR_RESULT, TRUE, Route14_EventScript_BennyRematch msgbox Route14_Text_BennyPostBattle, MSGBOX_AUTOCLOSE end @@ -1210,8 +1117,7 @@ Route14_EventScript_BennyRematch:: Route14_EventScript_Carter:: trainerbattle_single TRAINER_BIRD_KEEPER_CARTER, Route14_Text_CarterIntro, Route14_Text_CarterDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route14_EventScript_CarterRematch + goto_if_eq VAR_RESULT, TRUE, Route14_EventScript_CarterRematch msgbox Route14_Text_CarterPostBattle, MSGBOX_AUTOCLOSE end @@ -1223,8 +1129,7 @@ Route14_EventScript_CarterRematch:: Route14_EventScript_Mitch:: trainerbattle_single TRAINER_BIRD_KEEPER_MITCH, Route14_Text_MitchIntro, Route14_Text_MitchDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route14_EventScript_MitchRematch + goto_if_eq VAR_RESULT, TRUE, Route14_EventScript_MitchRematch msgbox Route14_Text_MitchPostBattle, MSGBOX_AUTOCLOSE end @@ -1236,8 +1141,7 @@ Route14_EventScript_MitchRematch:: Route14_EventScript_Beck:: trainerbattle_single TRAINER_BIRD_KEEPER_BECK, Route14_Text_BeckIntro, Route14_Text_BeckDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route14_EventScript_BeckRematch + goto_if_eq VAR_RESULT, TRUE, Route14_EventScript_BeckRematch msgbox Route14_Text_BeckPostBattle, MSGBOX_AUTOCLOSE end @@ -1249,8 +1153,7 @@ Route14_EventScript_BeckRematch:: Route14_EventScript_Marlon:: trainerbattle_single TRAINER_BIRD_KEEPER_MARLON, Route14_Text_MarlonIntro, Route14_Text_MarlonDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route14_EventScript_MarlonRematch + goto_if_eq VAR_RESULT, TRUE, Route14_EventScript_MarlonRematch msgbox Route14_Text_MarlonPostBattle, MSGBOX_AUTOCLOSE end @@ -1262,8 +1165,7 @@ Route14_EventScript_MarlonRematch:: Route14_EventScript_Kiri:: trainerbattle_double TRAINER_TWINS_KIRI_JAN, Route14_Text_KiriIntro, Route14_Text_KiriDefeat, Route14_Text_KiriNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route14_EventScript_KiriRematch + goto_if_eq VAR_RESULT, TRUE, Route14_EventScript_KiriRematch msgbox Route14_Text_KiriPostBattle, MSGBOX_AUTOCLOSE end @@ -1275,8 +1177,7 @@ Route14_EventScript_KiriRematch:: Route14_EventScript_Jan:: trainerbattle_double TRAINER_TWINS_KIRI_JAN, Route14_Text_JanIntro, Route14_Text_JanDefeat, Route14_Text_JanNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route14_EventScript_JanRematch + goto_if_eq VAR_RESULT, TRUE, Route14_EventScript_JanRematch msgbox Route14_Text_JanPostBattle, MSGBOX_AUTOCLOSE end @@ -1288,8 +1189,7 @@ Route14_EventScript_JanRematch:: Route15_EventScript_Ernest:: trainerbattle_single TRAINER_BIKER_ERNEST, Route15_Text_ErnestIntro, Route15_Text_ErnestDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route15_EventScript_ErnestRematch + goto_if_eq VAR_RESULT, TRUE, Route15_EventScript_ErnestRematch msgbox Route15_Text_ErnestPostBattle, MSGBOX_AUTOCLOSE end @@ -1301,8 +1201,7 @@ Route15_EventScript_ErnestRematch:: Route15_EventScript_Alex:: trainerbattle_single TRAINER_BIKER_ALEX, Route15_Text_AlexIntro, Route15_Text_AlexDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route15_EventScript_AlexRematch + goto_if_eq VAR_RESULT, TRUE, Route15_EventScript_AlexRematch msgbox Route15_Text_AlexPostBattle, MSGBOX_AUTOCLOSE end @@ -1314,8 +1213,7 @@ Route15_EventScript_AlexRematch:: Route15_EventScript_Grace:: trainerbattle_single TRAINER_BEAUTY_GRACE, Route15_Text_GraceIntro, Route15_Text_GraceDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route15_EventScript_GraceRematch + goto_if_eq VAR_RESULT, TRUE, Route15_EventScript_GraceRematch msgbox Route15_Text_GracePostBattle, MSGBOX_AUTOCLOSE end @@ -1327,8 +1225,7 @@ Route15_EventScript_GraceRematch:: Route15_EventScript_Olivia:: trainerbattle_single TRAINER_BEAUTY_OLIVIA, Route15_Text_OliviaIntro, Route15_Text_OliviaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route15_EventScript_OliviaRematch + goto_if_eq VAR_RESULT, TRUE, Route15_EventScript_OliviaRematch msgbox Route15_Text_OliviaPostBattle, MSGBOX_AUTOCLOSE end @@ -1340,8 +1237,7 @@ Route15_EventScript_OliviaRematch:: Route15_EventScript_Edwin:: trainerbattle_single TRAINER_BIRD_KEEPER_EDWIN, Route15_Text_EdwinIntro, Route15_Text_EdwinDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route15_EventScript_EdwinRematch + goto_if_eq VAR_RESULT, TRUE, Route15_EventScript_EdwinRematch msgbox Route15_Text_EdwinPostBattle, MSGBOX_AUTOCLOSE end @@ -1353,8 +1249,7 @@ Route15_EventScript_EdwinRematch:: Route15_EventScript_Chester:: trainerbattle_single TRAINER_BIRD_KEEPER_CHESTER, Route15_Text_ChesterIntro, Route15_Text_ChesterDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route15_EventScript_ChesterRematch + goto_if_eq VAR_RESULT, TRUE, Route15_EventScript_ChesterRematch msgbox Route15_Text_ChesterPostBattle, MSGBOX_AUTOCLOSE end @@ -1366,8 +1261,7 @@ Route15_EventScript_ChesterRematch:: Route15_EventScript_Yazmin:: trainerbattle_single TRAINER_PICNICKER_YAZMIN, Route15_Text_YazminIntro, Route15_Text_YazminDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route15_EventScript_YazminRematch + goto_if_eq VAR_RESULT, TRUE, Route15_EventScript_YazminRematch msgbox Route15_Text_YazminPostBattle, MSGBOX_AUTOCLOSE end @@ -1379,8 +1273,7 @@ Route15_EventScript_YazminRematch:: Route15_EventScript_Kindra:: trainerbattle_single TRAINER_PICNICKER_KINDRA, Route15_Text_KindraIntro, Route15_Text_KindraDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route15_EventScript_KindraRematch + goto_if_eq VAR_RESULT, TRUE, Route15_EventScript_KindraRematch msgbox Route15_Text_KindraPostBattle, MSGBOX_AUTOCLOSE end @@ -1392,8 +1285,7 @@ Route15_EventScript_KindraRematch:: Route15_EventScript_Becky:: trainerbattle_single TRAINER_PICNICKER_BECKY, Route15_Text_BeckyIntro, Route15_Text_BeckyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route15_EventScript_BeckyRematch + goto_if_eq VAR_RESULT, TRUE, Route15_EventScript_BeckyRematch msgbox Route15_Text_BeckyPostBattle, MSGBOX_AUTOCLOSE end @@ -1405,8 +1297,7 @@ Route15_EventScript_BeckyRematch:: Route15_EventScript_Celia:: trainerbattle_single TRAINER_PICNICKER_CELIA, Route15_Text_CeliaIntro, Route15_Text_CeliaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route15_EventScript_CeliaRematch + goto_if_eq VAR_RESULT, TRUE, Route15_EventScript_CeliaRematch msgbox Route15_Text_CeliaPostBattle, MSGBOX_AUTOCLOSE end @@ -1418,8 +1309,7 @@ Route15_EventScript_CeliaRematch:: Route15_EventScript_Mya:: trainerbattle_double TRAINER_CRUSH_KIN_RON_MYA, Route15_Text_MyaIntro, Route15_Text_MyaDefeat, Route15_Text_MyaNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route15_EventScript_MyaRematch + goto_if_eq VAR_RESULT, TRUE, Route15_EventScript_MyaRematch msgbox Route15_Text_MyaPostBattle, MSGBOX_AUTOCLOSE end @@ -1431,8 +1321,7 @@ Route15_EventScript_MyaRematch:: Route15_EventScript_Ron:: trainerbattle_double TRAINER_CRUSH_KIN_RON_MYA, Route15_Text_RonIntro, Route15_Text_RonDefeat, Route15_Text_RonNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route15_EventScript_RonRematch + goto_if_eq VAR_RESULT, TRUE, Route15_EventScript_RonRematch msgbox Route15_Text_RonPostBattle, MSGBOX_AUTOCLOSE end @@ -1444,8 +1333,7 @@ Route15_EventScript_RonRematch:: Route16_EventScript_Lao:: trainerbattle_single TRAINER_BIKER_LAO, Route16_Text_LaoIntro, Route16_Text_LaoDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route16_EventScript_LaoRematch + goto_if_eq VAR_RESULT, TRUE, Route16_EventScript_LaoRematch msgbox Route16_Text_LaoPostBattle, MSGBOX_AUTOCLOSE end @@ -1457,8 +1345,7 @@ Route16_EventScript_LaoRematch:: Route16_EventScript_Hideo:: trainerbattle_single TRAINER_BIKER_HIDEO, Route16_Text_HideoIntro, Route16_Text_HideoDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route16_EventScript_HideoRematch + goto_if_eq VAR_RESULT, TRUE, Route16_EventScript_HideoRematch msgbox Route16_Text_HideoPostBattle, MSGBOX_AUTOCLOSE end @@ -1470,8 +1357,7 @@ Route16_EventScript_HideoRematch:: Route16_EventScript_Ruben:: trainerbattle_single TRAINER_BIKER_RUBEN, Route16_Text_RubenIntro, Route16_Text_RubenDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route16_EventScript_RubenRematch + goto_if_eq VAR_RESULT, TRUE, Route16_EventScript_RubenRematch msgbox Route16_Text_RubenPostBattle, MSGBOX_AUTOCLOSE end @@ -1483,8 +1369,7 @@ Route16_EventScript_RubenRematch:: Route16_EventScript_Koji:: trainerbattle_single TRAINER_CUE_BALL_KOJI, Route16_Text_KojiIntro, Route16_Text_KojiDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route16_EventScript_KojiRematch + goto_if_eq VAR_RESULT, TRUE, Route16_EventScript_KojiRematch msgbox Route16_Text_KojiPostBattle, MSGBOX_AUTOCLOSE end @@ -1496,8 +1381,7 @@ Route16_EventScript_KojiRematch:: Route16_EventScript_Luke:: trainerbattle_single TRAINER_CUE_BALL_LUKE, Route16_Text_LukeIntro, Route16_Text_LukeDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route16_EventScript_LukeRematch + goto_if_eq VAR_RESULT, TRUE, Route16_EventScript_LukeRematch msgbox Route16_Text_LukePostBattle, MSGBOX_AUTOCLOSE end @@ -1509,8 +1393,7 @@ Route16_EventScript_LukeRematch:: Route16_EventScript_Camron:: trainerbattle_single TRAINER_CUE_BALL_CAMRON, Route16_Text_CamronIntro, Route16_Text_CamronDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route16_EventScript_CamronRematch + goto_if_eq VAR_RESULT, TRUE, Route16_EventScript_CamronRematch msgbox Route16_Text_CamronPostBattle, MSGBOX_AUTOCLOSE end @@ -1522,8 +1405,7 @@ Route16_EventScript_CamronRematch:: Route16_EventScript_Jed:: trainerbattle_double TRAINER_YOUNG_COUPLE_LEA_JED, Route16_Text_JedIntro, Route16_Text_JedDefeat, Route16_Text_JedNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route16_EventScript_JedRematch + goto_if_eq VAR_RESULT, TRUE, Route16_EventScript_JedRematch msgbox Route16_Text_JedPostBattle, MSGBOX_AUTOCLOSE end @@ -1535,8 +1417,7 @@ Route16_EventScript_JedRematch:: Route16_EventScript_Lea:: trainerbattle_double TRAINER_YOUNG_COUPLE_LEA_JED, Route16_Text_LeaIntro, Route16_Text_LeaDefeat, Route16_Text_LeaNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route16_EventScript_LeaRematch + goto_if_eq VAR_RESULT, TRUE, Route16_EventScript_LeaRematch msgbox Route16_Text_LeaPostBattle, MSGBOX_AUTOCLOSE end @@ -1548,8 +1429,7 @@ Route16_EventScript_LeaRematch:: Route17_EventScript_Billy:: trainerbattle_single TRAINER_BIKER_BILLY, Route17_Text_BillyIntro, Route17_Text_BillyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route17_EventScript_BillyRematch + goto_if_eq VAR_RESULT, TRUE, Route17_EventScript_BillyRematch msgbox Route17_Text_BillyPostBattle, MSGBOX_AUTOCLOSE end @@ -1561,8 +1441,7 @@ Route17_EventScript_BillyRematch:: Route17_EventScript_Nikolas:: trainerbattle_single TRAINER_BIKER_NIKOLAS, Route17_Text_NikolasIntro, Route17_Text_NikolasDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route17_EventScript_NikolasRematch + goto_if_eq VAR_RESULT, TRUE, Route17_EventScript_NikolasRematch msgbox Route17_Text_NikolasPostBattle, MSGBOX_AUTOCLOSE end @@ -1574,8 +1453,7 @@ Route17_EventScript_NikolasRematch:: Route17_EventScript_Jaxon:: trainerbattle_single TRAINER_BIKER_JAXON, Route17_Text_JaxonIntro, Route17_Text_JaxonDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route17_EventScript_JaxonRematch + goto_if_eq VAR_RESULT, TRUE, Route17_EventScript_JaxonRematch msgbox Route17_Text_JaxonPostBattle, MSGBOX_AUTOCLOSE end @@ -1587,8 +1465,7 @@ Route17_EventScript_JaxonRematch:: Route17_EventScript_William:: trainerbattle_single TRAINER_BIKER_WILLIAM, Route17_Text_WilliamIntro, Route17_Text_WilliamDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route17_EventScript_WilliamRematch + goto_if_eq VAR_RESULT, TRUE, Route17_EventScript_WilliamRematch msgbox Route17_Text_WilliamPostBattle, MSGBOX_AUTOCLOSE end @@ -1600,8 +1477,7 @@ Route17_EventScript_WilliamRematch:: Route17_EventScript_Raul:: trainerbattle_single TRAINER_CUE_BALL_RAUL, Route17_Text_RaulIntro, Route17_Text_RaulDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route17_EventScript_RaulRematch + goto_if_eq VAR_RESULT, TRUE, Route17_EventScript_RaulRematch msgbox Route17_Text_RaulPostBattle, MSGBOX_AUTOCLOSE end @@ -1613,8 +1489,7 @@ Route17_EventScript_RaulRematch:: Route17_EventScript_Isaiah:: trainerbattle_single TRAINER_CUE_BALL_ISAIAH, Route17_Text_IsaiahIntro, Route17_Text_IsaiahDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route17_EventScript_IsaiahRematch + goto_if_eq VAR_RESULT, TRUE, Route17_EventScript_IsaiahRematch msgbox Route17_Text_IsaiahPostBattle, MSGBOX_AUTOCLOSE end @@ -1626,8 +1501,7 @@ Route17_EventScript_IsaiahRematch:: Route17_EventScript_Zeek:: trainerbattle_single TRAINER_CUE_BALL_ZEEK, Route17_Text_ZeekIntro, Route17_Text_ZeekDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route17_EventScript_ZeekRematch + goto_if_eq VAR_RESULT, TRUE, Route17_EventScript_ZeekRematch msgbox Route17_Text_ZeekPostBattle, MSGBOX_AUTOCLOSE end @@ -1639,8 +1513,7 @@ Route17_EventScript_ZeekRematch:: Route17_EventScript_Jamal:: trainerbattle_single TRAINER_CUE_BALL_JAMAL, Route17_Text_JamalIntro, Route17_Text_JamalDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route17_EventScript_JamalRematch + goto_if_eq VAR_RESULT, TRUE, Route17_EventScript_JamalRematch msgbox Route17_Text_JamalPostBattle, MSGBOX_AUTOCLOSE end @@ -1652,8 +1525,7 @@ Route17_EventScript_JamalRematch:: Route17_EventScript_Corey:: trainerbattle_single TRAINER_CUE_BALL_COREY, Route17_Text_CoreyIntro, Route17_Text_CoreyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route17_EventScript_CoreyRematch + goto_if_eq VAR_RESULT, TRUE, Route17_EventScript_CoreyRematch msgbox Route17_Text_CoreyPostBattle, MSGBOX_AUTOCLOSE end @@ -1665,8 +1537,7 @@ Route17_EventScript_CoreyRematch:: Route17_EventScript_Virgil:: trainerbattle_single TRAINER_BIKER_VIRGIL, Route17_Text_VirgilIntro, Route17_Text_VirgilDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route17_EventScript_VirgilRematch + goto_if_eq VAR_RESULT, TRUE, Route17_EventScript_VirgilRematch msgbox Route17_Text_VirgilPostBattle, MSGBOX_AUTOCLOSE end @@ -1678,8 +1549,7 @@ Route17_EventScript_VirgilRematch:: Route18_EventScript_Wilton:: trainerbattle_single TRAINER_BIRD_KEEPER_WILTON, Route18_Text_WiltonIntro, Route18_Text_WiltonDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route18_EventScript_WiltonRematch + goto_if_eq VAR_RESULT, TRUE, Route18_EventScript_WiltonRematch msgbox Route18_Text_WiltonPostBattle, MSGBOX_AUTOCLOSE end @@ -1691,8 +1561,7 @@ Route18_EventScript_WiltonRematch:: Route18_EventScript_Ramiro:: trainerbattle_single TRAINER_BIRD_KEEPER_RAMIRO, Route18_Text_RamiroIntro, Route18_Text_RamiroDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route18_EventScript_RamiroRematch + goto_if_eq VAR_RESULT, TRUE, Route18_EventScript_RamiroRematch msgbox Route18_Text_RamiroPostBattle, MSGBOX_AUTOCLOSE end @@ -1704,8 +1573,7 @@ Route18_EventScript_RamiroRematch:: Route18_EventScript_Jacob:: trainerbattle_single TRAINER_BIRD_KEEPER_JACOB, Route18_Text_JacobIntro, Route18_Text_JacobDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route18_EventScript_JacobRematch + goto_if_eq VAR_RESULT, TRUE, Route18_EventScript_JacobRematch msgbox Route18_Text_JacobPostBattle, MSGBOX_AUTOCLOSE end @@ -1717,8 +1585,7 @@ Route18_EventScript_JacobRematch:: Route19_EventScript_Richard:: trainerbattle_single TRAINER_SWIMMER_MALE_RICHARD, Route19_Text_RichardIntro, Route19_Text_RichardDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route19_EventScript_RichardRematch + goto_if_eq VAR_RESULT, TRUE, Route19_EventScript_RichardRematch msgbox Route19_Text_RichardPostBattle, MSGBOX_AUTOCLOSE end @@ -1730,8 +1597,7 @@ Route19_EventScript_RichardRematch:: Route19_EventScript_Reece:: trainerbattle_single TRAINER_SWIMMER_MALE_REECE, Route19_Text_ReeceIntro, Route19_Text_ReeceDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route19_EventScript_ReeceRematch + goto_if_eq VAR_RESULT, TRUE, Route19_EventScript_ReeceRematch msgbox Route19_Text_ReecePostBattle, MSGBOX_AUTOCLOSE end @@ -1743,8 +1609,7 @@ Route19_EventScript_ReeceRematch:: Route19_EventScript_Matthew:: trainerbattle_single TRAINER_SWIMMER_MALE_MATTHEW, Route19_Text_MatthewIntro, Route19_Text_MatthewDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route19_EventScript_MatthewRematch + goto_if_eq VAR_RESULT, TRUE, Route19_EventScript_MatthewRematch msgbox Route19_Text_MatthewPostBattle, MSGBOX_AUTOCLOSE end @@ -1756,8 +1621,7 @@ Route19_EventScript_MatthewRematch:: Route19_EventScript_Douglas:: trainerbattle_single TRAINER_SWIMMER_MALE_DOUGLAS, Route19_Text_DouglasIntro, Route19_Text_DouglasDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route19_EventScript_DouglasRematch + goto_if_eq VAR_RESULT, TRUE, Route19_EventScript_DouglasRematch msgbox Route19_Text_DouglasPostBattle, MSGBOX_AUTOCLOSE end @@ -1769,8 +1633,7 @@ Route19_EventScript_DouglasRematch:: Route19_EventScript_David:: trainerbattle_single TRAINER_SWIMMER_MALE_DAVID, Route19_Text_DavidIntro, Route19_Text_DavidDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route19_EventScript_DavidRematch + goto_if_eq VAR_RESULT, TRUE, Route19_EventScript_DavidRematch msgbox Route19_Text_DavidPostBattle, MSGBOX_AUTOCLOSE end @@ -1782,8 +1645,7 @@ Route19_EventScript_DavidRematch:: Route19_EventScript_Tony:: trainerbattle_single TRAINER_SWIMMER_MALE_TONY, Route19_Text_TonyIntro, Route19_Text_TonyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route19_EventScript_TonyRematch + goto_if_eq VAR_RESULT, TRUE, Route19_EventScript_TonyRematch msgbox Route19_Text_TonyPostBattle, MSGBOX_AUTOCLOSE end @@ -1795,8 +1657,7 @@ Route19_EventScript_TonyRematch:: Route19_EventScript_Axle:: trainerbattle_single TRAINER_SWIMMER_MALE_AXLE, Route19_Text_AxleIntro, Route19_Text_AxleDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route19_EventScript_AxleRematch + goto_if_eq VAR_RESULT, TRUE, Route19_EventScript_AxleRematch msgbox Route19_Text_AxlePostBattle, MSGBOX_AUTOCLOSE end @@ -1808,8 +1669,7 @@ Route19_EventScript_AxleRematch:: Route19_EventScript_Anya:: trainerbattle_single TRAINER_SWIMMER_FEMALE_ANYA, Route19_Text_AnyaIntro, Route19_Text_AnyaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route19_EventScript_AnyaRematch + goto_if_eq VAR_RESULT, TRUE, Route19_EventScript_AnyaRematch msgbox Route19_Text_AnyaPostBattle, MSGBOX_AUTOCLOSE end @@ -1821,8 +1681,7 @@ Route19_EventScript_AnyaRematch:: Route19_EventScript_Alice:: trainerbattle_single TRAINER_SWIMMER_FEMALE_ALICE, Route19_Text_AliceIntro, Route19_Text_AliceDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route19_EventScript_AliceRematch + goto_if_eq VAR_RESULT, TRUE, Route19_EventScript_AliceRematch msgbox Route19_Text_AlicePostBattle, MSGBOX_AUTOCLOSE end @@ -1834,8 +1693,7 @@ Route19_EventScript_AliceRematch:: Route19_EventScript_Connie:: trainerbattle_single TRAINER_SWIMMER_FEMALE_CONNIE, Route19_Text_ConnieIntro, Route19_Text_ConnieDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route19_EventScript_ConnieRematch + goto_if_eq VAR_RESULT, TRUE, Route19_EventScript_ConnieRematch msgbox Route19_Text_ConniePostBattle, MSGBOX_AUTOCLOSE end @@ -1847,8 +1705,7 @@ Route19_EventScript_ConnieRematch:: Route19_EventScript_Lia:: trainerbattle_double TRAINER_SIS_AND_BRO_LIA_LUC, Route19_Text_LiaIntro, Route19_Text_LiaDefeat, Route19_Text_LiaNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route19_EventScript_LiaRematch + goto_if_eq VAR_RESULT, TRUE, Route19_EventScript_LiaRematch msgbox Route19_Text_LiaPostBattle, MSGBOX_AUTOCLOSE end @@ -1860,8 +1717,7 @@ Route19_EventScript_LiaRematch:: Route19_EventScript_Luc:: trainerbattle_double TRAINER_SIS_AND_BRO_LIA_LUC, Route19_Text_LucIntro, Route19_Text_LucDefeat, Route19_Text_LucNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route19_EventScript_LucRematch + goto_if_eq VAR_RESULT, TRUE, Route19_EventScript_LucRematch msgbox Route19_Text_LucPostBattle, MSGBOX_AUTOCLOSE end @@ -1873,8 +1729,7 @@ Route19_EventScript_LucRematch:: Route20_EventScript_Barry:: trainerbattle_single TRAINER_SWIMMER_MALE_BARRY, Route20_Text_BarryIntro, Route20_Text_BarryDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route20_EventScript_BarryRematch + goto_if_eq VAR_RESULT, TRUE, Route20_EventScript_BarryRematch msgbox Route20_Text_BarryPostBattle, MSGBOX_AUTOCLOSE end @@ -1886,8 +1741,7 @@ Route20_EventScript_BarryRematch:: Route20_EventScript_Dean:: trainerbattle_single TRAINER_SWIMMER_MALE_DEAN, Route20_Text_DeanIntro, Route20_Text_DeanDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route20_EventScript_DeanRematch + goto_if_eq VAR_RESULT, TRUE, Route20_EventScript_DeanRematch msgbox Route20_Text_DeanPostBattle, MSGBOX_AUTOCLOSE end @@ -1899,8 +1753,7 @@ Route20_EventScript_DeanRematch:: Route20_EventScript_Darrin:: trainerbattle_single TRAINER_SWIMMER_MALE_DARRIN, Route20_Text_DarrinIntro, Route20_Text_DarrinDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route20_EventScript_DarrinRematch + goto_if_eq VAR_RESULT, TRUE, Route20_EventScript_DarrinRematch msgbox Route20_Text_DarrinPostBattle, MSGBOX_AUTOCLOSE end @@ -1912,8 +1765,7 @@ Route20_EventScript_DarrinRematch:: Route20_EventScript_Tiffany:: trainerbattle_single TRAINER_SWIMMER_FEMALE_TIFFANY, Route20_Text_TiffanyIntro, Route20_Text_TiffanyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route20_EventScript_TiffanyRematch + goto_if_eq VAR_RESULT, TRUE, Route20_EventScript_TiffanyRematch msgbox Route20_Text_TiffanyPostBattle, MSGBOX_AUTOCLOSE end @@ -1925,8 +1777,7 @@ Route20_EventScript_TiffanyRematch:: Route20_EventScript_Nora:: trainerbattle_single TRAINER_SWIMMER_FEMALE_NORA, Route20_Text_NoraIntro, Route20_Text_NoraDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route20_EventScript_NoraRematch + goto_if_eq VAR_RESULT, TRUE, Route20_EventScript_NoraRematch msgbox Route20_Text_NoraPostBattle, MSGBOX_AUTOCLOSE end @@ -1938,8 +1789,7 @@ Route20_EventScript_NoraRematch:: Route20_EventScript_Melissa:: trainerbattle_single TRAINER_SWIMMER_FEMALE_MELISSA, Route20_Text_MelissaIntro, Route20_Text_MelissaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route20_EventScript_MelissaRematch + goto_if_eq VAR_RESULT, TRUE, Route20_EventScript_MelissaRematch msgbox Route20_Text_MelissaPostBattle, MSGBOX_AUTOCLOSE end @@ -1951,8 +1801,7 @@ Route20_EventScript_MelissaRematch:: Route20_EventScript_Shirley:: trainerbattle_single TRAINER_SWIMMER_FEMALE_SHIRLEY, Route20_Text_ShirleyIntro, Route20_Text_ShirleyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route20_EventScript_ShirleyRematch + goto_if_eq VAR_RESULT, TRUE, Route20_EventScript_ShirleyRematch msgbox Route20_Text_ShirleyPostBattle, MSGBOX_AUTOCLOSE end @@ -1964,8 +1813,7 @@ Route20_EventScript_ShirleyRematch:: Route20_EventScript_Roger:: trainerbattle_single TRAINER_BIRD_KEEPER_ROGER, Route20_Text_RogerIntro, Route20_Text_RogerDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route20_EventScript_RogerRematch + goto_if_eq VAR_RESULT, TRUE, Route20_EventScript_RogerRematch msgbox Route20_Text_RogerPostBattle, MSGBOX_AUTOCLOSE end @@ -1977,8 +1825,7 @@ Route20_EventScript_RogerRematch:: Route20_EventScript_Missy:: trainerbattle_single TRAINER_PICNICKER_MISSY, Route20_Text_MissyIntro, Route20_Text_MissyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route20_EventScript_MissyRematch + goto_if_eq VAR_RESULT, TRUE, Route20_EventScript_MissyRematch msgbox Route20_Text_MissyPostBattle, MSGBOX_AUTOCLOSE end @@ -1990,8 +1837,7 @@ Route20_EventScript_MissyRematch:: Route20_EventScript_Irene:: trainerbattle_single TRAINER_PICNICKER_IRENE, Route20_Text_IreneIntro, Route20_Text_IreneDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route20_EventScript_IreneRematch + goto_if_eq VAR_RESULT, TRUE, Route20_EventScript_IreneRematch msgbox Route20_Text_IrenePostBattle, MSGBOX_AUTOCLOSE end @@ -2003,8 +1849,7 @@ Route20_EventScript_IreneRematch:: Route21_North_EventScript_Ronald:: trainerbattle_single TRAINER_FISHERMAN_RONALD, Route21_North_Text_RonaldIntro, Route21_North_Text_RonaldDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route21_North_EventScript_RonaldRematch + goto_if_eq VAR_RESULT, TRUE, Route21_North_EventScript_RonaldRematch msgbox Route21_North_Text_RonaldPostBattle, MSGBOX_AUTOCLOSE end @@ -2016,8 +1861,7 @@ Route21_North_EventScript_RonaldRematch:: Route21_South_EventScript_Claude:: trainerbattle_single TRAINER_FISHERMAN_CLAUDE, Route21_South_Text_ClaudeIntro, Route21_South_Text_ClaudeDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route21_South_EventScript_ClaudeRematch + goto_if_eq VAR_RESULT, TRUE, Route21_South_EventScript_ClaudeRematch msgbox Route21_South_Text_ClaudePostBattle, MSGBOX_AUTOCLOSE end @@ -2029,8 +1873,7 @@ Route21_South_EventScript_ClaudeRematch:: Route21_North_EventScript_Wade:: trainerbattle_single TRAINER_FISHERMAN_WADE, Route21_North_Text_WadeIntro, Route21_North_Text_WadeDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route21_North_EventScript_WadeRematch + goto_if_eq VAR_RESULT, TRUE, Route21_North_EventScript_WadeRematch msgbox Route21_North_Text_WadePostBattle, MSGBOX_AUTOCLOSE end @@ -2042,8 +1885,7 @@ Route21_North_EventScript_WadeRematch:: Route21_South_EventScript_Nolan:: trainerbattle_single TRAINER_FISHERMAN_NOLAN, Route21_South_Text_NolanIntro, Route21_South_Text_NolanDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route21_South_EventScript_NolanRematch + goto_if_eq VAR_RESULT, TRUE, Route21_South_EventScript_NolanRematch msgbox Route21_South_Text_NolanPostBattle, MSGBOX_AUTOCLOSE end @@ -2055,8 +1897,7 @@ Route21_South_EventScript_NolanRematch:: Route21_North_EventScript_Spencer:: trainerbattle_single TRAINER_SWIMMER_MALE_SPENCER, Route21_North_Text_SpencerIntro, Route21_North_Text_SpencerDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route21_North_EventScript_SpencerRematch + goto_if_eq VAR_RESULT, TRUE, Route21_North_EventScript_SpencerRematch msgbox Route21_North_Text_SpencerPostBattle, MSGBOX_AUTOCLOSE end @@ -2068,8 +1909,7 @@ Route21_North_EventScript_SpencerRematch:: Route21_South_EventScript_Jack:: trainerbattle_single TRAINER_SWIMMER_MALE_JACK, Route21_South_Text_JackIntro, Route21_South_Text_JackDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route21_South_EventScript_JackRematch + goto_if_eq VAR_RESULT, TRUE, Route21_South_EventScript_JackRematch msgbox Route21_South_Text_JackPostBattle, MSGBOX_AUTOCLOSE end @@ -2081,8 +1921,7 @@ Route21_South_EventScript_JackRematch:: Route21_South_EventScript_Jerome:: trainerbattle_single TRAINER_SWIMMER_MALE_JEROME, Route21_South_Text_JeromeIntro, Route21_South_Text_JeromeDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route21_South_EventScript_JeromeRematch + goto_if_eq VAR_RESULT, TRUE, Route21_South_EventScript_JeromeRematch msgbox Route21_South_Text_JeromePostBattle, MSGBOX_AUTOCLOSE end @@ -2094,8 +1933,7 @@ Route21_South_EventScript_JeromeRematch:: Route21_South_EventScript_Roland:: trainerbattle_single TRAINER_SWIMMER_MALE_ROLAND, Route21_South_Text_RolandIntro, Route21_South_Text_RolandDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route21_South_EventScript_RolandRematch + goto_if_eq VAR_RESULT, TRUE, Route21_South_EventScript_RolandRematch msgbox Route21_South_Text_RolandPostBattle, MSGBOX_AUTOCLOSE end @@ -2107,8 +1945,7 @@ Route21_South_EventScript_RolandRematch:: Route21_North_EventScript_Lil:: trainerbattle_double TRAINER_SIS_AND_BRO_LIL_IAN, Route21_North_Text_LilIntro, Route21_North_Text_LilDefeat, Route21_North_Text_LilNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route21_North_EventScript_LilRematch + goto_if_eq VAR_RESULT, TRUE, Route21_North_EventScript_LilRematch msgbox Route21_North_Text_LilPostBattle, MSGBOX_AUTOCLOSE end @@ -2120,8 +1957,7 @@ Route21_North_EventScript_LilRematch:: Route21_North_EventScript_Ian:: trainerbattle_double TRAINER_SIS_AND_BRO_LIL_IAN, Route21_North_Text_IanIntro, Route21_North_Text_IanDefeat, Route21_North_Text_IanNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq Route21_North_EventScript_IanRematch + goto_if_eq VAR_RESULT, TRUE, Route21_North_EventScript_IanRematch msgbox Route21_North_Text_IanPostBattle, MSGBOX_AUTOCLOSE end @@ -2133,8 +1969,7 @@ Route21_North_EventScript_IanRematch:: OneIsland_KindleRoad_EventScript_Maria:: trainerbattle_single TRAINER_SWIMMER_FEMALE_MARIA, OneIsland_KindleRoad_Text_MariaIntro, OneIsland_KindleRoad_Text_MariaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_MariaRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_MariaRematch msgbox OneIsland_KindleRoad_Text_MariaPostBattle, MSGBOX_AUTOCLOSE end @@ -2146,8 +1981,7 @@ OneIsland_KindleRoad_EventScript_MariaRematch:: OneIsland_KindleRoad_EventScript_Abigail:: trainerbattle_single TRAINER_SWIMMER_FEMALE_ABIGAIL, OneIsland_KindleRoad_Text_AbigailIntro, OneIsland_KindleRoad_Text_AbigailDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_AbigailRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_AbigailRematch msgbox OneIsland_KindleRoad_Text_AbigailPostBattle, MSGBOX_AUTOCLOSE end @@ -2159,8 +1993,7 @@ OneIsland_KindleRoad_EventScript_AbigailRematch:: OneIsland_KindleRoad_EventScript_Finn:: trainerbattle_single TRAINER_SWIMMER_MALE_FINN, OneIsland_KindleRoad_Text_FinnIntro, OneIsland_KindleRoad_Text_FinnDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_FinnRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_FinnRematch msgbox OneIsland_KindleRoad_Text_FinnPostBattle, MSGBOX_AUTOCLOSE end @@ -2172,8 +2005,7 @@ OneIsland_KindleRoad_EventScript_FinnRematch:: OneIsland_KindleRoad_EventScript_Garrett:: trainerbattle_single TRAINER_SWIMMER_MALE_GARRETT, OneIsland_KindleRoad_Text_GarrettIntro, OneIsland_KindleRoad_Text_GarrettDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_GarrettRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_GarrettRematch msgbox OneIsland_KindleRoad_Text_GarrettPostBattle, MSGBOX_AUTOCLOSE end @@ -2185,8 +2017,7 @@ OneIsland_KindleRoad_EventScript_GarrettRematch:: OneIsland_KindleRoad_EventScript_Tommy:: trainerbattle_single TRAINER_FISHERMAN_TOMMY, OneIsland_KindleRoad_Text_TommyIntro, OneIsland_KindleRoad_Text_TommyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_TommyRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_TommyRematch msgbox OneIsland_KindleRoad_Text_TommyPostBattle, MSGBOX_AUTOCLOSE end @@ -2198,8 +2029,7 @@ OneIsland_KindleRoad_EventScript_TommyRematch:: OneIsland_KindleRoad_EventScript_Sharon:: trainerbattle_single TRAINER_CRUSH_GIRL_SHARON, OneIsland_KindleRoad_Text_SharonIntro, OneIsland_KindleRoad_Text_SharonDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_SharonRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_SharonRematch msgbox OneIsland_KindleRoad_Text_SharonPostBattle, MSGBOX_AUTOCLOSE end @@ -2211,8 +2041,7 @@ OneIsland_KindleRoad_EventScript_SharonRematch:: OneIsland_KindleRoad_EventScript_Tanya:: trainerbattle_single TRAINER_CRUSH_GIRL_TANYA, OneIsland_KindleRoad_Text_TanyaIntro, OneIsland_KindleRoad_Text_TanyaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_TanyaRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_TanyaRematch msgbox OneIsland_KindleRoad_Text_TanyaPostBattle, MSGBOX_AUTOCLOSE end @@ -2224,8 +2053,7 @@ OneIsland_KindleRoad_EventScript_TanyaRematch:: OneIsland_KindleRoad_EventScript_Shea:: trainerbattle_single TRAINER_BLACK_BELT_SHEA, OneIsland_KindleRoad_Text_SheaIntro, OneIsland_KindleRoad_Text_SheaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_SheaRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_SheaRematch msgbox OneIsland_KindleRoad_Text_SheaPostBattle, MSGBOX_AUTOCLOSE end @@ -2237,8 +2065,7 @@ OneIsland_KindleRoad_EventScript_SheaRematch:: OneIsland_KindleRoad_EventScript_Hugh:: trainerbattle_single TRAINER_BLACK_BELT_HUGH, OneIsland_KindleRoad_Text_HughIntro, OneIsland_KindleRoad_Text_HughDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_HughRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_HughRematch msgbox OneIsland_KindleRoad_Text_HughPostBattle, MSGBOX_AUTOCLOSE end @@ -2250,8 +2077,7 @@ OneIsland_KindleRoad_EventScript_HughRematch:: OneIsland_KindleRoad_EventScript_Bryce:: trainerbattle_single TRAINER_CAMPER_BRYCE, OneIsland_KindleRoad_Text_BryceIntro, OneIsland_KindleRoad_Text_BryceDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_BryceRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_BryceRematch msgbox OneIsland_KindleRoad_Text_BrycePostBattle, MSGBOX_AUTOCLOSE end @@ -2263,8 +2089,7 @@ OneIsland_KindleRoad_EventScript_BryceRematch:: OneIsland_KindleRoad_EventScript_Claire:: trainerbattle_single TRAINER_PICNICKER_CLAIRE, OneIsland_KindleRoad_Text_ClaireIntro, OneIsland_KindleRoad_Text_ClaireDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_ClaireRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_ClaireRematch msgbox OneIsland_KindleRoad_Text_ClairePostBattle, MSGBOX_AUTOCLOSE end @@ -2276,8 +2101,7 @@ OneIsland_KindleRoad_EventScript_ClaireRematch:: OneIsland_KindleRoad_EventScript_Kia:: trainerbattle_double TRAINER_CRUSH_KIN_MIK_KIA, OneIsland_KindleRoad_Text_KiaIntro, OneIsland_KindleRoad_Text_KiaDefeat, OneIsland_KindleRoad_Text_KiaNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_KiaRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_KiaRematch msgbox OneIsland_KindleRoad_Text_KiaPostBattle, MSGBOX_AUTOCLOSE end @@ -2289,8 +2113,7 @@ OneIsland_KindleRoad_EventScript_KiaRematch:: OneIsland_KindleRoad_EventScript_Mik:: trainerbattle_double TRAINER_CRUSH_KIN_MIK_KIA, OneIsland_KindleRoad_Text_MikIntro, OneIsland_KindleRoad_Text_MikDefeat, OneIsland_KindleRoad_Text_MikNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_KindleRoad_EventScript_MikRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_KindleRoad_EventScript_MikRematch msgbox OneIsland_KindleRoad_Text_MikPostBattle, MSGBOX_AUTOCLOSE end @@ -2302,8 +2125,7 @@ OneIsland_KindleRoad_EventScript_MikRematch:: OneIsland_TreasureBeach_EventScript_Amara:: trainerbattle_single TRAINER_SWIMMER_FEMALE_AMARA, OneIsland_TreasureBeach_Text_AmaraIntro, OneIsland_TreasureBeach_Text_AmaraDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq OneIsland_TreasureBeach_EventScript_AmaraRematch + goto_if_eq VAR_RESULT, TRUE, OneIsland_TreasureBeach_EventScript_AmaraRematch msgbox OneIsland_TreasureBeach_Text_AmaraPostBattle, MSGBOX_AUTOCLOSE end @@ -2315,8 +2137,7 @@ OneIsland_TreasureBeach_EventScript_AmaraRematch:: ThreeIsland_BondBridge_EventScript_Nikki:: trainerbattle_single TRAINER_AROMA_LADY_NIKKI, ThreeIsland_BondBridge_Text_NikkiIntro, ThreeIsland_BondBridge_Text_NikkiDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq ThreeIsland_BondBridge_EventScript_NikkiRematch + goto_if_eq VAR_RESULT, TRUE, ThreeIsland_BondBridge_EventScript_NikkiRematch msgbox ThreeIsland_BondBridge_Text_NikkiPostBattle, MSGBOX_AUTOCLOSE end @@ -2328,8 +2149,7 @@ ThreeIsland_BondBridge_EventScript_NikkiRematch:: ThreeIsland_BondBridge_EventScript_Violet:: trainerbattle_single TRAINER_AROMA_LADY_VIOLET, ThreeIsland_BondBridge_Text_VioletIntro, ThreeIsland_BondBridge_Text_VioletDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq ThreeIsland_BondBridge_EventScript_VioletRematch + goto_if_eq VAR_RESULT, TRUE, ThreeIsland_BondBridge_EventScript_VioletRematch msgbox ThreeIsland_BondBridge_Text_VioletPostBattle, MSGBOX_AUTOCLOSE end @@ -2341,8 +2161,7 @@ ThreeIsland_BondBridge_EventScript_VioletRematch:: ThreeIsland_BondBridge_EventScript_Amira:: trainerbattle_single TRAINER_TUBER_AMIRA, ThreeIsland_BondBridge_Text_AmiraIntro, ThreeIsland_BondBridge_Text_AmiraDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq ThreeIsland_BondBridge_EventScript_AmiraRematch + goto_if_eq VAR_RESULT, TRUE, ThreeIsland_BondBridge_EventScript_AmiraRematch msgbox ThreeIsland_BondBridge_Text_AmiraPostBattle, MSGBOX_AUTOCLOSE end @@ -2354,8 +2173,7 @@ ThreeIsland_BondBridge_EventScript_AmiraRematch:: ThreeIsland_BondBridge_EventScript_Alexis:: trainerbattle_single TRAINER_TUBER_ALEXIS, ThreeIsland_BondBridge_Text_AlexisIntro, ThreeIsland_BondBridge_Text_AlexisDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq ThreeIsland_BondBridge_EventScript_AlexisRematch + goto_if_eq VAR_RESULT, TRUE, ThreeIsland_BondBridge_EventScript_AlexisRematch msgbox ThreeIsland_BondBridge_Text_AlexisPostBattle, MSGBOX_AUTOCLOSE end @@ -2367,8 +2185,7 @@ ThreeIsland_BondBridge_EventScript_AlexisRematch:: ThreeIsland_BondBridge_EventScript_Tisha:: trainerbattle_single TRAINER_SWIMMER_FEMALE_TISHA, ThreeIsland_BondBridge_Text_TishaIntro, ThreeIsland_BondBridge_Text_TishaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq ThreeIsland_BondBridge_EventScript_TishaRematch + goto_if_eq VAR_RESULT, TRUE, ThreeIsland_BondBridge_EventScript_TishaRematch msgbox ThreeIsland_BondBridge_Text_TishaPostBattle, MSGBOX_AUTOCLOSE end @@ -2380,8 +2197,7 @@ ThreeIsland_BondBridge_EventScript_TishaRematch:: ThreeIsland_BondBridge_EventScript_Joy:: trainerbattle_double TRAINER_TWINS_JOY_MEG, ThreeIsland_BondBridge_Text_JoyIntro, ThreeIsland_BondBridge_Text_JoyDefeat, ThreeIsland_BondBridge_Text_JoyNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq ThreeIsland_BondBridge_EventScript_JoyRematch + goto_if_eq VAR_RESULT, TRUE, ThreeIsland_BondBridge_EventScript_JoyRematch msgbox ThreeIsland_BondBridge_Text_JoyPostBattle, MSGBOX_AUTOCLOSE end @@ -2393,8 +2209,7 @@ ThreeIsland_BondBridge_EventScript_JoyRematch:: ThreeIsland_BondBridge_EventScript_Meg:: trainerbattle_double TRAINER_TWINS_JOY_MEG, ThreeIsland_BondBridge_Text_MegIntro, ThreeIsland_BondBridge_Text_MegDefeat, ThreeIsland_BondBridge_Text_MegNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq ThreeIsland_BondBridge_EventScript_MegRematch + goto_if_eq VAR_RESULT, TRUE, ThreeIsland_BondBridge_EventScript_MegRematch msgbox ThreeIsland_BondBridge_Text_MegPostBattle, MSGBOX_AUTOCLOSE end @@ -2406,8 +2221,7 @@ ThreeIsland_BondBridge_EventScript_MegRematch:: FiveIsland_ResortGorgeous_EventScript_Daisy:: trainerbattle_single TRAINER_PAINTER_DAISY, FiveIsland_ResortGorgeous_Text_DaisyIntro, FiveIsland_ResortGorgeous_Text_DaisyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_ResortGorgeous_EventScript_DaisyRematch + goto_if_eq VAR_RESULT, TRUE, FiveIsland_ResortGorgeous_EventScript_DaisyRematch msgbox FiveIsland_ResortGorgeous_Text_DaisyPostBattle, MSGBOX_AUTOCLOSE end @@ -2419,8 +2233,7 @@ FiveIsland_ResortGorgeous_EventScript_DaisyRematch:: FiveIsland_ResortGorgeous_EventScript_Celina:: trainerbattle_single TRAINER_PAINTER_CELINA, FiveIsland_ResortGorgeous_Text_CelinaIntro, FiveIsland_ResortGorgeous_Text_CelinaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_ResortGorgeous_EventScript_CelinaRematch + goto_if_eq VAR_RESULT, TRUE, FiveIsland_ResortGorgeous_EventScript_CelinaRematch msgbox FiveIsland_ResortGorgeous_Text_CelinaPostBattle, MSGBOX_AUTOCLOSE end @@ -2432,8 +2245,7 @@ FiveIsland_ResortGorgeous_EventScript_CelinaRematch:: FiveIsland_ResortGorgeous_EventScript_Rayna:: trainerbattle_single TRAINER_PAINTER_RAYNA, FiveIsland_ResortGorgeous_Text_RaynaIntro, FiveIsland_ResortGorgeous_Text_RaynaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_ResortGorgeous_EventScript_RaynaRematch + goto_if_eq VAR_RESULT, TRUE, FiveIsland_ResortGorgeous_EventScript_RaynaRematch msgbox FiveIsland_ResortGorgeous_Text_RaynaPostBattle, MSGBOX_AUTOCLOSE end @@ -2445,8 +2257,7 @@ FiveIsland_ResortGorgeous_EventScript_RaynaRematch:: FiveIsland_ResortGorgeous_EventScript_Jacki:: trainerbattle_single TRAINER_LADY_JACKI, FiveIsland_ResortGorgeous_Text_JackiIntro, FiveIsland_ResortGorgeous_Text_JackiDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_ResortGorgeous_EventScript_JackiRematch + goto_if_eq VAR_RESULT, TRUE, FiveIsland_ResortGorgeous_EventScript_JackiRematch msgbox FiveIsland_ResortGorgeous_Text_JackiPostBattle, MSGBOX_AUTOCLOSE end @@ -2458,8 +2269,7 @@ FiveIsland_ResortGorgeous_EventScript_JackiRematch:: FiveIsland_ResortGorgeous_EventScript_Gillian:: trainerbattle_single TRAINER_LADY_GILLIAN, FiveIsland_ResortGorgeous_Text_GillianIntro, FiveIsland_ResortGorgeous_Text_GillianDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_ResortGorgeous_EventScript_GillianRematch + goto_if_eq VAR_RESULT, TRUE, FiveIsland_ResortGorgeous_EventScript_GillianRematch msgbox FiveIsland_ResortGorgeous_Text_GillianPostBattle, MSGBOX_AUTOCLOSE end @@ -2471,8 +2281,7 @@ FiveIsland_ResortGorgeous_EventScript_GillianRematch:: FiveIsland_ResortGorgeous_EventScript_Destin:: trainerbattle_single TRAINER_YOUNGSTER_DESTIN, FiveIsland_ResortGorgeous_Text_DestinIntro, FiveIsland_ResortGorgeous_Text_DestinDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_ResortGorgeous_EventScript_DestinRematch + goto_if_eq VAR_RESULT, TRUE, FiveIsland_ResortGorgeous_EventScript_DestinRematch msgbox FiveIsland_ResortGorgeous_Text_DestinPostBattle, MSGBOX_AUTOCLOSE end @@ -2484,8 +2293,7 @@ FiveIsland_ResortGorgeous_EventScript_DestinRematch:: FiveIsland_ResortGorgeous_EventScript_Toby:: trainerbattle_single TRAINER_SWIMMER_MALE_TOBY, FiveIsland_ResortGorgeous_Text_TobyIntro, FiveIsland_ResortGorgeous_Text_TobyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_ResortGorgeous_EventScript_TobyRematch + goto_if_eq VAR_RESULT, TRUE, FiveIsland_ResortGorgeous_EventScript_TobyRematch msgbox FiveIsland_ResortGorgeous_Text_TobyPostBattle, MSGBOX_AUTOCLOSE end @@ -2497,8 +2305,7 @@ FiveIsland_ResortGorgeous_EventScript_TobyRematch:: FiveIsland_WaterLabyrinth_EventScript_Alize:: trainerbattle_single TRAINER_PKMN_BREEDER_ALIZE, FiveIsland_WaterLabyrinth_Text_AlizeIntro, FiveIsland_WaterLabyrinth_Text_AlizeDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_WaterLabyrinth_EventScript_AlizeRematch + goto_if_eq VAR_RESULT, TRUE, FiveIsland_WaterLabyrinth_EventScript_AlizeRematch msgbox FiveIsland_WaterLabyrinth_Text_AlizePostBattle, MSGBOX_AUTOCLOSE end @@ -2510,8 +2317,7 @@ FiveIsland_WaterLabyrinth_EventScript_AlizeRematch:: FiveIsland_MemorialPillar_EventScript_Milo:: trainerbattle_single TRAINER_BIRD_KEEPER_MILO, FiveIsland_MemorialPillar_Text_MiloIntro, FiveIsland_MemorialPillar_Text_MiloDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_MemorialPillar_EventScript_MiloRematch + goto_if_eq VAR_RESULT, TRUE, FiveIsland_MemorialPillar_EventScript_MiloRematch msgbox FiveIsland_MemorialPillar_Text_MiloPostBattle, MSGBOX_AUTOCLOSE end @@ -2523,8 +2329,7 @@ FiveIsland_MemorialPillar_EventScript_MiloRematch:: FiveIsland_MemorialPillar_EventScript_Chaz:: trainerbattle_single TRAINER_BIRD_KEEPER_CHAZ, FiveIsland_MemorialPillar_Text_ChazIntro, FiveIsland_MemorialPillar_Text_ChazDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_MemorialPillar_EventScript_ChazRematch + goto_if_eq VAR_RESULT, TRUE, FiveIsland_MemorialPillar_EventScript_ChazRematch msgbox FiveIsland_MemorialPillar_Text_ChazPostBattle, MSGBOX_AUTOCLOSE end @@ -2536,8 +2341,7 @@ FiveIsland_MemorialPillar_EventScript_ChazRematch:: FiveIsland_MemorialPillar_EventScript_Harold:: trainerbattle_single TRAINER_BIRD_KEEPER_HAROLD, FiveIsland_MemorialPillar_Text_HaroldIntro, FiveIsland_MemorialPillar_Text_HaroldDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq FiveIsland_MemorialPillar_EventScript_HaroldRematch + goto_if_eq VAR_RESULT, TRUE, FiveIsland_MemorialPillar_EventScript_HaroldRematch msgbox FiveIsland_MemorialPillar_Text_HaroldPostBattle, MSGBOX_AUTOCLOSE end @@ -2549,8 +2353,7 @@ FiveIsland_MemorialPillar_EventScript_HaroldRematch:: SixIsland_OutcastIsland_EventScript_Tylor:: trainerbattle_single TRAINER_FISHERMAN_TYLOR, SixIsland_OutcastIsland_Text_TylorIntro, SixIsland_OutcastIsland_Text_TylorDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_OutcastIsland_EventScript_TylorRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_OutcastIsland_EventScript_TylorRematch msgbox SixIsland_OutcastIsland_Text_TylorPostBattle, MSGBOX_AUTOCLOSE end @@ -2562,8 +2365,7 @@ SixIsland_OutcastIsland_EventScript_TylorRematch:: SixIsland_OutcastIsland_EventScript_Mymo:: trainerbattle_single TRAINER_SWIMMER_MALE_MYMO, SixIsland_OutcastIsland_Text_MymoIntro, SixIsland_OutcastIsland_Text_MymoDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_OutcastIsland_EventScript_MymoRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_OutcastIsland_EventScript_MymoRematch msgbox SixIsland_OutcastIsland_Text_MymoPostBattle, MSGBOX_AUTOCLOSE end @@ -2575,8 +2377,7 @@ SixIsland_OutcastIsland_EventScript_MymoRematch:: SixIsland_OutcastIsland_EventScript_Nicole:: trainerbattle_single TRAINER_SWIMMER_FEMALE_NICOLE, SixIsland_OutcastIsland_Text_NicoleIntro, SixIsland_OutcastIsland_Text_NicoleDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_OutcastIsland_EventScript_NicoleRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_OutcastIsland_EventScript_NicoleRematch msgbox SixIsland_OutcastIsland_Text_NicolePostBattle, MSGBOX_AUTOCLOSE end @@ -2588,8 +2389,7 @@ SixIsland_OutcastIsland_EventScript_NicoleRematch:: SixIsland_OutcastIsland_EventScript_Ava:: trainerbattle_double TRAINER_SIS_AND_BRO_AVA_GEB, SixIsland_OutcastIsland_Text_AvaIntro, SixIsland_OutcastIsland_Text_AvaDefeat, SixIsland_OutcastIsland_Text_AvaNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_OutcastIsland_EventScript_AvaRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_OutcastIsland_EventScript_AvaRematch msgbox SixIsland_OutcastIsland_Text_AvaPostBattle, MSGBOX_AUTOCLOSE end @@ -2601,8 +2401,7 @@ SixIsland_OutcastIsland_EventScript_AvaRematch:: SixIsland_OutcastIsland_EventScript_Geb:: trainerbattle_double TRAINER_SIS_AND_BRO_AVA_GEB, SixIsland_OutcastIsland_Text_GebIntro, SixIsland_OutcastIsland_Text_GebDefeat, SixIsland_OutcastIsland_Text_GebNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_OutcastIsland_EventScript_GebRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_OutcastIsland_EventScript_GebRematch msgbox SixIsland_OutcastIsland_Text_GebPostBattle, MSGBOX_AUTOCLOSE end @@ -2614,8 +2413,7 @@ SixIsland_OutcastIsland_EventScript_GebRematch:: SixIsland_GreenPath_EventScript_Jaclyn:: trainerbattle_single TRAINER_PSYCHIC_JACLYN, SixIsland_GreenPath_Text_JaclynIntro, SixIsland_GreenPath_Text_JaclynDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_GreenPath_EventScript_JaclynRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_GreenPath_EventScript_JaclynRematch msgbox SixIsland_GreenPath_Text_JaclynPostBattle, MSGBOX_AUTOCLOSE end @@ -2627,8 +2425,7 @@ SixIsland_GreenPath_EventScript_JaclynRematch:: SixIsland_WaterPath_EventScript_Rose:: trainerbattle_single TRAINER_AROMA_LADY_ROSE, SixIsland_WaterPath_Text_RoseIntro, SixIsland_WaterPath_Text_RoseDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_WaterPath_EventScript_RoseRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_WaterPath_EventScript_RoseRematch msgbox SixIsland_WaterPath_Text_RosePostBattle, MSGBOX_AUTOCLOSE end @@ -2640,8 +2437,7 @@ SixIsland_WaterPath_EventScript_RoseRematch:: SixIsland_WaterPath_EventScript_Edward:: trainerbattle_single TRAINER_JUGGLER_EDWARD, SixIsland_WaterPath_Text_EdwardIntro, SixIsland_WaterPath_Text_EdwardDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_WaterPath_EventScript_EdwardRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_WaterPath_EventScript_EdwardRematch msgbox SixIsland_WaterPath_Text_EdwardPostBattle, MSGBOX_AUTOCLOSE end @@ -2653,8 +2449,7 @@ SixIsland_WaterPath_EventScript_EdwardRematch:: SixIsland_WaterPath_EventScript_Samir:: trainerbattle_single TRAINER_SWIMMER_MALE_SAMIR, SixIsland_WaterPath_Text_SamirIntro, SixIsland_WaterPath_Text_SamirDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_WaterPath_EventScript_SamirRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_WaterPath_EventScript_SamirRematch msgbox SixIsland_WaterPath_Text_SamirPostBattle, MSGBOX_AUTOCLOSE end @@ -2666,8 +2461,7 @@ SixIsland_WaterPath_EventScript_SamirRematch:: SixIsland_WaterPath_EventScript_Denise:: trainerbattle_single TRAINER_SWIMMER_FEMALE_DENISE, SixIsland_WaterPath_Text_DeniseIntro, SixIsland_WaterPath_Text_DeniseDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_WaterPath_EventScript_DeniseRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_WaterPath_EventScript_DeniseRematch msgbox SixIsland_WaterPath_Text_DenisePostBattle, MSGBOX_AUTOCLOSE end @@ -2679,8 +2473,7 @@ SixIsland_WaterPath_EventScript_DeniseRematch:: SixIsland_WaterPath_EventScript_Miu:: trainerbattle_double TRAINER_TWINS_MIU_MIA, SixIsland_WaterPath_Text_MiuIntro, SixIsland_WaterPath_Text_MiuDefeat, SixIsland_WaterPath_Text_MiuNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_WaterPath_EventScript_MiuRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_WaterPath_EventScript_MiuRematch msgbox SixIsland_WaterPath_Text_MiuPostBattle, MSGBOX_AUTOCLOSE end @@ -2692,8 +2485,7 @@ SixIsland_WaterPath_EventScript_MiuRematch:: SixIsland_WaterPath_EventScript_Mia:: trainerbattle_double TRAINER_TWINS_MIU_MIA, SixIsland_WaterPath_Text_MiaIntro, SixIsland_WaterPath_Text_MiaDefeat, SixIsland_WaterPath_Text_MiaNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_WaterPath_EventScript_MiaRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_WaterPath_EventScript_MiaRematch msgbox SixIsland_WaterPath_Text_MiaPostBattle, MSGBOX_AUTOCLOSE end @@ -2705,8 +2497,7 @@ SixIsland_WaterPath_EventScript_MiaRematch:: SixIsland_WaterPath_EventScript_Earl:: trainerbattle_single TRAINER_HIKER_EARL, SixIsland_WaterPath_Text_EarlIntro, SixIsland_WaterPath_Text_EarlDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_WaterPath_EventScript_EarlRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_WaterPath_EventScript_EarlRematch msgbox SixIsland_WaterPath_Text_EarlPostBattle, MSGBOX_AUTOCLOSE end @@ -2718,8 +2509,7 @@ SixIsland_WaterPath_EventScript_EarlRematch:: SixIsland_RuinValley_EventScript_Stanly:: trainerbattle_single TRAINER_RUIN_MANIAC_STANLY, SixIsland_RuinValley_Text_StanlyIntro, SixIsland_RuinValley_Text_StanlyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_RuinValley_EventScript_StanlyRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_RuinValley_EventScript_StanlyRematch msgbox SixIsland_RuinValley_Text_StanlyPostBattle, MSGBOX_AUTOCLOSE end @@ -2731,8 +2521,7 @@ SixIsland_RuinValley_EventScript_StanlyRematch:: SixIsland_RuinValley_EventScript_Foster:: trainerbattle_single TRAINER_RUIN_MANIAC_FOSTER, SixIsland_RuinValley_Text_FosterIntro, SixIsland_RuinValley_Text_FosterDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_RuinValley_EventScript_FosterRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_RuinValley_EventScript_FosterRematch msgbox SixIsland_RuinValley_Text_FosterPostBattle, MSGBOX_AUTOCLOSE end @@ -2744,8 +2533,7 @@ SixIsland_RuinValley_EventScript_FosterRematch:: SixIsland_RuinValley_EventScript_Larry:: trainerbattle_single TRAINER_RUIN_MANIAC_LARRY, SixIsland_RuinValley_Text_LarryIntro, SixIsland_RuinValley_Text_LarryDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_RuinValley_EventScript_LarryRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_RuinValley_EventScript_LarryRematch msgbox SixIsland_RuinValley_Text_LarryPostBattle, MSGBOX_AUTOCLOSE end @@ -2757,8 +2545,7 @@ SixIsland_RuinValley_EventScript_LarryRematch:: SixIsland_RuinValley_EventScript_Daryl:: trainerbattle_single TRAINER_HIKER_DARYL, SixIsland_RuinValley_Text_DarylIntro, SixIsland_RuinValley_Text_DarylDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_RuinValley_EventScript_DarylRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_RuinValley_EventScript_DarylRematch msgbox SixIsland_RuinValley_Text_DarylPostBattle, MSGBOX_AUTOCLOSE end @@ -2770,8 +2557,7 @@ SixIsland_RuinValley_EventScript_DarylRematch:: SixIsland_RuinValley_EventScript_Hector:: trainerbattle_single TRAINER_POKEMANIAC_HECTOR, SixIsland_RuinValley_Text_HectorIntro, SixIsland_RuinValley_Text_HectorDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SixIsland_RuinValley_EventScript_HectorRematch + goto_if_eq VAR_RESULT, TRUE, SixIsland_RuinValley_EventScript_HectorRematch msgbox SixIsland_RuinValley_Text_HectorPostBattle, MSGBOX_AUTOCLOSE end @@ -2783,8 +2569,7 @@ SixIsland_RuinValley_EventScript_HectorRematch:: SevenIsland_TrainerTower_EventScript_Dario:: trainerbattle_single TRAINER_PSYCHIC_DARIO, SevenIsland_TrainerTower_Text_DarioIntro, SevenIsland_TrainerTower_Text_DarioDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_TrainerTower_EventScript_DarioRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_TrainerTower_EventScript_DarioRematch msgbox SevenIsland_TrainerTower_Text_DarioPostBattle, MSGBOX_AUTOCLOSE end @@ -2796,8 +2581,7 @@ SevenIsland_TrainerTower_EventScript_DarioRematch:: SevenIsland_TrainerTower_EventScript_Rodette:: trainerbattle_single TRAINER_PSYCHIC_RODETTE, SevenIsland_TrainerTower_Text_RodetteIntro, SevenIsland_TrainerTower_Text_RodetteDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_TrainerTower_EventScript_RodetteRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_TrainerTower_EventScript_RodetteRematch msgbox SevenIsland_TrainerTower_Text_RodettePostBattle, MSGBOX_AUTOCLOSE end @@ -2809,8 +2593,7 @@ SevenIsland_TrainerTower_EventScript_RodetteRematch:: SevenIsland_SevaultCanyon_Entrance_EventScript_Miah:: trainerbattle_single TRAINER_AROMA_LADY_MIAH, SevenIsland_SevaultCanyon_Entrance_Text_MiahIntro, SevenIsland_SevaultCanyon_Entrance_Text_MiahDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_Entrance_EventScript_MiahRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_Entrance_EventScript_MiahRematch msgbox SevenIsland_SevaultCanyon_Entrance_Text_MiahPostBattle, MSGBOX_AUTOCLOSE end @@ -2822,8 +2605,7 @@ SevenIsland_SevaultCanyon_Entrance_EventScript_MiahRematch:: SevenIsland_SevaultCanyon_Entrance_EventScript_Eve:: trainerbattle_double TRAINER_YOUNG_COUPLE_EVE_JON, SevenIsland_SevaultCanyon_Entrance_Text_EveIntro, SevenIsland_SevaultCanyon_Entrance_Text_EveDefeat, SevenIsland_SevaultCanyon_Entrance_Text_EveNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_Entrance_EventScript_EveRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_Entrance_EventScript_EveRematch msgbox SevenIsland_SevaultCanyon_Entrance_Text_EvePostBattle, MSGBOX_AUTOCLOSE end @@ -2835,8 +2617,7 @@ SevenIsland_SevaultCanyon_Entrance_EventScript_EveRematch:: SevenIsland_SevaultCanyon_Entrance_EventScript_Jon:: trainerbattle_double TRAINER_YOUNG_COUPLE_EVE_JON, SevenIsland_SevaultCanyon_Entrance_Text_JonIntro, SevenIsland_SevaultCanyon_Entrance_Text_JonDefeat, SevenIsland_SevaultCanyon_Entrance_Text_JonNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_Entrance_EventScript_JonRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_Entrance_EventScript_JonRematch msgbox SevenIsland_SevaultCanyon_Entrance_Text_JonPostBattle, MSGBOX_AUTOCLOSE end @@ -2848,8 +2629,7 @@ SevenIsland_SevaultCanyon_Entrance_EventScript_JonRematch:: SevenIsland_SevaultCanyon_Entrance_EventScript_Mason:: trainerbattle_single TRAINER_JUGGLER_MASON, SevenIsland_SevaultCanyon_Entrance_Text_MasonIntro, SevenIsland_SevaultCanyon_Entrance_Text_MasonDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_Entrance_EventScript_MasonRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_Entrance_EventScript_MasonRematch msgbox SevenIsland_SevaultCanyon_Entrance_Text_MasonPostBattle, MSGBOX_AUTOCLOSE end @@ -2861,8 +2641,7 @@ SevenIsland_SevaultCanyon_Entrance_EventScript_MasonRematch:: SevenIsland_SevaultCanyon_Entrance_EventScript_Nicolas:: trainerbattle_single TRAINER_PKMN_RANGER_NICOLAS, SevenIsland_SevaultCanyon_Entrance_Text_NicolasIntro, SevenIsland_SevaultCanyon_Entrance_Text_NicolasDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_Entrance_EventScript_NicolasRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_Entrance_EventScript_NicolasRematch msgbox SevenIsland_SevaultCanyon_Entrance_Text_NicolasPostBattle, MSGBOX_AUTOCLOSE end @@ -2874,8 +2653,7 @@ SevenIsland_SevaultCanyon_Entrance_EventScript_NicolasRematch:: SevenIsland_SevaultCanyon_Entrance_EventScript_Madeline:: trainerbattle_single TRAINER_PKMN_RANGER_MADELINE, SevenIsland_SevaultCanyon_Entrance_Text_MadelineIntro, SevenIsland_SevaultCanyon_Entrance_Text_MadelineDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_Entrance_EventScript_MadelineRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_Entrance_EventScript_MadelineRematch msgbox SevenIsland_SevaultCanyon_Entrance_Text_MadelinePostBattle, MSGBOX_AUTOCLOSE end @@ -2887,8 +2665,7 @@ SevenIsland_SevaultCanyon_Entrance_EventScript_MadelineRematch:: SevenIsland_SevaultCanyon_EventScript_Cyndy:: trainerbattle_single TRAINER_CRUSH_GIRL_CYNDY, SevenIsland_SevaultCanyon_Text_CyndyIntro, SevenIsland_SevaultCanyon_Text_CyndyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_EventScript_CyndyRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_EventScript_CyndyRematch msgbox SevenIsland_SevaultCanyon_Text_CyndyPostBattle, MSGBOX_AUTOCLOSE end @@ -2900,8 +2677,7 @@ SevenIsland_SevaultCanyon_EventScript_CyndyRematch:: SevenIsland_SevaultCanyon_EventScript_Evan:: trainerbattle_single TRAINER_TAMER_EVAN, SevenIsland_SevaultCanyon_Text_EvanIntro, SevenIsland_SevaultCanyon_Text_EvanDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_EventScript_EvanRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_EventScript_EvanRematch msgbox SevenIsland_SevaultCanyon_Text_EvanPostBattle, MSGBOX_AUTOCLOSE end @@ -2913,8 +2689,7 @@ SevenIsland_SevaultCanyon_EventScript_EvanRematch:: SevenIsland_SevaultCanyon_EventScript_Jackson:: trainerbattle_single TRAINER_PKMN_RANGER_JACKSON, SevenIsland_SevaultCanyon_Text_JacksonIntro, SevenIsland_SevaultCanyon_Text_JacksonDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_EventScript_JacksonRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_EventScript_JacksonRematch msgbox SevenIsland_SevaultCanyon_Text_JacksonPostBattle, MSGBOX_AUTOCLOSE end @@ -2926,8 +2701,7 @@ SevenIsland_SevaultCanyon_EventScript_JacksonRematch:: SevenIsland_SevaultCanyon_EventScript_Katelyn:: trainerbattle_single TRAINER_PKMN_RANGER_KATELYN, SevenIsland_SevaultCanyon_Text_KatelynIntro, SevenIsland_SevaultCanyon_Text_KatelynDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_EventScript_KatelynRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_EventScript_KatelynRematch msgbox SevenIsland_SevaultCanyon_Text_KatelynPostBattle, MSGBOX_AUTOCLOSE end @@ -2939,8 +2713,7 @@ SevenIsland_SevaultCanyon_EventScript_KatelynRematch:: SevenIsland_SevaultCanyon_EventScript_Leroy:: trainerbattle_single TRAINER_COOLTRAINER_LEROY, SevenIsland_SevaultCanyon_Text_LeroyIntro, SevenIsland_SevaultCanyon_Text_LeroyDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_EventScript_LeroyRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_EventScript_LeroyRematch msgbox SevenIsland_SevaultCanyon_Text_LeroyPostBattle, MSGBOX_AUTOCLOSE end @@ -2952,8 +2725,7 @@ SevenIsland_SevaultCanyon_EventScript_LeroyRematch:: SevenIsland_SevaultCanyon_EventScript_Michelle:: trainerbattle_single TRAINER_COOLTRAINER_MICHELLE, SevenIsland_SevaultCanyon_Text_MichelleIntro, SevenIsland_SevaultCanyon_Text_MichelleDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_EventScript_MichelleRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_EventScript_MichelleRematch msgbox SevenIsland_SevaultCanyon_Text_MichellePostBattle, MSGBOX_AUTOCLOSE end @@ -2965,8 +2737,7 @@ SevenIsland_SevaultCanyon_EventScript_MichelleRematch:: SevenIsland_SevaultCanyon_EventScript_Lex:: trainerbattle_double TRAINER_COOL_COUPLE_LEX_NYA, SevenIsland_SevaultCanyon_Text_LexIntro, SevenIsland_SevaultCanyon_Text_LexDefeat, SevenIsland_SevaultCanyon_Text_LexNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_EventScript_LexRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_EventScript_LexRematch msgbox SevenIsland_SevaultCanyon_Text_LexPostBattle, MSGBOX_AUTOCLOSE end @@ -2978,8 +2749,7 @@ SevenIsland_SevaultCanyon_EventScript_LexRematch:: SevenIsland_SevaultCanyon_EventScript_Nya:: trainerbattle_double TRAINER_COOL_COUPLE_LEX_NYA, SevenIsland_SevaultCanyon_Text_NyaIntro, SevenIsland_SevaultCanyon_Text_NyaDefeat, SevenIsland_SevaultCanyon_Text_NyaNotEnoughMons specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_SevaultCanyon_EventScript_NyaRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_SevaultCanyon_EventScript_NyaRematch msgbox SevenIsland_SevaultCanyon_Text_NyaPostBattle, MSGBOX_AUTOCLOSE end @@ -2991,8 +2761,7 @@ SevenIsland_SevaultCanyon_EventScript_NyaRematch:: SevenIsland_TanobyRuins_EventScript_Brandon:: trainerbattle_single TRAINER_RUIN_MANIAC_BRANDON, SevenIsland_TanobyRuins_Text_BrandonIntro, SevenIsland_TanobyRuins_Text_BrandonDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_TanobyRuins_EventScript_BrandonRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_TanobyRuins_EventScript_BrandonRematch msgbox SevenIsland_TanobyRuins_Text_BrandonPostBattle, MSGBOX_AUTOCLOSE end @@ -3004,8 +2773,7 @@ SevenIsland_TanobyRuins_EventScript_BrandonRematch:: SevenIsland_TanobyRuins_EventScript_Benjamin:: trainerbattle_single TRAINER_RUIN_MANIAC_BENJAMIN, SevenIsland_TanobyRuins_Text_BenjaminIntro, SevenIsland_TanobyRuins_Text_BenjaminDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_TanobyRuins_EventScript_BenjaminRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_TanobyRuins_EventScript_BenjaminRematch msgbox SevenIsland_TanobyRuins_Text_BenjaminPostBattle, MSGBOX_AUTOCLOSE end @@ -3017,8 +2785,7 @@ SevenIsland_TanobyRuins_EventScript_BenjaminRematch:: SevenIsland_TanobyRuins_EventScript_Edna:: trainerbattle_single TRAINER_PAINTER_EDNA, SevenIsland_TanobyRuins_Text_EdnaIntro, SevenIsland_TanobyRuins_Text_EdnaDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_TanobyRuins_EventScript_EdnaRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_TanobyRuins_EventScript_EdnaRematch msgbox SevenIsland_TanobyRuins_Text_EdnaPostBattle, MSGBOX_AUTOCLOSE end @@ -3030,8 +2797,7 @@ SevenIsland_TanobyRuins_EventScript_EdnaRematch:: SevenIsland_TanobyRuins_EventScript_Clifford:: trainerbattle_single TRAINER_GENTLEMAN_CLIFFORD, SevenIsland_TanobyRuins_Text_CliffordIntro, SevenIsland_TanobyRuins_Text_CliffordDefeat specialvar VAR_RESULT, ShouldTryRematchBattle - compare VAR_RESULT, TRUE - goto_if_eq SevenIsland_TanobyRuins_EventScript_CliffordRematch + goto_if_eq VAR_RESULT, TRUE, SevenIsland_TanobyRuins_EventScript_CliffordRematch msgbox SevenIsland_TanobyRuins_Text_CliffordPostBattle, MSGBOX_AUTOCLOSE end diff --git a/data/scripts/white_out.inc b/data/scripts/white_out.inc index c86341d8e..cbf593c82 100644 --- a/data/scripts/white_out.inc +++ b/data/scripts/white_out.inc @@ -1,6 +1,6 @@ EventScript_AfterWhiteOutHeal:: lockall - textcolor 1 + textcolor NPC_TEXT_COLOR_FEMALE msgbox Text_FirstShouldRestoreMonsHealth call EventScript_PkmnCenterNurse_TakeAndHealPkmn call_if_unset FLAG_DEFEATED_BROCK, EventScript_AfterWhiteOutHealMsgPreBrock @@ -23,8 +23,8 @@ EventScript_AfterWhiteOutHealMsg:: EventScript_AfterWhiteOutMomHeal:: lockall - textcolor 1 - applymovement LOCALID_MOM, Movement_WalkInPlaceFastestDown + textcolor NPC_TEXT_COLOR_FEMALE + applymovement LOCALID_MOM, Movement_WalkInPlaceFasterDown waitmovement 0 msgbox Text_HadQuiteAnExperienceTakeRest call EventScript_OutOfCenterPartyHeal @@ -35,20 +35,17 @@ EventScript_AfterWhiteOutMomHeal:: EventScript_FieldPoison:: lockall - textcolor 3 + textcolor NPC_TEXT_COLOR_NEUTRAL special TryFieldPoisonWhiteOut waitstate - compare VAR_RESULT, TRUE - goto_if_eq EventScript_FieldWhiteOut + goto_if_eq VAR_RESULT, TRUE, EventScript_FieldWhiteOut releaseall end EventScript_FieldWhiteOut:: - checkmoney 1, 0 - compare VAR_RESULT, FALSE - goto_if_eq EventScript_FieldWhiteOutNoMoney - compare VAR_RESULT, TRUE - goto_if_eq EventScript_FieldWhiteOutHasMoney + checkmoney 1 + goto_if_eq VAR_RESULT, FALSE, EventScript_FieldWhiteOutNoMoney + goto_if_eq VAR_RESULT, TRUE, EventScript_FieldWhiteOutHasMoney end EventScript_FieldWhiteOutNoMoney:: diff --git a/graphics/link_games/dodrioberry_berrysprites.png b/graphics/dodrio_berry_picking/berries.png similarity index 100% rename from graphics/link_games/dodrioberry_berrysprites.png rename to graphics/dodrio_berry_picking/berries.png diff --git a/graphics/link_games/dodrioberry_bg1.bin b/graphics/dodrio_berry_picking/bg.bin similarity index 100% rename from graphics/link_games/dodrioberry_bg1.bin rename to graphics/dodrio_berry_picking/bg.bin diff --git a/graphics/link_games/dodrioberry_bg1.pal b/graphics/dodrio_berry_picking/bg.pal similarity index 100% rename from graphics/link_games/dodrioberry_bg1.pal rename to graphics/dodrio_berry_picking/bg.pal diff --git a/graphics/link_games/dodrioberry_bg1.png b/graphics/dodrio_berry_picking/bg.png similarity index 100% rename from graphics/link_games/dodrioberry_bg1.png rename to graphics/dodrio_berry_picking/bg.png diff --git a/graphics/link_games/dodrioberry_platform.png b/graphics/dodrio_berry_picking/cloud.png similarity index 100% rename from graphics/link_games/dodrioberry_platform.png rename to graphics/dodrio_berry_picking/cloud.png diff --git a/graphics/link_games/dodrioberry_pkmn.png b/graphics/dodrio_berry_picking/dodrio.png similarity index 100% rename from graphics/link_games/dodrioberry_pkmn.png rename to graphics/dodrio_berry_picking/dodrio.png diff --git a/graphics/link_games/dodrioberry_shiny.pal b/graphics/dodrio_berry_picking/shiny.pal similarity index 100% rename from graphics/link_games/dodrioberry_shiny.pal rename to graphics/dodrio_berry_picking/shiny.pal diff --git a/graphics/link_games/dodrioberry_status.png b/graphics/dodrio_berry_picking/status.png similarity index 100% rename from graphics/link_games/dodrioberry_status.png rename to graphics/dodrio_berry_picking/status.png diff --git a/graphics/link_games/dodrioberry_bg2.pal b/graphics/dodrio_berry_picking/tree_border.pal similarity index 100% rename from graphics/link_games/dodrioberry_bg2.pal rename to graphics/dodrio_berry_picking/tree_border.pal diff --git a/graphics/link_games/dodrioberry_bg2.png b/graphics/dodrio_berry_picking/tree_border.png similarity index 100% rename from graphics/link_games/dodrioberry_bg2.png rename to graphics/dodrio_berry_picking/tree_border.png diff --git a/graphics/link_games/dodrioberry_bg2left.bin b/graphics/dodrio_berry_picking/tree_border_left.bin similarity index 100% rename from graphics/link_games/dodrioberry_bg2left.bin rename to graphics/dodrio_berry_picking/tree_border_left.bin diff --git a/graphics/link_games/dodrioberry_bg2right.bin b/graphics/dodrio_berry_picking/tree_border_right.bin similarity index 100% rename from graphics/link_games/dodrioberry_bg2right.bin rename to graphics/dodrio_berry_picking/tree_border_right.bin diff --git a/graphics/interface/naming_screen_83E1800.png b/graphics/interface/naming_screen_83E1800.png deleted file mode 100644 index a24d40836..000000000 Binary files a/graphics/interface/naming_screen_83E1800.png and /dev/null differ diff --git a/graphics/interface/naming_screen_83E18C0.png b/graphics/interface/naming_screen_83E18C0.png deleted file mode 100644 index 1985816c3..000000000 Binary files a/graphics/interface/naming_screen_83E18C0.png and /dev/null differ diff --git a/graphics/interface/naming_screen_8E985D8.png b/graphics/interface/naming_screen_8E985D8.png deleted file mode 100644 index 1e8f40983..000000000 Binary files a/graphics/interface/naming_screen_8E985D8.png and /dev/null differ diff --git a/graphics/interface/naming_screen_8E98858.png b/graphics/interface/naming_screen_8E98858.png deleted file mode 100644 index 57c434194..000000000 Binary files a/graphics/interface/naming_screen_8E98858.png and /dev/null differ diff --git a/graphics/interface/naming_screen_8E98A38.png b/graphics/interface/naming_screen_8E98A38.png deleted file mode 100644 index 51acd15d1..000000000 Binary files a/graphics/interface/naming_screen_8E98A38.png and /dev/null differ diff --git a/graphics/interface/naming_screen_8E98C18.png b/graphics/interface/naming_screen_8E98C18.png deleted file mode 100644 index 68f0637b4..000000000 Binary files a/graphics/interface/naming_screen_8E98C18.png and /dev/null differ diff --git a/graphics/interface/naming_screen_8E98CB8.png b/graphics/interface/naming_screen_8E98CB8.png deleted file mode 100644 index 741c5e589..000000000 Binary files a/graphics/interface/naming_screen_8E98CB8.png and /dev/null differ diff --git a/graphics/interface/naming_screen_8E98DF8.png b/graphics/interface/naming_screen_8E98DF8.png deleted file mode 100644 index e34896cb9..000000000 Binary files a/graphics/interface/naming_screen_8E98DF8.png and /dev/null differ diff --git a/graphics/interface/naming_screen_8E98E98.png b/graphics/interface/naming_screen_8E98E98.png deleted file mode 100644 index 45197320d..000000000 Binary files a/graphics/interface/naming_screen_8E98E98.png and /dev/null differ diff --git a/graphics/interface/naming_screen_8E98F38.png b/graphics/interface/naming_screen_8E98F38.png deleted file mode 100644 index bf1049e89..000000000 Binary files a/graphics/interface/naming_screen_8E98F38.png and /dev/null differ diff --git a/graphics/interface/naming_screen_8E98FD8.png b/graphics/interface/naming_screen_8E98FD8.png deleted file mode 100644 index 6c8fa888d..000000000 Binary files a/graphics/interface/naming_screen_8E98FD8.png and /dev/null differ diff --git a/graphics/interface/naming_screen_8E990D8.png b/graphics/interface/naming_screen_8E990D8.png deleted file mode 100644 index dd3f2a671..000000000 Binary files a/graphics/interface/naming_screen_8E990D8.png and /dev/null differ diff --git a/graphics/interface/naming_screen_8E990F8.png b/graphics/interface/naming_screen_8E990F8.png deleted file mode 100644 index 5d631ce99..000000000 Binary files a/graphics/interface/naming_screen_8E990F8.png and /dev/null differ diff --git a/graphics/naming_screen/back_button.png b/graphics/naming_screen/back_button.png new file mode 100644 index 000000000..52f76b6fa Binary files /dev/null and b/graphics/naming_screen/back_button.png differ diff --git a/graphics/interface/naming_screen_menu.bin b/graphics/naming_screen/background.bin similarity index 100% rename from graphics/interface/naming_screen_menu.bin rename to graphics/naming_screen/background.bin diff --git a/graphics/interface/naming_screen_8E980A4.pal b/graphics/naming_screen/buttons.pal similarity index 100% rename from graphics/interface/naming_screen_8E980A4.pal rename to graphics/naming_screen/buttons.pal diff --git a/graphics/interface/naming_screen_8E980C4.pal b/graphics/naming_screen/cursor.pal similarity index 100% rename from graphics/interface/naming_screen_8E980C4.pal rename to graphics/naming_screen/cursor.pal diff --git a/graphics/naming_screen/cursor.png b/graphics/naming_screen/cursor.png new file mode 100644 index 000000000..e0f5022be Binary files /dev/null and b/graphics/naming_screen/cursor.png differ diff --git a/graphics/naming_screen/cursor_filled.png b/graphics/naming_screen/cursor_filled.png new file mode 100644 index 000000000..efb5e1101 Binary files /dev/null and b/graphics/naming_screen/cursor_filled.png differ diff --git a/graphics/naming_screen/cursor_squished.png b/graphics/naming_screen/cursor_squished.png new file mode 100644 index 000000000..5126fccca Binary files /dev/null and b/graphics/naming_screen/cursor_squished.png differ diff --git a/graphics/naming_screen/input_arrow.png b/graphics/naming_screen/input_arrow.png new file mode 100644 index 000000000..0a5072673 Binary files /dev/null and b/graphics/naming_screen/input_arrow.png differ diff --git a/graphics/interface/naming_screen_8E97FE4.pal b/graphics/naming_screen/keyboard.pal similarity index 100% rename from graphics/interface/naming_screen_8E97FE4.pal rename to graphics/naming_screen/keyboard.pal diff --git a/graphics/interface/naming_screen_E98458.bin b/graphics/naming_screen/keyboard_lower.bin similarity index 100% rename from graphics/interface/naming_screen_E98458.bin rename to graphics/naming_screen/keyboard_lower.bin diff --git a/graphics/interface/naming_screen_E98518.bin b/graphics/naming_screen/keyboard_symbols.bin similarity index 100% rename from graphics/interface/naming_screen_E98518.bin rename to graphics/naming_screen/keyboard_symbols.bin diff --git a/graphics/interface/naming_screen_E98398.bin b/graphics/naming_screen/keyboard_upper.bin similarity index 100% rename from graphics/interface/naming_screen_E98398.bin rename to graphics/naming_screen/keyboard_upper.bin diff --git a/graphics/interface/naming_screen_8E98024.pal b/graphics/naming_screen/menu.pal similarity index 100% rename from graphics/interface/naming_screen_8E98024.pal rename to graphics/naming_screen/menu.pal diff --git a/graphics/interface/naming_screen_menu.png b/graphics/naming_screen/menu.png similarity index 70% rename from graphics/interface/naming_screen_menu.png rename to graphics/naming_screen/menu.png index e7c4374c7..5bdf0a3ee 100644 Binary files a/graphics/interface/naming_screen_menu.png and b/graphics/naming_screen/menu.png differ diff --git a/graphics/naming_screen/ok_button.png b/graphics/naming_screen/ok_button.png new file mode 100644 index 000000000..f8dafbf97 Binary files /dev/null and b/graphics/naming_screen/ok_button.png differ diff --git a/graphics/naming_screen/page_swap_button.png b/graphics/naming_screen/page_swap_button.png new file mode 100644 index 000000000..2e5cabed0 Binary files /dev/null and b/graphics/naming_screen/page_swap_button.png differ diff --git a/graphics/naming_screen/page_swap_frame.png b/graphics/naming_screen/page_swap_frame.png new file mode 100644 index 000000000..bc3ff122b Binary files /dev/null and b/graphics/naming_screen/page_swap_frame.png differ diff --git a/graphics/interface/naming_screen_8E98064.pal b/graphics/naming_screen/page_swap_lower.pal similarity index 100% rename from graphics/interface/naming_screen_8E98064.pal rename to graphics/naming_screen/page_swap_lower.pal diff --git a/graphics/naming_screen/page_swap_lower.png b/graphics/naming_screen/page_swap_lower.png new file mode 100644 index 000000000..5747c6265 Binary files /dev/null and b/graphics/naming_screen/page_swap_lower.png differ diff --git a/graphics/interface/naming_screen_8E98084.pal b/graphics/naming_screen/page_swap_others.pal similarity index 100% rename from graphics/interface/naming_screen_8E98084.pal rename to graphics/naming_screen/page_swap_others.pal diff --git a/graphics/interface/naming_screen_8E98D58.png b/graphics/naming_screen/page_swap_others.png similarity index 76% rename from graphics/interface/naming_screen_8E98D58.png rename to graphics/naming_screen/page_swap_others.png index 32afa5282..8b5f55ce3 100644 Binary files a/graphics/interface/naming_screen_8E98D58.png and b/graphics/naming_screen/page_swap_others.png differ diff --git a/graphics/interface/naming_screen_8E98044.pal b/graphics/naming_screen/page_swap_upper.pal similarity index 100% rename from graphics/interface/naming_screen_8E98044.pal rename to graphics/naming_screen/page_swap_upper.pal diff --git a/graphics/naming_screen/page_swap_upper.png b/graphics/naming_screen/page_swap_upper.png new file mode 100644 index 000000000..35ff51d20 Binary files /dev/null and b/graphics/naming_screen/page_swap_upper.png differ diff --git a/graphics/naming_screen/pc_icon_off.png b/graphics/naming_screen/pc_icon_off.png new file mode 100644 index 000000000..1f4c65a4e Binary files /dev/null and b/graphics/naming_screen/pc_icon_off.png differ diff --git a/graphics/naming_screen/pc_icon_on.png b/graphics/naming_screen/pc_icon_on.png new file mode 100644 index 000000000..8b9a2021e Binary files /dev/null and b/graphics/naming_screen/pc_icon_on.png differ diff --git a/graphics/interface/naming_screen_8E98004.pal b/graphics/naming_screen/rival.pal similarity index 100% rename from graphics/interface/naming_screen_8E98004.pal rename to graphics/naming_screen/rival.pal diff --git a/graphics/interface/naming_screen_83E1980.png b/graphics/naming_screen/rival.png similarity index 100% rename from graphics/interface/naming_screen_83E1980.png rename to graphics/naming_screen/rival.png diff --git a/graphics/naming_screen/underscore.png b/graphics/naming_screen/underscore.png new file mode 100644 index 000000000..58d78ce08 Binary files /dev/null and b/graphics/naming_screen/underscore.png differ diff --git a/graphics/object_events/pics/misc/town_map.png b/graphics/object_events/pics/misc/town_map.png index 1092e5695..1afb1921e 100644 Binary files a/graphics/object_events/pics/misc/town_map.png and b/graphics/object_events/pics/misc/town_map.png differ diff --git a/graphics/pokemon/icon notes b/graphics/pokemon/icon notes deleted file mode 100644 index 1af808968..000000000 --- a/graphics/pokemon/icon notes +++ /dev/null @@ -1,3 +0,0 @@ -deoxys_speed 0 -jynx 2 -poliwhirl 0 \ No newline at end of file diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index 7ac567281..d2f5ab5c6 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -29,6 +29,7 @@ BATTLETERRAINGFXDIR := graphics/battle_terrain BERRYPOUCHGFXDIR := graphics/berry_pouch HALLOFFAMEGFXDIR := graphics/hall_of_fame MAPPREVIEWGFXDIR := graphics/map_preview +NAMINGGFXDIR := graphics/naming_screen types := normal fight flying poison ground rock bug ghost steel mystery fire water grass electric psychic ice dragon dark contest_types := cool beauty cute smart tough @@ -654,3 +655,12 @@ $(MAPPREVIEWGFXDIR)/victory_road/tiles.4bpp: %.4bpp: %.png $(MAPPREVIEWGFXDIR)/viridian_forest/tiles.4bpp: %.4bpp: %.png $(GFX) $< $@ -num_tiles 389 + +$(NAMINGGFXDIR)/cursor.4bpp: %.4bpp: %.png + $(GFX) $< $@ -num_tiles 5 + +$(NAMINGGFXDIR)/cursor_squished.4bpp: %.4bpp: %.png + $(GFX) $< $@ -num_tiles 5 + +$(NAMINGGFXDIR)/cursor_filled.4bpp: %.4bpp: %.png + $(GFX) $< $@ -num_tiles 5 diff --git a/include/battle.h b/include/battle.h index b581190d6..ec98208a9 100644 --- a/include/battle.h +++ b/include/battle.h @@ -188,7 +188,7 @@ struct ProtectStruct u32 confusionSelfDmg:1; u32 targetNotAffected:1; u32 chargingTurn:1; - u32 fleeFlag:2; // for RunAway and Smoke Ball + u32 fleeType:2; // for RunAway and Smoke Ball u32 usedImprisonedMove:1; u32 loveImmobility:1; u32 usedDisabledMove:1; @@ -361,7 +361,7 @@ struct BattleResults extern struct BattleResults gBattleResults; -struct LinkPartnerHeader +struct LinkBattlerHeader { u8 versionSignatureLo; u8 versionSignatureHi; @@ -452,7 +452,7 @@ struct BattleStruct u8 field_182; // align 4 union { - struct LinkPartnerHeader linkPartnerHeader; + struct LinkBattlerHeader linkBattlerHeader; struct MultiBattlePokemonTx multiBattleMons[3]; } multiBuffer; u8 padding_1E4[0x1C]; @@ -681,8 +681,8 @@ extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; extern void (*gPreBattleCallback1)(void); extern bool8 gDoingBattleAnim; extern struct PokedudeBattlerState *gPokedudeBattlerStates[MAX_BATTLERS_COUNT]; -extern u8 *gBattleAnimMons_BgTilesBuffer; -extern u8 *gBattleAnimMons_BgTilemapBuffer; +extern u8 *gBattleAnimBgTileBuffer; +extern u8 *gBattleAnimBgTilemapBuffer; extern void (*gBattleMainFunc)(void); extern u8 gMoveSelectionCursor[MAX_BATTLERS_COUNT]; extern u32 gUnknown_2022B54; diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 12e786fc9..b473f5022 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -101,6 +101,8 @@ enum { #define INSTANT_HP_BAR_DROP 0x7FFF +#define PARTY_SUMM_SKIP_DRAW_DELAY (1 << 7) + // Special return values in gBattleBufferB from Battle Controller functions. #define RET_VALUE_LEVELED_UP 11 diff --git a/include/battle_main.h b/include/battle_main.h index 8d5e1d19d..009e0e562 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -73,10 +73,10 @@ u32 GetBattleBgTemplateData(u8 arrayId, u8 caseId); void SpriteCB_EnemyMon(struct Sprite *sprite); void SpriteCallbackDummy_2(struct Sprite *sprite); void SpriteCB_FaintOpponentMon(struct Sprite *sprite); -void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite); -void SpriteCb_HideAsMoveTarget(struct Sprite *sprite); +void SpriteCB_ShowAsMoveTarget(struct Sprite *sprite); +void SpriteCB_HideAsMoveTarget(struct Sprite *sprite); void SpriteCB_AllyMon(struct Sprite *sprite); -void SpriteCB_SetToDummy3(struct Sprite *sprite); +void SetIdleSpriteCallback(struct Sprite *sprite); void SpriteCB_FaintSlideAnim(struct Sprite *sprite); void DoBounceEffect(u8 battler, u8 which, s8 delta, s8 amplitude); void EndBounceEffect(u8 battler, u8 which); diff --git a/include/battle_util.h b/include/battle_util.h index cd0b1ab12..fe19aace0 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -9,6 +9,7 @@ #define MOVE_LIMITATION_TORMENTED (1 << 3) #define MOVE_LIMITATION_TAUNT (1 << 4) #define MOVE_LIMITATION_IMPRISON (1 << 5) +#define MOVE_LIMITATIONS_ALL 0xFF #define ABILITYEFFECT_ON_SWITCHIN 0 #define ABILITYEFFECT_ENDTURN 1 @@ -38,9 +39,12 @@ #define ABILITY_ON_FIELD(abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, abilityId, 0, 0)) #define ABILITY_ON_FIELD2(abilityId)(AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, abilityId, 0, 0)) -#define ITEMEFFECT_ON_SWITCH_IN 0x0 -#define ITEMEFFECT_MOVE_END 0x3 -#define ITEMEFFECT_KINGSROCK_SHELLBELL 0x4 +// For the first argument of ItemBattleEffects, to deteremine which block of item effects to try +#define ITEMEFFECT_ON_SWITCH_IN 0 +#define ITEMEFFECT_NORMAL 1 +#define ITEMEFFECT_DUMMY 2 // Unused, empty +#define ITEMEFFECT_MOVE_END 3 +#define ITEMEFFECT_KINGSROCK_SHELLBELL 4 #define WEATHER_HAS_EFFECT ((!AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, ABILITY_CLOUD_NINE, 0, 0) && !AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, ABILITY_AIR_LOCK, 0, 0))) #define WEATHER_HAS_EFFECT2 ((!AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_CLOUD_NINE, 0, 0) && !AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_AIR_LOCK, 0, 0))) @@ -58,7 +62,6 @@ u8 GetBattlerForBattleScript(u8 caseId); void PressurePPLose(u8 target, u8 attacker, u16 move); void PressurePPLoseOnUsingImprison(u8 attacker); void PressurePPLoseOnUsingPerishSong(u8 attacker); -void MarkAllBattlersForControllerExec(void); void MarkBattlerForControllerExec(u8 battlerId); void MarkBattlerReceivedLinkData(u8 battlerId); void CancelMultiTurnMoves(u8 battler); diff --git a/include/constants/battle.h b/include/constants/battle.h index 0b4c372a2..f628e7fed 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -316,6 +316,9 @@ #define NUM_CASTFORM_FORMS 4 #define CASTFORM_SUBSTITUTE (1 << 7) +#define FLEE_ITEM 1 +#define FLEE_ABILITY 2 + // Return value for IsRunningFromBattleImpossible. #define BATTLE_RUN_SUCCESS 0 #define BATTLE_RUN_FORBIDDEN 1 @@ -351,4 +354,7 @@ #define B_TEXT_FLAG_NPC_CONTEXT_FONT (1 << 6) #define B_TEXT_FLAG_WINDOW_CLEAR (1 << 7) +// Indicator for the party summary bar to display an empty slot. +#define HP_EMPTY_SLOT 0xFFFF + #endif // GUARD_CONSTANTS_BATTLE_H diff --git a/include/constants/event_object_movement.h b/include/constants/event_object_movement.h index 88056783e..9ab0c7801 100644 --- a/include/constants/event_object_movement.h +++ b/include/constants/event_object_movement.h @@ -79,9 +79,9 @@ #define MOVEMENT_TYPE_JOG_IN_PLACE_LEFT 0x4A #define MOVEMENT_TYPE_JOG_IN_PLACE_RIGHT 0x4B #define MOVEMENT_TYPE_INVISIBLE 0x4C -#define MOVEMENT_TYPE_VS_SEEKER_4D 0x4D -#define MOVEMENT_TYPE_VS_SEEKER_4E 0x4E -#define MOVEMENT_TYPE_VS_SEEKER_4F 0x4F +#define MOVEMENT_TYPE_RAISE_HAND_AND_STOP 0x4D +#define MOVEMENT_TYPE_RAISE_HAND_AND_JUMP 0x4E +#define MOVEMENT_TYPE_RAISE_HAND_AND_SWIM 0x4F #define MOVEMENT_TYPE_WANDER_AROUND_SLOWER 0x50 #define MOVEMENT_TYPES_COUNT 0x51 @@ -130,18 +130,18 @@ #define MOVEMENT_ACTION_WALK_IN_PLACE_FAST_UP 0x2A #define MOVEMENT_ACTION_WALK_IN_PLACE_FAST_LEFT 0x2B #define MOVEMENT_ACTION_WALK_IN_PLACE_FAST_RIGHT 0x2C -#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_DOWN 0x2D -#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_UP 0x2E -#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_LEFT 0x2F -#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_RIGHT 0x30 +#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_DOWN 0x2D +#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_UP 0x2E +#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_LEFT 0x2F +#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_RIGHT 0x30 #define MOVEMENT_ACTION_RIDE_WATER_CURRENT_DOWN 0x31 #define MOVEMENT_ACTION_RIDE_WATER_CURRENT_UP 0x32 #define MOVEMENT_ACTION_RIDE_WATER_CURRENT_LEFT 0x33 #define MOVEMENT_ACTION_RIDE_WATER_CURRENT_RIGHT 0x34 -#define MOVEMENT_ACTION_WALK_FASTEST_DOWN 0x35 -#define MOVEMENT_ACTION_WALK_FASTEST_UP 0x36 -#define MOVEMENT_ACTION_WALK_FASTEST_LEFT 0x37 -#define MOVEMENT_ACTION_WALK_FASTEST_RIGHT 0x38 +#define MOVEMENT_ACTION_WALK_FASTER_DOWN 0x35 +#define MOVEMENT_ACTION_WALK_FASTER_UP 0x36 +#define MOVEMENT_ACTION_WALK_FASTER_LEFT 0x37 +#define MOVEMENT_ACTION_WALK_FASTER_RIGHT 0x38 #define MOVEMENT_ACTION_SLIDE_DOWN 0x39 #define MOVEMENT_ACTION_SLIDE_UP 0x3A #define MOVEMENT_ACTION_SLIDE_LEFT 0x3B @@ -240,18 +240,18 @@ #define MOVEMENT_ACTION_SPIN_UP 0x95 #define MOVEMENT_ACTION_SPIN_LEFT 0x96 #define MOVEMENT_ACTION_SPIN_RIGHT 0x97 -#define MOVEMENT_ACTION_0x98 0x98 -#define MOVEMENT_ACTION_0x99 0x99 -#define MOVEMENT_ACTION_0x9A 0x9A +#define MOVEMENT_ACTION_RAISE_HAND_AND_STOP 0x98 +#define MOVEMENT_ACTION_RAISE_HAND_AND_JUMP 0x99 +#define MOVEMENT_ACTION_RAISE_HAND_AND_SWIM 0x9A #define MOVEMENT_ACTION_WALK_SLOWEST_DOWN 0x9B #define MOVEMENT_ACTION_WALK_SLOWEST_UP 0x9C #define MOVEMENT_ACTION_WALK_SLOWEST_LEFT 0x9D #define MOVEMENT_ACTION_WALK_SLOWEST_RIGHT 0x9E #define MOVEMENT_ACTION_SHAKE_HEAD_OR_WALK_IN_PLACE 0x9F -#define MOVEMENT_ACTION_0xA0 0xA0 -#define MOVEMENT_ACTION_0xA1 0xA1 -#define MOVEMENT_ACTION_0xA2 0xA2 -#define MOVEMENT_ACTION_0xA3 0xA3 +#define MOVEMENT_ACTION_GLIDE_DOWN 0xA0 +#define MOVEMENT_ACTION_GLIDE_UP 0xA1 +#define MOVEMENT_ACTION_GLIDE_LEFT 0xA2 +#define MOVEMENT_ACTION_GLIDE_RIGHT 0xA3 #define MOVEMENT_ACTION_FLY_UP 0xA4 #define MOVEMENT_ACTION_FLY_DOWN 0xA5 #define MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_DOWN 0xA6 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/constants/pokemon.h b/include/constants/pokemon.h index dbea7dff5..8e59604d7 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -224,7 +224,6 @@ #define EV_ITEM_RAISE_LIMIT 100 #define PARTY_SIZE 6 -#define UNOWN_FORM_COUNT 28 #define BOX_NAME_LENGTH 8 #define EVO_MODE_NORMAL 0 diff --git a/include/constants/vars.h b/include/constants/vars.h index bb301609d..0db01238c 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -334,4 +334,11 @@ #define SPECIAL_VARS_END 0x8014 +// Text color ids for VAR_TEXT_COLOR / VAR_PREV_TEXT_COLOR +#define NPC_TEXT_COLOR_MALE 0 // Blue, for male NPCs +#define NPC_TEXT_COLOR_FEMALE 1 // Red, for female NPCs +#define NPC_TEXT_COLOR_MON 2 // Black, for Pokémon +#define NPC_TEXT_COLOR_NEUTRAL 3 // Black, for inanimate objects and messages from the game +#define NPC_TEXT_COLOR_DEFAULT 255 // If an NPC is selected, use the color specified by GetColorFromTextColorTable, otherwise use Neutral. + #endif // GUARD_CONSTANTS_VARS_H diff --git a/include/data.h b/include/data.h index 55eda56a4..6fb3bcab2 100644 --- a/include/data.h +++ b/include/data.h @@ -16,10 +16,6 @@ struct MonCoords extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; extern const u8 gMoveNames[][13]; -extern const u16 gUnknown_8251CB8[]; -extern const u16 gUnknown_8251FEE[]; -extern const u16 gUnknown_8252324[]; -extern const u16 gUnknown_82539D4[]; extern const u8 gTrainerClassNames[][13]; @@ -32,6 +28,7 @@ extern const struct CompressedSpritePalette gMonShinyPaletteTable[]; extern const union AnimCmd *const *const gTrainerFrontAnimsPtrTable[]; extern const struct MonCoords gTrainerFrontPicCoords[]; extern const struct CompressedSpriteSheet gTrainerFrontPicTable[]; +extern const struct CompressedSpriteSheet gTrainerBackPicTable[]; extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; extern const union AnimCmd *const *const gTrainerBackAnimsPtrTable[]; extern const struct MonCoords gTrainerBackPicCoords[]; @@ -45,15 +42,13 @@ extern const u8 gEnemyMonElevation[NUM_SPECIES]; extern const u8 *const gBattleAnims_General[]; extern const u8 *const gBattleAnims_Special[]; -extern const struct OamData gUnknown_824F010; -extern const struct OamData gUnknown_824F018; -extern const union AnimCmd *const gSpriteAnimTable_82349BC[]; -extern const union AffineAnimCmd *const gSpriteAffineAnimTable_BattlerPlayer[]; -extern const union AffineAnimCmd *const gSpriteAffineAnimTable_BattlerOpponent[]; -extern const struct SpriteFrameImage gSpriteImages_BattlerPlayerLeft[]; -extern const struct SpriteFrameImage gSpriteImages_BattlerOpponentLeft[]; -extern const struct SpriteFrameImage gSpriteImages_BattlerPlayerRight[]; -extern const struct SpriteFrameImage gSpriteImages_BattlerOpponentRight[]; +extern const union AnimCmd *const gAnims_MonPic[]; +extern const union AffineAnimCmd *const gAffineAnims_BattleSpritePlayerSide[]; +extern const union AffineAnimCmd *const gAffineAnims_BattleSpriteOpponentSide[]; +extern const struct SpriteFrameImage gBattlerPicTable_PlayerLeft[]; +extern const struct SpriteFrameImage gBattlerPicTable_OpponentLeft[]; +extern const struct SpriteFrameImage gBattlerPicTable_PlayerRight[]; +extern const struct SpriteFrameImage gBattlerPicTable_OpponentRight[]; extern const struct SpriteFrameImage gTrainerBackPicTable_Red[]; extern const struct SpriteFrameImage gTrainerBackPicTable_Leaf[]; extern const struct SpriteFrameImage gTrainerBackPicTable_Pokedude[]; diff --git a/include/dodrio_berry_picking.h b/include/dodrio_berry_picking.h index 26aa51023..b075910c1 100644 --- a/include/dodrio_berry_picking.h +++ b/include/dodrio_berry_picking.h @@ -1,106 +1,64 @@ #ifndef GUARD_DODRIO_BERRY_PICKING_H #define GUARD_DODRIO_BERRY_PICKING_H -struct DodrioSubstruct_0160 -{ - /*0x0000 : 0x3000*/ u16 ALIGNED(4) tilemapBuffers[3][BG_SCREEN_SIZE]; - /*0x3000 : 0x3160*/ bool32 finished; - /*0x3004 : 0x3164*/ u8 ALIGNED(4) unk3004; - /*0x3008 : 0x3168*/ u8 ALIGNED(4) unk3008[10]; - /*0x3014 : 0x3174*/ u8 ALIGNED(4) state; - /*0x3018 : 0x3178*/ u8 ALIGNED(4) unk3018; - /*0x301C : 0x317C*/ u16 ALIGNED(4) unk301C; - /*0x3020 : 0x3180*/ u8 ALIGNED(4) unk3020; - /*0x3024 : 0x3184*/ u8 ALIGNED(4) unk3024; - /*0x3024 : 0x3184*/ void (*unk3028)(void); -}; // size = 0x302C +// Berries fall in predefined columns. +// A total of 10 are available, though fewer will be used with < 5 players +// The 11th column is a repeat of the 1st column wrapped around, so only +// the values 0-9 are unique 'valid' columns +#define NUM_BERRY_COLUMNS 11 -struct DodrioSubstruct_318C +struct DodrioGame_Berries { - bool8 isShiny; + u8 ids[NUM_BERRY_COLUMNS]; + u8 fallDist[NUM_BERRY_COLUMNS]; }; -struct DodrioSubstruct_31A0_14 +struct DodrioGame_PlayerCommData { - u8 unk0[11]; - u8 unkB[11]; + u8 pickState; + bool8 ALIGNED(4) ateBerry; + bool8 ALIGNED(4) missedBerry; }; -struct DodrioSubstruct_31A0_2C +struct DodrioGame_Player { - u8 unk0; - u8 ALIGNED(4) unk4; - u8 ALIGNED(4) unk8; -}; - -struct DodrioSubstruct_31A0 -{ - u8 name[0x10]; - u32 unk10; - struct DodrioSubstruct_31A0_14 unk14; - struct DodrioSubstruct_31A0_2C unk2C; - u8 filler_35[4]; + u8 name[16]; + bool32 receivedGameStatePacket; // Never read + struct DodrioGame_Berries berries; + struct DodrioGame_PlayerCommData comm; + u32 unused; }; // size = 0x3C -struct DodrioSubstruct_3308 -{ - u8 unk0; - u32 unk4; -}; - -void StartDodrioBerryPicking(u16 species, MainCallback callback); - -u32 sub_815A950(u32 unused, struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 *arg6, u32 *arg7, u32 *arg8); -u32 sub_815AB04(u32 arg0, u8 *arg1); -bool32 sub_815AB60(u32 a0); -void sub_815A61C(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 arg6, u32 arg7, u32 arg8); -void sub_815A5BC(s32 a0); -void sub_815AAD8(u8 a0); -void sub_815AB3C(u32 a0); -u8 sub_815A5E8(s32 a0); -u32 IncrementWithLimit(u32, u32); -void sub_8153A9C(void); -void sub_8153AFC(struct DodrioSubstruct_318C * unk318C, u8 a1, u8 a2, u8 a3); -void sub_8153BC0(u8 a0); -void sub_8153BF8(u8 a0); -void sub_8153D08(u8 playerCount); -u8 sub_8155E8C(void); -u8 sub_81533B4(void); -void sub_8153DA8(u8 a0, u8 a1); -void sub_8153D80(bool8 a0, u8 a1); -void sub_8153FC8(u8 a0); -void sub_8153DD8(void); -void sub_8153E28(void); -void sub_8153ED8(void); -bool32 sub_8153F1C(void); -void sub_81540DC(bool8 a0); -void sub_8154128(void); -void sub_815417C(void); -void sub_8154274(void); -void sub_81542EC(u8 a0, u8 a1); -void sub_8154370(u8 a0, u8 a1); -void sub_8154398(u16 a0, u8 a1); -void sub_8154438(void); -void sub_81544F0(void); -void sub_8154540(void); -void sub_8154578(void); -void sub_81545BC(bool8 a0); -void sub_81546C0(void); -void sub_8154730(void); -void sub_8154968(struct DodrioSubstruct_0160 * unk0160); -void sub_81549D4(u8 a0); -u8 *sub_81533C4(u8 id); -u8 sub_81537AC(u8 id); -void sub_81536A0(struct DodrioSubstruct_3308 *dst, u8 id); -u32 sub_81534AC(void); -u32 Min(u32 x, u32 y); -u16 sub_8153404(u8 arg0, u8 arg1); -u32 sub_81534F0(u8 arg0); -u32 sub_81535B0(void); -u16 sub_8153390(void); -u8 sub_815372C(void); -bool32 sub_8155E68(void); +// dodrio_berry_picking.c +void StartDodrioBerryPicking(u16 partyId, MainCallback exitCallback); void ShowDodrioBerryPickingRecords(void); void IsDodrioInParty(void); +// dodrio_berry_picking_comm.c +void SendPacket_ReadyToStart(bool32 ready); +bool8 RecvPacket_ReadyToStart(s32 playerId); +void SendPacket_GameState(struct DodrioGame_Player *player, + struct DodrioGame_PlayerCommData *player1, + struct DodrioGame_PlayerCommData *player2, + struct DodrioGame_PlayerCommData *player3, + struct DodrioGame_PlayerCommData *player4, + struct DodrioGame_PlayerCommData *player5, + u8 numGraySquares, + bool32 berriesFalling, + bool32 allReadyToEnd); +bool32 RecvPacket_GameState(u32 playerId, + struct DodrioGame_Player *player, + struct DodrioGame_PlayerCommData *player1, + struct DodrioGame_PlayerCommData *player2, + struct DodrioGame_PlayerCommData *player3, + struct DodrioGame_PlayerCommData *player4, + struct DodrioGame_PlayerCommData *player5, + u8 *numGraySquares, + bool32 *berriesFalling, + bool32 *allReadyToEnd); +void SendPacket_PickState(u8 pickState); +bool32 RecvPacket_PickState(u32 playerId, u8 *pickState); +void SendPacket_ReadyToEnd(bool32 readyToEnd); +bool32 RecvPacket_ReadyToEnd(u32 playerId); + #endif //GUARD_DODRIO_BERRY_PICKING_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/graphics.h b/include/graphics.h index add2653d4..f26373307 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4902,26 +4902,26 @@ extern const u32 gEasyChatSelectGroupHelp_Tiles[]; extern const u32 gEasyChatModeIcons_Tiles[]; // naming_screen -extern const u32 gUnknown_8E982BC[]; -extern const u32 gUnknown_8E98458[]; -extern const u32 gUnknown_8E98398[]; -extern const u32 gUnknown_8E98518[]; +extern const u32 gNamingScreenBackground_Tilemap[]; +extern const u32 gNamingScreenKeyboardLower_Tilemap[]; +extern const u32 gNamingScreenKeyboardUpper_Tilemap[]; +extern const u32 gNamingScreenKeyboardSymbols_Tilemap[]; extern const u32 gNamingScreenMenu_Gfx[]; -extern const u16 gUnknown_8E98004[]; -extern const u16 gUnknown_8E97FE4[]; -extern const u16 gNamingScreenMenu_Pal[]; -extern const u16 gUnknown_8E98858[]; -extern const u16 gUnknown_8E98A38[]; -extern const u16 gUnknown_8E985D8[]; -extern const u16 gUnknown_8E98FD8[]; -extern const u16 gUnknown_8E98C18[]; -extern const u16 gUnknown_8E98CB8[]; -extern const u16 gUnknown_8E98D58[]; -extern const u16 gUnknown_8E98DF8[]; -extern const u16 gUnknown_8E98E98[]; -extern const u16 gUnknown_8E98F38[]; -extern const u16 gUnknown_8E990D8[]; -extern const u16 gUnknown_8E990F8[]; +extern const u16 gNamingScreenRival_Pal[]; +extern const u16 gNamingScreenKeyboard_Pal[]; +extern const u16 gNamingScreenMenu_Pal[6][16]; +extern const u16 gNamingScreenBackButton_Gfx[]; +extern const u16 gNamingScreenOKButton_Gfx[]; +extern const u16 gNamingScreenPageSwapFrame_Gfx[]; +extern const u16 gNamingScreenPageSwapButton_Gfx[]; +extern const u16 gNamingScreenPageSwapUpper_Gfx[]; +extern const u16 gNamingScreenPageSwapLower_Gfx[]; +extern const u16 gNamingScreenPageSwapOthers_Gfx[]; +extern const u16 gNamingScreenCursor_Gfx[]; +extern const u16 gNamingScreenCursorSquished_Gfx[]; +extern const u16 gNamingScreenCursorFilled_Gfx[]; +extern const u16 gNamingScreenInputArrow_Gfx[]; +extern const u16 gNamingScreenUnderscore_Gfx[]; // pokemon_storage_system extern const u32 gPSSMenu_Gfx[]; diff --git a/include/naming_screen.h b/include/naming_screen.h index 1e8d11b3a..b03c6cebf 100644 --- a/include/naming_screen.h +++ b/include/naming_screen.h @@ -6,7 +6,7 @@ #define NAMING_SCREEN_PLAYER 0 #define NAMING_SCREEN_BOX 1 #define NAMING_SCREEN_CAUGHT_MON 2 -#define NAMING_SCREEN_NAME_RATER 3 +#define NAMING_SCREEN_NICKNAME 3 #define NAMING_SCREEN_RIVAL 4 void DoNamingScreen(u8 templateNum, u8 *destBuffer, u16 monSpecies, u16 monGender, u32 monPersonality, MainCallback returnCallback); 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/pokemon.h b/include/pokemon.h index 0c5657f24..29ed66072 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -314,6 +314,15 @@ struct Evolution #define EVOS_PER_MON 5 +#define NUM_UNOWN_FORMS 28 + +#define GET_UNOWN_LETTER(personality) (( \ + (((personality) & 0x03000000) >> 18) \ + | (((personality) & 0x00030000) >> 12) \ + | (((personality) & 0x00000300) >> 6) \ + | (((personality) & 0x00000003) >> 0) \ +) % NUM_UNOWN_FORMS) + extern u8 gPlayerPartyCount; extern struct Pokemon gPlayerParty[PARTY_SIZE]; extern u8 gEnemyPartyCount; diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index aee4c27be..e4be91f1f 100644 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -3,8 +3,8 @@ #include "main.h" -extern const u8 * const gMoveDescriptionPointers[]; -extern const u8 * const gNatureNamePointers[]; +extern const u8 *const gMoveDescriptionPointers[]; +extern const u8 *const gNatureNamePointers[]; void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16); u8 GetMoveSlotToReplace(void); 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/ld_script.txt b/ld_script.txt index 2ea2d0cfd..09e230ed6 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -292,10 +292,9 @@ SECTIONS { src/text_window.o(.text); src/quest_log_player.o(.text); src/dodrio_berry_picking.o(.text); - src/dodrio_berry_picking_2.o(.text); src/battle_controller_pokedude.o(.text); src/quest_log_objects.o(.text); - src/dodrio_berry_picking_3.o(.text); + src/dodrio_berry_picking_comm.o(.text); src/teachy_tv.o(.text); src/ereader_helpers.o(.text); src/digit_obj_util.o(.text); @@ -590,7 +589,6 @@ SECTIONS { src/text_window_graphics.o(.rodata); src/quest_log_player.o(.rodata); src/dodrio_berry_picking.o(.rodata); - src/dodrio_berry_picking_2.o(.rodata); src/battle_controller_pokedude.o(.rodata); src/teachy_tv.o(.rodata); src/digit_obj_util.o(.rodata); diff --git a/spritesheet_rules.mk b/spritesheet_rules.mk index 7b08dd1e0..24c3b1b20 100644 --- a/spritesheet_rules.mk +++ b/spritesheet_rules.mk @@ -13,6 +13,9 @@ $(OBJEVENTGFXDIR)/misc/surf_blob.4bpp: %.4bpp: %.png $(OBJEVENTGFXDIR)/misc/ss_anne.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 8 -mheight 4 +$(OBJEVENTGFXDIR)/misc/town_map.4bpp: %.4bpp: %.png + $(GFX) $< $@ -mwidth 2 -mheight 2 + $(OBJEVENTGFXDIR)/people/agatha.4bpp: %.4bpp: %.png $(GFX) $< $@ -mwidth 2 -mheight 4 diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index fa59a20c9..81536395c 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -9,13 +9,6 @@ #include "util.h" #include "constants/battle_anim.h" -#define GET_UNOWN_LETTER(personality) (( \ - (((personality & 0x03000000) >> 24) << 6) \ - | (((personality & 0x00030000) >> 16) << 4) \ - | (((personality & 0x00000300) >> 8) << 2) \ - | (((personality & 0x00000003) >> 0) << 0) \ -) % 28) - #define IS_DOUBLE_BATTLE() (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) static u8 GetBattlerSpriteFinal_Y(u8 battlerId, u16 species, bool8 a3); @@ -811,8 +804,8 @@ bool8 IsDoubleBattle(void) void GetBattleAnimBg1Data(struct BattleAnimBgData *animBgData) { - animBgData->bgTiles = gBattleAnimMons_BgTilesBuffer; - animBgData->bgTilemap = (u16 *)gBattleAnimMons_BgTilemapBuffer; + animBgData->bgTiles = gBattleAnimBgTileBuffer; + animBgData->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; animBgData->paletteId = 8; animBgData->bgId = 1; animBgData->tilesOffset = 0x200; @@ -827,8 +820,8 @@ void GetBattleAnimBgData(struct BattleAnimBgData *animBgData, u32 bgId) } else { - animBgData->bgTiles = gBattleAnimMons_BgTilesBuffer; - animBgData->bgTilemap = (u16 *)gBattleAnimMons_BgTilemapBuffer; + animBgData->bgTiles = gBattleAnimBgTileBuffer; + animBgData->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; animBgData->paletteId = 9; animBgData->bgId = 2; animBgData->tilesOffset = 0x300; @@ -838,8 +831,8 @@ void GetBattleAnimBgData(struct BattleAnimBgData *animBgData, u32 bgId) void GetBattleAnimBgDataByPriorityRank(struct BattleAnimBgData *animBgData, u8 unused) { - animBgData->bgTiles = gBattleAnimMons_BgTilesBuffer; - animBgData->bgTilemap = (u16 *)gBattleAnimMons_BgTilemapBuffer; + animBgData->bgTiles = gBattleAnimBgTileBuffer; + animBgData->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; if (GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) == 1) { animBgData->paletteId = 8; @@ -869,9 +862,9 @@ void InitBattleAnimBg(u32 bgId) void AnimLoadCompressedBgGfx(u32 bgId, const u32 *src, u32 tilesOffset) { - CpuFill32(0, gBattleAnimMons_BgTilesBuffer, 0x2000); - LZDecompressWram(src, gBattleAnimMons_BgTilesBuffer); - LoadBgTiles(bgId, gBattleAnimMons_BgTilesBuffer, 0x2000, tilesOffset); + CpuFill32(0, gBattleAnimBgTileBuffer, 0x2000); + LZDecompressWram(src, gBattleAnimBgTileBuffer); + LoadBgTiles(bgId, gBattleAnimBgTileBuffer, 0x2000, tilesOffset); } void InitAnimBgTilemapBuffer(u32 bgId, const void *src) diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 16c812fb0..2ebffdc77 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -337,7 +337,7 @@ static void HandleInputChooseTarget(void) if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_HideAsMoveTarget; BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX); PlayerBufferExecCompleted(); @@ -345,7 +345,7 @@ static void HandleInputChooseTarget(void) else if (JOY_NEW(B_BUTTON)) { PlaySE(SE_SELECT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_HideAsMoveTarget; gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1); DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1); @@ -354,7 +354,7 @@ static void HandleInputChooseTarget(void) else if (JOY_NEW(DPAD_LEFT | DPAD_UP)) { PlaySE(SE_SELECT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_HideAsMoveTarget; do { @@ -389,12 +389,12 @@ static void HandleInputChooseTarget(void) i = 0; } while (i == 0); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_ShowAsMoveTarget; } else if (JOY_NEW(DPAD_RIGHT | DPAD_DOWN)) { PlaySE(SE_SELECT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_HideAsMoveTarget; do { @@ -429,7 +429,7 @@ static void HandleInputChooseTarget(void) i = 0; } while (i == 0); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_ShowAsMoveTarget; } } @@ -496,7 +496,7 @@ void HandleInputChooseMove(void) gMultiUsePlayerCursor = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); else gMultiUsePlayerCursor = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_ShowAsMoveTarget; } } else if (JOY_NEW(B_BUTTON)) diff --git a/src/battle_controllers.c b/src/battle_controllers.c index f259903e7..205c49362 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -1100,13 +1100,13 @@ void BtlController_EmitIntroTrainerBallThrow(u8 bufferId) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 param) +void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 flags) { s32 i; sBattleBuffersTransferData[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; - sBattleBuffersTransferData[1] = param & 0x7F; - sBattleBuffersTransferData[2] = (param & 0x80) >> 7; + sBattleBuffersTransferData[1] = flags & ~PARTY_SUMM_SKIP_DRAW_DELAY; // If true, skip player side + sBattleBuffersTransferData[2] = (flags & PARTY_SUMM_SKIP_DRAW_DELAY) >> 7; // If true, skip delay after drawing. True during intro sBattleBuffersTransferData[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY; for (i = 0; i < (s32)(sizeof(struct HpAndStatus) * PARTY_SIZE); ++i) sBattleBuffersTransferData[4 + i] = *(i + (u8 *)(hpAndStatus)); diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 88334ba9c..327253c04 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -140,7 +140,7 @@ void SpriteCB_WaitForBattlerBallReleaseAnim(struct Sprite *sprite) gSprites[spriteId].animPaused = 0; else if (gSprites[spriteId].animEnded) { - gSprites[spriteId].callback = SpriteCB_SetToDummy3; + gSprites[spriteId].callback = SetIdleSpriteCallback; StartSpriteAffineAnim(&gSprites[spriteId], 0); sprite->callback = SpriteCallbackDummy; } diff --git a/src/battle_interface.c b/src/battle_interface.c index d0713bda1..57130c9ee 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1137,8 +1137,9 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, { if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - if (partyInfo[i].hp == 0xFFFF) // empty slot or an egg + if (partyInfo[i].hp == HP_EMPTY_SLOT) { + // empty slot or an egg gSprites[ballIconSpritesIds[i]].oam.tileNum += 1; gSprites[ballIconSpritesIds[i]].data[7] = 1; } @@ -1153,17 +1154,20 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, } else { - if (i >= nValidMons) // empty slot or an egg + if (i >= nValidMons) { + // empty slot or an egg gSprites[ballIconSpritesIds[i]].oam.tileNum += 1; gSprites[ballIconSpritesIds[i]].data[7] = 1; } - else if (partyInfo[i].hp == 0) // fainted mon + else if (partyInfo[i].hp == 0) { + // fainted mon gSprites[ballIconSpritesIds[i]].oam.tileNum += 3; } - else if (partyInfo[i].status != 0) // mon with major status + else if (partyInfo[i].status != 0) { + // mon with major status gSprites[ballIconSpritesIds[i]].oam.tileNum += 2; } } @@ -1175,17 +1179,20 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, { if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - if (partyInfo[i].hp == 0xFFFF) // empty slot or an egg + if (partyInfo[i].hp == HP_EMPTY_SLOT) { + // empty slot or an egg gSprites[ballIconSpritesIds[5 - i]].oam.tileNum += 1; gSprites[ballIconSpritesIds[5 - i]].data[7] = 1; } - else if (partyInfo[i].hp == 0) // fainted mon + else if (partyInfo[i].hp == 0) { + // fainted mon gSprites[ballIconSpritesIds[5 - i]].oam.tileNum += 3; } - else if (partyInfo[i].status != 0) // mon with major status + else if (partyInfo[i].status != 0) { + // mon with major status gSprites[ballIconSpritesIds[5 - i]].oam.tileNum += 2; } } diff --git a/src/battle_main.c b/src/battle_main.c index 710463543..681230482 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -79,9 +79,9 @@ static void SpriteCB_MoveWildMonToRight(struct Sprite *sprite); static void SpriteCB_WildMonShowHealthbox(struct Sprite *sprite); static void SpriteCB_Unused_8011E28_Step(struct Sprite *sprite); static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite); -static void SpriteCb_BlinkVisible(struct Sprite *sprite); +static void SpriteCB_BlinkVisible(struct Sprite *sprite); static void oac_poke_ally_(struct Sprite *sprite); -static void SpriteCallbackDummy3(struct Sprite *sprite); +static void SpriteCB_Idle(struct Sprite *sprite); static void SpriteCB_BounceEffect(struct Sprite *sprite); static void SpriteCB_PlayerThrowUpdate(struct Sprite *sprite); static void BattleStartClearSetData(void); @@ -125,13 +125,18 @@ EWRAM_DATA u8 gDisplayedStringBattle[300] = {0}; EWRAM_DATA u8 gBattleTextBuff1[TEXT_BUFF_ARRAY_COUNT] = {0}; EWRAM_DATA u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT] = {0}; EWRAM_DATA u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT] = {0}; -static EWRAM_DATA u32 gUnknown_2022AE8[25] = {0}; // Note: This shouldn't be removed without adjusting the size of gDisplayedStringBattle. +// The below array is never intentionally used. However, Brock's +// defeat text (PewterCity_Gym_Text_BrockDefeat) is too long +// for gDisplayedStringBattle and overflows into this array. If it +// is removed (and none of the buffers above are increased in size) +// it will instead overflow into useful data. +static EWRAM_DATA u32 sFlickerArray[25] = {0}; EWRAM_DATA u32 gBattleTypeFlags = 0; EWRAM_DATA u8 gBattleTerrain = 0; EWRAM_DATA u32 gUnknown_2022B54 = 0; EWRAM_DATA struct MultiBattlePokemonTx gMultiPartnerParty[3] = {0}; -EWRAM_DATA u8 *gBattleAnimMons_BgTilesBuffer = NULL; -EWRAM_DATA u8 *gBattleAnimMons_BgTilemapBuffer = NULL; +EWRAM_DATA u8 *gBattleAnimBgTileBuffer = NULL; +EWRAM_DATA u8 *gBattleAnimBgTilemapBuffer = NULL; static EWRAM_DATA u16 *sUnknownDebugSpriteDataBuffer = NULL; EWRAM_DATA u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200] = {0}; EWRAM_DATA u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200] = {0}; @@ -178,7 +183,7 @@ EWRAM_DATA u8 gLastHitBy[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u16 gChosenMoveByBattler[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u8 gMoveResultFlags = 0; EWRAM_DATA u32 gHitMarker = 0; -static EWRAM_DATA u8 gUnknown_2023DD4[MAX_BATTLERS_COUNT] = {0}; +static EWRAM_DATA u8 sUnusedBattlersArray[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u8 gTakenDmgByBattler[MAX_BATTLERS_COUNT] = {0}; EWRAM_DATA u8 gUnknown_2023DDC = 0; EWRAM_DATA u16 gSideStatuses[2] = {0}; @@ -425,188 +430,188 @@ const u8 gTypeEffectiveness[336] = TYPE_ENDTABLE, TYPE_ENDTABLE, TYPE_MUL_NO_EFFECT }; -const u8 gTypeNames[][TYPE_NAME_LENGTH + 1] = +const u8 gTypeNames[NUMBER_OF_MON_TYPES][TYPE_NAME_LENGTH + 1] = { - _("NORMAL"), - _("FIGHT"), - _("FLYING"), - _("POISON"), - _("GROUND"), - _("ROCK"), - _("BUG"), - _("GHOST"), - _("STEEL"), - _("???"), - _("FIRE"), - _("WATER"), - _("GRASS"), - _("ELECTR"), - _("PSYCHC"), - _("ICE"), - _("DRAGON"), - _("DARK"), + [TYPE_NORMAL] = _("NORMAL"), + [TYPE_FIGHTING] = _("FIGHT"), + [TYPE_FLYING] = _("FLYING"), + [TYPE_POISON] = _("POISON"), + [TYPE_GROUND] = _("GROUND"), + [TYPE_ROCK] = _("ROCK"), + [TYPE_BUG] = _("BUG"), + [TYPE_GHOST] = _("GHOST"), + [TYPE_STEEL] = _("STEEL"), + [TYPE_MYSTERY] = _("???"), + [TYPE_FIRE] = _("FIRE"), + [TYPE_WATER] = _("WATER"), + [TYPE_GRASS] = _("GRASS"), + [TYPE_ELECTRIC] = _("ELECTR"), + [TYPE_PSYCHIC] = _("PSYCHC"), + [TYPE_ICE] = _("ICE"), + [TYPE_DRAGON] = _("DRAGON"), + [TYPE_DARK] = _("DARK"), }; // This is a factor in how much money you get for beating a trainer. const struct TrainerMoney gTrainerMoneyTable[] = { - { TRAINER_CLASS_LEADER, 25 }, - { TRAINER_CLASS_ELITE_FOUR, 25 }, - { TRAINER_CLASS_PKMN_PROF, 25 }, - { TRAINER_CLASS_RIVAL_EARLY, 4 }, - { TRAINER_CLASS_RIVAL_LATE, 9 }, - { TRAINER_CLASS_CHAMPION, 25 }, - { TRAINER_CLASS_YOUNGSTER, 4 }, - { TRAINER_CLASS_BUG_CATCHER, 3 }, - { TRAINER_CLASS_HIKER, 9 }, - { TRAINER_CLASS_BIRD_KEEPER, 6 }, - { TRAINER_CLASS_PICNICKER, 5 }, - { TRAINER_CLASS_SUPER_NERD, 6 }, - { TRAINER_CLASS_FISHERMAN, 9 }, - { TRAINER_CLASS_TEAM_ROCKET, 8 }, - { TRAINER_CLASS_LASS, 4 }, - { TRAINER_CLASS_BEAUTY, 18 }, - { TRAINER_CLASS_BLACK_BELT, 6 }, - { TRAINER_CLASS_CUE_BALL, 6 }, - { TRAINER_CLASS_CHANNELER, 8 }, - { TRAINER_CLASS_ROCKER, 6 }, - { TRAINER_CLASS_GENTLEMAN, 18 }, - { TRAINER_CLASS_BURGLAR, 22 }, - { TRAINER_CLASS_SWIMMER_M, 1 }, - { TRAINER_CLASS_ENGINEER, 12 }, - { TRAINER_CLASS_JUGGLER, 10 }, - { TRAINER_CLASS_SAILOR, 8 }, - { TRAINER_CLASS_COOLTRAINER, 9 }, - { TRAINER_CLASS_POKEMANIAC, 12 }, - { TRAINER_CLASS_TAMER, 10 }, - { TRAINER_CLASS_CAMPER, 5 }, - { TRAINER_CLASS_PSYCHIC, 5 }, - { TRAINER_CLASS_BIKER, 5 }, - { TRAINER_CLASS_GAMER, 18 }, - { TRAINER_CLASS_SCIENTIST, 12 }, - { TRAINER_CLASS_CRUSH_GIRL, 6 }, - { TRAINER_CLASS_TUBER, 1 }, - { TRAINER_CLASS_PKMN_BREEDER, 7 }, - { TRAINER_CLASS_PKMN_RANGER, 9 }, - { TRAINER_CLASS_AROMA_LADY, 7 }, - { TRAINER_CLASS_RUIN_MANIAC, 12 }, - { TRAINER_CLASS_LADY, 50 }, - { TRAINER_CLASS_PAINTER, 4 }, - { TRAINER_CLASS_TWINS, 3 }, - { TRAINER_CLASS_YOUNG_COUPLE, 7 }, - { TRAINER_CLASS_SIS_AND_BRO, 1 }, - { TRAINER_CLASS_COOL_COUPLE, 6 }, - { TRAINER_CLASS_CRUSH_KIN, 6 }, - { TRAINER_CLASS_SWIMMER_F, 1 }, - { TRAINER_CLASS_PLAYER, 1 }, - { TRAINER_CLASS_RS_LEADER, 25 }, - { TRAINER_CLASS_RS_ELITE_FOUR, 25 }, - { TRAINER_CLASS_RS_LASS, 4 }, - { TRAINER_CLASS_RS_YOUNGSTER, 4 }, - { TRAINER_CLASS_PKMN_TRAINER, 15 }, - { TRAINER_CLASS_RS_HIKER, 10 }, - { TRAINER_CLASS_RS_BEAUTY, 20 }, - { TRAINER_CLASS_RS_FISHERMAN, 10 }, - { TRAINER_CLASS_RS_LADY, 50 }, - { TRAINER_CLASS_TRIATHLETE, 10 }, - { TRAINER_CLASS_TEAM_AQUA, 5 }, - { TRAINER_CLASS_RS_TWINS, 3 }, - { TRAINER_CLASS_RS_SWIMMER_F, 2 }, - { TRAINER_CLASS_RS_BUG_CATCHER, 4 }, - { TRAINER_CLASS_SCHOOL_KID, 5 }, - { TRAINER_CLASS_RICH_BOY, 50 }, - { TRAINER_CLASS_SR_AND_JR, 4 }, - { TRAINER_CLASS_RS_BLACK_BELT, 8 }, - { TRAINER_CLASS_RS_TUBER_F, 1 }, - { TRAINER_CLASS_HEX_MANIAC, 6 }, - { TRAINER_CLASS_RS_PKMN_BREEDER, 10 }, - { TRAINER_CLASS_TEAM_MAGMA, 5 }, - { TRAINER_CLASS_INTERVIEWER, 12 }, - { TRAINER_CLASS_RS_TUBER_M, 1 }, - { TRAINER_CLASS_RS_YOUNG_COUPLE, 8 }, - { TRAINER_CLASS_GUITARIST, 8 }, - { TRAINER_CLASS_RS_GENTLEMAN, 20 }, - { TRAINER_CLASS_RS_CHAMPION, 50 }, - { TRAINER_CLASS_MAGMA_LEADER, 20 }, - { TRAINER_CLASS_BATTLE_GIRL, 6 }, - { TRAINER_CLASS_RS_SWIMMER_M, 2 }, - { TRAINER_CLASS_POKEFAN, 20 }, - { TRAINER_CLASS_EXPERT, 10 }, - { TRAINER_CLASS_DRAGON_TAMER, 12 }, - { TRAINER_CLASS_RS_BIRD_KEEPER, 8 }, - { TRAINER_CLASS_NINJA_BOY, 3 }, - { TRAINER_CLASS_PARASOL_LADY, 10 }, - { TRAINER_CLASS_BUG_MANIAC, 15 }, - { TRAINER_CLASS_RS_SAILOR, 8 }, - { TRAINER_CLASS_COLLECTOR, 15 }, - { TRAINER_CLASS_RS_PKMN_RANGER, 12 }, - { TRAINER_CLASS_MAGMA_ADMIN, 10 }, - { TRAINER_CLASS_RS_AROMA_LADY, 10 }, - { TRAINER_CLASS_RS_RUIN_MANIAC, 15 }, - { TRAINER_CLASS_RS_COOLTRAINER, 12 }, - { TRAINER_CLASS_RS_POKEMANIAC, 15 }, - { TRAINER_CLASS_KINDLER, 8 }, - { TRAINER_CLASS_RS_CAMPER, 4 }, - { TRAINER_CLASS_RS_PICNICKER, 4 }, - { TRAINER_CLASS_RS_PSYCHIC, 6 }, - { TRAINER_CLASS_RS_SIS_AND_BRO, 3 }, - { TRAINER_CLASS_OLD_COUPLE, 10 }, - { TRAINER_CLASS_AQUA_ADMIN, 10 }, - { TRAINER_CLASS_AQUA_LEADER, 20 }, - { TRAINER_CLASS_BOSS, 25 }, - { 0xFF, 5 }, + {TRAINER_CLASS_LEADER, 25}, + {TRAINER_CLASS_ELITE_FOUR, 25}, + {TRAINER_CLASS_PKMN_PROF, 25}, + {TRAINER_CLASS_RIVAL_EARLY, 4}, + {TRAINER_CLASS_RIVAL_LATE, 9}, + {TRAINER_CLASS_CHAMPION, 25}, + {TRAINER_CLASS_YOUNGSTER, 4}, + {TRAINER_CLASS_BUG_CATCHER, 3}, + {TRAINER_CLASS_HIKER, 9}, + {TRAINER_CLASS_BIRD_KEEPER, 6}, + {TRAINER_CLASS_PICNICKER, 5}, + {TRAINER_CLASS_SUPER_NERD, 6}, + {TRAINER_CLASS_FISHERMAN, 9}, + {TRAINER_CLASS_TEAM_ROCKET, 8}, + {TRAINER_CLASS_LASS, 4}, + {TRAINER_CLASS_BEAUTY, 18}, + {TRAINER_CLASS_BLACK_BELT, 6}, + {TRAINER_CLASS_CUE_BALL, 6}, + {TRAINER_CLASS_CHANNELER, 8}, + {TRAINER_CLASS_ROCKER, 6}, + {TRAINER_CLASS_GENTLEMAN, 18}, + {TRAINER_CLASS_BURGLAR, 22}, + {TRAINER_CLASS_SWIMMER_M, 1}, + {TRAINER_CLASS_ENGINEER, 12}, + {TRAINER_CLASS_JUGGLER, 10}, + {TRAINER_CLASS_SAILOR, 8}, + {TRAINER_CLASS_COOLTRAINER, 9}, + {TRAINER_CLASS_POKEMANIAC, 12}, + {TRAINER_CLASS_TAMER, 10}, + {TRAINER_CLASS_CAMPER, 5}, + {TRAINER_CLASS_PSYCHIC, 5}, + {TRAINER_CLASS_BIKER, 5}, + {TRAINER_CLASS_GAMER, 18}, + {TRAINER_CLASS_SCIENTIST, 12}, + {TRAINER_CLASS_CRUSH_GIRL, 6}, + {TRAINER_CLASS_TUBER, 1}, + {TRAINER_CLASS_PKMN_BREEDER, 7}, + {TRAINER_CLASS_PKMN_RANGER, 9}, + {TRAINER_CLASS_AROMA_LADY, 7}, + {TRAINER_CLASS_RUIN_MANIAC, 12}, + {TRAINER_CLASS_LADY, 50}, + {TRAINER_CLASS_PAINTER, 4}, + {TRAINER_CLASS_TWINS, 3}, + {TRAINER_CLASS_YOUNG_COUPLE, 7}, + {TRAINER_CLASS_SIS_AND_BRO, 1}, + {TRAINER_CLASS_COOL_COUPLE, 6}, + {TRAINER_CLASS_CRUSH_KIN, 6}, + {TRAINER_CLASS_SWIMMER_F, 1}, + {TRAINER_CLASS_PLAYER, 1}, + {TRAINER_CLASS_RS_LEADER, 25}, + {TRAINER_CLASS_RS_ELITE_FOUR, 25}, + {TRAINER_CLASS_RS_LASS, 4}, + {TRAINER_CLASS_RS_YOUNGSTER, 4}, + {TRAINER_CLASS_PKMN_TRAINER, 15}, + {TRAINER_CLASS_RS_HIKER, 10}, + {TRAINER_CLASS_RS_BEAUTY, 20}, + {TRAINER_CLASS_RS_FISHERMAN, 10}, + {TRAINER_CLASS_RS_LADY, 50}, + {TRAINER_CLASS_TRIATHLETE, 10}, + {TRAINER_CLASS_TEAM_AQUA, 5}, + {TRAINER_CLASS_RS_TWINS, 3}, + {TRAINER_CLASS_RS_SWIMMER_F, 2}, + {TRAINER_CLASS_RS_BUG_CATCHER, 4}, + {TRAINER_CLASS_SCHOOL_KID, 5}, + {TRAINER_CLASS_RICH_BOY, 50}, + {TRAINER_CLASS_SR_AND_JR, 4}, + {TRAINER_CLASS_RS_BLACK_BELT, 8}, + {TRAINER_CLASS_RS_TUBER_F, 1}, + {TRAINER_CLASS_HEX_MANIAC, 6}, + {TRAINER_CLASS_RS_PKMN_BREEDER, 10}, + {TRAINER_CLASS_TEAM_MAGMA, 5}, + {TRAINER_CLASS_INTERVIEWER, 12}, + {TRAINER_CLASS_RS_TUBER_M, 1}, + {TRAINER_CLASS_RS_YOUNG_COUPLE, 8}, + {TRAINER_CLASS_GUITARIST, 8}, + {TRAINER_CLASS_RS_GENTLEMAN, 20}, + {TRAINER_CLASS_RS_CHAMPION, 50}, + {TRAINER_CLASS_MAGMA_LEADER, 20}, + {TRAINER_CLASS_BATTLE_GIRL, 6}, + {TRAINER_CLASS_RS_SWIMMER_M, 2}, + {TRAINER_CLASS_POKEFAN, 20}, + {TRAINER_CLASS_EXPERT, 10}, + {TRAINER_CLASS_DRAGON_TAMER, 12}, + {TRAINER_CLASS_RS_BIRD_KEEPER, 8}, + {TRAINER_CLASS_NINJA_BOY, 3}, + {TRAINER_CLASS_PARASOL_LADY, 10}, + {TRAINER_CLASS_BUG_MANIAC, 15}, + {TRAINER_CLASS_RS_SAILOR, 8}, + {TRAINER_CLASS_COLLECTOR, 15}, + {TRAINER_CLASS_RS_PKMN_RANGER, 12}, + {TRAINER_CLASS_MAGMA_ADMIN, 10}, + {TRAINER_CLASS_RS_AROMA_LADY, 10}, + {TRAINER_CLASS_RS_RUIN_MANIAC, 15}, + {TRAINER_CLASS_RS_COOLTRAINER, 12}, + {TRAINER_CLASS_RS_POKEMANIAC, 15}, + {TRAINER_CLASS_KINDLER, 8}, + {TRAINER_CLASS_RS_CAMPER, 4}, + {TRAINER_CLASS_RS_PICNICKER, 4}, + {TRAINER_CLASS_RS_PSYCHIC, 6}, + {TRAINER_CLASS_RS_SIS_AND_BRO, 3}, + {TRAINER_CLASS_OLD_COUPLE, 10}, + {TRAINER_CLASS_AQUA_ADMIN, 10}, + {TRAINER_CLASS_AQUA_LEADER, 20}, + {TRAINER_CLASS_BOSS, 25}, + { 0xFF, 5}, }; #include "data/text/abilities.h" static void (*const sTurnActionsFuncsTable[])(void) = { - [B_ACTION_USE_MOVE] = HandleAction_UseMove, - [B_ACTION_USE_ITEM] = HandleAction_UseItem, - [B_ACTION_SWITCH] = HandleAction_Switch, - [B_ACTION_RUN] = HandleAction_Run, + [B_ACTION_USE_MOVE] = HandleAction_UseMove, + [B_ACTION_USE_ITEM] = HandleAction_UseItem, + [B_ACTION_SWITCH] = HandleAction_Switch, + [B_ACTION_RUN] = HandleAction_Run, [B_ACTION_SAFARI_WATCH_CAREFULLY] = HandleAction_WatchesCarefully, - [B_ACTION_SAFARI_BALL] = HandleAction_SafariZoneBallThrow, - [B_ACTION_SAFARI_BAIT] = HandleAction_ThrowBait, - [B_ACTION_SAFARI_GO_NEAR] = HandleAction_ThrowRock, - [B_ACTION_SAFARI_RUN] = HandleAction_SafariZoneRun, - [B_ACTION_OLDMAN_THROW] = HandleAction_OldManBallThrow, - [B_ACTION_EXEC_SCRIPT] = HandleAction_RunBattleScript, - [B_ACTION_TRY_FINISH] = HandleAction_TryFinish, - [B_ACTION_FINISHED] = HandleAction_ActionFinished, - [B_ACTION_NOTHING_FAINTED] = HandleAction_NothingIsFainted, + [B_ACTION_SAFARI_BALL] = HandleAction_SafariZoneBallThrow, + [B_ACTION_SAFARI_BAIT] = HandleAction_ThrowBait, + [B_ACTION_SAFARI_GO_NEAR] = HandleAction_ThrowRock, + [B_ACTION_SAFARI_RUN] = HandleAction_SafariZoneRun, + [B_ACTION_OLDMAN_THROW] = HandleAction_OldManBallThrow, + [B_ACTION_EXEC_SCRIPT] = HandleAction_RunBattleScript, + [B_ACTION_TRY_FINISH] = HandleAction_TryFinish, + [B_ACTION_FINISHED] = HandleAction_ActionFinished, + [B_ACTION_NOTHING_FAINTED] = HandleAction_NothingIsFainted, }; static void (*const sEndTurnFuncsTable[])(void) = { - [0] = HandleEndTurn_ContinueBattle, //B_OUTCOME_NONE? - [B_OUTCOME_WON] = HandleEndTurn_BattleWon, - [B_OUTCOME_LOST] = HandleEndTurn_BattleLost, - [B_OUTCOME_DREW] = HandleEndTurn_BattleLost, - [B_OUTCOME_RAN] = HandleEndTurn_RanFromBattle, + [0] = HandleEndTurn_ContinueBattle, + [B_OUTCOME_WON] = HandleEndTurn_BattleWon, + [B_OUTCOME_LOST] = HandleEndTurn_BattleLost, + [B_OUTCOME_DREW] = HandleEndTurn_BattleLost, + [B_OUTCOME_RAN] = HandleEndTurn_RanFromBattle, [B_OUTCOME_PLAYER_TELEPORTED] = HandleEndTurn_FinishBattle, - [B_OUTCOME_MON_FLED] = HandleEndTurn_MonFled, - [B_OUTCOME_CAUGHT] = HandleEndTurn_FinishBattle, - [B_OUTCOME_NO_SAFARI_BALLS] = HandleEndTurn_FinishBattle, + [B_OUTCOME_MON_FLED] = HandleEndTurn_MonFled, + [B_OUTCOME_CAUGHT] = HandleEndTurn_FinishBattle, + [B_OUTCOME_NO_SAFARI_BALLS] = HandleEndTurn_FinishBattle, }; -const u8 gStatusConditionString_PoisonJpn[8] = _("どく$$$$$"); -const u8 gStatusConditionString_SleepJpn[8] = _("ねむり$$$$"); -const u8 gStatusConditionString_ParalysisJpn[8] = _("まひ$$$$$"); -const u8 gStatusConditionString_BurnJpn[8] = _("やけど$$$$"); -const u8 gStatusConditionString_IceJpn[8] = _("こおり$$$$"); -const u8 gStatusConditionString_ConfusionJpn[8] = _("こんらん$$$"); -const u8 gStatusConditionString_LoveJpn[8] = _("メロメロ$$$"); +const u8 gStatusConditionString_PoisonJpn[] = _("どく$$$$$"); +const u8 gStatusConditionString_SleepJpn[] = _("ねむり$$$$"); +const u8 gStatusConditionString_ParalysisJpn[] = _("まひ$$$$$"); +const u8 gStatusConditionString_BurnJpn[] = _("やけど$$$$"); +const u8 gStatusConditionString_IceJpn[] = _("こおり$$$$"); +const u8 gStatusConditionString_ConfusionJpn[] = _("こんらん$$$"); +const u8 gStatusConditionString_LoveJpn[] = _("メロメロ$$$"); -const u8 *const gStatusConditionStringsTable[7][2] = +const u8 *const gStatusConditionStringsTable[][2] = { - { gStatusConditionString_PoisonJpn, gText_Poison }, - { gStatusConditionString_SleepJpn, gText_Sleep }, - { gStatusConditionString_ParalysisJpn, gText_Paralysis }, - { gStatusConditionString_BurnJpn, gText_Burn }, - { gStatusConditionString_IceJpn, gText_Ice }, - { gStatusConditionString_ConfusionJpn, gText_Confusion }, - { gStatusConditionString_LoveJpn, gText_Love } + {gStatusConditionString_PoisonJpn, gText_Poison}, + {gStatusConditionString_SleepJpn, gText_Sleep}, + {gStatusConditionString_ParalysisJpn, gText_Paralysis}, + {gStatusConditionString_BurnJpn, gText_Burn}, + {gStatusConditionString_IceJpn, gText_Ice}, + {gStatusConditionString_ConfusionJpn, gText_Confusion}, + {gStatusConditionString_LoveJpn, gText_Love} }; void CB2_InitBattle(void) @@ -651,15 +656,19 @@ static void CB2_InitBattleInternal(void) SetHBlankCallback(NULL); SetVBlankCallback(NULL); - CpuFill32(0, (void *)VRAM, VRAM_SIZE); + + CpuFill32(0, (void *)(VRAM), VRAM_SIZE); + SetGpuReg(REG_OFFSET_MOSAIC, 0); - SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, 0xF0)); - SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0x50, 0x51)); + SetGpuReg(REG_OFFSET_WIN0H, DISPLAY_WIDTH); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2 + 1)); SetGpuReg(REG_OFFSET_WININ, 0); SetGpuReg(REG_OFFSET_WINOUT, 0); - gBattle_WIN0H = WIN_RANGE(0, 0xF0); - gBattle_WIN0V = WIN_RANGE(0x50, 0x51); + + gBattle_WIN0H = DISPLAY_WIDTH; + gBattle_WIN0V = WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2 + 1); ScanlineEffect_Clear(); + for (i = 0; i < 80; ++i) { gScanlineEffectRegBuffers[0][i] = 0xF0; @@ -671,6 +680,7 @@ static void CB2_InitBattleInternal(void) gScanlineEffectRegBuffers[1][i] = 0xFF10; } ScanlineEffect_SetParams(sIntroScanlineParams16Bit); + ResetPaletteFade(); gBattle_BG0_X = 0; gBattle_BG0_Y = 0; @@ -680,7 +690,9 @@ static void CB2_InitBattleInternal(void) gBattle_BG2_Y = 0; gBattle_BG3_X = 0; gBattle_BG3_Y = 0; + gBattleTerrain = BattleSetup_GetTerrainId(); + InitBattleBgsVideo(); LoadBattleTextboxAndBackground(); ResetSpriteData(); @@ -690,6 +702,7 @@ static void CB2_InitBattleInternal(void) gReservedSpritePaletteCount = 4; SetVBlankCallback(VBlankCB_Battle); SetUpBattleVars(); + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) SetMainCallback2(CB2_HandleStartMultiBattle); else @@ -699,9 +712,11 @@ static void CB2_InitBattleInternal(void) CreateNPCTrainerParty(&gEnemyParty[0], gTrainerBattleOpponent_A); SetWildMonHeldItem(); } + gMain.inBattle = TRUE; - for (i = 0; i < PARTY_SIZE; ++i) + for (i = 0; i < PARTY_SIZE; i++) AdjustFriendship(&gPlayerParty[i], FRIENDSHIP_EVENT_LEAGUE_BATTLE); + gBattleCommunication[MULTIUSE_STATE] = 0; } @@ -734,28 +749,29 @@ static void CB2_InitBattleInternal(void) (flags) |= 3 << (i) * 2; \ } +// For Vs Screen at link battle start static void BufferPartyVsScreenHealth_AtStart(void) { u16 flags = 0; s32 i; BUFFER_PARTY_VS_SCREEN_STATUS(gPlayerParty, flags, i); - gBattleStruct->multiBuffer.linkPartnerHeader.vsScreenHealthFlagsLo = flags; - *(&gBattleStruct->multiBuffer.linkPartnerHeader.vsScreenHealthFlagsHi) = flags >> 8; + gBattleStruct->multiBuffer.linkBattlerHeader.vsScreenHealthFlagsLo = flags; + *(&gBattleStruct->multiBuffer.linkBattlerHeader.vsScreenHealthFlagsHi) = flags >> 8; } static void SetPlayerBerryDataInBattleStruct(void) { s32 i; struct BattleStruct *battleStruct = gBattleStruct; - struct BattleEnigmaBerry *battleBerry = &battleStruct->multiBuffer.linkPartnerHeader.battleEnigmaBerry; + struct BattleEnigmaBerry *battleBerry = &battleStruct->multiBuffer.linkBattlerHeader.battleEnigmaBerry; if (IsEnigmaBerryValid() == TRUE) { - for (i = 0; i < BERRY_NAME_LENGTH; ++i) + for (i = 0; i < BERRY_NAME_LENGTH; i++) battleBerry->name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i]; battleBerry->name[i] = EOS; - for (i = 0; i < BERRY_ITEM_EFFECT_COUNT; ++i) + for (i = 0; i < BERRY_ITEM_EFFECT_COUNT; i++) battleBerry->itemEffect[i] = gSaveBlock1Ptr->enigmaBerry.itemEffect[i]; battleBerry->holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; battleBerry->holdEffectParam = gSaveBlock1Ptr->enigmaBerry.holdEffectParam; @@ -764,10 +780,10 @@ static void SetPlayerBerryDataInBattleStruct(void) { const struct Berry *berryData = GetBerryInfo(ItemIdToBerryType(ITEM_ENIGMA_BERRY)); - for (i = 0; i < BERRY_NAME_LENGTH; ++i) + for (i = 0; i < BERRY_NAME_LENGTH; i++) battleBerry->name[i] = berryData->name[i]; battleBerry->name[i] = EOS; - for (i = 0; i < BERRY_ITEM_EFFECT_COUNT; ++i) + for (i = 0; i < BERRY_ITEM_EFFECT_COUNT; i++) battleBerry->itemEffect[i] = 0; battleBerry->holdEffect = HOLD_EFFECT_NONE; battleBerry->holdEffectParam = 0; @@ -782,18 +798,20 @@ static void SetAllPlayersBerryData(void) { if (IsEnigmaBerryValid() == TRUE) { - for (i = 0; i < BERRY_NAME_LENGTH; ++i) + for (i = 0; i < BERRY_NAME_LENGTH; i++) { gEnigmaBerries[0].name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i]; gEnigmaBerries[2].name[i] = gSaveBlock1Ptr->enigmaBerry.berry.name[i]; } gEnigmaBerries[0].name[i] = EOS; gEnigmaBerries[2].name[i] = EOS; - for (i = 0; i < BERRY_ITEM_EFFECT_COUNT; ++i) + + for (i = 0; i < BERRY_ITEM_EFFECT_COUNT; i++) { gEnigmaBerries[0].itemEffect[i] = gSaveBlock1Ptr->enigmaBerry.itemEffect[i]; gEnigmaBerries[2].itemEffect[i] = gSaveBlock1Ptr->enigmaBerry.itemEffect[i]; } + gEnigmaBerries[0].holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; gEnigmaBerries[2].holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect; gEnigmaBerries[0].holdEffectParam = gSaveBlock1Ptr->enigmaBerry.holdEffectParam; @@ -803,18 +821,20 @@ static void SetAllPlayersBerryData(void) { const struct Berry *berryData = GetBerryInfo(ItemIdToBerryType(ITEM_ENIGMA_BERRY)); - for (i = 0; i < BERRY_NAME_LENGTH; ++i) + for (i = 0; i < BERRY_NAME_LENGTH; i++) { gEnigmaBerries[0].name[i] = berryData->name[i]; gEnigmaBerries[2].name[i] = berryData->name[i]; } gEnigmaBerries[0].name[i] = EOS; gEnigmaBerries[2].name[i] = EOS; - for (i = 0; i < BERRY_ITEM_EFFECT_COUNT; ++i) + + for (i = 0; i < BERRY_ITEM_EFFECT_COUNT; i++) { gEnigmaBerries[0].itemEffect[i] = 0; gEnigmaBerries[2].itemEffect[i] = 0; } + gEnigmaBerries[0].holdEffect = HOLD_EFFECT_NONE; gEnigmaBerries[2].holdEffect = HOLD_EFFECT_NONE; gEnigmaBerries[0].holdEffectParam = 0; @@ -829,14 +849,14 @@ static void SetAllPlayersBerryData(void) if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - for (i = 0; i < 4; ++i) + for (i = 0; i < 4; i++) { src = (struct BattleEnigmaBerry *)(gBlockRecvBuffer[i] + 2); battlerId = gLinkPlayers[i].id; - for (j = 0; j < BERRY_NAME_LENGTH; ++j) + for (j = 0; j < BERRY_NAME_LENGTH; j++) gEnigmaBerries[battlerId].name[j] = src->name[j]; gEnigmaBerries[battlerId].name[j] = EOS; - for (j = 0; j < BERRY_ITEM_EFFECT_COUNT; ++j) + for (j = 0; j < BERRY_ITEM_EFFECT_COUNT; j++) gEnigmaBerries[battlerId].itemEffect[j] = src->itemEffect[j]; gEnigmaBerries[battlerId].holdEffect = src->holdEffect; gEnigmaBerries[battlerId].holdEffectParam = src->holdEffectParam; @@ -844,17 +864,17 @@ static void SetAllPlayersBerryData(void) } else { - for (i = 0; i < 2; ++i) + for (i = 0; i < 2; i++) { src = (struct BattleEnigmaBerry *)(gBlockRecvBuffer[i] + 2); - for (j = 0; j < BERRY_NAME_LENGTH; ++j) + for (j = 0; j < BERRY_NAME_LENGTH; j++) { gEnigmaBerries[i].name[j] = src->name[j]; gEnigmaBerries[i + 2].name[j] = src->name[j]; } gEnigmaBerries[i].name[j] = EOS; gEnigmaBerries[i + 2].name[j] = EOS; - for (j = 0; j < BERRY_ITEM_EFFECT_COUNT; ++j) + for (j = 0; j < BERRY_ITEM_EFFECT_COUNT; j++) { gEnigmaBerries[i].itemEffect[j] = src->itemEffect[j]; gEnigmaBerries[i + 2].itemEffect[j] = src->itemEffect[j]; @@ -879,14 +899,14 @@ static void LinkBattleComputeBattleTypeFlags(u8 numPlayers, u8 multiPlayerId) gBattleTypeFlags |= BATTLE_TYPE_IS_MASTER | BATTLE_TYPE_TRAINER; else gBattleTypeFlags |= BATTLE_TYPE_TRAINER; - ++found; + found++; } if (found == 0) { // If multiple different versions are being used, player 1 is master. s32 i; - for (i = 0; i < numPlayers; ++i) + for (i = 0; i < numPlayers; i++) if (gBlockRecvBuffer[0][0] != gBlockRecvBuffer[i][0]) break; if (i == numPlayers) @@ -895,12 +915,12 @@ static void LinkBattleComputeBattleTypeFlags(u8 numPlayers, u8 multiPlayerId) gBattleTypeFlags |= BATTLE_TYPE_IS_MASTER | BATTLE_TYPE_TRAINER; else gBattleTypeFlags |= BATTLE_TYPE_TRAINER; - ++found; + found++; } if (found == 0) { // Lowest index player with the highest game version is master. - for (i = 0; i < numPlayers; ++i) + for (i = 0; i < numPlayers; i++) { if (gBlockRecvBuffer[i][0] == 0x201 && i != multiPlayerId) if (i < multiPlayerId) @@ -950,11 +970,11 @@ static void CB2_HandleStartBattle(void) if (IsLinkTaskFinished()) { // 0x201 - *(&gBattleStruct->multiBuffer.linkPartnerHeader.versionSignatureLo) = 1; - *(&gBattleStruct->multiBuffer.linkPartnerHeader.versionSignatureHi) = 2; + *(&gBattleStruct->multiBuffer.linkBattlerHeader.versionSignatureLo) = 1; + *(&gBattleStruct->multiBuffer.linkBattlerHeader.versionSignatureHi) = 2; BufferPartyVsScreenHealth_AtStart(); SetPlayerBerryDataInBattleStruct(); - SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->multiBuffer.linkPartnerHeader, sizeof(gBattleStruct->multiBuffer.linkPartnerHeader)); + SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->multiBuffer.linkBattlerHeader, sizeof(gBattleStruct->multiBuffer.linkBattlerHeader)); gBattleCommunication[MULTIUSE_STATE] = 2; } if (gWirelessCommType != 0) @@ -980,17 +1000,17 @@ static void CB2_HandleStartBattle(void) gTasks[taskId].data[1] = 270; gTasks[taskId].data[2] = 90; gTasks[taskId].data[5] = 0; - gTasks[taskId].data[3] = gBattleStruct->multiBuffer.linkPartnerHeader.vsScreenHealthFlagsLo | (gBattleStruct->multiBuffer.linkPartnerHeader.vsScreenHealthFlagsHi << 8); + gTasks[taskId].data[3] = gBattleStruct->multiBuffer.linkBattlerHeader.vsScreenHealthFlagsLo | (gBattleStruct->multiBuffer.linkBattlerHeader.vsScreenHealthFlagsHi << 8); gTasks[taskId].data[4] = gBlockRecvBuffer[enemyMultiplayerId][1]; SetDeoxysStats(); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 3: if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gPlayerParty, sizeof(struct Pokemon) * 2); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 4: @@ -998,14 +1018,14 @@ static void CB2_HandleStartBattle(void) { ResetBlockReceivedFlags(); memcpy(gEnemyParty, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 7: if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gPlayerParty + 2, sizeof(struct Pokemon) * 2); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 8: @@ -1013,14 +1033,14 @@ static void CB2_HandleStartBattle(void) { ResetBlockReceivedFlags(); memcpy(gEnemyParty + 2, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 11: if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gPlayerParty + 4, sizeof(struct Pokemon) * 2); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 12: @@ -1034,12 +1054,12 @@ static void CB2_HandleStartBattle(void) TryCorrectShedinjaLanguage(&gEnemyParty[3]); TryCorrectShedinjaLanguage(&gEnemyParty[4]); TryCorrectShedinjaLanguage(&gEnemyParty[5]); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 15: InitBtlControllers(); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; gBattleCommunication[SPRITES_INIT_STATE1] = 0; gBattleCommunication[SPRITES_INIT_STATE2] = 0; break; @@ -1058,13 +1078,13 @@ static void CB2_HandleStartBattle(void) case 5: case 9: case 13: - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; gBattleCommunication[1] = 1; case 6: case 10: case 14: if (--gBattleCommunication[1] == 0) - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; break; } } @@ -1074,7 +1094,7 @@ static void PrepareOwnMultiPartnerBuffer(void) s32 i, j; u8 *nick, *cur; - for (i = 0; i < 3; ++i) + for (i = 0; i < 3; i++) { gMultiPartnerParty[i].species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES); gMultiPartnerParty[i].heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); @@ -1089,7 +1109,7 @@ static void PrepareOwnMultiPartnerBuffer(void) StripExtCtrlCodes(nick); if (GetMonData(&gPlayerParty[i], MON_DATA_LANGUAGE) != LANGUAGE_JAPANESE) { - for (cur = nick, j = 0; cur[j] != EOS; ++j) + for (cur = nick, j = 0; cur[j] != EOS; j++) ; while (j < 6) cur[j++] = 0; @@ -1122,14 +1142,14 @@ static void CB2_PreInitMultiBattle(void) { PrepareOwnMultiPartnerBuffer(); SendBlock(bitmask_all_link_players_but_self(), gBattleStruct->multiBuffer.multiBattleMons, sizeof(gBattleStruct->multiBuffer.multiBattleMons)); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 1: if ((GetBlockReceivedStatus() & r4) == r4) { ResetBlockReceivedFlags(); - for (i = 0; i < 4; ++i) + for (i = 0; i < 4; i++) { if (i == playerMultiplierId) continue; @@ -1137,7 +1157,7 @@ static void CB2_PreInitMultiBattle(void) || (gLinkPlayers[i].id & 1 && gLinkPlayers[playerMultiplierId].id & 1)) memcpy(gMultiPartnerParty, gBlockRecvBuffer[i], sizeof(gMultiPartnerParty)); } - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; *savedCallback = gMain.savedCallback; *savedBattleTypeFlags = gBattleTypeFlags; gMain.savedCallback = CB2_PreInitMultiBattle; @@ -1147,7 +1167,7 @@ static void CB2_PreInitMultiBattle(void) case 2: if (!gPaletteFade.active) { - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; if (gWirelessCommType) SetLinkStandbyCallback(); else @@ -1206,12 +1226,12 @@ static void CB2_HandleStartMultiBattle(void) if (IsLinkTaskFinished()) { // 0x201 - *(&gBattleStruct->multiBuffer.linkPartnerHeader.versionSignatureLo) = 1; - *(&gBattleStruct->multiBuffer.linkPartnerHeader.versionSignatureHi) = 2; + *(&gBattleStruct->multiBuffer.linkBattlerHeader.versionSignatureLo) = 1; + *(&gBattleStruct->multiBuffer.linkBattlerHeader.versionSignatureHi) = 2; BufferPartyVsScreenHealth_AtStart(); SetPlayerBerryDataInBattleStruct(); - SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->multiBuffer.linkPartnerHeader, sizeof(gBattleStruct->multiBuffer.linkPartnerHeader)); - ++gBattleCommunication[MULTIUSE_STATE]; + SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->multiBuffer.linkBattlerHeader, sizeof(gBattleStruct->multiBuffer.linkBattlerHeader)); + gBattleCommunication[MULTIUSE_STATE]++; } if (gWirelessCommType) CreateWirelessStatusIndicatorSprite(0, 0); @@ -1251,7 +1271,7 @@ static void CB2_HandleStartMultiBattle(void) } ZeroPlayerPartyMons(); ZeroEnemyPartyMons(); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } else { @@ -1262,7 +1282,7 @@ static void CB2_HandleStartMultiBattle(void) if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gDecompressionBuffer, sizeof(struct Pokemon) * 2); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 4: @@ -1318,14 +1338,14 @@ static void CB2_HandleStartMultiBattle(void) } } } - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 7: if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gDecompressionBuffer + sizeof(struct Pokemon) * 2, sizeof(struct Pokemon)); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 8: @@ -1393,12 +1413,12 @@ static void CB2_HandleStartMultiBattle(void) TryCorrectShedinjaLanguage(&gEnemyParty[3]); TryCorrectShedinjaLanguage(&gEnemyParty[4]); TryCorrectShedinjaLanguage(&gEnemyParty[5]); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 11: InitBtlControllers(); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; gBattleCommunication[SPRITES_INIT_STATE1] = 0; gBattleCommunication[SPRITES_INIT_STATE2] = 0; break; @@ -1432,11 +1452,12 @@ void BattleMainCB2(void) RunTextPrinters(); UpdatePaletteFade(); RunTasks(); + if (JOY_HELD(B_BUTTON) && gBattleTypeFlags & BATTLE_TYPE_POKEDUDE) { gSpecialVar_Result = gBattleOutcome = B_OUTCOME_DREW; ResetPaletteFadeControl(); - BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); SetMainCallback2(CB2_QuitPokedudeBattle); } } @@ -1525,31 +1546,35 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum) if (trainerNum == TRAINER_SECRET_BASE) return 0; + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && !(gBattleTypeFlags & (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_TRAINER_TOWER))) { ZeroEnemyPartyMons(); - for (i = 0; i < gTrainers[trainerNum].partySize; ++i) + for (i = 0; i < gTrainers[trainerNum].partySize; i++) { if (gTrainers[trainerNum].doubleBattle == TRUE) personalityValue = 0x80; - else if (gTrainers[trainerNum].encounterMusic_gender & 0x80) - personalityValue = 0x78; + else if (gTrainers[trainerNum].encounterMusic_gender & F_TRAINER_FEMALE) + personalityValue = 0x78; // Use personality more likely to result in a female Pokémon else - personalityValue = 0x88; - for (j = 0; gTrainers[trainerNum].trainerName[j] != EOS; ++j) + personalityValue = 0x88; // Use personality more likely to result in a male Pokémon + + for (j = 0; gTrainers[trainerNum].trainerName[j] != EOS; j++) nameHash += gTrainers[trainerNum].trainerName[j]; + switch (gTrainers[trainerNum].partyFlags) { case 0: { const struct TrainerMonNoItemDefaultMoves *partyData = gTrainers[trainerNum].party.NoItemDefaultMoves; - for (j = 0; gSpeciesNames[partyData[i].species][j] != EOS; ++j) + for (j = 0; gSpeciesNames[partyData[i].species][j] != EOS; j++) nameHash += gSpeciesNames[partyData[i].species][j]; + personalityValue += nameHash << 8; - fixedIV = partyData[i].iv * 31 / 255; + fixedIV = partyData[i].iv * MAX_PER_STAT_IVS / 255; CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0); break; } @@ -1557,12 +1582,14 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum) { const struct TrainerMonNoItemCustomMoves *partyData = gTrainers[trainerNum].party.NoItemCustomMoves; - for (j = 0; gSpeciesNames[partyData[i].species][j] != EOS; ++j) + for (j = 0; gSpeciesNames[partyData[i].species][j] != EOS; j++) nameHash += gSpeciesNames[partyData[i].species][j]; + personalityValue += nameHash << 8; - fixedIV = partyData[i].iv * 31 / 255; + fixedIV = partyData[i].iv * MAX_PER_STAT_IVS / 255; CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0); - for (j = 0; j < MAX_MON_MOVES; ++j) + + for (j = 0; j < MAX_MON_MOVES; j++) { SetMonData(&party[i], MON_DATA_MOVE1 + j, &partyData[i].moves[j]); SetMonData(&party[i], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp); @@ -1573,10 +1600,11 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum) { const struct TrainerMonItemDefaultMoves *partyData = gTrainers[trainerNum].party.ItemDefaultMoves; - for (j = 0; gSpeciesNames[partyData[i].species][j] != EOS; ++j) + for (j = 0; gSpeciesNames[partyData[i].species][j] != EOS; j++) nameHash += gSpeciesNames[partyData[i].species][j]; + personalityValue += nameHash << 8; - fixedIV = partyData[i].iv * 31 / 255; + fixedIV = partyData[i].iv * MAX_PER_STAT_IVS / 255; CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0); SetMonData(&party[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem); @@ -1586,13 +1614,15 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum) { const struct TrainerMonItemCustomMoves *partyData = gTrainers[trainerNum].party.ItemCustomMoves; - for (j = 0; gSpeciesNames[partyData[i].species][j] != EOS; ++j) + for (j = 0; gSpeciesNames[partyData[i].species][j] != EOS; j++) nameHash += gSpeciesNames[partyData[i].species][j]; + personalityValue += nameHash << 8; - fixedIV = partyData[i].iv * 31 / 255; + fixedIV = partyData[i].iv * MAX_PER_STAT_IVS / 255; CreateMon(&party[i], partyData[i].species, partyData[i].lvl, fixedIV, TRUE, personalityValue, OT_ID_RANDOM_NO_SHINY, 0); SetMonData(&party[i], MON_DATA_HELD_ITEM, &partyData[i].heldItem); - for (j = 0; j < MAX_MON_MOVES; ++j) + + for (j = 0; j < MAX_MON_MOVES; j++) { SetMonData(&party[i], MON_DATA_MOVE1 + j, &partyData[i].moves[j]); SetMonData(&party[i], MON_DATA_PP1 + j, &gBattleMoves[partyData[i].moves[j]].pp); @@ -1601,15 +1631,17 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum) } } } + gBattleTypeFlags |= gTrainers[trainerNum].doubleBattle; } + return gTrainers[trainerNum].partySize; } -// not used -UNUSED static void unused_80116CC(void) +// Unused +static void HBlankCB_Battle(void) { - if (REG_VCOUNT < 0xA0 && REG_VCOUNT >= 0x6F) + if (REG_VCOUNT < DISPLAY_HEIGHT && REG_VCOUNT >= 111) REG_BG0CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(24) | BGCNT_16COLOR | BGCNT_TXT256x512; } @@ -1617,6 +1649,7 @@ void VBlankCB_Battle(void) { // Change gRngSeed every vblank. Random(); + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X); SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y); SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); @@ -1637,6 +1670,7 @@ void VBlankCB_Battle(void) void SpriteCB_VsLetterDummy(struct Sprite *sprite) { + } static void SpriteCB_VsLetter(struct Sprite *sprite) @@ -1645,7 +1679,9 @@ static void SpriteCB_VsLetter(struct Sprite *sprite) sprite->x = sprite->data[1] + ((sprite->data[2] & 0xFF00) >> 8); else sprite->x = sprite->data[1] - ((sprite->data[2] & 0xFF00) >> 8); + sprite->data[2] += 0x180; + if (sprite->affineAnimEnded) { FreeSpriteTilesByTag(ANIM_SPRITES_START); @@ -1667,7 +1703,7 @@ static void BufferPartyVsScreenHealth_AtEnd(u8 taskId) struct Pokemon *party1 = NULL; struct Pokemon *party2 = NULL; u8 multiplayerId = gBattleStruct->multiplayerId; - u32 r7; + u32 flags; s32 i; if (gBattleTypeFlags & BATTLE_TYPE_MULTI) @@ -1691,12 +1727,14 @@ static void BufferPartyVsScreenHealth_AtEnd(u8 taskId) party1 = gPlayerParty; party2 = gEnemyParty; } - r7 = 0; - BUFFER_PARTY_VS_SCREEN_STATUS(party1, r7, i); - gTasks[taskId].data[3] = r7; - r7 = 0; - BUFFER_PARTY_VS_SCREEN_STATUS(party2, r7, i); - gTasks[taskId].data[4] = r7; + + flags = 0; + BUFFER_PARTY_VS_SCREEN_STATUS(party1, flags, i); + gTasks[taskId].data[3] = flags; + + flags = 0; + BUFFER_PARTY_VS_SCREEN_STATUS(party2, flags, i); + gTasks[taskId].data[4] = flags; } void CB2_InitEndLinkBattle(void) @@ -1715,13 +1753,13 @@ void CB2_InitEndLinkBattle(void) gBattle_WIN0H = WIN_RANGE(0, 0xF0); gBattle_WIN0V = WIN_RANGE(0x50, 0x51); ScanlineEffect_Clear(); - for (i = 0; i < 80; ++i) + for (i = 0; i < 80; i++) { gScanlineEffectRegBuffers[0][i] = 0xF0; gScanlineEffectRegBuffers[1][i] = 0xF0; } - for (; i < 160; ++i) + for (; i < 160; i++) { gScanlineEffectRegBuffers[0][i] = 0xFF10; gScanlineEffectRegBuffers[1][i] = 0xFF10; @@ -1774,13 +1812,13 @@ static void EndLinkBattleInSteps(void) ShowBg(1); ShowBg(2); gBattleCommunication[1] = 0xFF; - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; break; case 1: if (--gBattleCommunication[1] == 0) { BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; } break; case 2: @@ -1901,7 +1939,7 @@ static void SpriteCB_Unused_8011E28_Step(struct Sprite *sprite) { sprite->invisible = FALSE; sprite->callback = SpriteCallbackDummy_2; - gUnknown_2022AE8[0] = 0; + sFlickerArray[0] = 0; } } } @@ -1916,17 +1954,20 @@ void SpriteCB_FaintOpponentMon(struct Sprite *sprite) species = gBattleSpritesDataPtr->battlerData[battler].transformSpecies; else species = sprite->sSpeciesId; + GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_PERSONALITY); // Unused return value. + if (species == SPECIES_UNOWN) { u32 personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_PERSONALITY); - u16 unownForm = ((((personalityValue & 0x3000000) >> 18) | ((personalityValue & 0x30000) >> 12) | ((personalityValue & 0x300) >> 6) | (personalityValue & 3)) % 0x1C); + u16 unownForm = GET_UNOWN_LETTER(personalityValue); u16 unownSpecies; if (unownForm == 0) unownSpecies = SPECIES_UNOWN; // Use the A Unown form. else unownSpecies = NUM_SPECIES + unownForm; // Use one of the other Unown letters. + yOffset = gMonFrontPicCoords[unownSpecies].y_offset; } else if (species == SPECIES_CASTFORM) @@ -1941,6 +1982,7 @@ void SpriteCB_FaintOpponentMon(struct Sprite *sprite) { yOffset = gMonFrontPicCoords[species].y_offset; } + sprite->data[3] = 8 - yOffset / 8; sprite->data[4] = 1; sprite->callback = SpriteCB_AnimFaintOpponent; @@ -1963,31 +2005,31 @@ static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite) { u8 *dst = (u8 *)gMonSpritesGfxPtr->sprites[GetBattlerPosition(sprite->sBattler)] + (gBattleMonForms[sprite->sBattler] << 11) + (sprite->data[3] << 8); - for (i = 0; i < 0x100; ++i) + for (i = 0; i < 0x100; i++) *(dst++) = 0; StartSpriteAnim(sprite, gBattleMonForms[sprite->sBattler]); } } } -void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite) +// Used when selecting a move, which can hit multiple targets, in double battles. +void SpriteCB_ShowAsMoveTarget(struct Sprite *sprite) { sprite->data[3] = 8; sprite->data[4] = sprite->invisible; - sprite->callback = SpriteCb_BlinkVisible; + sprite->callback = SpriteCB_BlinkVisible; } -static void SpriteCb_BlinkVisible(struct Sprite *sprite) +static void SpriteCB_BlinkVisible(struct Sprite *sprite) { - --sprite->data[3]; - if (sprite->data[3] == 0) + if (--sprite->data[3] == 0) { sprite->invisible ^= 1; sprite->data[3] = 8; } } -void SpriteCb_HideAsMoveTarget(struct Sprite *sprite) +void SpriteCB_HideAsMoveTarget(struct Sprite *sprite) { sprite->invisible = sprite->data[4]; sprite->data[4] = FALSE; @@ -2006,30 +2048,36 @@ static void oac_poke_ally_(struct Sprite *sprite) sprite->x2 -= 2; if (sprite->x2 == 0) { - sprite->callback = SpriteCallbackDummy3; + sprite->callback = SpriteCB_Idle; sprite->data[1] = 0; } } } -void SpriteCB_SetToDummy3(struct Sprite *sprite) +void SetIdleSpriteCallback(struct Sprite *sprite) { - sprite->callback = SpriteCallbackDummy3; + sprite->callback = SpriteCB_Idle; } -static void SpriteCallbackDummy3(struct Sprite *sprite) +static void SpriteCB_Idle(struct Sprite *sprite) { } +#define sSpeedX data[1] +#define sSpeedY data[2] + void SpriteCB_FaintSlideAnim(struct Sprite *sprite) { if (!(gIntroSlideFlags & 1)) { - sprite->x2 += sprite->data[1]; - sprite->y2 += sprite->data[2]; + sprite->x2 += sprite->sSpeedX; + sprite->y2 += sprite->sSpeedY; } } +#define sSpeedX data[1] +#define sSpeedY data[2] + #define sSinIndex data[0] #define sDelta data[1] #define sAmplitude data[2] @@ -2053,6 +2101,7 @@ void DoBounceEffect(u8 battler, u8 which, s8 delta, s8 amplitude) return; break; } + invisibleSpriteId = CreateInvisibleSpriteWithCallback(SpriteCB_BounceEffect); if (which == BOUNCE_HEALTHBOX) { @@ -2098,6 +2147,7 @@ void EndBounceEffect(u8 battler, u8 which) DestroySprite(&gSprites[gBattleSpritesDataPtr->healthBoxesData[battler].battlerBounceSpriteId]); gBattleSpritesDataPtr->healthBoxesData[battler].battlerIsBouncing = 0; } + gSprites[bouncerSpriteId].x2 = 0; gSprites[bouncerSpriteId].y2 = 0; } @@ -2131,7 +2181,7 @@ static void SpriteCB_PlayerThrowUpdate(struct Sprite *sprite) { UpdatePlayerPosInThrowAnim(sprite); if (sprite->animEnded) - sprite->callback = SpriteCallbackDummy3; + sprite->callback = SpriteCB_Idle; } void BattleDummy(void) @@ -2148,7 +2198,8 @@ void BeginBattleIntro(void) static void BattleMainCB1(void) { gBattleMainFunc(); - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) gBattlerControllerFuncs[gActiveBattler](); } @@ -2160,14 +2211,17 @@ static void BattleStartClearSetData(void) TurnValuesCleanUp(FALSE); SpecialStatusesClear(); - for (i = 0; i < MAX_BATTLERS_COUNT; ++i) + + for (i = 0; i < MAX_BATTLERS_COUNT; i++) { gStatuses3[i] = 0; + dataPtr = (u8 *)&gDisableStructs[i]; - for (j = 0; j < sizeof(struct DisableStruct); ++j) + for (j = 0; j < sizeof(struct DisableStruct); j++) dataPtr[j] = 0; + gDisableStructs[i].isFirstTurn = 2; - gUnknown_2023DD4[i] = 0; + sUnusedBattlersArray[i] = 0; gLastMoves[i] = MOVE_NONE; gLastLandedMoves[i] = MOVE_NONE; gLastHitByType[i] = 0; @@ -2177,31 +2231,41 @@ static void BattleStartClearSetData(void) gLastPrintedMoves[i] = MOVE_NONE; gBattleResources->flags->flags[i] = 0; } - for (i = 0; i < 2; ++i) + + for (i = 0; i < 2; i++) { gSideStatuses[i] = 0; + dataPtr = (u8 *)&gSideTimers[i]; - for (j = 0; j < sizeof(struct SideTimer); ++j) + for (j = 0; j < sizeof(struct SideTimer); j++) dataPtr[j] = 0; } + gBattlerAttacker = 0; gBattlerTarget = 0; gBattleWeather = 0; + dataPtr = (u8 *)&gWishFutureKnock; - for (i = 0; i < sizeof(struct WishFutureKnock); ++i) + for (i = 0; i < sizeof(struct WishFutureKnock); i++) dataPtr[i] = 0; + gHitMarker = 0; + if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_POKEDUDE)) && gSaveBlock2Ptr->optionsBattleSceneOff) gHitMarker |= HITMARKER_NO_ANIMATIONS; + gBattleScripting.battleStyle = gSaveBlock2Ptr->optionsBattleStyle; + gMultiHitCounter = 0; gBattleOutcome = 0; gBattleControllerExecFlags = 0; gPaydayMoney = 0; gBattleResources->battleScriptsStack->size = 0; gBattleResources->battleCallbackStack->size = 0; - for (i = 0; i < BATTLE_COMMUNICATION_ENTRIES_COUNT; ++i) + + for (i = 0; i < BATTLE_COMMUNICATION_ENTRIES_COUNT; i++) gBattleCommunication[i] = 0; + gPauseCounterBattle = 0; gBattleMoveDamage = 0; gIntroSlideFlags = 0; @@ -2218,7 +2282,8 @@ static void BattleStartClearSetData(void) gBattleStruct->safariEscapeFactor = 2; gBattleStruct->wildVictorySong = 0; gBattleStruct->moneyMultiplier = 1; - for (i = 0; i < 8; ++i) + + for (i = 0; i < 8; i++) { *((u8 *)gBattleStruct->lastTakenMove + i) = MOVE_NONE; *((u8 *)gBattleStruct->usedHeldItems + i) = ITEM_NONE; @@ -2232,7 +2297,7 @@ static void BattleStartClearSetData(void) *(gBattleStruct->AI_monToSwitchIntoId + 0) = PARTY_SIZE; *(gBattleStruct->AI_monToSwitchIntoId + 1) = PARTY_SIZE; *(&gBattleStruct->givenExpMons) = 0; - for (i = 0; i < 11; ++i) + for (i = 0; i < 11; i++) gBattleResults.catchAttempts[i] = 0; gBattleResults.battleTurnCounter = 0; gBattleResults.playerFaintCounter = 0; @@ -2264,9 +2329,9 @@ void SwitchInClearSetData(void) if (gBattleMoves[gCurrentMove].effect != EFFECT_BATON_PASS) { - for (i = 0; i < NUM_BATTLE_STATS; ++i) - gBattleMons[gActiveBattler].statStages[i] = 6; - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < NUM_BATTLE_STATS; i++) + gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE; + for (i = 0; i < gBattlersCount; i++) { if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].battlerPreventingEscape == gActiveBattler) gBattleMons[i].status2 &= ~STATUS2_ESCAPE_PREVENTION; @@ -2281,14 +2346,14 @@ void SwitchInClearSetData(void) { gBattleMons[gActiveBattler].status2 &= (STATUS2_CONFUSION | STATUS2_FOCUS_ENERGY | STATUS2_SUBSTITUTE | STATUS2_ESCAPE_PREVENTION | STATUS2_CURSED); gStatuses3[gActiveBattler] &= (STATUS3_LEECHSEED_BATTLER | STATUS3_LEECHSEED | STATUS3_ALWAYS_HITS | STATUS3_PERISH_SONG | STATUS3_ROOTED | STATUS3_MUDSPORT | STATUS3_WATERSPORT); - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (GetBattlerSide(gActiveBattler) != GetBattlerSide(i) && (gStatuses3[i] & STATUS3_ALWAYS_HITS) != 0 && (gDisableStructs[i].battlerWithSureHit == gActiveBattler)) { - gStatuses3[i] &= ~(STATUS3_ALWAYS_HITS); - gStatuses3[i] |= 0x10; + gStatuses3[i] &= ~STATUS3_ALWAYS_HITS; + gStatuses3[i] |= STATUS3_ALWAYS_HITS_TURN(2); } } } @@ -2297,18 +2362,22 @@ void SwitchInClearSetData(void) gBattleMons[gActiveBattler].status2 = 0; gStatuses3[gActiveBattler] = 0; } - for (i = 0; i < gBattlersCount; ++i) + + for (i = 0; i < gBattlersCount; i++) { if (gBattleMons[i].status2 & STATUS2_INFATUATED_WITH(gActiveBattler)) - gBattleMons[i].status2 &= ~(STATUS2_INFATUATED_WITH(gActiveBattler)); + gBattleMons[i].status2 &= ~STATUS2_INFATUATED_WITH(gActiveBattler); if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && *(gBattleStruct->wrappedBy + i) == gActiveBattler) - gBattleMons[i].status2 &= ~(STATUS2_WRAPPED); + gBattleMons[i].status2 &= ~STATUS2_WRAPPED; } + gActionSelectionCursor[gActiveBattler] = 0; gMoveSelectionCursor[gActiveBattler] = 0; + ptr = (u8 *)&gDisableStructs[gActiveBattler]; - for (i = 0; i < sizeof(struct DisableStruct); ++i) + for (i = 0; i < sizeof(struct DisableStruct); i++) ptr[i] = 0; + if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS) { gDisableStructs[gActiveBattler].substituteHP = disableStructCopy.substituteHP; @@ -2317,6 +2386,7 @@ void SwitchInClearSetData(void) gDisableStructs[gActiveBattler].perishSongTimerStartValue = disableStructCopy.perishSongTimerStartValue; gDisableStructs[gActiveBattler].battlerPreventingEscape = disableStructCopy.battlerPreventingEscape; } + gMoveResultFlags = 0; gDisableStructs[gActiveBattler].isFirstTurn = 2; gLastMoves[gActiveBattler] = MOVE_NONE; @@ -2325,6 +2395,7 @@ void SwitchInClearSetData(void) gLastResultingMoves[gActiveBattler] = MOVE_NONE; gLastPrintedMoves[gActiveBattler] = MOVE_NONE; gLastHitBy[gActiveBattler] = 0xFF; + *(gBattleStruct->lastTakenMove + gActiveBattler * 2 + 0) = MOVE_NONE; *(gBattleStruct->lastTakenMove + gActiveBattler * 2 + 1) = MOVE_NONE; *(0 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; @@ -2335,7 +2406,8 @@ void SwitchInClearSetData(void) *(2 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 1) = 0; *(3 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; *(3 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 1) = 0; - for (i = 0; i < gBattlersCount; ++i) + + for (i = 0; i < gBattlersCount; i++) { if (i != gActiveBattler) { @@ -2345,8 +2417,10 @@ void SwitchInClearSetData(void) *(i * 8 + gActiveBattler * 2 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; *(i * 8 + gActiveBattler * 2 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 1) = 0; } + *((u8 *)(&gBattleStruct->choicedMove[gActiveBattler]) + 0) = MOVE_NONE; *((u8 *)(&gBattleStruct->choicedMove[gActiveBattler]) + 1) = MOVE_NONE; + gBattleResources->flags->flags[gActiveBattler] = 0; gCurrentMove = MOVE_NONE; } @@ -2356,24 +2430,29 @@ void FaintClearSetData(void) s32 i; u8 *ptr; - for (i = 0; i < NUM_BATTLE_STATS; ++i) - gBattleMons[gActiveBattler].statStages[i] = 6; + for (i = 0; i < NUM_BATTLE_STATS; i++) + gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE; + gBattleMons[gActiveBattler].status2 = 0; gStatuses3[gActiveBattler] = 0; - for (i = 0; i < gBattlersCount; ++i) + + for (i = 0; i < gBattlersCount; i++) { if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].battlerPreventingEscape == gActiveBattler) gBattleMons[i].status2 &= ~STATUS2_ESCAPE_PREVENTION; if (gBattleMons[i].status2 & STATUS2_INFATUATED_WITH(gActiveBattler)) - gBattleMons[i].status2 &= ~(STATUS2_INFATUATED_WITH(gActiveBattler)); + gBattleMons[i].status2 &= ~STATUS2_INFATUATED_WITH(gActiveBattler); if ((gBattleMons[i].status2 & STATUS2_WRAPPED) && *(gBattleStruct->wrappedBy + i) == gActiveBattler) - gBattleMons[i].status2 &= ~(STATUS2_WRAPPED); + gBattleMons[i].status2 &= ~STATUS2_WRAPPED; } + gActionSelectionCursor[gActiveBattler] = 0; gMoveSelectionCursor[gActiveBattler] = 0; + ptr = (u8 *)&gDisableStructs[gActiveBattler]; - for (i = 0; i < sizeof(struct DisableStruct); ++i) + for (i = 0; i < sizeof(struct DisableStruct); i++) ptr[i] = 0; + gProtectStructs[gActiveBattler].protected = FALSE; gProtectStructs[gActiveBattler].endured = FALSE; gProtectStructs[gActiveBattler].noValidMoves = FALSE; @@ -2385,7 +2464,7 @@ void FaintClearSetData(void) gProtectStructs[gActiveBattler].confusionSelfDmg = FALSE; gProtectStructs[gActiveBattler].targetNotAffected = FALSE; gProtectStructs[gActiveBattler].chargingTurn = FALSE; - gProtectStructs[gActiveBattler].fleeFlag = 0; + gProtectStructs[gActiveBattler].fleeType = 0; gProtectStructs[gActiveBattler].usedImprisonedMove = FALSE; gProtectStructs[gActiveBattler].loveImmobility = FALSE; gProtectStructs[gActiveBattler].usedDisabledMove = FALSE; @@ -2393,15 +2472,19 @@ void FaintClearSetData(void) gProtectStructs[gActiveBattler].flag2Unknown = FALSE; gProtectStructs[gActiveBattler].flinchImmobility = FALSE; gProtectStructs[gActiveBattler].notFirstStrike = FALSE; + gDisableStructs[gActiveBattler].isFirstTurn = 2; + gLastMoves[gActiveBattler] = MOVE_NONE; gLastLandedMoves[gActiveBattler] = MOVE_NONE; - gLastHitByType[gActiveBattler] = MOVE_NONE; + gLastHitByType[gActiveBattler] = 0; gLastResultingMoves[gActiveBattler] = MOVE_NONE; gLastPrintedMoves[gActiveBattler] = MOVE_NONE; gLastHitBy[gActiveBattler] = 0xFF; + *((u8 *)(&gBattleStruct->choicedMove[gActiveBattler]) + 0) = MOVE_NONE; *((u8 *)(&gBattleStruct->choicedMove[gActiveBattler]) + 1) = MOVE_NONE; + *(gBattleStruct->lastTakenMove + gActiveBattler * 2 + 0) = MOVE_NONE; *(gBattleStruct->lastTakenMove + gActiveBattler * 2 + 1) = MOVE_NONE; *(0 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; @@ -2412,7 +2495,8 @@ void FaintClearSetData(void) *(2 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 1) = 0; *(3 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; *(3 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 1) = 0; - for (i = 0; i < gBattlersCount; ++i) + + for (i = 0; i < gBattlersCount; i++) { if (i != gActiveBattler) { @@ -2435,12 +2519,12 @@ static void BattleIntroGetMonsData(void) gActiveBattler = gBattleCommunication[1]; BtlController_EmitGetMonData(BUFFER_A, REQUEST_ALL_BATTLE, 0); MarkBattlerForControllerExec(gActiveBattler); - ++gBattleCommunication[MULTIUSE_STATE]; + gBattleCommunication[MULTIUSE_STATE]++; break; case 1: if (gBattleControllerExecFlags == 0) { - ++gBattleCommunication[1]; + gBattleCommunication[1]++; if (gBattleCommunication[1] == gBattlersCount) gBattleMainFunc = BattleIntroPrepareBackgroundSlide; else @@ -2455,7 +2539,7 @@ static void BattleIntroPrepareBackgroundSlide(void) if (gBattleControllerExecFlags == 0) { gActiveBattler = GetBattlerAtPosition(0); - BtlController_EmitIntroSlide(0, gBattleTerrain); + BtlController_EmitIntroSlide(BUFFER_A, gBattleTerrain); MarkBattlerForControllerExec(gActiveBattler); gBattleMainFunc = BattleIntroDrawTrainersOrMonsSprites; gBattleCommunication[MULTIUSE_STATE] = 0; @@ -2468,85 +2552,90 @@ static void BattleIntroDrawTrainersOrMonsSprites(void) u8 *ptr; s32 i; - if (gBattleControllerExecFlags == 0) - { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) - { - if ((gBattleTypeFlags & BATTLE_TYPE_SAFARI) - && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - { - ptr = (u8 *)&gBattleMons[gActiveBattler]; - for (i = 0; i < sizeof(struct BattlePokemon); ++i) - ptr[i] = 0; - } - else - { - u16 *hpOnSwitchout; + if (gBattleControllerExecFlags) + return; - ptr = (u8 *)&gBattleMons[gActiveBattler]; - for (i = 0; i < sizeof(struct BattlePokemon); ++i) - ptr[i] = gBattleBufferB[gActiveBattler][4 + i]; - gBattleMons[gActiveBattler].type1 = gBaseStats[gBattleMons[gActiveBattler].species].type1; - gBattleMons[gActiveBattler].type2 = gBaseStats[gBattleMons[gActiveBattler].species].type2; - gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); - hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)]; - *hpOnSwitchout = gBattleMons[gActiveBattler].hp; - for (i = 0; i < NUM_BATTLE_STATS; ++i) - gBattleMons[gActiveBattler].statStages[i] = 6; - gBattleMons[gActiveBattler].status2 = 0; - } - if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) + { + if ((gBattleTypeFlags & BATTLE_TYPE_SAFARI) + && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + { + ptr = (u8 *)&gBattleMons[gActiveBattler]; + for (i = 0; i < sizeof(struct BattlePokemon); i++) + ptr[i] = 0; + } + else + { + u16 *hpOnSwitchout; + + ptr = (u8 *)&gBattleMons[gActiveBattler]; + for (i = 0; i < sizeof(struct BattlePokemon); i++) + ptr[i] = gBattleBufferB[gActiveBattler][4 + i]; + + gBattleMons[gActiveBattler].type1 = gBaseStats[gBattleMons[gActiveBattler].species].type1; + gBattleMons[gActiveBattler].type2 = gBaseStats[gBattleMons[gActiveBattler].species].type2; + gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum); + hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)]; + *hpOnSwitchout = gBattleMons[gActiveBattler].hp; + for (i = 0; i < NUM_BATTLE_STATS; i++) + gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE; + gBattleMons[gActiveBattler].status2 = 0; + } + + if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT) + { + BtlController_EmitDrawTrainerPic(BUFFER_A); + MarkBattlerForControllerExec(gActiveBattler); + } + + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) + { + if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_LEFT) { - BtlController_EmitDrawTrainerPic(0); + BtlController_EmitDrawTrainerPic(BUFFER_A); MarkBattlerForControllerExec(gActiveBattler); } - if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) + if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT + && !(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER + | BATTLE_TYPE_POKEDUDE + | BATTLE_TYPE_LINK + | BATTLE_TYPE_GHOST + | BATTLE_TYPE_OLD_MAN_TUTORIAL + | BATTLE_TYPE_LEGENDARY))) { - if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_LEFT) - { - BtlController_EmitDrawTrainerPic(0); - MarkBattlerForControllerExec(gActiveBattler); - } - if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT - && !(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER - | BATTLE_TYPE_POKEDUDE - | BATTLE_TYPE_LINK - | BATTLE_TYPE_GHOST - | BATTLE_TYPE_OLD_MAN_TUTORIAL - | BATTLE_TYPE_LEGENDARY))) - HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality); + HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality); } - else + } + else + { + if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT) { - if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT) + if (gBattleTypeFlags & (BATTLE_TYPE_GHOST | BATTLE_TYPE_GHOST_UNVEILED)) { - if (gBattleTypeFlags & (BATTLE_TYPE_GHOST | BATTLE_TYPE_GHOST_UNVEILED)) - { - if (!IS_BATTLE_TYPE_GHOST_WITHOUT_SCOPE(gBattleTypeFlags)) - HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality); - } - else if (!(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER - | BATTLE_TYPE_POKEDUDE - | BATTLE_TYPE_LINK - | BATTLE_TYPE_GHOST - | BATTLE_TYPE_OLD_MAN_TUTORIAL - | BATTLE_TYPE_LEGENDARY))) - { + if (!IS_BATTLE_TYPE_GHOST_WITHOUT_SCOPE(gBattleTypeFlags)) HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality); - } - BtlController_EmitLoadMonSprite(0); - MarkBattlerForControllerExec(gActiveBattler); } - } - if (gBattleTypeFlags & BATTLE_TYPE_MULTI - && (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT || GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT)) - { - BtlController_EmitDrawTrainerPic(0); + else if (!(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER + | BATTLE_TYPE_POKEDUDE + | BATTLE_TYPE_LINK + | BATTLE_TYPE_GHOST + | BATTLE_TYPE_OLD_MAN_TUTORIAL + | BATTLE_TYPE_LEGENDARY))) + { + HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality); + } + BtlController_EmitLoadMonSprite(0); MarkBattlerForControllerExec(gActiveBattler); } } - gBattleMainFunc = BattleIntroDrawPartySummaryScreens; + if (gBattleTypeFlags & BATTLE_TYPE_MULTI + && (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT || GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT)) + { + BtlController_EmitDrawTrainerPic(BUFFER_A); + MarkBattlerForControllerExec(gActiveBattler); + } } + gBattleMainFunc = BattleIntroDrawPartySummaryScreens; } static void BattleIntroDrawPartySummaryScreens(void) @@ -2554,68 +2643,71 @@ static void BattleIntroDrawPartySummaryScreens(void) s32 i; struct HpAndStatus hpStatus[PARTY_SIZE]; - if (gBattleControllerExecFlags == 0) - { - if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) - { - for (i = 0; i < PARTY_SIZE; ++i) - { - if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES2) == SPECIES_NONE - || GetMonData(&gEnemyParty[i], MON_DATA_SPECIES2) == SPECIES_EGG) - { - hpStatus[i].hp = 0xFFFF; - hpStatus[i].status = 0; - } - else - { - hpStatus[i].hp = GetMonData(&gEnemyParty[i], MON_DATA_HP); - hpStatus[i].status = GetMonData(&gEnemyParty[i], MON_DATA_STATUS); - } - } - gActiveBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - BtlController_EmitDrawPartyStatusSummary(0, hpStatus, 0x80); - MarkBattlerForControllerExec(gActiveBattler); - for (i = 0; i < PARTY_SIZE; ++i) - { - if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) == SPECIES_NONE - || GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) == SPECIES_EGG) - { - hpStatus[i].hp = 0xFFFF; - hpStatus[i].status = 0; - } - else - { - hpStatus[i].hp = GetMonData(&gPlayerParty[i], MON_DATA_HP); - hpStatus[i].status = GetMonData(&gPlayerParty[i], MON_DATA_STATUS); - } - } - gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - BtlController_EmitDrawPartyStatusSummary(0, hpStatus, 0x80); - MarkBattlerForControllerExec(gActiveBattler); + if (gBattleControllerExecFlags) + return; - gBattleMainFunc = BattleIntroPrintTrainerWantsToBattle; - } - else + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) + { + for (i = 0; i < PARTY_SIZE; i++) { - // The struct gets set here, but nothing is ever done with it since - // wild battles don't show the party summary. - // Still, there's no point in having dead code. - for (i = 0; i < PARTY_SIZE; ++i) + if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES2) == SPECIES_NONE + || GetMonData(&gEnemyParty[i], MON_DATA_SPECIES2) == SPECIES_EGG) { - if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) == SPECIES_NONE - || GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) == SPECIES_EGG) - { - hpStatus[i].hp = 0xFFFF; - hpStatus[i].status = 0; - } - else - { - hpStatus[i].hp = GetMonData(&gPlayerParty[i], MON_DATA_HP); - hpStatus[i].status = GetMonData(&gPlayerParty[i], MON_DATA_STATUS); - } + hpStatus[i].hp = HP_EMPTY_SLOT; + hpStatus[i].status = 0; + } + else + { + hpStatus[i].hp = GetMonData(&gEnemyParty[i], MON_DATA_HP); + hpStatus[i].status = GetMonData(&gEnemyParty[i], MON_DATA_STATUS); } - gBattleMainFunc = BattleIntroPrintWildMonAttacked; } + gActiveBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + BtlController_EmitDrawPartyStatusSummary(BUFFER_A, hpStatus, PARTY_SUMM_SKIP_DRAW_DELAY); + MarkBattlerForControllerExec(gActiveBattler); + + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) == SPECIES_NONE + || GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) == SPECIES_EGG) + { + hpStatus[i].hp = HP_EMPTY_SLOT; + hpStatus[i].status = 0; + } + else + { + hpStatus[i].hp = GetMonData(&gPlayerParty[i], MON_DATA_HP); + hpStatus[i].status = GetMonData(&gPlayerParty[i], MON_DATA_STATUS); + } + } + gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + BtlController_EmitDrawPartyStatusSummary(BUFFER_A, hpStatus, PARTY_SUMM_SKIP_DRAW_DELAY); + MarkBattlerForControllerExec(gActiveBattler); + + gBattleMainFunc = BattleIntroPrintTrainerWantsToBattle; + } + else + { + // The struct gets set here, but nothing is ever done with it since + // wild battles don't show the party summary. + // Still, there's no point in having dead code. + + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) == SPECIES_NONE + || GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) == SPECIES_EGG) + { + hpStatus[i].hp = HP_EMPTY_SLOT; + hpStatus[i].status = 0; + } + else + { + hpStatus[i].hp = GetMonData(&gPlayerParty[i], MON_DATA_HP); + hpStatus[i].status = GetMonData(&gPlayerParty[i], MON_DATA_STATUS); + } + } + + gBattleMainFunc = BattleIntroPrintWildMonAttacked; } } @@ -2656,7 +2748,7 @@ static void BattleIntroOpponentSendsOutMonAnimation(void) { if (gBattleControllerExecFlags == 0) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_LEFT) { @@ -2677,7 +2769,7 @@ static void BattleIntroRecordMonsToDex(void) { if (gBattleControllerExecFlags == 0) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT && !(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_POKEDUDE @@ -2697,7 +2789,7 @@ static void Unused_AutoProgressToIntro(void) gBattleMainFunc = BattleIntroPrintPlayerSendsOut; } -void BattleIntroPrintPlayerSendsOut(void) +static void BattleIntroPrintPlayerSendsOut(void) { if (gBattleControllerExecFlags == 0) { @@ -2711,34 +2803,35 @@ static void BattleIntroPlayerSendsOutMonAnimation(void) { u32 position; - if (gBattleControllerExecFlags == 0) + if (gBattleControllerExecFlags) + return; + + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT) { - if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT) - { - BtlController_EmitIntroTrainerBallThrow(0); - MarkBattlerForControllerExec(gActiveBattler); - } - if (gBattleTypeFlags & BATTLE_TYPE_MULTI && GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT) - { - BtlController_EmitIntroTrainerBallThrow(0); - MarkBattlerForControllerExec(gActiveBattler); - } + BtlController_EmitIntroTrainerBallThrow(0); + MarkBattlerForControllerExec(gActiveBattler); + } + if (gBattleTypeFlags & BATTLE_TYPE_MULTI && GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT) + { + BtlController_EmitIntroTrainerBallThrow(0); + MarkBattlerForControllerExec(gActiveBattler); } - gBattleStruct->switchInAbilitiesCounter = 0; - gBattleStruct->switchInItemsCounter = 0; - gBattleStruct->overworldWeatherDone = FALSE; - gBattleMainFunc = TryDoEventsBeforeFirstTurn; } + gBattleStruct->switchInAbilitiesCounter = 0; + gBattleStruct->switchInItemsCounter = 0; + gBattleStruct->overworldWeatherDone = FALSE; + + gBattleMainFunc = TryDoEventsBeforeFirstTurn; } -// not used -static void Unused_AutoProgressToSwitchInAnims(void) +// Unused +static void BattleIntroSwitchInPlayerMons(void) { if (gBattleControllerExecFlags == 0) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) { @@ -2746,9 +2839,11 @@ static void Unused_AutoProgressToSwitchInAnims(void) MarkBattlerForControllerExec(gActiveBattler); } } + gBattleStruct->switchInAbilitiesCounter = 0; gBattleStruct->switchInItemsCounter = 0; gBattleStruct->overworldWeatherDone = FALSE; + gBattleMainFunc = TryDoEventsBeforeFirstTurn; } } @@ -2758,73 +2853,72 @@ static void TryDoEventsBeforeFirstTurn(void) s32 i, j; u8 effect = 0; - if (gBattleControllerExecFlags == 0) - { + if (gBattleControllerExecFlags) + return; - if (gBattleStruct->switchInAbilitiesCounter == 0) - { - for (i = 0; i < gBattlersCount; ++i) - gBattlerByTurnOrder[i] = i; - for (i = 0; i < gBattlersCount - 1; ++i) - for (j = i + 1; j < gBattlersCount; ++j) - if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], TRUE) != 0) - SwapTurnOrder(i, j); - } - if (!gBattleStruct->overworldWeatherDone - && AbilityBattleEffects(0, 0, 0, ABILITYEFFECT_SWITCH_IN_WEATHER, 0) != 0) - { - gBattleStruct->overworldWeatherDone = TRUE; - return; - } - // Check all switch in abilities happening from the fastest mon to slowest. - while (gBattleStruct->switchInAbilitiesCounter < gBattlersCount) - { - if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gBattlerByTurnOrder[gBattleStruct->switchInAbilitiesCounter], 0, 0, 0) != 0) - ++effect; - ++gBattleStruct->switchInAbilitiesCounter; - if (effect) - return; - } - if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) != 0) - return; - if (AbilityBattleEffects(ABILITYEFFECT_TRACE, 0, 0, 0, 0) != 0) - return; - // Check all switch in items having effect from the fastest mon to slowest. - while (gBattleStruct->switchInItemsCounter < gBattlersCount) - { - if (ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gBattlerByTurnOrder[gBattleStruct->switchInItemsCounter], FALSE)) - ++effect; - ++gBattleStruct->switchInItemsCounter; - if (effect) - return; - } - for (i = 0; i < gBattlersCount; ++i) // pointless, ruby leftover - ; - for (i = 0; i < MAX_BATTLERS_COUNT; ++i) - { - *(gBattleStruct->monToSwitchIntoId + i) = PARTY_SIZE; - gChosenActionByBattler[i] = B_ACTION_NONE; - gChosenMoveByBattler[i] = MOVE_NONE; - } - TurnValuesCleanUp(FALSE); - SpecialStatusesClear(); - *(&gBattleStruct->absentBattlerFlags) = gAbsentBattlerFlags; - gBattleMainFunc = HandleTurnActionSelectionState; - ResetSentPokesToOpponentValue(); - for (i = 0; i < BATTLE_COMMUNICATION_ENTRIES_COUNT; ++i) - gBattleCommunication[i] = 0; - for (i = 0; i < gBattlersCount; ++i) - gBattleMons[i].status2 &= ~(STATUS2_FLINCHED); - *(&gBattleStruct->turnEffectsTracker) = 0; - *(&gBattleStruct->turnEffectsBattlerId) = 0; - *(&gBattleStruct->wishPerishSongState) = 0; - *(&gBattleStruct->wishPerishSongBattlerId) = 0; - gBattleScripting.moveendState = 0; - gBattleStruct->faintedActionsState = 0; - gBattleStruct->turnCountersTracker = 0; - gMoveResultFlags = 0; - gRandomTurnNumber = Random(); + if (gBattleStruct->switchInAbilitiesCounter == 0) + { + for (i = 0; i < gBattlersCount; i++) + gBattlerByTurnOrder[i] = i; + for (i = 0; i < gBattlersCount - 1; i++) + for (j = i + 1; j < gBattlersCount; j++) + if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], TRUE) != 0) + SwapTurnOrder(i, j); } + if (!gBattleStruct->overworldWeatherDone + && AbilityBattleEffects(0, 0, 0, ABILITYEFFECT_SWITCH_IN_WEATHER, 0) != 0) + { + gBattleStruct->overworldWeatherDone = TRUE; + return; + } + // Check all switch in abilities happening from the fastest mon to slowest. + while (gBattleStruct->switchInAbilitiesCounter < gBattlersCount) + { + if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gBattlerByTurnOrder[gBattleStruct->switchInAbilitiesCounter], 0, 0, 0) != 0) + effect++; + ++gBattleStruct->switchInAbilitiesCounter; + if (effect != 0) + return; + } + if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) != 0) + return; + if (AbilityBattleEffects(ABILITYEFFECT_TRACE, 0, 0, 0, 0) != 0) + return; + // Check all switch in items having effect from the fastest mon to slowest. + while (gBattleStruct->switchInItemsCounter < gBattlersCount) + { + if (ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gBattlerByTurnOrder[gBattleStruct->switchInItemsCounter], FALSE)) + effect++; + ++gBattleStruct->switchInItemsCounter; + if (effect != 0) + return; + } + for (i = 0; i < gBattlersCount; i++) // pointless, ruby leftover + ; + for (i = 0; i < MAX_BATTLERS_COUNT; i++) + { + *(gBattleStruct->monToSwitchIntoId + i) = PARTY_SIZE; + gChosenActionByBattler[i] = B_ACTION_NONE; + gChosenMoveByBattler[i] = MOVE_NONE; + } + TurnValuesCleanUp(FALSE); + SpecialStatusesClear(); + *(&gBattleStruct->absentBattlerFlags) = gAbsentBattlerFlags; + gBattleMainFunc = HandleTurnActionSelectionState; + ResetSentPokesToOpponentValue(); + for (i = 0; i < BATTLE_COMMUNICATION_ENTRIES_COUNT; i++) + gBattleCommunication[i] = 0; + for (i = 0; i < gBattlersCount; i++) + gBattleMons[i].status2 &= ~(STATUS2_FLINCHED); + *(&gBattleStruct->turnEffectsTracker) = 0; + *(&gBattleStruct->turnEffectsBattlerId) = 0; + *(&gBattleStruct->wishPerishSongState) = 0; + *(&gBattleStruct->wishPerishSongBattlerId) = 0; + gBattleScripting.moveendState = 0; + gBattleStruct->faintedActionsState = 0; + gBattleStruct->turnCountersTracker = 0; + gMoveResultFlags = 0; + gRandomTurnNumber = Random(); } static void HandleEndTurn_ContinueBattle(void) @@ -2834,9 +2928,9 @@ static void HandleEndTurn_ContinueBattle(void) if (gBattleControllerExecFlags == 0) { gBattleMainFunc = BattleTurnPassed; - for (i = 0; i < BATTLE_COMMUNICATION_ENTRIES_COUNT; ++i) + for (i = 0; i < BATTLE_COMMUNICATION_ENTRIES_COUNT; i++) gBattleCommunication[i] = 0; - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { gBattleMons[i].status2 &= ~(STATUS2_FLINCHED); if ((gBattleMons[i].status1 & STATUS1_SLEEP) && (gBattleMons[i].status2 & STATUS2_MULTIPLETURNS)) @@ -2878,7 +2972,7 @@ void BattleTurnPassed(void) gBattleScripting.moveendState = 0; gBattleMoveDamage = 0; gMoveResultFlags = 0; - for (i = 0; i < 5; ++i) + for (i = 0; i < 5; i++) gBattleCommunication[i] = 0; if (gBattleOutcome != 0) { @@ -2888,12 +2982,12 @@ void BattleTurnPassed(void) } if (gBattleResults.battleTurnCounter < 0xFF) ++gBattleResults.battleTurnCounter; - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { gChosenActionByBattler[i] = B_ACTION_NONE; gChosenMoveByBattler[i] = MOVE_NONE; } - for (i = 0; i < MAX_BATTLERS_COUNT; ++i) + for (i = 0; i < MAX_BATTLERS_COUNT; i++) *(gBattleStruct->monToSwitchIntoId + i) = PARTY_SIZE; *(&gBattleStruct->absentBattlerFlags) = gAbsentBattlerFlags; gBattleMainFunc = HandleTurnActionSelectionState; @@ -2916,7 +3010,7 @@ u8 IsRunningFromBattleImpossible(void) || gBattleMons[gActiveBattler].ability == ABILITY_RUN_AWAY) return BATTLE_RUN_SUCCESS; side = GetBattlerSide(gActiveBattler); - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (side != GetBattlerSide(i) && gBattleMons[i].ability == ABILITY_SHADOW_TAG) @@ -2964,14 +3058,14 @@ void UpdatePartyOwnerOnSwitch_NonMulti(u8 battler) s32 i; u8 r4, r1; - for (i = 0; i < 3; ++i) + for (i = 0; i < 3; i++) gBattlePartyCurrentOrder[i] = *(battler * 3 + i + (u8 *)(gBattleStruct->battlerPartyOrders)); r4 = GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battler]); r1 = GetPartyIdFromBattlePartyId(*(gBattleStruct->monToSwitchIntoId + battler)); SwitchPartyMonSlots(r4, r1); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - for (i = 0; i < 3; ++i) + for (i = 0; i < 3; i++) { *(battler * 3 + i + (u8 *)(gBattleStruct->battlerPartyOrders)) = gBattlePartyCurrentOrder[i]; *(BATTLE_PARTNER(battler) * 3 + i + (u8 *)(gBattleStruct->battlerPartyOrders)) = gBattlePartyCurrentOrder[i]; @@ -2979,7 +3073,7 @@ void UpdatePartyOwnerOnSwitch_NonMulti(u8 battler) } else { - for (i = 0; i < 3; ++i) + for (i = 0; i < 3; i++) *(battler * 3 + i + (u8 *)(gBattleStruct->battlerPartyOrders)) = gBattlePartyCurrentOrder[i]; } } @@ -3000,7 +3094,7 @@ static void HandleTurnActionSelectionState(void) s32 i; gBattleCommunication[ACTIONS_CONFIRMED_COUNT] = 0; - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { u8 position = GetBattlerPosition(gActiveBattler); @@ -3033,7 +3127,7 @@ static void HandleTurnActionSelectionState(void) { BtlController_EmitChooseAction(0, gChosenActionByBattler[0], gBattleBufferB[0][1] | (gBattleBufferB[0][2] << 8)); MarkBattlerForControllerExec(gActiveBattler); - ++gBattleCommunication[gActiveBattler]; + gBattleCommunication[gActiveBattler]++; } } } @@ -3067,7 +3161,7 @@ static void HandleTurnActionSelectionState(void) moveInfo.species = gBattleMons[gActiveBattler].species; moveInfo.monType1 = gBattleMons[gActiveBattler].type1; moveInfo.monType2 = gBattleMons[gActiveBattler].type2; - for (i = 0; i < MAX_MON_MOVES; ++i) + for (i = 0; i < MAX_MON_MOVES; i++) { moveInfo.moves[i] = gBattleMons[gActiveBattler].moves[i]; moveInfo.currentPp[i] = gBattleMons[gActiveBattler].pp[i]; @@ -3155,7 +3249,7 @@ static void HandleTurnActionSelectionState(void) } else { - ++gBattleCommunication[gActiveBattler]; + gBattleCommunication[gActiveBattler]++; } } break; @@ -3188,7 +3282,7 @@ static void HandleTurnActionSelectionState(void) *(gBattleStruct->chosenMovePositions + gActiveBattler) = gBattleBufferB[gActiveBattler][2]; gChosenMoveByBattler[gActiveBattler] = gBattleMons[gActiveBattler].moves[*(gBattleStruct->chosenMovePositions + gActiveBattler)]; *(gBattleStruct->moveTarget + gActiveBattler) = gBattleBufferB[gActiveBattler][3]; - ++gBattleCommunication[gActiveBattler]; + gBattleCommunication[gActiveBattler]++; } break; } @@ -3201,7 +3295,7 @@ static void HandleTurnActionSelectionState(void) else { gLastUsedItem = (gBattleBufferB[gActiveBattler][1] | (gBattleBufferB[gActiveBattler][2] << 8)); - ++gBattleCommunication[gActiveBattler]; + gBattleCommunication[gActiveBattler]++; } break; case B_ACTION_SWITCH: @@ -3221,29 +3315,29 @@ static void HandleTurnActionSelectionState(void) *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleBufferB[gActiveBattler][2] & 0xF0) >> 4; *((gActiveBattler ^ BIT_FLANK) * 3 + (u8 *)(gBattleStruct->battlerPartyOrders) + 2) = gBattleBufferB[gActiveBattler][3]; } - ++gBattleCommunication[gActiveBattler]; + gBattleCommunication[gActiveBattler]++; } break; case B_ACTION_RUN: gHitMarker |= HITMARKER_RUN; - ++gBattleCommunication[gActiveBattler]; + gBattleCommunication[gActiveBattler]++; break; case B_ACTION_SAFARI_WATCH_CAREFULLY: - ++gBattleCommunication[gActiveBattler]; + gBattleCommunication[gActiveBattler]++; break; case B_ACTION_SAFARI_BALL: - ++gBattleCommunication[gActiveBattler]; + gBattleCommunication[gActiveBattler]++; break; case B_ACTION_SAFARI_BAIT: case B_ACTION_SAFARI_GO_NEAR: - ++gBattleCommunication[gActiveBattler]; + gBattleCommunication[gActiveBattler]++; break; case B_ACTION_SAFARI_RUN: gHitMarker |= HITMARKER_RUN; - ++gBattleCommunication[gActiveBattler]; + gBattleCommunication[gActiveBattler]++; break; case B_ACTION_OLDMAN_THROW: - ++gBattleCommunication[gActiveBattler]; + gBattleCommunication[gActiveBattler]++; break; } } @@ -3258,7 +3352,7 @@ static void HandleTurnActionSelectionState(void) else BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_STOP_BOUNCE_ONLY); MarkBattlerForControllerExec(gActiveBattler); - ++gBattleCommunication[gActiveBattler]; + gBattleCommunication[gActiveBattler]++; } break; case STATE_WAIT_ACTION_CONFIRMED: @@ -3310,12 +3404,12 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) if (WEATHER_HAS_EFFECT) { if ((gBattleMons[battler1].ability == ABILITY_SWIFT_SWIM && gBattleWeather & B_WEATHER_RAIN) - || (gBattleMons[battler1].ability == ABILITY_CHLOROPHYLL && gBattleWeather & B_WEATHER_SUN)) + || (gBattleMons[battler1].ability == ABILITY_CHLOROPHYLL && gBattleWeather & B_WEATHER_SUN)) speedMultiplierBattler1 = 2; else speedMultiplierBattler1 = 1; if ((gBattleMons[battler2].ability == ABILITY_SWIFT_SWIM && gBattleWeather & B_WEATHER_RAIN) - || (gBattleMons[battler2].ability == ABILITY_CHLOROPHYLL && gBattleWeather & B_WEATHER_SUN)) + || (gBattleMons[battler2].ability == ABILITY_CHLOROPHYLL && gBattleWeather & B_WEATHER_SUN)) speedMultiplierBattler2 = 2; else speedMultiplierBattler2 = 1; @@ -3325,9 +3419,11 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) speedMultiplierBattler1 = 1; speedMultiplierBattler2 = 1; } + speedBattler1 = (gBattleMons[battler1].speed * speedMultiplierBattler1) - * (gStatStageRatios[gBattleMons[battler1].statStages[STAT_SPEED]][0]) - / (gStatStageRatios[gBattleMons[battler1].statStages[STAT_SPEED]][1]); + * (gStatStageRatios[gBattleMons[battler1].statStages[STAT_SPEED]][0]) + / (gStatStageRatios[gBattleMons[battler1].statStages[STAT_SPEED]][1]); + if (gBattleMons[battler1].item == ITEM_ENIGMA_BERRY) { holdEffect = gEnigmaBerries[battler1].holdEffect; @@ -3435,18 +3531,18 @@ static void SetActionsAndBattlersTurnOrder(void) if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[gActiveBattler]; gBattlerByTurnOrder[turnOrderId] = gActiveBattler; - ++turnOrderId; + turnOrderId++; } } else { if (gBattleTypeFlags & BATTLE_TYPE_LINK) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if (gChosenActionByBattler[gActiveBattler] == B_ACTION_RUN) { @@ -3465,13 +3561,13 @@ static void SetActionsAndBattlersTurnOrder(void) gActionsByTurnOrder[0] = gChosenActionByBattler[gActiveBattler]; gBattlerByTurnOrder[0] = gActiveBattler; turnOrderId = 1; - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (i != gActiveBattler) { gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[i]; gBattlerByTurnOrder[turnOrderId] = i; - ++turnOrderId; + turnOrderId++; } } gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts; @@ -3480,27 +3576,27 @@ static void SetActionsAndBattlersTurnOrder(void) } else { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if (gChosenActionByBattler[gActiveBattler] == B_ACTION_USE_ITEM || gChosenActionByBattler[gActiveBattler] == B_ACTION_SWITCH) { gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[gActiveBattler]; gBattlerByTurnOrder[turnOrderId] = gActiveBattler; - ++turnOrderId; + turnOrderId++; } } - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if (gChosenActionByBattler[gActiveBattler] != B_ACTION_USE_ITEM && gChosenActionByBattler[gActiveBattler] != B_ACTION_SWITCH) { gActionsByTurnOrder[turnOrderId] = gChosenActionByBattler[gActiveBattler]; gBattlerByTurnOrder[turnOrderId] = gActiveBattler; - ++turnOrderId; + turnOrderId++; } } - for (i = 0; i < gBattlersCount - 1; ++i) + for (i = 0; i < gBattlersCount - 1; i++) { - for (j = i + 1; j < gBattlersCount; ++j) + for (j = i + 1; j < gBattlersCount; j++) { u8 battler1 = gBattlerByTurnOrder[i]; u8 battler2 = gBattlerByTurnOrder[j]; @@ -3524,7 +3620,7 @@ static void TurnValuesCleanUp(bool8 var0) s32 i; u8 *dataPtr; - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if (var0) { @@ -3534,7 +3630,7 @@ static void TurnValuesCleanUp(bool8 var0) else { dataPtr = (u8 *)(&gProtectStructs[gActiveBattler]); - for (i = 0; i < sizeof(struct ProtectStruct); ++i) + for (i = 0; i < sizeof(struct ProtectStruct); i++) dataPtr[i] = 0; if (gDisableStructs[gActiveBattler].isFirstTurn) --gDisableStructs[gActiveBattler].isFirstTurn; @@ -3555,12 +3651,12 @@ static void TurnValuesCleanUp(bool8 var0) static void SpecialStatusesClear(void) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { s32 i; u8 *dataPtr = (u8 *)(&gSpecialStatuses[gActiveBattler]); - for (i = 0; i < sizeof(struct SpecialStatus); ++i) + for (i = 0; i < sizeof(struct SpecialStatus); i++) dataPtr[i] = 0; } } @@ -3697,7 +3793,7 @@ static void HandleEndTurn_BattleLost(void) static void HandleEndTurn_RanFromBattle(void) { gCurrentActionFuncId = 0; - switch (gProtectStructs[gBattlerAttacker].fleeFlag) + switch (gProtectStructs[gBattlerAttacker].fleeType) { default: gBattlescriptCurrInstr = BattleScript_GotAwaySafely; @@ -3726,7 +3822,7 @@ static void HandleEndTurn_FinishBattle(void) { if (!(gBattleTypeFlags & (BATTLE_TYPE_TRAINER_TOWER | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_OLD_MAN_TUTORIAL | BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_SAFARI | BATTLE_TYPE_FIRST_BATTLE | BATTLE_TYPE_LINK))) { - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) { @@ -3782,7 +3878,7 @@ static void TryEvolvePokemon(void) while (gLeveledUpInBattle != 0) { - for (i = 0; i < PARTY_SIZE; ++i) + for (i = 0; i < PARTY_SIZE; i++) { if (gLeveledUpInBattle & gBitTable[i]) { @@ -3791,6 +3887,7 @@ static void TryEvolvePokemon(void) levelUpBits &= ~(gBitTable[i]); gLeveledUpInBattle = levelUpBits; + species = GetEvolutionTargetSpecies(&gPlayerParty[i], EVO_MODE_NORMAL, levelUpBits); if (species != SPECIES_NONE) { @@ -3842,7 +3939,7 @@ void RunBattleScriptCommands_PopCallbacksStack(void) if (gCurrentActionFuncId == B_ACTION_TRY_FINISH || gCurrentActionFuncId == B_ACTION_FINISHED) { if (gBattleResources->battleCallbackStack->size != 0) - --gBattleResources->battleCallbackStack->size; + gBattleResources->battleCallbackStack->size--; gBattleMainFunc = gBattleResources->battleCallbackStack->function[gBattleResources->battleCallbackStack->size]; } else @@ -3882,7 +3979,7 @@ static void HandleAction_UseMove(void) gProtectStructs[gBattlerAttacker].noValidMoves = 0; gCurrentMove = gChosenMove = MOVE_STRUGGLE; gHitMarker |= HITMARKER_NO_PPDEDUCT; - *(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(MOVE_STRUGGLE, 0); + *(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(MOVE_STRUGGLE, NO_TARGET_OVERRIDE); } else if (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS || gBattleMons[gBattlerAttacker].status2 & STATUS2_RECHARGE) { @@ -3894,7 +3991,7 @@ static void HandleAction_UseMove(void) { gCurrentMove = gChosenMove = gDisableStructs[gBattlerAttacker].encoredMove; gCurrMovePos = gChosenMovePos = gDisableStructs[gBattlerAttacker].encoredMovePos; - *(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(gCurrentMove, 0); + *(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(gCurrentMove, NO_TARGET_OVERRIDE); } // check if the encored move wasn't overwritten else if (gDisableStructs[gBattlerAttacker].encoredMove != MOVE_NONE @@ -3905,12 +4002,12 @@ static void HandleAction_UseMove(void) gDisableStructs[gBattlerAttacker].encoredMove = MOVE_NONE; gDisableStructs[gBattlerAttacker].encoredMovePos = 0; gDisableStructs[gBattlerAttacker].encoreTimer = 0; - *(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(gCurrentMove, 0); + *(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(gCurrentMove, NO_TARGET_OVERRIDE); } else if (gBattleMons[gBattlerAttacker].moves[gCurrMovePos] != gChosenMoveByBattler[gBattlerAttacker]) { gCurrentMove = gChosenMove = gBattleMons[gBattlerAttacker].moves[gCurrMovePos]; - *(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(gCurrentMove, 0); + *(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(gCurrentMove, NO_TARGET_OVERRIDE); } else { @@ -3937,7 +4034,7 @@ static void HandleAction_UseMove(void) && gBattleMoves[gCurrentMove].type == TYPE_ELECTRIC) { side = GetBattlerSide(gBattlerAttacker); - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) if (side != GetBattlerSide(gActiveBattler) && *(gBattleStruct->moveTarget + gBattlerAttacker) != gActiveBattler && gBattleMons[gActiveBattler].ability == ABILITY_LIGHTNING_ROD @@ -4138,19 +4235,19 @@ bool8 TryRunFromBattle(u8 battler) if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN) { gLastUsedItem = gBattleMons[battler].item; - gProtectStructs[battler].fleeFlag = 1; - ++effect; + gProtectStructs[battler].fleeType = FLEE_ITEM; + effect++; } else if (gBattleMons[battler].ability == ABILITY_RUN_AWAY) { gLastUsedAbility = ABILITY_RUN_AWAY; - gProtectStructs[battler].fleeFlag = 2; - ++effect; + gProtectStructs[battler].fleeType = FLEE_ABILITY; + effect++; } else if (IS_BATTLE_TYPE_GHOST_WITHOUT_SCOPE(gBattleTypeFlags)) { if (GetBattlerSide(battler) == B_SIDE_PLAYER) - ++effect; + effect++; } else { @@ -4160,17 +4257,17 @@ bool8 TryRunFromBattle(u8 battler) { speedVar = (gBattleMons[battler].speed * 128) / (gBattleMons[BATTLE_OPPOSITE(battler)].speed) + (gBattleStruct->runTries * 30); if (speedVar > (Random() & 0xFF)) - ++effect; + effect++; } else // same speed or faster { - ++effect; + effect++; } } ++gBattleStruct->runTries; } - if (effect) + if (effect != 0) { gCurrentTurnActionNumber = gBattlersCount; gBattleOutcome = B_OUTCOME_RAN; @@ -4185,7 +4282,7 @@ static void HandleAction_Run(void) if (gBattleTypeFlags & BATTLE_TYPE_LINK) { gCurrentTurnActionNumber = gBattlersCount; - for (gActiveBattler = 0; gActiveBattler < gBattlersCount; ++gActiveBattler) + for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) { diff --git a/src/battle_message.c b/src/battle_message.c index 12369f063..a845fe57c 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -2378,7 +2378,13 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] = { {PIXEL_FILL(0x1), 4, 0x00, 1, 0, 1, 1, 0x2, 0x1, 0x3} }; -const u8 gUnknown_83FEC90[] = {0x04, 0x05, 0x02, 0x02}; +static const u8 sNpcTextColorToFont[] = +{ + [NPC_TEXT_COLOR_MALE] = FONT_4, + [NPC_TEXT_COLOR_FEMALE] = FONT_5, + [NPC_TEXT_COLOR_MON] = FONT_2, + [NPC_TEXT_COLOR_NEUTRAL] = FONT_2, +}; // windowId: Upper 2 bits are text flags // x40: Use NPC context-defined font @@ -2388,15 +2394,15 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId) { struct TextPrinterTemplate printerTemplate; u8 speed; int x; - u8 context; + u8 color; u8 textFlags = windowId & 0xC0; windowId &= 0x3F; if (!(textFlags & 0x80)) FillWindowPixelBuffer(windowId, sTextOnWindowsInfo_Normal[windowId].fillValue); if (textFlags & 0x40) { - context = ContextNpcGetTextColor(); - printerTemplate.fontId = gUnknown_83FEC90[context]; + color = ContextNpcGetTextColor(); + printerTemplate.fontId = sNpcTextColorToFont[color]; } else { printerTemplate.fontId = sTextOnWindowsInfo_Normal[windowId].fontId; diff --git a/src/battle_util.c b/src/battle_util.c index 383a8fc0e..bad9457a2 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -27,16 +27,17 @@ #include "constants/battle_move_effects.h" #include "constants/battle_script_commands.h" +#define SOUND_MOVES_END 0xFFFF + static const u16 sSoundMovesTable[] = { MOVE_GROWL, MOVE_ROAR, MOVE_SING, MOVE_SUPERSONIC, MOVE_SCREECH, MOVE_SNORE, - MOVE_UPROAR, MOVE_METAL_SOUND, MOVE_GRASS_WHISTLE, MOVE_HYPER_VOICE, 0xFFFF + MOVE_UPROAR, MOVE_METAL_SOUND, MOVE_GRASS_WHISTLE, MOVE_HYPER_VOICE, SOUND_MOVES_END }; u8 GetBattlerForBattleScript(u8 caseId) { - u32 ret = 0; - + u8 ret = 0; switch (caseId) { case BS_TARGET: @@ -57,7 +58,7 @@ u8 GetBattlerForBattleScript(u8 caseId) case BS_FAINTED: ret = gBattlerFainted; break; - case 5: + case BS_FAINTED_LINK_MULTIPLE_1: ret = gBattlerFainted; break; case BS_PLAYER1: @@ -66,10 +67,10 @@ u8 GetBattlerForBattleScript(u8 caseId) case BS_OPPONENT1: ret = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); break; - case 4: - case 6: - case 8: - case 9: + case BS_ATTACKER_WITH_PARTNER: + case BS_FAINTED_LINK_MULTIPLE_2: + case BS_ATTACKER_SIDE: + case BS_NOT_ATTACKER_SIDE: break; } return ret; @@ -77,99 +78,115 @@ u8 GetBattlerForBattleScript(u8 caseId) void PressurePPLose(u8 target, u8 attacker, u16 move) { - s32 i; + int moveIndex; - if (gBattleMons[target].ability == ABILITY_PRESSURE) + if (gBattleMons[target].ability != ABILITY_PRESSURE) + return; + + for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) { - for (i = 0; i < MAX_MON_MOVES && gBattleMons[attacker].moves[i] != move; ++i); - if (i != MAX_MON_MOVES) - { - if (gBattleMons[attacker].pp[i]) - --gBattleMons[attacker].pp[i]; - if (!(gBattleMons[attacker].status2 & STATUS2_TRANSFORMED) - && !(gDisableStructs[attacker].mimickedMoves & gBitTable[i])) - { - gActiveBattler = attacker; - BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + i, 0, 1, &gBattleMons[gActiveBattler].pp[i]); - MarkBattlerForControllerExec(gActiveBattler); - } - } + if (gBattleMons[attacker].moves[moveIndex] == move) + break; + } + + if (moveIndex == MAX_MON_MOVES) + return; + + if (gBattleMons[attacker].pp[moveIndex] != 0) + gBattleMons[attacker].pp[moveIndex]--; + + if (MOVE_IS_PERMANENT(attacker, moveIndex)) + { + gActiveBattler = attacker; + BtlController_EmitSetMonData(BUFFER_A, REQUEST_PPMOVE1_BATTLE + moveIndex, 0, 1, &gBattleMons[gActiveBattler].pp[moveIndex]); + MarkBattlerForControllerExec(gActiveBattler); } } void PressurePPLoseOnUsingImprison(u8 attacker) { - s32 i, j; - s32 imprisonPos = 4; + int i, j; + int imprisonPos = MAX_MON_MOVES; u8 atkSide = GetBattlerSide(attacker); - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (atkSide != GetBattlerSide(i) && gBattleMons[i].ability == ABILITY_PRESSURE) { - for (j = 0; j < MAX_MON_MOVES && gBattleMons[attacker].moves[j] != MOVE_IMPRISON; ++j); + for (j = 0; j < MAX_MON_MOVES; j++) + { + if (gBattleMons[attacker].moves[j] == MOVE_IMPRISON) + break; + } if (j != MAX_MON_MOVES) { imprisonPos = j; - if (gBattleMons[attacker].pp[j]) - --gBattleMons[attacker].pp[j]; + if (gBattleMons[attacker].pp[j] != 0) + gBattleMons[attacker].pp[j]--; } } } - if (imprisonPos != 4 - && !(gBattleMons[attacker].status2 & STATUS2_TRANSFORMED) - && !(gDisableStructs[attacker].mimickedMoves & gBitTable[imprisonPos])) + + if (imprisonPos != MAX_MON_MOVES && MOVE_IS_PERMANENT(attacker, imprisonPos)) { gActiveBattler = attacker; - BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + imprisonPos, 0, 1, &gBattleMons[gActiveBattler].pp[imprisonPos]); + BtlController_EmitSetMonData(BUFFER_A, REQUEST_PPMOVE1_BATTLE + imprisonPos, 0, 1, &gBattleMons[gActiveBattler].pp[imprisonPos]); MarkBattlerForControllerExec(gActiveBattler); } } void PressurePPLoseOnUsingPerishSong(u8 attacker) { - s32 i, j; - s32 perishSongPos = 4; + int i, j; + int perishSongPos = MAX_MON_MOVES; - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (gBattleMons[i].ability == ABILITY_PRESSURE && i != attacker) { - for (j = 0; j < MAX_MON_MOVES && gBattleMons[attacker].moves[j] != MOVE_PERISH_SONG; ++j); + for (j = 0; j < MAX_MON_MOVES; j++) + { + if (gBattleMons[attacker].moves[j] == MOVE_PERISH_SONG) + break; + } if (j != MAX_MON_MOVES) { perishSongPos = j; - if (gBattleMons[attacker].pp[j]) - --gBattleMons[attacker].pp[j]; + if (gBattleMons[attacker].pp[j] != 0) + gBattleMons[attacker].pp[j]--; } } } - if (perishSongPos != MAX_MON_MOVES - && !(gBattleMons[attacker].status2 & STATUS2_TRANSFORMED) - && !(gDisableStructs[attacker].mimickedMoves & gBitTable[perishSongPos])) + + if (perishSongPos != MAX_MON_MOVES && MOVE_IS_PERMANENT(attacker, perishSongPos)) { gActiveBattler = attacker; - BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + perishSongPos, 0, 1, &gBattleMons[gActiveBattler].pp[perishSongPos]); + BtlController_EmitSetMonData(BUFFER_A, REQUEST_PPMOVE1_BATTLE + perishSongPos, 0, 1, &gBattleMons[gActiveBattler].pp[perishSongPos]); MarkBattlerForControllerExec(gActiveBattler); } } -void MarkAllBattlersForControllerExec(void) +// Unused +static void MarkAllBattlersForControllerExec(void) { - s32 i; + int i; if (gBattleTypeFlags & BATTLE_TYPE_LINK) - for (i = 0; i < gBattlersCount; ++i) - gBattleControllerExecFlags |= gBitTable[i] << 0x1C; + { + for (i = 0; i < gBattlersCount; i++) + gBattleControllerExecFlags |= gBitTable[i] << (32 - MAX_BATTLERS_COUNT); + } else - for (i = 0; i < gBattlersCount; ++i) + { + for (i = 0; i < gBattlersCount; i++) gBattleControllerExecFlags |= gBitTable[i]; + } } void MarkBattlerForControllerExec(u8 battlerId) { if (gBattleTypeFlags & BATTLE_TYPE_LINK) - gBattleControllerExecFlags |= gBitTable[battlerId] << 0x1C; + gBattleControllerExecFlags |= gBitTable[battlerId] << (32 - MAX_BATTLERS_COUNT); else gBattleControllerExecFlags |= gBitTable[battlerId]; } @@ -178,19 +195,21 @@ void MarkBattlerReceivedLinkData(u8 battlerId) { s32 i; - for (i = 0; i < GetLinkPlayerCount(); ++i) + for (i = 0; i < GetLinkPlayerCount(); i++) gBattleControllerExecFlags |= gBitTable[battlerId] << (i << 2); - gBattleControllerExecFlags &= ~(0x10000000 << battlerId); + gBattleControllerExecFlags &= ~((1 << 28) << battlerId); } void CancelMultiTurnMoves(u8 battler) { - gBattleMons[battler].status2 &= ~(STATUS2_MULTIPLETURNS); - gBattleMons[battler].status2 &= ~(STATUS2_LOCK_CONFUSE); - gBattleMons[battler].status2 &= ~(STATUS2_UPROAR); - gBattleMons[battler].status2 &= ~(STATUS2_BIDE); - gStatuses3[battler] &= ~(STATUS3_SEMI_INVULNERABLE); + gBattleMons[battler].status2 &= ~STATUS2_MULTIPLETURNS; + gBattleMons[battler].status2 &= ~STATUS2_LOCK_CONFUSE; + gBattleMons[battler].status2 &= ~STATUS2_UPROAR; + gBattleMons[battler].status2 &= ~STATUS2_BIDE; + + gStatuses3[battler] &= ~STATUS3_SEMI_INVULNERABLE; + gDisableStructs[battler].rolloutTimer = 0; gDisableStructs[battler].furyCutterCounter = 0; } @@ -198,14 +217,14 @@ void CancelMultiTurnMoves(u8 battler) bool8 WasUnableToUseMove(u8 battler) { if (gProtectStructs[battler].prlzImmobility - || gProtectStructs[battler].targetNotAffected - || gProtectStructs[battler].usedImprisonedMove - || gProtectStructs[battler].loveImmobility - || gProtectStructs[battler].usedDisabledMove - || gProtectStructs[battler].usedTauntedMove - || gProtectStructs[battler].flag2Unknown - || gProtectStructs[battler].flinchImmobility - || gProtectStructs[battler].confusionSelfDmg) + || gProtectStructs[battler].targetNotAffected + || gProtectStructs[battler].usedImprisonedMove + || gProtectStructs[battler].loveImmobility + || gProtectStructs[battler].usedDisabledMove + || gProtectStructs[battler].usedTauntedMove + || gProtectStructs[battler].flag2Unknown + || gProtectStructs[battler].flinchImmobility + || gProtectStructs[battler].confusionSelfDmg) return TRUE; else return FALSE; @@ -214,7 +233,7 @@ bool8 WasUnableToUseMove(u8 battler) void PrepareStringBattle(u16 stringId, u8 battler) { gActiveBattler = battler; - BtlController_EmitPrintString(0, stringId); + BtlController_EmitPrintString(BUFFER_A, stringId); MarkBattlerForControllerExec(gActiveBattler); } @@ -225,8 +244,10 @@ void ResetSentPokesToOpponentValue(void) gSentPokesToOpponent[0] = 0; gSentPokesToOpponent[1] = 0; + for (i = 0; i < gBattlersCount; i += 2) bits |= gBitTable[gBattlerPartyIndexes[i]]; + for (i = 1; i < gBattlersCount; i += 2) gSentPokesToOpponent[(i & BIT_FLANK) >> 1] = bits; } @@ -242,8 +263,10 @@ void OpponentSwitchInResetSentPokesToOpponentValue(u8 battler) gSentPokesToOpponent[flank] = 0; for (i = 0; i < gBattlersCount; i += 2) + { if (!(gAbsentBattlerFlags & gBitTable[i])) bits |= gBitTable[gBattlerPartyIndexes[i]]; + } gSentPokesToOpponent[flank] = bits; } } @@ -257,8 +280,7 @@ void UpdateSentPokesToOpponentValue(u8 battler) else { s32 i; - - for (i = 1; i < gBattlersCount; ++i) + for (i = 1; i < gBattlersCount; i++) gSentPokesToOpponent[(i & BIT_FLANK) >> 1] |= gBitTable[gBattlerPartyIndexes[battler]]; } } @@ -292,40 +314,47 @@ u8 TrySetCantSelectMoveBattleScript(void) gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingDisabledMove; limitations = 1; } + if (move == gLastMoves[gActiveBattler] && move != MOVE_STRUGGLE && (gBattleMons[gActiveBattler].status2 & STATUS2_TORMENT)) { CancelMultiTurnMoves(gActiveBattler); gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingTormentedMove; - ++limitations; + limitations++; } - if (gDisableStructs[gActiveBattler].tauntTimer && !gBattleMoves[move].power) + + if (gDisableStructs[gActiveBattler].tauntTimer != 0 && gBattleMoves[move].power == 0) { gCurrentMove = move; gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveTaunt; - ++limitations; + limitations++; } + if (GetImprisonedMovesCount(gActiveBattler, move)) { gCurrentMove = move; gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingImprisonedMove; - ++limitations; + limitations++; } + if (gBattleMons[gActiveBattler].item == ITEM_ENIGMA_BERRY) holdEffect = gEnigmaBerries[gActiveBattler].holdEffect; else holdEffect = ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item); + gPotentialItemEffectBattler = gActiveBattler; - if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove && *choicedMove != 0xFFFF && *choicedMove != move) + + if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != move) { gCurrentMove = *choicedMove; gLastUsedItem = gBattleMons[gActiveBattler].item; gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveChoiceItem; - ++limitations; + limitations++; } - if (!gBattleMons[gActiveBattler].pp[gBattleBufferB[gActiveBattler][2]]) + + if (gBattleMons[gActiveBattler].pp[gBattleBufferB[gActiveBattler][2]] == 0) { gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingMoveWithNoPP; - ++limitations; + limitations++; } return limitations; } @@ -340,37 +369,47 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check) holdEffect = gEnigmaBerries[battlerId].holdEffect; else holdEffect = ItemId_GetHoldEffect(gBattleMons[battlerId].item); + gPotentialItemEffectBattler = battlerId; - for (i = 0; i < MAX_MON_MOVES; ++i) + for (i = 0; i < MAX_MON_MOVES; i++) { - if (gBattleMons[battlerId].moves[i] == 0 && check & MOVE_LIMITATION_ZEROMOVE) + // No move + if (gBattleMons[battlerId].moves[i] == MOVE_NONE && check & MOVE_LIMITATION_ZEROMOVE) unusableMoves |= gBitTable[i]; + // No PP if (gBattleMons[battlerId].pp[i] == 0 && check & MOVE_LIMITATION_PP) unusableMoves |= gBitTable[i]; + // Disable if (gBattleMons[battlerId].moves[i] == gDisableStructs[battlerId].disabledMove && check & MOVE_LIMITATION_DISABLED) unusableMoves |= gBitTable[i]; + // Torment if (gBattleMons[battlerId].moves[i] == gLastMoves[battlerId] && check & MOVE_LIMITATION_TORMENTED && gBattleMons[battlerId].status2 & STATUS2_TORMENT) unusableMoves |= gBitTable[i]; + // Taunt if (gDisableStructs[battlerId].tauntTimer && check & MOVE_LIMITATION_TAUNT && gBattleMoves[gBattleMons[battlerId].moves[i]].power == 0) unusableMoves |= gBitTable[i]; + // Imprison if (GetImprisonedMovesCount(battlerId, gBattleMons[battlerId].moves[i]) && check & MOVE_LIMITATION_IMPRISON) unusableMoves |= gBitTable[i]; + // Encore if (gDisableStructs[battlerId].encoreTimer && gDisableStructs[battlerId].encoredMove != gBattleMons[battlerId].moves[i]) unusableMoves |= gBitTable[i]; - if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != gBattleMons[battlerId].moves[i]) + // Choice Band + if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i]) unusableMoves |= gBitTable[i]; } return unusableMoves; } +#define ALL_MOVES_MASK ((1 << MAX_MON_MOVES) - 1) bool8 AreAllMovesUnusable(void) { - u8 unusable = CheckMoveLimitations(gActiveBattler, 0, 0xFF); + u8 unusable = CheckMoveLimitations(gActiveBattler, 0, MOVE_LIMITATIONS_ALL); - if (unusable == 0xF) // All moves are unusable. + if (unusable == ALL_MOVES_MASK) // All moves are unusable. { - gProtectStructs[gActiveBattler].noValidMoves = 1; + gProtectStructs[gActiveBattler].noValidMoves = TRUE; gSelectionBattleScripts[gActiveBattler] = BattleScript_NoMovesLeft; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) gBattleBufferB[gActiveBattler][3] = GetBattlerAtPosition((BATTLE_OPPOSITE(GetBattlerPosition(gActiveBattler))) | (Random() & 2)); @@ -379,10 +418,12 @@ bool8 AreAllMovesUnusable(void) } else { - gProtectStructs[gActiveBattler].noValidMoves = 0; + gProtectStructs[gActiveBattler].noValidMoves = FALSE; } - return (unusable == 0xF); + + return (unusable == ALL_MOVES_MASK); } +#undef ALL_MOVES_MASK u8 GetImprisonedMovesCount(u8 battlerId, u16 move) { @@ -390,17 +431,21 @@ u8 GetImprisonedMovesCount(u8 battlerId, u16 move) u8 imprisonedMoves = 0; u8 battlerSide = GetBattlerSide(battlerId); - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (battlerSide != GetBattlerSide(i) && gStatuses3[i] & STATUS3_IMPRISONED_OTHERS) { s32 j; - - for (j = 0; j < MAX_MON_MOVES && move != gBattleMons[i].moves[j]; ++j); + for (j = 0; j < MAX_MON_MOVES; j++) + { + if (move == gBattleMons[i].moves[j]) + break; + } if (j < MAX_MON_MOVES) - ++imprisonedMoves; + imprisonedMoves++; } } + return imprisonedMoves; } @@ -424,8 +469,13 @@ u8 DoFieldEndTurnEffects(void) u8 effect = 0; s32 i; - for (gBattlerAttacker = 0; gBattlerAttacker < gBattlersCount && gAbsentBattlerFlags & gBitTable[gBattlerAttacker]; ++gBattlerAttacker); - for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount && gAbsentBattlerFlags & gBitTable[gBattlerTarget]; ++gBattlerTarget); + for (gBattlerAttacker = 0; gBattlerAttacker < gBattlersCount && gAbsentBattlerFlags & gBitTable[gBattlerAttacker]; gBattlerAttacker++) + { + } + for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount && gAbsentBattlerFlags & gBitTable[gBattlerTarget]; gBattlerTarget++) + { + } + do { u8 side; @@ -433,15 +483,18 @@ u8 DoFieldEndTurnEffects(void) switch (gBattleStruct->turnCountersTracker) { case ENDTURN_ORDER: - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) + { gBattlerByTurnOrder[i] = i; - for (i = 0; i < gBattlersCount - 1; ++i) + } + for (i = 0; i < gBattlersCount - 1; i++) { s32 j; - - for (j = i + 1; j < gBattlersCount; ++j) - if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], 0)) + for (j = i + 1; j < gBattlersCount; j++) + { + if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], FALSE)) SwapTurnOrder(i, j); + } } { u8 *var = &gBattleStruct->turnCountersTracker; @@ -462,16 +515,16 @@ u8 DoFieldEndTurnEffects(void) gSideStatuses[side] &= ~SIDE_STATUS_REFLECT; BattleScriptExecute(BattleScript_SideStatusWoreOff); PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_REFLECT); - ++effect; + effect++; } } - ++gBattleStruct->turnSideTracker; - if (effect) + gBattleStruct->turnSideTracker++; + if (effect != 0) break; } - if (!effect) + if (effect == 0) { - ++gBattleStruct->turnCountersTracker; + gBattleStruct->turnCountersTracker++; gBattleStruct->turnSideTracker = 0; } break; @@ -488,16 +541,16 @@ u8 DoFieldEndTurnEffects(void) BattleScriptExecute(BattleScript_SideStatusWoreOff); gBattleCommunication[MULTISTRING_CHOOSER] = side; PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_LIGHT_SCREEN); - ++effect; + effect++; } } - ++gBattleStruct->turnSideTracker; - if (effect) + gBattleStruct->turnSideTracker++; + if (effect != 0) break; } - if (!effect) + if (effect == 0) { - ++gBattleStruct->turnCountersTracker; + gBattleStruct->turnCountersTracker++; gBattleStruct->turnSideTracker = 0; } break; @@ -512,15 +565,15 @@ u8 DoFieldEndTurnEffects(void) BattleScriptExecute(BattleScript_SideStatusWoreOff); gBattleCommunication[MULTISTRING_CHOOSER] = side; PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_MIST); - ++effect; + effect++; } - ++gBattleStruct->turnSideTracker; - if (effect) + gBattleStruct->turnSideTracker++; + if (effect != 0) break; } - if (!effect) + if (effect == 0) { - ++gBattleStruct->turnCountersTracker; + gBattleStruct->turnCountersTracker++; gBattleStruct->turnSideTracker = 0; } break; @@ -535,16 +588,16 @@ u8 DoFieldEndTurnEffects(void) { gSideStatuses[side] &= ~SIDE_STATUS_SAFEGUARD; BattleScriptExecute(BattleScript_SafeguardEnds); - ++effect; + effect++; } } - ++gBattleStruct->turnSideTracker; - if (effect) + gBattleStruct->turnSideTracker++; + if (effect != 0) break; } - if (!effect) + if (effect == 0) { - ++gBattleStruct->turnCountersTracker; + gBattleStruct->turnCountersTracker++; gBattleStruct->turnSideTracker = 0; } break; @@ -558,14 +611,16 @@ u8 DoFieldEndTurnEffects(void) { gBattlerTarget = gActiveBattler; BattleScriptExecute(BattleScript_WishComesTrue); - ++effect; + effect++; } - ++gBattleStruct->turnSideTracker; - if (effect) + gBattleStruct->turnSideTracker++; + if (effect != 0) break; } - if (!effect) - ++gBattleStruct->turnCountersTracker; + if (effect == 0) + { + gBattleStruct->turnCountersTracker++; + } break; case ENDTURN_RAIN: if (gBattleWeather & B_WEATHER_RAIN) @@ -576,25 +631,26 @@ u8 DoFieldEndTurnEffects(void) { gBattleWeather &= ~B_WEATHER_RAIN_TEMPORARY; gBattleWeather &= ~B_WEATHER_RAIN_DOWNPOUR; - gBattleCommunication[MULTISTRING_CHOOSER] = 2; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_STOPPED; } else if (gBattleWeather & B_WEATHER_RAIN_DOWNPOUR) - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOWNPOUR_CONTINUES; else - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_CONTINUES; } else if (gBattleWeather & B_WEATHER_RAIN_DOWNPOUR) { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOWNPOUR_CONTINUES; } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_CONTINUES; } + BattleScriptExecute(BattleScript_RainContinuesOrEnds); - ++effect; + effect++; } - ++gBattleStruct->turnCountersTracker; + gBattleStruct->turnCountersTracker++; break; case ENDTURN_SANDSTORM: if (gBattleWeather & B_WEATHER_SANDSTORM) @@ -608,12 +664,13 @@ u8 DoFieldEndTurnEffects(void) { gBattlescriptCurrInstr = BattleScript_DamagingWeatherContinues; } + gBattleScripting.animArg1 = B_ANIM_SANDSTORM_CONTINUES; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SANDSTORM; BattleScriptExecute(gBattlescriptCurrInstr); - ++effect; + effect++; } - ++gBattleStruct->turnCountersTracker; + gBattleStruct->turnCountersTracker++; break; case ENDTURN_SUN: if (gBattleWeather & B_WEATHER_SUN) @@ -627,10 +684,11 @@ u8 DoFieldEndTurnEffects(void) { gBattlescriptCurrInstr = BattleScript_SunlightContinues; } + BattleScriptExecute(gBattlescriptCurrInstr); - ++effect; + effect++; } - ++gBattleStruct->turnCountersTracker; + gBattleStruct->turnCountersTracker++; break; case ENDTURN_HAIL: if (gBattleWeather & B_WEATHER_HAIL) @@ -644,18 +702,19 @@ u8 DoFieldEndTurnEffects(void) { gBattlescriptCurrInstr = BattleScript_DamagingWeatherContinues; } + gBattleScripting.animArg1 = B_ANIM_HAIL_CONTINUES; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_HAIL; BattleScriptExecute(gBattlescriptCurrInstr); - ++effect; + effect++; } - ++gBattleStruct->turnCountersTracker; + gBattleStruct->turnCountersTracker++; break; case ENDTURN_FIELD_COUNT: - ++effect; + effect++; break; } - } while (!effect); + } while (effect == 0); return (gBattleMainFunc != BattleTurnPassed); } @@ -693,7 +752,7 @@ u8 DoBattlerEndTurnEffects(void) gActiveBattler = gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->turnEffectsBattlerId]; if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) { - ++gBattleStruct->turnEffectsBattlerId; + gBattleStruct->turnEffectsBattlerId++; } else { @@ -709,24 +768,24 @@ u8 DoBattlerEndTurnEffects(void) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; BattleScriptExecute(BattleScript_IngrainTurnHeal); - ++effect; + effect++; } - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ABILITIES: // end turn abilities if (AbilityBattleEffects(ABILITYEFFECT_ENDTURN, gActiveBattler, 0, 0, 0)) - ++effect; - ++gBattleStruct->turnEffectsTracker; + effect++; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ITEMS1: // item effects - if (ItemBattleEffects(1, gActiveBattler, FALSE)) - ++effect; - ++gBattleStruct->turnEffectsTracker; + if (ItemBattleEffects(ITEMEFFECT_NORMAL, gActiveBattler, FALSE)) + effect++; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ITEMS2: // item effects again - if (ItemBattleEffects(1, gActiveBattler, TRUE)) - ++effect; - ++gBattleStruct->turnEffectsTracker; + if (ItemBattleEffects(ITEMEFFECT_NORMAL, gActiveBattler, TRUE)) + effect++; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_LEECH_SEED: // leech seed if ((gStatuses3[gActiveBattler] & STATUS3_LEECHSEED) @@ -740,9 +799,9 @@ u8 DoBattlerEndTurnEffects(void) gBattleScripting.animArg1 = gBattlerTarget; gBattleScripting.animArg2 = gBattlerAttacker; BattleScriptExecute(BattleScript_LeechSeedTurnDrain); - ++effect; + effect++; } - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_POISON: // poison if ((gBattleMons[gActiveBattler].status1 & STATUS1_POISON) && gBattleMons[gActiveBattler].hp != 0) @@ -751,9 +810,9 @@ u8 DoBattlerEndTurnEffects(void) if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; BattleScriptExecute(BattleScript_PoisonTurnDmg); - ++effect; + effect++; } - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_BAD_POISON: // toxic poison if ((gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_POISON) && gBattleMons[gActiveBattler].hp != 0) @@ -761,13 +820,13 @@ u8 DoBattlerEndTurnEffects(void) gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; - if ((gBattleMons[gActiveBattler].status1 & 0xF00) != 0xF00) // not 16 turns - gBattleMons[gActiveBattler].status1 += 0x100; - gBattleMoveDamage *= (gBattleMons[gActiveBattler].status1 & 0xF00) >> 8; + if ((gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_COUNTER) != STATUS1_TOXIC_TURN(15)) // not 16 turns + gBattleMons[gActiveBattler].status1 += STATUS1_TOXIC_TURN(1); + gBattleMoveDamage *= (gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_COUNTER) >> 8; BattleScriptExecute(BattleScript_PoisonTurnDmg); - ++effect; + effect++; } - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_BURN: // burn if ((gBattleMons[gActiveBattler].status1 & STATUS1_BURN) && gBattleMons[gActiveBattler].hp != 0) @@ -776,9 +835,9 @@ u8 DoBattlerEndTurnEffects(void) if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; BattleScriptExecute(BattleScript_BurnTurnDmg); - ++effect; + effect++; } - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_NIGHTMARES: // spooky nightmares if ((gBattleMons[gActiveBattler].status2 & STATUS2_NIGHTMARE) && gBattleMons[gActiveBattler].hp != 0) @@ -791,14 +850,14 @@ u8 DoBattlerEndTurnEffects(void) if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; BattleScriptExecute(BattleScript_NightmareTurnDmg); - ++effect; + effect++; } else { gBattleMons[gActiveBattler].status2 &= ~STATUS2_NIGHTMARE; } } - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_CURSE: // curse if ((gBattleMons[gActiveBattler].status2 & STATUS2_CURSED) && gBattleMons[gActiveBattler].hp != 0) @@ -807,14 +866,14 @@ u8 DoBattlerEndTurnEffects(void) if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; BattleScriptExecute(BattleScript_CurseTurnDmg); - ++effect; + effect++; } - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_WRAP: // wrap if ((gBattleMons[gActiveBattler].status2 & STATUS2_WRAPPED) && gBattleMons[gActiveBattler].hp != 0) { - gBattleMons[gActiveBattler].status2 -= 0x2000; + gBattleMons[gActiveBattler].status2 -= STATUS2_WRAPPED_TURN(1); if (gBattleMons[gActiveBattler].status2 & STATUS2_WRAPPED) // damaged by wrap { gBattleScripting.animArg1 = *(gBattleStruct->wrappedMove + gActiveBattler * 2 + 0); @@ -839,24 +898,24 @@ u8 DoBattlerEndTurnEffects(void) gBattlescriptCurrInstr = BattleScript_WrapEnds; } BattleScriptExecute(gBattlescriptCurrInstr); - ++effect; + effect++; } - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_UPROAR: // uproar if (gBattleMons[gActiveBattler].status2 & STATUS2_UPROAR) { - for (gBattlerAttacker = 0; gBattlerAttacker < gBattlersCount; ++gBattlerAttacker) + for (gBattlerAttacker = 0; gBattlerAttacker < gBattlersCount; gBattlerAttacker++) { if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP) && gBattleMons[gBattlerAttacker].ability != ABILITY_SOUNDPROOF) { - gBattleMons[gBattlerAttacker].status1 &= ~(STATUS1_SLEEP); - gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[gBattlerAttacker].status1 &= ~STATUS1_SLEEP; + gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE; gBattleCommunication[MULTISTRING_CHOOSER] = 1; BattleScriptExecute(BattleScript_MonWokeUpInUproar); gActiveBattler = gBattlerAttacker; - BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); MarkBattlerForControllerExec(gActiveBattler); break; } @@ -869,20 +928,20 @@ u8 DoBattlerEndTurnEffects(void) else { gBattlerAttacker = gActiveBattler; - gBattleMons[gActiveBattler].status2 -= 0x10; // uproar timer goes down + gBattleMons[gActiveBattler].status2 -= STATUS2_UPROAR_TURN(1); if (WasUnableToUseMove(gActiveBattler)) { CancelMultiTurnMoves(gActiveBattler); - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_UPROAR_ENDS; } else if (gBattleMons[gActiveBattler].status2 & STATUS2_UPROAR) { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_UPROAR_CONTINUES; gBattleMons[gActiveBattler].status2 |= STATUS2_MULTIPLETURNS; } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_UPROAR_ENDS; CancelMultiTurnMoves(gActiveBattler); } BattleScriptExecute(BattleScript_PrintUproarOverTurns); @@ -890,36 +949,35 @@ u8 DoBattlerEndTurnEffects(void) } } if (effect != 2) - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_THRASH: // thrash if (gBattleMons[gActiveBattler].status2 & STATUS2_LOCK_CONFUSE) { - gBattleMons[gActiveBattler].status2 -= 0x400; + gBattleMons[gActiveBattler].status2 -= STATUS2_LOCK_CONFUSE_TURN(1); if (WasUnableToUseMove(gActiveBattler)) CancelMultiTurnMoves(gActiveBattler); else if (!(gBattleMons[gActiveBattler].status2 & STATUS2_LOCK_CONFUSE) - && (gBattleMons[gActiveBattler].status2 & STATUS2_MULTIPLETURNS)) + && (gBattleMons[gActiveBattler].status2 & STATUS2_MULTIPLETURNS)) { - gBattleMons[gActiveBattler].status2 &= ~(STATUS2_MULTIPLETURNS); + gBattleMons[gActiveBattler].status2 &= ~STATUS2_MULTIPLETURNS; if (!(gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION)) { gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_CONFUSION | MOVE_EFFECT_AFFECTS_USER; - SetMoveEffect(1, 0); + SetMoveEffect(TRUE, 0); if (gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION) BattleScriptExecute(BattleScript_ThrashConfuses); - ++effect; + effect++; } } } - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_DISABLE: // disable if (gDisableStructs[gActiveBattler].disableTimer != 0) { s32 i; - - for (i = 0; i < MAX_MON_MOVES; ++i) + for (i = 0; i < MAX_MON_MOVES; i++) { if (gDisableStructs[gActiveBattler].disabledMove == gBattleMons[gActiveBattler].moves[i]) break; @@ -933,10 +991,10 @@ u8 DoBattlerEndTurnEffects(void) { gDisableStructs[gActiveBattler].disabledMove = MOVE_NONE; BattleScriptExecute(BattleScript_DisabledNoMore); - ++effect; + effect++; } } - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ENCORE: // encore if (gDisableStructs[gActiveBattler].encoreTimer != 0) @@ -947,56 +1005,56 @@ u8 DoBattlerEndTurnEffects(void) gDisableStructs[gActiveBattler].encoreTimer = 0; } else if (--gDisableStructs[gActiveBattler].encoreTimer == 0 - || gBattleMons[gActiveBattler].pp[gDisableStructs[gActiveBattler].encoredMovePos] == 0) + || gBattleMons[gActiveBattler].pp[gDisableStructs[gActiveBattler].encoredMovePos] == 0) { gDisableStructs[gActiveBattler].encoredMove = MOVE_NONE; gDisableStructs[gActiveBattler].encoreTimer = 0; BattleScriptExecute(BattleScript_EncoredNoMore); - ++effect; + effect++; } } - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_LOCK_ON: // lock-on decrement if (gStatuses3[gActiveBattler] & STATUS3_ALWAYS_HITS) - gStatuses3[gActiveBattler] -= 0x8; - ++gBattleStruct->turnEffectsTracker; + gStatuses3[gActiveBattler] -= STATUS3_ALWAYS_HITS_TURN(1); + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_CHARGE: // charge if (gDisableStructs[gActiveBattler].chargeTimer && --gDisableStructs[gActiveBattler].chargeTimer == 0) gStatuses3[gActiveBattler] &= ~STATUS3_CHARGED_UP; - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_TAUNT: // taunt if (gDisableStructs[gActiveBattler].tauntTimer) - --gDisableStructs[gActiveBattler].tauntTimer; - ++gBattleStruct->turnEffectsTracker; + gDisableStructs[gActiveBattler].tauntTimer--; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_YAWN: // yawn if (gStatuses3[gActiveBattler] & STATUS3_YAWN) { - gStatuses3[gActiveBattler] -= 0x800; + gStatuses3[gActiveBattler] -= STATUS3_YAWN_TURN(1); if (!(gStatuses3[gActiveBattler] & STATUS3_YAWN) && !(gBattleMons[gActiveBattler].status1 & STATUS1_ANY) && gBattleMons[gActiveBattler].ability != ABILITY_VITAL_SPIRIT && gBattleMons[gActiveBattler].ability != ABILITY_INSOMNIA && !UproarWakeUpCheck(gActiveBattler)) { CancelMultiTurnMoves(gActiveBattler); - gBattleMons[gActiveBattler].status1 |= (Random() & 3) + 2; - BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + gBattleMons[gActiveBattler].status1 |= STATUS1_SLEEP_TURN((Random() & 3) + 2); // 2-5 turns of sleep + BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); MarkBattlerForControllerExec(gActiveBattler); gEffectBattler = gActiveBattler; BattleScriptExecute(BattleScript_YawnMakesAsleep); - ++effect; + effect++; } } - ++gBattleStruct->turnEffectsTracker; + gBattleStruct->turnEffectsTracker++; break; case ENDTURN_BATTLER_COUNT: // done gBattleStruct->turnEffectsTracker = 0; - ++gBattleStruct->turnEffectsBattlerId; + gBattleStruct->turnEffectsBattlerId++; break; } - if (effect) + if (effect != 0) return effect; } } @@ -1007,6 +1065,7 @@ u8 DoBattlerEndTurnEffects(void) bool8 HandleWishPerishSongOnTurnEnd(void) { gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); + switch (gBattleStruct->wishPerishSongState) { case 0: @@ -1015,19 +1074,22 @@ bool8 HandleWishPerishSongOnTurnEnd(void) gActiveBattler = gBattleStruct->wishPerishSongBattlerId; if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) { - ++gBattleStruct->wishPerishSongBattlerId; + gBattleStruct->wishPerishSongBattlerId++; continue; } - ++gBattleStruct->wishPerishSongBattlerId; + + gBattleStruct->wishPerishSongBattlerId++; if (gWishFutureKnock.futureSightCounter[gActiveBattler] != 0 && --gWishFutureKnock.futureSightCounter[gActiveBattler] == 0 && gBattleMons[gActiveBattler].hp != 0) { if (gWishFutureKnock.futureSightMove[gActiveBattler] == MOVE_FUTURE_SIGHT) - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FUTURE_SIGHT; else - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOOM_DESIRE; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, gWishFutureKnock.futureSightMove[gActiveBattler]); + gBattlerTarget = gActiveBattler; gBattlerAttacker = gWishFutureKnock.futureSightAttacker[gActiveBattler]; gBattleMoveDamage = gWishFutureKnock.futureSightDmg[gActiveBattler]; @@ -1038,7 +1100,6 @@ bool8 HandleWishPerishSongOnTurnEnd(void) } { u8 *state = &gBattleStruct->wishPerishSongState; - *state = 1; gBattleStruct->wishPerishSongBattlerId = 0; } @@ -1049,10 +1110,10 @@ bool8 HandleWishPerishSongOnTurnEnd(void) gActiveBattler = gBattlerAttacker = gBattlerByTurnOrder[gBattleStruct->wishPerishSongBattlerId]; if (gAbsentBattlerFlags & gBitTable[gActiveBattler]) { - ++gBattleStruct->wishPerishSongBattlerId; + gBattleStruct->wishPerishSongBattlerId++; continue; } - ++gBattleStruct->wishPerishSongBattlerId; + gBattleStruct->wishPerishSongBattlerId++; if (gStatuses3[gActiveBattler] & STATUS3_PERISH_SONG) { PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gActiveBattler].perishSongTimer); @@ -1064,7 +1125,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void) } else { - --gDisableStructs[gActiveBattler].perishSongTimer; + gDisableStructs[gActiveBattler].perishSongTimer--; gBattlescriptCurrInstr = BattleScript_PerishSongCountGoesDown; } BattleScriptExecute(gBattlescriptCurrInstr); @@ -1073,7 +1134,9 @@ bool8 HandleWishPerishSongOnTurnEnd(void) } break; } + gHitMarker &= ~(HITMARKER_GRUDGE | HITMARKER_SKIP_DMG_TRACK); + return FALSE; } @@ -1090,8 +1153,8 @@ bool8 HandleFaintedMonActions(void) { case 0: gBattleStruct->faintedActionsBattlerId = 0; - ++gBattleStruct->faintedActionsState; - for (i = 0; i < gBattlersCount; ++i) + gBattleStruct->faintedActionsState++; + for (i = 0; i < gBattlersCount; i++) { if (gAbsentBattlerFlags & gBitTable[i] && !HasNoMonsToSwitch(i, PARTY_SIZE, PARTY_SIZE)) gAbsentBattlerFlags &= ~(gBitTable[i]); @@ -1121,7 +1184,7 @@ bool8 HandleFaintedMonActions(void) break; case 3: gBattleStruct->faintedActionsBattlerId = 0; - ++gBattleStruct->faintedActionsState; + gBattleStruct->faintedActionsState++; // fall through case 4: do @@ -1144,9 +1207,12 @@ bool8 HandleFaintedMonActions(void) gBattleStruct->faintedActionsState = 4; break; case 6: - if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) || AbilityBattleEffects(ABILITYEFFECT_TRACE, 0, 0, 0, 0) || ItemBattleEffects(1, 0, TRUE) || AbilityBattleEffects(ABILITYEFFECT_FORECAST, 0, 0, 0, 0)) + if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) + || AbilityBattleEffects(ABILITYEFFECT_TRACE, 0, 0, 0, 0) + || ItemBattleEffects(ITEMEFFECT_NORMAL, 0, TRUE) + || AbilityBattleEffects(ABILITYEFFECT_FORECAST, 0, 0, 0, 0)) return TRUE; - ++gBattleStruct->faintedActionsState; + gBattleStruct->faintedActionsState++; break; case FAINTED_ACTIONS_MAX_CASE: break; @@ -1158,10 +1224,11 @@ bool8 HandleFaintedMonActions(void) void TryClearRageStatuses(void) { s32 i; - - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) + { if ((gBattleMons[i].status2 & STATUS2_RAGE) && gChosenMoveByBattler[i] != MOVE_RAGE) - gBattleMons[i].status2 &= ~(STATUS2_RAGE); + gBattleMons[i].status2 &= ~STATUS2_RAGE; + } } enum @@ -1188,38 +1255,36 @@ u8 AtkCanceller_UnableToUseMove(void) { u8 effect = 0; s32 *bideDmg = &gBattleScripting.bideDmg; - do { switch (gBattleStruct->atkCancellerTracker) { case CANCELLER_FLAGS: // flags clear - gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_DESTINY_BOND); - gStatuses3[gBattlerAttacker] &= ~(STATUS3_GRUDGE); - ++gBattleStruct->atkCancellerTracker; + gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_DESTINY_BOND; + gStatuses3[gBattlerAttacker] &= ~STATUS3_GRUDGE; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_ASLEEP: // check being asleep if (gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP) { if (UproarWakeUpCheck(gBattlerAttacker)) { - gBattleMons[gBattlerAttacker].status1 &= ~(STATUS1_SLEEP); - gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[gBattlerAttacker].status1 &= ~STATUS1_SLEEP; + gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE; BattleScriptPushCursor(); - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WOKE_UP_UPROAR; gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp; effect = 2; } else { u8 toSub; - if (gBattleMons[gBattlerAttacker].ability == ABILITY_EARLY_BIRD) toSub = 2; else toSub = 1; if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP) < toSub) - gBattleMons[gBattlerAttacker].status1 &= ~(STATUS1_SLEEP); + gBattleMons[gBattlerAttacker].status1 &= ~STATUS1_SLEEP; else gBattleMons[gBattlerAttacker].status1 -= toSub; if (gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP) @@ -1233,15 +1298,15 @@ u8 AtkCanceller_UnableToUseMove(void) } else { - gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_NIGHTMARE; BattleScriptPushCursor(); - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_WOKE_UP; gBattlescriptCurrInstr = BattleScript_MoveUsedWokeUp; effect = 2; } } } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_FROZEN: // check being frozen if (gBattleMons[gBattlerAttacker].status1 & STATUS1_FREEZE) @@ -1255,56 +1320,56 @@ u8 AtkCanceller_UnableToUseMove(void) } else { - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; } } else // unfreeze { - gBattleMons[gBattlerAttacker].status1 &= ~(STATUS1_FREEZE); + gBattleMons[gBattlerAttacker].status1 &= ~STATUS1_FREEZE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DEFROSTED; } effect = 2; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_TRUANT: // truant if (gBattleMons[gBattlerAttacker].ability == ABILITY_TRUANT && gDisableStructs[gBattlerAttacker].truantCounter) { CancelMultiTurnMoves(gBattlerAttacker); gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_LOAFING; gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; gMoveResultFlags |= MOVE_RESULT_MISSED; effect = 1; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_RECHARGE: // recharge if (gBattleMons[gBattlerAttacker].status2 & STATUS2_RECHARGE) { - gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_RECHARGE); + gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_RECHARGE; gDisableStructs[gBattlerAttacker].rechargeTimer = 0; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedMustRecharge; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; effect = 1; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_FLINCH: // flinch if (gBattleMons[gBattlerAttacker].status2 & STATUS2_FLINCHED) { - gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_FLINCHED); + gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_FLINCHED; gProtectStructs[gBattlerAttacker].flinchImmobility = 1; CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedFlinched; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; effect = 1; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_DISABLED: // disabled move if (gDisableStructs[gBattlerAttacker].disabledMove == gCurrentMove && gDisableStructs[gBattlerAttacker].disabledMove != MOVE_NONE) @@ -1316,7 +1381,7 @@ u8 AtkCanceller_UnableToUseMove(void) gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; effect = 1; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_TAUNTED: // taunt if (gDisableStructs[gBattlerAttacker].tauntTimer && gBattleMoves[gCurrentMove].power == 0) @@ -1327,7 +1392,7 @@ u8 AtkCanceller_UnableToUseMove(void) gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; effect = 1; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_IMPRISONED: // imprisoned if (GetImprisonedMovesCount(gBattlerAttacker, gCurrentMove)) @@ -1338,22 +1403,24 @@ u8 AtkCanceller_UnableToUseMove(void) gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; effect = 1; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_CONFUSED: // confusion if (gBattleMons[gBattlerAttacker].status2 & STATUS2_CONFUSION) { - --gBattleMons[gBattlerAttacker].status2; + gBattleMons[gBattlerAttacker].status2 -= STATUS2_CONFUSION_TURN(1); if (gBattleMons[gBattlerAttacker].status2 & STATUS2_CONFUSION) { if (Random() & 1) { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + // The MULTISTRING_CHOOSER is used here as a bool to signal + // to BattleScript_MoveUsedIsConfused whether or not damage was taken + gBattleCommunication[MULTISTRING_CHOOSER] = FALSE; BattleScriptPushCursor(); } else // confusion dmg { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = TRUE; gBattlerTarget = gBattlerAttacker; gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattlerAttacker], &gBattleMons[gBattlerAttacker], MOVE_POUND, 0, 40, 0, gBattlerAttacker, gBattlerAttacker); gProtectStructs[gBattlerAttacker].confusionSelfDmg = 1; @@ -1368,17 +1435,19 @@ u8 AtkCanceller_UnableToUseMove(void) } effect = 1; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_PARALYSED: // paralysis if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_PARALYSIS) && (Random() % 4) == 0) { gProtectStructs[gBattlerAttacker].prlzImmobility = 1; + // This is removed in FRLG and Emerald for some reason + //CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsParalyzed; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; effect = 1; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_GHOST: // GHOST in pokemon tower if (IS_BATTLE_TYPE_GHOST_WITHOUT_SCOPE(gBattleTypeFlags)) @@ -1390,7 +1459,7 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleCommunication[MULTISTRING_CHOOSER] = 0; effect = 1; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_IN_LOVE: // infatuation if (gBattleMons[gBattlerAttacker].status2 & STATUS2_INFATUATION) @@ -1410,25 +1479,27 @@ u8 AtkCanceller_UnableToUseMove(void) gBattlescriptCurrInstr = BattleScript_MoveUsedIsInLove; effect = 1; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_BIDE: // bide if (gBattleMons[gBattlerAttacker].status2 & STATUS2_BIDE) { - gBattleMons[gBattlerAttacker].status2 -= 0x100; + gBattleMons[gBattlerAttacker].status2 -= STATUS2_BIDE_TURN(1); if (gBattleMons[gBattlerAttacker].status2 & STATUS2_BIDE) { gBattlescriptCurrInstr = BattleScript_BideStoringEnergy; } else { + // This is removed in FRLG and Emerald for some reason + //gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_MULTIPLETURNS; if (gTakenDmg[gBattlerAttacker]) { gCurrentMove = MOVE_BIDE; *bideDmg = gTakenDmg[gBattlerAttacker] * 2; gBattlerTarget = gTakenDmgByBattler[gBattlerAttacker]; if (gAbsentBattlerFlags & gBitTable[gBattlerTarget]) - gBattlerTarget = GetMoveTarget(MOVE_BIDE, 1); + gBattlerTarget = GetMoveTarget(MOVE_BIDE, MOVE_TARGET_SELECTED + 1); gBattlescriptCurrInstr = BattleScript_BideAttack; } else @@ -1438,31 +1509,32 @@ u8 AtkCanceller_UnableToUseMove(void) } effect = 1; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_THAW: // move thawing if (gBattleMons[gBattlerAttacker].status1 & STATUS1_FREEZE) { if (gBattleMoves[gCurrentMove].effect == EFFECT_THAW_HIT) { - gBattleMons[gBattlerAttacker].status1 &= ~(STATUS1_FREEZE); + gBattleMons[gBattlerAttacker].status1 &= ~STATUS1_FREEZE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_MoveUsedUnfroze; - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DEFROSTED_BY_MOVE; } effect = 2; } - ++gBattleStruct->atkCancellerTracker; + gBattleStruct->atkCancellerTracker++; break; case CANCELLER_END: break; } - } while (gBattleStruct->atkCancellerTracker != CANCELLER_END && !effect); + } while (gBattleStruct->atkCancellerTracker != CANCELLER_END && effect == 0); + if (effect == 2) { gActiveBattler = gBattlerAttacker; - BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); MarkBattlerForControllerExec(gActiveBattler); } return effect; @@ -1475,59 +1547,56 @@ bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2) s32 i; if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) - { return FALSE; + + if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + { + flankId = GetBattlerMultiplayerId(battler); + if (GetBattlerSide(battler) == B_SIDE_PLAYER) + party = gPlayerParty; + else + party = gEnemyParty; + + playerId = GetLinkTrainerFlankId(flankId); + for (i = playerId * MULTI_PARTY_SIZE; i < playerId * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE; i++) + { + if (GetMonData(&party[i], MON_DATA_HP) != 0 + && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE + && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG) + break; + } + return (i == playerId * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE); } else { - if (gBattleTypeFlags & BATTLE_TYPE_MULTI) + if (GetBattlerSide(battler) == B_SIDE_OPPONENT) { - playerId = GetBattlerMultiplayerId(battler); - if (GetBattlerSide(battler) == B_SIDE_PLAYER) - party = gPlayerParty; - else - party = gEnemyParty; - flankId = GetLinkTrainerFlankId(playerId); - for (i = flankId * 3; i < flankId * 3 + 3; ++i) - { - if (GetMonData(&party[i], MON_DATA_HP) != 0 - && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE - && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG) - break; - } - return (i == flankId * 3 + 3); + flankId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + playerId = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + party = gEnemyParty; } else { - if (GetBattlerSide(battler) == B_SIDE_OPPONENT) - { - playerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - flankId = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); - party = gEnemyParty; - } - else - { - playerId = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - flankId = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); - party = gPlayerParty; - } - if (partyIdBattlerOn1 == PARTY_SIZE) - partyIdBattlerOn1 = gBattlerPartyIndexes[playerId]; - if (partyIdBattlerOn2 == PARTY_SIZE) - partyIdBattlerOn2 = gBattlerPartyIndexes[flankId]; - for (i = 0; i < PARTY_SIZE; ++i) - { - if (GetMonData(&party[i], MON_DATA_HP) != 0 - && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE - && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG - && i != partyIdBattlerOn1 - && i != partyIdBattlerOn2 - && i != *(gBattleStruct->monToSwitchIntoId + playerId) - && i != flankId[gBattleStruct->monToSwitchIntoId]) - break; - } - return (i == PARTY_SIZE); + flankId = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + playerId = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + party = gPlayerParty; } + + if (partyIdBattlerOn1 == PARTY_SIZE) + partyIdBattlerOn1 = gBattlerPartyIndexes[flankId]; + if (partyIdBattlerOn2 == PARTY_SIZE) + partyIdBattlerOn2 = gBattlerPartyIndexes[playerId]; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&party[i], MON_DATA_HP) != 0 + && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE + && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG + && i != partyIdBattlerOn1 && i != partyIdBattlerOn2 + && i != *(gBattleStruct->monToSwitchIntoId + flankId) && i != playerId[gBattleStruct->monToSwitchIntoId]) + break; + } + return (i == PARTY_SIZE); } } @@ -1587,24 +1656,31 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (gBattlerAttacker >= gBattlersCount) gBattlerAttacker = battler; + if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER) pokeAtk = &gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]]; else pokeAtk = &gEnemyParty[gBattlerPartyIndexes[gBattlerAttacker]]; + if (gBattlerTarget >= gBattlersCount) gBattlerTarget = battler; + if (GetBattlerSide(gBattlerTarget) == B_SIDE_PLAYER) pokeDef = &gPlayerParty[gBattlerPartyIndexes[gBattlerTarget]]; else pokeDef = &gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]]; + speciesAtk = GetMonData(pokeAtk, MON_DATA_SPECIES); pidAtk = GetMonData(pokeAtk, MON_DATA_PERSONALITY); + speciesDef = GetMonData(pokeDef, MON_DATA_SPECIES); pidDef = GetMonData(pokeDef, MON_DATA_PERSONALITY); + if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) // Why isn't that check done at the beginning? { u8 moveType; s32 i; + u16 move; u8 side; u8 target1; @@ -1612,12 +1688,18 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gLastUsedAbility = special; else gLastUsedAbility = gBattleMons[battler].ability; - if (!moveArg) - moveArg = gCurrentMove; - GET_MOVE_TYPE(moveArg, moveType); + + if (moveArg) + move = moveArg; + else + move = gCurrentMove; + + GET_MOVE_TYPE(move, moveType); + if (IS_BATTLE_TYPE_GHOST_WITHOUT_SCOPE(gBattleTypeFlags) && (gLastUsedAbility == ABILITY_INTIMIDATE || gLastUsedAbility == ABILITY_TRACE)) return effect; + switch (caseID) { case ABILITYEFFECT_ON_SWITCHIN: // 0 @@ -1636,29 +1718,29 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleWeather = (B_WEATHER_RAIN_TEMPORARY | B_WEATHER_RAIN_PERMANENT); gBattleScripting.animArg1 = B_ANIM_RAIN_CONTINUES; gBattleScripting.battler = battler; - ++effect; + effect++; } break; case WEATHER_SANDSTORM: if (!(gBattleWeather & B_WEATHER_SANDSTORM)) { - gBattleWeather = (B_WEATHER_SANDSTORM_PERMANENT | B_WEATHER_SANDSTORM_TEMPORARY); + gBattleWeather = B_WEATHER_SANDSTORM; gBattleScripting.animArg1 = B_ANIM_SANDSTORM_CONTINUES; gBattleScripting.battler = battler; - ++effect; + effect++; } break; case WEATHER_DROUGHT: if (!(gBattleWeather & B_WEATHER_SUN)) { - gBattleWeather = (B_WEATHER_SUN_PERMANENT | B_WEATHER_SUN_TEMPORARY); + gBattleWeather = B_WEATHER_SUN; gBattleScripting.animArg1 = B_ANIM_SUN_CONTINUES; gBattleScripting.battler = battler; - ++effect; + effect++; } break; } - if (effect) + if (effect != 0) { gBattleCommunication[MULTISTRING_CHOOSER] = GetCurrentWeather(); BattleScriptPushCursorAndCallback(BattleScript_OverworldWeatherStarts); @@ -1670,25 +1752,25 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleWeather = (B_WEATHER_RAIN_PERMANENT | B_WEATHER_RAIN_TEMPORARY); BattleScriptPushCursorAndCallback(BattleScript_DrizzleActivates); gBattleScripting.battler = battler; - ++effect; + effect++; } break; case ABILITY_SAND_STREAM: if (!(gBattleWeather & B_WEATHER_SANDSTORM_PERMANENT)) { - gBattleWeather = (B_WEATHER_SANDSTORM_PERMANENT | B_WEATHER_SANDSTORM_TEMPORARY); + gBattleWeather = B_WEATHER_SANDSTORM; BattleScriptPushCursorAndCallback(BattleScript_SandstreamActivates); gBattleScripting.battler = battler; - ++effect; + effect++; } break; case ABILITY_DROUGHT: if (!(gBattleWeather & B_WEATHER_SUN_PERMANENT)) { - gBattleWeather = (B_WEATHER_SUN_PERMANENT | B_WEATHER_SUN_TEMPORARY); + gBattleWeather = B_WEATHER_SUN; BattleScriptPushCursorAndCallback(BattleScript_DroughtActivates); gBattleScripting.battler = battler; - ++effect; + effect++; } break; case ABILITY_INTIMIDATE: @@ -1717,7 +1799,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA case ABILITY_CLOUD_NINE: case ABILITY_AIR_LOCK: { - for (target1 = 0; target1 < gBattlersCount; ++target1) + for (target1 = 0; target1 < gBattlersCount; target1++) { effect = CastformDataTypeChange(target1); if (effect != 0) @@ -1748,7 +1830,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; gBattleMoveDamage *= -1; - ++effect; + effect++; } break; case ABILITY_SHED_SKIN: @@ -1765,23 +1847,23 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (gBattleMons[battler].status1 & STATUS1_FREEZE) StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn); gBattleMons[battler].status1 = 0; - gBattleMons[battler].status2 &= ~(STATUS2_NIGHTMARE); // fix nightmare glitch + gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; // fix nightmare glitch gBattleScripting.battler = gActiveBattler = battler; BattleScriptPushCursorAndCallback(BattleScript_ShedSkinActivates); - BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); + BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1); MarkBattlerForControllerExec(gActiveBattler); - ++effect; + effect++; } break; case ABILITY_SPEED_BOOST: - if (gBattleMons[battler].statStages[STAT_SPEED] < 0xC && gDisableStructs[battler].isFirstTurn != 2) + if (gBattleMons[battler].statStages[STAT_SPEED] < MAX_STAT_STAGE && gDisableStructs[battler].isFirstTurn != 2) { - ++gBattleMons[battler].statStages[STAT_SPEED]; - gBattleScripting.animArg1 = 0x11; + gBattleMons[battler].statStages[STAT_SPEED]++; + gBattleScripting.animArg1 = 14 + STAT_SPEED; gBattleScripting.animArg2 = 0; BattleScriptPushCursorAndCallback(BattleScript_SpeedBoostActivates); gBattleScripting.battler = battler; - ++effect; + effect++; } break; case ABILITY_TRUANT: @@ -1793,10 +1875,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA case ABILITYEFFECT_MOVES_BLOCK: // 2 if (gLastUsedAbility == ABILITY_SOUNDPROOF) { - for (i = 0; sSoundMovesTable[i] != 0xFFFF; ++i) - if (sSoundMovesTable[i] == moveArg) + for (i = 0; sSoundMovesTable[i] != SOUND_MOVES_END; i++) + { + if (sSoundMovesTable[i] == move) break; - if (sSoundMovesTable[i] != 0xFFFF) + } + if (sSoundMovesTable[i] != SOUND_MOVES_END) { if (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS) gHitMarker |= HITMARKER_NO_PPDEDUCT; @@ -1806,27 +1890,29 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA } break; case ABILITYEFFECT_ABSORBING: // 3 - if (moveArg) + if (move) { switch (gLastUsedAbility) { case ABILITY_VOLT_ABSORB: - if (moveType == TYPE_ELECTRIC && gBattleMoves[moveArg].power != 0) + if (moveType == TYPE_ELECTRIC && gBattleMoves[move].power != 0) { if (gProtectStructs[gBattlerAttacker].notFirstStrike) gBattlescriptCurrInstr = BattleScript_MoveHPDrain; else gBattlescriptCurrInstr = BattleScript_MoveHPDrain_PPLoss; + effect = 1; } break; case ABILITY_WATER_ABSORB: - if (moveType == TYPE_WATER && gBattleMoves[moveArg].power != 0) + if (moveType == TYPE_WATER && gBattleMoves[move].power != 0) { if (gProtectStructs[gBattlerAttacker].notFirstStrike) gBattlescriptCurrInstr = BattleScript_MoveHPDrain; else gBattlescriptCurrInstr = BattleScript_MoveHPDrain_PPLoss; + effect = 1; } break; @@ -1835,21 +1921,23 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA { if (!(gBattleResources->flags->flags[battler] & RESOURCE_FLAG_FLASH_FIRE)) { - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FLASH_FIRE_BOOST; if (gProtectStructs[gBattlerAttacker].notFirstStrike) gBattlescriptCurrInstr = BattleScript_FlashFireBoost; else gBattlescriptCurrInstr = BattleScript_FlashFireBoost_PPLoss; + gBattleResources->flags->flags[battler] |= RESOURCE_FLAG_FLASH_FIRE; effect = 2; } else { - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_FLASH_FIRE_NO_BOOST; if (gProtectStructs[gBattlerAttacker].notFirstStrike) gBattlescriptCurrInstr = BattleScript_FlashFireBoost; else gBattlescriptCurrInstr = BattleScript_FlashFireBoost_PPLoss; + effect = 2; } } @@ -1879,8 +1967,8 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA { case ABILITY_COLOR_CHANGE: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && moveArg != MOVE_STRUGGLE - && gBattleMoves[moveArg].power != 0 + && move != MOVE_STRUGGLE + && gBattleMoves[move].power != 0 && TARGET_TURN_DAMAGED && !IS_BATTLER_OF_TYPE(battler, moveType) && gBattleMons[battler].hp != 0) @@ -1889,7 +1977,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA PREPARE_TYPE_BUFFER(gBattleTextBuff1, moveType); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ColorChangeActivates; - ++effect; + effect++; } break; case ABILITY_ROUGH_SKIN: @@ -1897,14 +1985,14 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED - && (gBattleMoves[moveArg].flags & FLAG_MAKES_CONTACT)) + && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)) { gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 16; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_RoughSkinActivates; - ++effect; + effect++; } break; case ABILITY_EFFECT_SPORE: @@ -1912,20 +2000,22 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED - && (gBattleMoves[moveArg].flags & FLAG_MAKES_CONTACT) + && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) && (Random() % 10) == 0) { do + { gBattleCommunication[MOVE_EFFECT_BYTE] = Random() & 3; - while (gBattleCommunication[MOVE_EFFECT_BYTE] == 0); + } while (gBattleCommunication[MOVE_EFFECT_BYTE] == 0); if (gBattleCommunication[MOVE_EFFECT_BYTE] == MOVE_EFFECT_BURN) gBattleCommunication[MOVE_EFFECT_BYTE] += 2; // 5 MOVE_EFFECT_PARALYSIS + gBattleCommunication[MOVE_EFFECT_BYTE] += MOVE_EFFECT_AFFECTS_USER; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; - ++effect; + effect++; } break; case ABILITY_POISON_POINT: @@ -1933,14 +2023,14 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED - && (gBattleMoves[moveArg].flags & FLAG_MAKES_CONTACT) + && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) && (Random() % 3) == 0) { gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_POISON; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; - ++effect; + effect++; } break; case ABILITY_STATIC: @@ -1948,21 +2038,21 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg && TARGET_TURN_DAMAGED - && (gBattleMoves[moveArg].flags & FLAG_MAKES_CONTACT) + && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) && (Random() % 3) == 0) { gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_PARALYSIS; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; - ++effect; + effect++; } break; case ABILITY_FLAME_BODY: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && (gBattleMoves[moveArg].flags & FLAG_MAKES_CONTACT) + && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) && TARGET_TURN_DAMAGED && (Random() % 3) == 0) { @@ -1970,14 +2060,14 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ApplySecondaryEffect; gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; - ++effect; + effect++; } break; case ABILITY_CUTE_CHARM: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && gBattleMons[gBattlerAttacker].hp != 0 && !gProtectStructs[gBattlerAttacker].confusionSelfDmg - && (gBattleMoves[moveArg].flags & FLAG_MAKES_CONTACT) + && (gBattleMoves[move].flags & FLAG_MAKES_CONTACT) && TARGET_TURN_DAMAGED && gBattleMons[gBattlerTarget].hp != 0 && (Random() % 3) == 0 @@ -1990,13 +2080,13 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleMons[gBattlerAttacker].status2 |= STATUS2_INFATUATED_WITH(gBattlerTarget); BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_CuteCharmActivates; - ++effect; + effect++; } break; } break; case ABILITYEFFECT_IMMUNITY: // 5 - for (battler = 0; battler < gBattlersCount; ++battler) + for (battler = 0; battler < gBattlersCount; battler++) { switch (gBattleMons[battler].ability) { @@ -2025,7 +2115,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA case ABILITY_VITAL_SPIRIT: if (gBattleMons[battler].status1 & STATUS1_SLEEP) { - gBattleMons[battler].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); effect = 1; } @@ -2052,7 +2142,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA } break; } - if (effect) + if (effect != 0) { switch (effect) { @@ -2060,10 +2150,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattleMons[battler].status1 = 0; break; case 2: // get rid of confusion - gBattleMons[battler].status2 &= ~(STATUS2_CONFUSION); + gBattleMons[battler].status2 &= ~STATUS2_CONFUSION; break; case 3: // get rid of infatuation - gBattleMons[battler].status2 &= ~(STATUS2_INFATUATION); + gBattleMons[battler].status2 &= ~STATUS2_INFATUATION; break; } @@ -2071,19 +2161,19 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gBattlescriptCurrInstr = BattleScript_AbilityCuredStatus; gBattleScripting.battler = battler; gActiveBattler = battler; - BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); MarkBattlerForControllerExec(gActiveBattler); return effect; } } break; case ABILITYEFFECT_FORECAST: // 6 - for (battler = 0; battler < gBattlersCount; ++battler) + for (battler = 0; battler < gBattlersCount; battler++) { if (gBattleMons[battler].ability == ABILITY_FORECAST) { effect = CastformDataTypeChange(battler); - if (effect) + if (effect != 0) { BattleScriptPushCursorAndCallback(BattleScript_CastformChange); gBattleScripting.battler = battler; @@ -2096,80 +2186,81 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA case ABILITYEFFECT_SYNCHRONIZE: // 7 if (gLastUsedAbility == ABILITY_SYNCHRONIZE && (gHitMarker & HITMARKER_SYNCHRONISE_EFFECT)) { - gHitMarker &= ~(HITMARKER_SYNCHRONISE_EFFECT); + gHitMarker &= ~HITMARKER_SYNCHRONISE_EFFECT; gBattleStruct->synchronizeMoveEffect &= ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN); if (gBattleStruct->synchronizeMoveEffect == MOVE_EFFECT_TOXIC) gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON; + gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleStruct->synchronizeMoveEffect + MOVE_EFFECT_AFFECTS_USER; gBattleScripting.battler = gBattlerTarget; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; - ++effect; + effect++; } break; case ABILITYEFFECT_ATK_SYNCHRONIZE: // 8 if (gLastUsedAbility == ABILITY_SYNCHRONIZE && (gHitMarker & HITMARKER_SYNCHRONISE_EFFECT)) { - gHitMarker &= ~(HITMARKER_SYNCHRONISE_EFFECT); + gHitMarker &= ~HITMARKER_SYNCHRONISE_EFFECT; gBattleStruct->synchronizeMoveEffect &= ~(MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN); if (gBattleStruct->synchronizeMoveEffect == MOVE_EFFECT_TOXIC) gBattleStruct->synchronizeMoveEffect = MOVE_EFFECT_POISON; + gBattleCommunication[MOVE_EFFECT_BYTE] = gBattleStruct->synchronizeMoveEffect; gBattleScripting.battler = gBattlerAttacker; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_SynchronizeActivates; gHitMarker |= HITMARKER_IGNORE_SAFEGUARD; - ++effect; + effect++; } break; case ABILITYEFFECT_INTIMIDATE1: // 9 - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (gBattleMons[i].ability == ABILITY_INTIMIDATE && gStatuses3[i] & STATUS3_INTIMIDATE_POKES) { gLastUsedAbility = ABILITY_INTIMIDATE; - gStatuses3[i] &= ~(STATUS3_INTIMIDATE_POKES); + gStatuses3[i] &= ~STATUS3_INTIMIDATE_POKES; BattleScriptPushCursorAndCallback(BattleScript_IntimidateActivatesEnd3); gBattleStruct->intimidateBattler = i; - ++effect; + effect++; break; } } break; case ABILITYEFFECT_TRACE: // 11 - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (gBattleMons[i].ability == ABILITY_TRACE && (gStatuses3[i] & STATUS3_TRACE)) { u8 target2; - side = (GetBattlerPosition(i) ^ BIT_SIDE) & BIT_SIDE; // side of the opposing pokemon target1 = GetBattlerAtPosition(side); target2 = GetBattlerAtPosition(side + BIT_FLANK); if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { - if (gBattleMons[target1].ability != 0 && gBattleMons[target1].hp != 0 - && gBattleMons[target2].ability != 0 && gBattleMons[target2].hp != 0) + if (gBattleMons[target1].ability != ABILITY_NONE && gBattleMons[target1].hp != 0 + && gBattleMons[target2].ability != ABILITY_NONE && gBattleMons[target2].hp != 0) { gActiveBattler = GetBattlerAtPosition(((Random() & 1) * 2) | side); gBattleMons[i].ability = gBattleMons[gActiveBattler].ability; gLastUsedAbility = gBattleMons[gActiveBattler].ability; - ++effect; + effect++; } - else if (gBattleMons[target1].ability != 0 && gBattleMons[target1].hp != 0) + else if (gBattleMons[target1].ability != ABILITY_NONE && gBattleMons[target1].hp != 0) { gActiveBattler = target1; gBattleMons[i].ability = gBattleMons[gActiveBattler].ability; gLastUsedAbility = gBattleMons[gActiveBattler].ability; - ++effect; + effect++; } - else if (gBattleMons[target2].ability != 0 && gBattleMons[target2].hp != 0) + else if (gBattleMons[target2].ability != ABILITY_NONE && gBattleMons[target2].hp != 0) { gActiveBattler = target2; gBattleMons[i].ability = gBattleMons[gActiveBattler].ability; gLastUsedAbility = gBattleMons[gActiveBattler].ability; - ++effect; + effect++; } } else @@ -2179,14 +2270,15 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA { gBattleMons[i].ability = gBattleMons[target1].ability; gLastUsedAbility = gBattleMons[target1].ability; - ++effect; + effect++; } } - if (effect) + if (effect != 0) { BattleScriptPushCursorAndCallback(BattleScript_TraceActivates); - gStatuses3[i] &= ~(STATUS3_TRACE); + gStatuses3[i] &= ~STATUS3_TRACE; gBattleScripting.battler = i; + PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gActiveBattler, gBattlerPartyIndexes[gActiveBattler]) PREPARE_ABILITY_BUFFER(gBattleTextBuff2, gLastUsedAbility) break; @@ -2195,23 +2287,23 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA } break; case ABILITYEFFECT_INTIMIDATE2: // 10 - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (gBattleMons[i].ability == ABILITY_INTIMIDATE && (gStatuses3[i] & STATUS3_INTIMIDATE_POKES)) { gLastUsedAbility = ABILITY_INTIMIDATE; - gStatuses3[i] &= ~(STATUS3_INTIMIDATE_POKES); + gStatuses3[i] &= ~STATUS3_INTIMIDATE_POKES; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_IntimidateActivates; gBattleStruct->intimidateBattler = i; - ++effect; + effect++; break; } } break; case ABILITYEFFECT_CHECK_OTHER_SIDE: // 12 side = GetBattlerSide(battler); - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (GetBattlerSide(i) != side && gBattleMons[i].ability == ability) { @@ -2222,7 +2314,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA break; case ABILITYEFFECT_CHECK_BATTLER_SIDE: // 13 side = GetBattlerSide(battler); - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (GetBattlerSide(i) == side && gBattleMons[i].ability == ability) { @@ -2235,17 +2327,21 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA switch (gLastUsedAbility) { case ABILITYEFFECT_MUD_SPORT: - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) + { if (gStatuses3[i] & STATUS3_MUDSPORT) effect = i + 1; + } break; case ABILITYEFFECT_WATER_SPORT: - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) + { if (gStatuses3[i] & STATUS3_WATERSPORT) effect = i + 1; + } break; default: - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (gBattleMons[i].ability == ability) { @@ -2257,7 +2353,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA } break; case ABILITYEFFECT_CHECK_ON_FIELD: // 19 - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (gBattleMons[i].ability == ability && gBattleMons[i].hp != 0) { @@ -2268,7 +2364,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA break; case ABILITYEFFECT_CHECK_FIELD_EXCEPT_BATTLER: // 15 side = GetBattlerSide(battler); - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (GetBattlerSide(i) != side && gBattleMons[i].ability == ability) { @@ -2277,9 +2373,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA break; } } - if (!effect) + if (effect == 0) { - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (gBattleMons[i].ability == ability && GetBattlerSide(i) == side && i != battler) { @@ -2291,40 +2387,42 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA break; case ABILITYEFFECT_COUNT_OTHER_SIDE: // 16 side = GetBattlerSide(battler); - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (GetBattlerSide(i) != side && gBattleMons[i].ability == ability) { gLastUsedAbility = ability; - ++effect; + effect++; } } break; case ABILITYEFFECT_COUNT_BATTLER_SIDE: // 17 side = GetBattlerSide(battler); - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (GetBattlerSide(i) == side && gBattleMons[i].ability == ability) { gLastUsedAbility = ability; - ++effect; + effect++; } } break; case ABILITYEFFECT_COUNT_ON_FIELD: // 18 - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) { if (gBattleMons[i].ability == ability && i != battler) { gLastUsedAbility = ability; - ++effect; + effect++; } } break; } + if (effect && caseID < ABILITYEFFECT_CHECK_OTHER_SIDE && gLastUsedAbility != 0xFF) RecordAbilityBattle(battler, gLastUsedAbility); } + return effect; } @@ -2354,6 +2452,36 @@ enum ITEM_STATS_CHANGE, }; +#define TRY_EAT_CONFUSE_BERRY(flavor) \ + if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn) \ + { \ + PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, flavor); \ + gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam; \ + if (gBattleMoveDamage == 0) \ + gBattleMoveDamage = 1; \ + if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP) \ + gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp; \ + gBattleMoveDamage *= -1; \ + if (GetFlavorRelationByPersonality(gBattleMons[battlerId].personality, flavor) < 0) \ + BattleScriptExecute(BattleScript_BerryConfuseHealEnd2); \ + else \ + BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem); \ + effect = ITEM_HP_CHANGE; \ + } + +#define TRY_EAT_STAT_UP_BERRY(stat) \ + if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam \ + && !moveTurn && gBattleMons[battlerId].statStages[stat] < MAX_STAT_STAGE) \ + { \ + PREPARE_STAT_BUFFER(gBattleTextBuff1, stat); \ + gEffectBattler = battlerId; \ + SET_STATCHANGER(stat, 1, FALSE); \ + gBattleScripting.animArg1 = 14 + (stat); \ + gBattleScripting.animArg2 = 0; \ + BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); \ + effect = ITEM_STATS_CHANGE; \ + } + u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) { int i = 0; @@ -2399,6 +2527,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) defHoldEffect = ItemId_GetHoldEffect(defItem); defHoldEffectParam = ItemId_GetHoldEffectParam(defItem); } + switch (caseID) { case ITEMEFFECT_ON_SWITCH_IN: @@ -2408,15 +2537,15 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gBattleStruct->moneyMultiplier = 2; break; case HOLD_EFFECT_RESTORE_STATS: - for (i = 0; i < NUM_BATTLE_STATS; ++i) + for (i = 0; i < NUM_BATTLE_STATS; i++) { - if (gBattleMons[battlerId].statStages[i] < 6) + if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE) { - gBattleMons[battlerId].statStages[i] = 6; + gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE; effect = ITEM_STATS_CHANGE; } } - if (effect) + if (effect != 0) { gBattleScripting.battler = battlerId; gPotentialItemEffectBattler = battlerId; @@ -2426,7 +2555,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) break; } break; - case 1: + case ITEMEFFECT_NORMAL: if (gBattleMons[battlerId].hp) { switch (battlerHoldEffect) @@ -2439,7 +2568,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp; gBattleMoveDamage *= -1; BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem); - effect = 4; + effect = ITEM_HP_CHANGE; } break; case HOLD_EFFECT_RESTORE_PP: @@ -2453,7 +2582,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]]; else mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]]; - for (i = 0; i < MAX_MON_MOVES; ++i) + for (i = 0; i < MAX_MON_MOVES; i++) { move = GetMonData(mon, MON_DATA_MOVE1 + i); changedPP = GetMonData(mon, MON_DATA_PP1 + i); @@ -2468,24 +2597,26 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) changedPP = maxPP; else changedPP = changedPP + battlerHoldEffectParam; + PREPARE_MOVE_BUFFER(gBattleTextBuff1, move); + BattleScriptExecute(BattleScript_BerryPPHealEnd2); - BtlController_EmitSetMonData(0, i + REQUEST_PPMOVE1_BATTLE, 0, 1, &changedPP); + BtlController_EmitSetMonData(BUFFER_A, i + REQUEST_PPMOVE1_BATTLE, 0, 1, &changedPP); MarkBattlerForControllerExec(gActiveBattler); effect = ITEM_PP_CHANGE; } } break; case HOLD_EFFECT_RESTORE_STATS: - for (i = 0; i < NUM_BATTLE_STATS; ++i) + for (i = 0; i < NUM_BATTLE_STATS; i++) { - if (gBattleMons[battlerId].statStages[i] < 6) + if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE) { - gBattleMons[battlerId].statStages[i] = 6; + gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE; effect = ITEM_STATS_CHANGE; } } - if (effect) + if (effect != 0) { gBattleScripting.battler = battlerId; gPotentialItemEffectBattler = battlerId; @@ -2508,153 +2639,49 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; case HOLD_EFFECT_CONFUSE_SPICY: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn) - { - PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_SPICY); - gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; - if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP) - gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp; - gBattleMoveDamage *= -1; - if (GetFlavorRelationByPersonality(gBattleMons[battlerId].personality, FLAVOR_SPICY) < 0) - BattleScriptExecute(BattleScript_BerryConfuseHealEnd2); - else - BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem); - effect = ITEM_HP_CHANGE; - } + TRY_EAT_CONFUSE_BERRY(FLAVOR_SPICY); break; case HOLD_EFFECT_CONFUSE_DRY: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn) - { - PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_DRY); - gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; - if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP) - gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp; - gBattleMoveDamage *= -1; - if (GetFlavorRelationByPersonality(gBattleMons[battlerId].personality, FLAVOR_DRY) < 0) - BattleScriptExecute(BattleScript_BerryConfuseHealEnd2); - else - BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem); - effect = ITEM_HP_CHANGE; - } + TRY_EAT_CONFUSE_BERRY(FLAVOR_DRY); break; case HOLD_EFFECT_CONFUSE_SWEET: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn) - { - PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_SWEET); - gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; - if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP) - gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp; - gBattleMoveDamage *= -1; - if (GetFlavorRelationByPersonality(gBattleMons[battlerId].personality, FLAVOR_SWEET) < 0) - BattleScriptExecute(BattleScript_BerryConfuseHealEnd2); - else - BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem); - effect = ITEM_HP_CHANGE; - } + TRY_EAT_CONFUSE_BERRY(FLAVOR_SWEET); break; case HOLD_EFFECT_CONFUSE_BITTER: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn) - { - PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_BITTER); - gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; - if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP) - gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp; - gBattleMoveDamage *= -1; - if (GetFlavorRelationByPersonality(gBattleMons[battlerId].personality, FLAVOR_BITTER) < 0) - BattleScriptExecute(BattleScript_BerryConfuseHealEnd2); - else - BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem); - effect = ITEM_HP_CHANGE; - } + TRY_EAT_CONFUSE_BERRY(FLAVOR_BITTER); break; case HOLD_EFFECT_CONFUSE_SOUR: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn) - { - PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, FLAVOR_SOUR); - gBattleMoveDamage = gBattleMons[battlerId].maxHP / battlerHoldEffectParam; - if (gBattleMoveDamage == 0) - gBattleMoveDamage = 1; - if (gBattleMons[battlerId].hp + gBattleMoveDamage > gBattleMons[battlerId].maxHP) - gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp; - gBattleMoveDamage *= -1; - if (GetFlavorRelationByPersonality(gBattleMons[battlerId].personality, FLAVOR_SOUR) < 0) - BattleScriptExecute(BattleScript_BerryConfuseHealEnd2); - else - BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem); - effect = ITEM_HP_CHANGE; - } + TRY_EAT_CONFUSE_BERRY(FLAVOR_SOUR); break; case HOLD_EFFECT_ATTACK_UP: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < 0xC) + if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam + && !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < MAX_STAT_STAGE) { PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK); - PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE); + PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE); // Only the Attack stat-up berry has this gEffectBattler = battlerId; SET_STATCHANGER(STAT_ATK, 1, FALSE); - gBattleScripting.animArg1 = 0xE + STAT_ATK; + gBattleScripting.animArg1 = 14 + STAT_ATK; gBattleScripting.animArg2 = 0; BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); effect = ITEM_STATS_CHANGE; } break; case HOLD_EFFECT_DEFENSE_UP: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_DEF] < 0xC) - { - PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_DEF); - gEffectBattler = battlerId; - SET_STATCHANGER(STAT_DEF, 1, FALSE); - gBattleScripting.animArg1 = 0xE + STAT_DEF; - gBattleScripting.animArg2 = 0; - BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); - effect = ITEM_STATS_CHANGE; - } + TRY_EAT_STAT_UP_BERRY(STAT_DEF); break; case HOLD_EFFECT_SPEED_UP: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPEED] < 0xC) - { - PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPEED); - gEffectBattler = battlerId; - SET_STATCHANGER(STAT_SPEED, 1, FALSE); - gBattleScripting.animArg1 = 0xE + STAT_SPEED; - gBattleScripting.animArg2 = 0; - BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); - effect = ITEM_STATS_CHANGE; - } + TRY_EAT_STAT_UP_BERRY(STAT_SPEED); break; case HOLD_EFFECT_SP_ATTACK_UP: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPATK] < 0xC) - { - PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPATK); - gEffectBattler = battlerId; - SET_STATCHANGER(STAT_SPATK, 1, FALSE); - gBattleScripting.animArg1 = 0xE + STAT_SPATK; - gBattleScripting.animArg2 = 0; - BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); - effect = ITEM_STATS_CHANGE; - } + TRY_EAT_STAT_UP_BERRY(STAT_SPATK); break; case HOLD_EFFECT_SP_DEFENSE_UP: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPDEF] < 0xC) - { - PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPDEF); - gEffectBattler = battlerId; - SET_STATCHANGER(STAT_SPDEF, 1, FALSE); - gBattleScripting.animArg1 = 0xE + STAT_SPDEF; - gBattleScripting.animArg2 = 0; - BattleScriptExecute(BattleScript_BerryStatRaiseEnd2); - effect = ITEM_STATS_CHANGE; - } + TRY_EAT_STAT_UP_BERRY(STAT_SPDEF); break; case HOLD_EFFECT_CRITICAL_UP: - if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY)) + if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn + && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY)) { gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY; BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2); @@ -2664,13 +2691,20 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_RANDOM_STAT_UP: if (!moveTurn && gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam) { - for (i = 0; i < 5 && gBattleMons[battlerId].statStages[STAT_ATK + i] >= 0xC; ++i); - if (i != 5) + for (i = 0; i < NUM_STATS - 1; i++) + { + if (gBattleMons[battlerId].statStages[STAT_ATK + i] < MAX_STAT_STAGE) + break; + } + if (i != NUM_STATS - 1) { do - i = Random() % 5; - while (gBattleMons[battlerId].statStages[STAT_ATK + i] == 0xC); + { + i = Random() % (NUM_STATS - 1); + } while (gBattleMons[battlerId].statStages[STAT_ATK + i] == MAX_STAT_STAGE); + PREPARE_STAT_BUFFER(gBattleTextBuff1, i + 1); + gBattleTextBuff2[0] = B_BUFF_PLACEHOLDER_BEGIN; gBattleTextBuff2[1] = B_BUFF_STRING; gBattleTextBuff2[2] = STRINGID_STATSHARPLY; @@ -2679,6 +2713,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gBattleTextBuff2[5] = STRINGID_STATROSE; gBattleTextBuff2[6] = STRINGID_STATROSE >> 8; gBattleTextBuff2[7] = EOS; + gEffectBattler = battlerId; SET_STATCHANGER(i + 1, 2, FALSE); gBattleScripting.animArg1 = 0x21 + i + 6; @@ -2691,7 +2726,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_CURE_PAR: if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS) { - gBattleMons[battlerId].status1 &= ~(STATUS1_PARALYSIS); + gBattleMons[battlerId].status1 &= ~STATUS1_PARALYSIS; BattleScriptExecute(BattleScript_BerryCurePrlzEnd2); effect = ITEM_STATUS_CHANGE; } @@ -2707,7 +2742,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_CURE_BRN: if (gBattleMons[battlerId].status1 & STATUS1_BURN) { - gBattleMons[battlerId].status1 &= ~(STATUS1_BURN); + gBattleMons[battlerId].status1 &= ~STATUS1_BURN; BattleScriptExecute(BattleScript_BerryCureBrnEnd2); effect = ITEM_STATUS_CHANGE; } @@ -2715,7 +2750,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_CURE_FRZ: if (gBattleMons[battlerId].status1 & STATUS1_FREEZE) { - gBattleMons[battlerId].status1 &= ~(STATUS1_FREEZE); + gBattleMons[battlerId].status1 &= ~STATUS1_FREEZE; BattleScriptExecute(BattleScript_BerryCureFrzEnd2); effect = ITEM_STATUS_CHANGE; } @@ -2723,8 +2758,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_CURE_SLP: if (gBattleMons[battlerId].status1 & STATUS1_SLEEP) { - gBattleMons[battlerId].status1 &= ~(STATUS1_SLEEP); - gBattleMons[battlerId].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[battlerId].status1 &= ~STATUS1_SLEEP; + gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; BattleScriptExecute(BattleScript_BerryCureSlpEnd2); effect = ITEM_STATUS_CHANGE; } @@ -2732,7 +2767,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_CURE_CONFUSION: if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION) { - gBattleMons[battlerId].status2 &= ~(STATUS2_CONFUSION); + gBattleMons[battlerId].status2 &= ~STATUS2_CONFUSION; BattleScriptExecute(BattleScript_BerryCureConfusionEnd2); effect = ITEM_EFFECT_OTHER; } @@ -2744,40 +2779,40 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY) { StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn); - ++i; + i++; } if (gBattleMons[battlerId].status1 & STATUS1_SLEEP) { - gBattleMons[battlerId].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); - ++i; + i++; } if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS) { StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn); - ++i; + i++; } if (gBattleMons[battlerId].status1 & STATUS1_BURN) { StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn); - ++i; + i++; } if (gBattleMons[battlerId].status1 & STATUS1_FREEZE) { StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn); - ++i; + i++; } if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION) { StringCopy(gBattleTextBuff1, gStatusConditionString_ConfusionJpn); - ++i; + i++; } - if (!(i > 1)) - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + if (i <= 1) + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM; else - gBattleCommunication[MULTISTRING_CHOOSER] = 1; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_NORMALIZED_STATUS; gBattleMons[battlerId].status1 = 0; - gBattleMons[battlerId].status2 &= ~(STATUS2_CONFUSION); + gBattleMons[battlerId].status2 &= ~STATUS2_CONFUSION; BattleScriptExecute(BattleScript_BerryCureChosenStatusEnd2); effect = ITEM_STATUS_CHANGE; } @@ -2785,15 +2820,15 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_CURE_ATTRACT: if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION) { - gBattleMons[battlerId].status2 &= ~(STATUS2_INFATUATION); + gBattleMons[battlerId].status2 &= ~STATUS2_INFATUATION; StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); BattleScriptExecute(BattleScript_BerryCureChosenStatusEnd2); - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM; effect = ITEM_EFFECT_OTHER; } break; } - if (effect) + if (effect != 0) { gBattleScripting.battler = battlerId; gPotentialItemEffectBattler = battlerId; @@ -2801,21 +2836,21 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) switch (effect) { case ITEM_STATUS_CHANGE: - BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battlerId].status1); + BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battlerId].status1); MarkBattlerForControllerExec(gActiveBattler); break; case ITEM_PP_CHANGE: - if (!(gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED) && !(gDisableStructs[battlerId].mimickedMoves & gBitTable[i])) + if (MOVE_IS_PERMANENT(battlerId, i)) gBattleMons[battlerId].pp[i] = changedPP; break; } } } break; - case 2: + case ITEMEFFECT_DUMMY: break; case ITEMEFFECT_MOVE_END: - for (battlerId = 0; battlerId < gBattlersCount; ++battlerId) + for (battlerId = 0; battlerId < gBattlersCount; battlerId++) { gLastUsedItem = gBattleMons[battlerId].item; if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY) @@ -2833,7 +2868,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_CURE_PAR: if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS) { - gBattleMons[battlerId].status1 &= ~(STATUS1_PARALYSIS); + gBattleMons[battlerId].status1 &= ~STATUS1_PARALYSIS; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCureParRet; effect = ITEM_STATUS_CHANGE; @@ -2851,7 +2886,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_CURE_BRN: if (gBattleMons[battlerId].status1 & STATUS1_BURN) { - gBattleMons[battlerId].status1 &= ~(STATUS1_BURN); + gBattleMons[battlerId].status1 &= ~STATUS1_BURN; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCureBrnRet; effect = ITEM_STATUS_CHANGE; @@ -2860,7 +2895,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_CURE_FRZ: if (gBattleMons[battlerId].status1 & STATUS1_FREEZE) { - gBattleMons[battlerId].status1 &= ~(STATUS1_FREEZE); + gBattleMons[battlerId].status1 &= ~STATUS1_FREEZE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCureFrzRet; effect = ITEM_STATUS_CHANGE; @@ -2869,8 +2904,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_CURE_SLP: if (gBattleMons[battlerId].status1 & STATUS1_SLEEP) { - gBattleMons[battlerId].status1 &= ~(STATUS1_SLEEP); - gBattleMons[battlerId].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[battlerId].status1 &= ~STATUS1_SLEEP; + gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCureSlpRet; effect = ITEM_STATUS_CHANGE; @@ -2879,7 +2914,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_CURE_CONFUSION: if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION) { - gBattleMons[battlerId].status2 &= ~(STATUS2_CONFUSION); + gBattleMons[battlerId].status2 &= ~STATUS2_CONFUSION; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_BerryCureConfusionRet; effect = ITEM_EFFECT_OTHER; @@ -2888,10 +2923,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) case HOLD_EFFECT_CURE_ATTRACT: if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION) { - gBattleMons[battlerId].status2 &= ~(STATUS2_INFATUATION); + gBattleMons[battlerId].status2 &= ~STATUS2_INFATUATION; StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn); BattleScriptPushCursor(); - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM; gBattlescriptCurrInstr = BattleScript_BerryCureChosenStatusRet; effect = ITEM_EFFECT_OTHER; } @@ -2900,48 +2935,44 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) if (gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION) { if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY) - { StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn); - } + if (gBattleMons[battlerId].status1 & STATUS1_SLEEP) { - gBattleMons[battlerId].status2 &= ~(STATUS2_NIGHTMARE); + gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn); } + if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS) - { StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn); - } + if (gBattleMons[battlerId].status1 & STATUS1_BURN) - { StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn); - } + if (gBattleMons[battlerId].status1 & STATUS1_FREEZE) - { StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn); - } + if (gBattleMons[battlerId].status2 & STATUS2_CONFUSION) - { StringCopy(gBattleTextBuff1, gStatusConditionString_ConfusionJpn); - } + gBattleMons[battlerId].status1 = 0; - gBattleMons[battlerId].status2 &= ~(STATUS2_CONFUSION); + gBattleMons[battlerId].status2 &= ~STATUS2_CONFUSION; BattleScriptPushCursor(); - gBattleCommunication[MULTISTRING_CHOOSER] = 0; + gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CURED_PROBLEM; gBattlescriptCurrInstr = BattleScript_BerryCureChosenStatusRet; effect = ITEM_STATUS_CHANGE; } break; case HOLD_EFFECT_RESTORE_STATS: - for (i = 0; i < NUM_BATTLE_STATS; ++i) + for (i = 0; i < NUM_BATTLE_STATS; i++) { - if (gBattleMons[battlerId].statStages[i] < 6) + if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE) { - gBattleMons[battlerId].statStages[i] = 6; + gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE; effect = ITEM_STATS_CHANGE; } } - if (effect) + if (effect != 0) { gBattleScripting.battler = battlerId; gPotentialItemEffectBattler = battlerId; @@ -2951,12 +2982,12 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; } - if (effect) + if (effect != 0) { gBattleScripting.battler = battlerId; gPotentialItemEffectBattler = battlerId; gActiveBattler = battlerId; - BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); + BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); MarkBattlerForControllerExec(gActiveBattler); break; } @@ -2969,10 +3000,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) { case HOLD_EFFECT_FLINCH: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && TARGET_TURN_DAMAGED - && (Random() % 100) < battlerHoldEffectParam - && gBattleMoves[gCurrentMove].flags & FLAG_KINGS_ROCK_AFFECTED - && gBattleMons[gBattlerTarget].hp) + && TARGET_TURN_DAMAGED + && (Random() % 100) < battlerHoldEffectParam + && gBattleMoves[gCurrentMove].flags & FLAG_KINGS_ROCK_AFFECTED + && gBattleMons[gBattlerTarget].hp) { gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_FLINCH; BattleScriptPushCursor(); @@ -2982,11 +3013,11 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) break; case HOLD_EFFECT_SHELL_BELL: if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) - && gSpecialStatuses[gBattlerTarget].dmg != 0 - && gSpecialStatuses[gBattlerTarget].dmg != 0xFFFF - && gBattlerAttacker != gBattlerTarget - && gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP - && gBattleMons[gBattlerAttacker].hp != 0) + && gSpecialStatuses[gBattlerTarget].dmg != 0 + && gSpecialStatuses[gBattlerTarget].dmg != 0xFFFF + && gBattlerAttacker != gBattlerTarget + && gBattleMons[gBattlerAttacker].hp != gBattleMons[gBattlerAttacker].maxHP + && gBattleMons[gBattlerAttacker].hp != 0) { gLastUsedItem = atkItem; gPotentialItemEffectBattler = gBattlerAttacker; @@ -2997,21 +3028,22 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gSpecialStatuses[gBattlerTarget].dmg = 0; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ItemHealHP_Ret; - ++effect; + effect++; } break; } } break; } + return effect; } void ClearFuryCutterDestinyBondGrudge(u8 battlerId) { gDisableStructs[battlerId].furyCutterCounter = 0; - gBattleMons[battlerId].status2 &= ~(STATUS2_DESTINY_BOND); - gStatuses3[battlerId] &= ~(STATUS3_GRUDGE); + gBattleMons[battlerId].status2 &= ~STATUS2_DESTINY_BOND; + gStatuses3[battlerId] &= ~STATUS3_GRUDGE; } void HandleAction_RunBattleScript(void) // identical to RunBattleScriptCommands @@ -3026,10 +3058,11 @@ u8 GetMoveTarget(u16 move, u8 setTarget) u8 moveTarget; u8 side; - if (setTarget) + if (setTarget != NO_TARGET_OVERRIDE) moveTarget = setTarget - 1; else moveTarget = gBattleMoves[move].target; + switch (moveTarget) { case MOVE_TARGET_SELECTED: @@ -3044,8 +3077,8 @@ u8 GetMoveTarget(u16 move, u8 setTarget) targetBattler = Random() % gBattlersCount; } while (targetBattler == gBattlerAttacker || side == GetBattlerSide(targetBattler) || gAbsentBattlerFlags & gBitTable[targetBattler]); if (gBattleMoves[move].type == TYPE_ELECTRIC - && AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIDE, gBattlerAttacker, ABILITY_LIGHTNING_ROD, 0, 0) - && gBattleMons[targetBattler].ability != ABILITY_LIGHTNING_ROD) + && AbilityBattleEffects(ABILITYEFFECT_COUNT_OTHER_SIDE, gBattlerAttacker, ABILITY_LIGHTNING_ROD, 0, 0) + && gBattleMons[targetBattler].ability != ABILITY_LIGHTNING_ROD) { targetBattler ^= BIT_FLANK; RecordAbilityBattle(targetBattler, gBattleMons[targetBattler].ability); @@ -3092,16 +3125,19 @@ u8 GetMoveTarget(u16 move, u8 setTarget) targetBattler = gBattlerAttacker; break; } + *(gBattleStruct->moveTarget + gBattlerAttacker) = targetBattler; + return targetBattler; } -static bool32 IsNotEventLegalMewOrDeoxys(u8 battlerId) +static bool32 IsMonEventLegal(u8 battlerId) { - if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT - || (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS - && GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_MEW)) + if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT) return TRUE; + if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_DEOXYS + && GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES, NULL) != SPECIES_MEW) + return TRUE; return GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_EVENT_LEGAL, NULL); } @@ -3111,13 +3147,20 @@ u8 IsMonDisobedient(void) s32 calc; u8 obedienceLevel = 0; - if ((gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_POKEDUDE)) || GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT) + if ((gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_POKEDUDE))) return 0; - if (IsNotEventLegalMewOrDeoxys(gBattlerAttacker)) // only if species is Mew or Deoxys + if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT) + return 0; + + if (IsMonEventLegal(gBattlerAttacker)) // only false if illegal Mew or Deoxys { - if (!IsOtherTrainer(gBattleMons[gBattlerAttacker].otId, gBattleMons[gBattlerAttacker].otName) || FlagGet(FLAG_BADGE08_GET)) + if (!IsOtherTrainer(gBattleMons[gBattlerAttacker].otId, gBattleMons[gBattlerAttacker].otName)) return 0; + if (FlagGet(FLAG_BADGE08_GET)) + return 0; + obedienceLevel = 10; + if (FlagGet(FLAG_BADGE02_GET)) obedienceLevel = 30; if (FlagGet(FLAG_BADGE04_GET)) @@ -3125,39 +3168,46 @@ u8 IsMonDisobedient(void) if (FlagGet(FLAG_BADGE06_GET)) obedienceLevel = 70; } + if (gBattleMons[gBattlerAttacker].level <= obedienceLevel) return 0; rnd = (Random() & 255); calc = (gBattleMons[gBattlerAttacker].level + obedienceLevel) * rnd >> 8; if (calc < obedienceLevel) return 0; + // is not obedient if (gCurrentMove == MOVE_RAGE) - gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_RAGE); + gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_RAGE; if (gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP && (gCurrentMove == MOVE_SNORE || gCurrentMove == MOVE_SLEEP_TALK)) { gBattlescriptCurrInstr = BattleScript_IgnoresWhileAsleep; return 1; } + rnd = (Random() & 255); calc = (gBattleMons[gBattlerAttacker].level + obedienceLevel) * rnd >> 8; if (calc < obedienceLevel && gCurrentMove != MOVE_FOCUS_PUNCH) // Additional check for focus punch in FR { - calc = CheckMoveLimitations(gBattlerAttacker, gBitTable[gCurrMovePos], 0xFF); + calc = CheckMoveLimitations(gBattlerAttacker, gBitTable[gCurrMovePos], MOVE_LIMITATIONS_ALL); if (calc == 0xF) // all moves cannot be used { - gBattleCommunication[MULTISTRING_CHOOSER] = Random() & 3; + // Randomly select, then print a disobedient string + // B_MSG_LOAFING, B_MSG_WONT_OBEY, B_MSG_TURNED_AWAY, or B_MSG_PRETEND_NOT_NOTICE + gBattleCommunication[MULTISTRING_CHOOSER] = Random() & (NUM_LOAF_STRINGS - 1); gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; return 1; } else // use a random move { do - gCurrMovePos = gChosenMovePos = Random() & 3; - while (gBitTable[gCurrMovePos] & calc); + { + gCurrMovePos = gChosenMovePos = Random() & (MAX_MON_MOVES - 1); + } while (gBitTable[gCurrMovePos] & calc); + gCalledMove = gBattleMons[gBattlerAttacker].moves[gCurrMovePos]; gBattlescriptCurrInstr = BattleScript_IgnoresAndUsesRandomMove; - gBattlerTarget = GetMoveTarget(gCalledMove, 0); + gBattlerTarget = GetMoveTarget(gCalledMove, NO_TARGET_OVERRIDE); gHitMarker |= HITMARKER_DISOBEDIENT_MOVE; return 2; } @@ -3165,15 +3215,17 @@ u8 IsMonDisobedient(void) else { obedienceLevel = gBattleMons[gBattlerAttacker].level - obedienceLevel; + calc = (Random() & 255); if (calc < obedienceLevel && !(gBattleMons[gBattlerAttacker].status1 & STATUS1_ANY) && gBattleMons[gBattlerAttacker].ability != ABILITY_VITAL_SPIRIT && gBattleMons[gBattlerAttacker].ability != ABILITY_INSOMNIA) { // try putting asleep int i; - - for (i = 0; i < gBattlersCount; ++i) + for (i = 0; i < gBattlersCount; i++) + { if (gBattleMons[i].status2 & STATUS2_UPROAR) break; + } if (i == gBattlersCount) { gBattlescriptCurrInstr = BattleScript_IgnoresAndFallsAsleep; @@ -3191,7 +3243,9 @@ u8 IsMonDisobedient(void) } else { - gBattleCommunication[MULTISTRING_CHOOSER] = Random() & 3; + // Randomly select, then print a disobedient string + // B_MSG_LOAFING, B_MSG_WONT_OBEY, B_MSG_TURNED_AWAY, or B_MSG_PRETEND_NOT_NOTICE + gBattleCommunication[MULTISTRING_CHOOSER] = Random() & (NUM_LOAF_STRINGS - 1); gBattlescriptCurrInstr = BattleScript_MoveUsedLoafingAround; return 1; } diff --git a/src/battle_util2.c b/src/battle_util2.c index e3fa1a6a7..8a5fbccf6 100644 --- a/src/battle_util2.c +++ b/src/battle_util2.c @@ -2,8 +2,8 @@ #include "bg.h" #include "battle.h" #include "battle_anim.h" -#include "pokemon.h" #include "malloc.h" +#include "pokemon.h" #include "trainer_tower.h" void AllocateBattleResources(void) @@ -14,10 +14,12 @@ void AllocateBattleResources(void) { s32 i; - for (i = 0; i < 4; ++i) + for (i = 0; i < 4; i++) gPokedudeBattlerStates[i] = AllocZeroed(sizeof(struct PokedudeBattlerState)); } + gBattleStruct = AllocZeroed(sizeof(*gBattleStruct)); + gBattleResources = AllocZeroed(sizeof(*gBattleResources)); gBattleResources->secretBase = AllocZeroed(sizeof(*gBattleResources->secretBase)); gBattleResources->flags = AllocZeroed(sizeof(*gBattleResources->flags)); @@ -27,12 +29,15 @@ void AllocateBattleResources(void) gBattleResources->ai = AllocZeroed(sizeof(*gBattleResources->ai)); gBattleResources->battleHistory = AllocZeroed(sizeof(*gBattleResources->battleHistory)); gBattleResources->AI_ScriptsStack = AllocZeroed(sizeof(*gBattleResources->AI_ScriptsStack)); + gLinkBattleSendBuffer = AllocZeroed(BATTLE_BUFFER_LINK_SIZE); gLinkBattleRecvBuffer = AllocZeroed(BATTLE_BUFFER_LINK_SIZE); - gBattleAnimMons_BgTilesBuffer = AllocZeroed(0x2000); - gBattleAnimMons_BgTilemapBuffer = AllocZeroed(0x1000); - SetBgTilemapBuffer(1, gBattleAnimMons_BgTilemapBuffer); - SetBgTilemapBuffer(2, gBattleAnimMons_BgTilemapBuffer); + + gBattleAnimBgTileBuffer = AllocZeroed(0x2000); + gBattleAnimBgTilemapBuffer = AllocZeroed(0x1000); + + SetBgTilemapBuffer(1, gBattleAnimBgTilemapBuffer); + SetBgTilemapBuffer(2, gBattleAnimBgTilemapBuffer); } void FreeBattleResources(void) @@ -43,7 +48,7 @@ void FreeBattleResources(void) { s32 i; - for (i = 0; i < 4; ++i) + for (i = 0; i < 4; i++) { FREE_AND_SET_NULL(gPokedudeBattlerStates[i]); } @@ -51,6 +56,7 @@ void FreeBattleResources(void) if (gBattleResources != NULL) { FREE_AND_SET_NULL(gBattleStruct); + FREE_AND_SET_NULL(gBattleResources->secretBase); FREE_AND_SET_NULL(gBattleResources->flags); FREE_AND_SET_NULL(gBattleResources->battleScriptsStack); @@ -60,21 +66,26 @@ void FreeBattleResources(void) FREE_AND_SET_NULL(gBattleResources->battleHistory); FREE_AND_SET_NULL(gBattleResources->AI_ScriptsStack); FREE_AND_SET_NULL(gBattleResources); + FREE_AND_SET_NULL(gLinkBattleSendBuffer); FREE_AND_SET_NULL(gLinkBattleRecvBuffer); - FREE_AND_SET_NULL(gBattleAnimMons_BgTilesBuffer); - FREE_AND_SET_NULL(gBattleAnimMons_BgTilemapBuffer); + + FREE_AND_SET_NULL(gBattleAnimBgTileBuffer); + FREE_AND_SET_NULL(gBattleAnimBgTilemapBuffer); } } void AdjustFriendshipOnBattleFaint(u8 battlerId) { - u8 opposingBattlerId, opposingBattlerId2; + u8 opposingBattlerId; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { + u8 opposingBattlerId2; + opposingBattlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); opposingBattlerId2 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + if (gBattleMons[opposingBattlerId2].level > gBattleMons[opposingBattlerId].level) opposingBattlerId = opposingBattlerId2; } @@ -82,6 +93,7 @@ void AdjustFriendshipOnBattleFaint(u8 battlerId) { opposingBattlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); } + if (gBattleMons[opposingBattlerId].level > gBattleMons[battlerId].level) { if (gBattleMons[opposingBattlerId].level - gBattleMons[battlerId].level > 29) diff --git a/src/data.c b/src/data.c index 2b1d802ab..498f281b4 100644 --- a/src/data.c +++ b/src/data.c @@ -8,36 +8,38 @@ #include "constants/battle_ai.h" #include "constants/trainers.h" -const struct SpriteFrameImage gSpriteImages_BattlerPlayerLeft[] = +#define BATTLER_OFFSET(i) (gHeap + 0x8000 + MON_PIC_SIZE * (i)) + +const struct SpriteFrameImage gBattlerPicTable_PlayerLeft[] = { - gHeap + 0x8000, 0x800, - gHeap + 0x8800, 0x800, - gHeap + 0x9000, 0x800, - gHeap + 0x9800, 0x800, + BATTLER_OFFSET(0), MON_PIC_SIZE, + BATTLER_OFFSET(1), MON_PIC_SIZE, + BATTLER_OFFSET(2), MON_PIC_SIZE, + BATTLER_OFFSET(3), MON_PIC_SIZE, }; -const struct SpriteFrameImage gSpriteImages_BattlerOpponentLeft[] = +const struct SpriteFrameImage gBattlerPicTable_OpponentLeft[] = { - gHeap + 0xA000, 0x800, - gHeap + 0xA800, 0x800, - gHeap + 0xB000, 0x800, - gHeap + 0xB800, 0x800, + BATTLER_OFFSET(4), MON_PIC_SIZE, + BATTLER_OFFSET(5), MON_PIC_SIZE, + BATTLER_OFFSET(6), MON_PIC_SIZE, + BATTLER_OFFSET(7), MON_PIC_SIZE, }; -const struct SpriteFrameImage gSpriteImages_BattlerPlayerRight[] = +const struct SpriteFrameImage gBattlerPicTable_PlayerRight[] = { - gHeap + 0xC000, 0x800, - gHeap + 0xC800, 0x800, - gHeap + 0xD000, 0x800, - gHeap + 0xD800, 0x800, + BATTLER_OFFSET(8), MON_PIC_SIZE, + BATTLER_OFFSET(9), MON_PIC_SIZE, + BATTLER_OFFSET(10), MON_PIC_SIZE, + BATTLER_OFFSET(11), MON_PIC_SIZE, }; -const struct SpriteFrameImage gSpriteImages_BattlerOpponentRight[] = +const struct SpriteFrameImage gBattlerPicTable_OpponentRight[] = { - gHeap + 0xE000, 0x800, - gHeap + 0xE800, 0x800, - gHeap + 0xF000, 0x800, - gHeap + 0xF800, 0x800, + BATTLER_OFFSET(12), MON_PIC_SIZE, + BATTLER_OFFSET(13), MON_PIC_SIZE, + BATTLER_OFFSET(14), MON_PIC_SIZE, + BATTLER_OFFSET(15), MON_PIC_SIZE, }; const struct SpriteFrameImage gTrainerBackPicTable_Red[] = @@ -102,172 +104,177 @@ static const union AnimCmd sAnim_GeneralFrame3[] = ANIMCMD_END, }; -static const union AffineAnimCmd gSpriteAffineAnim_82347F8[] = +// Many of these affine anims seem to go unused, and +// instead SetSpriteRotScale is used to manipulate +// the battler sprites directly (for instance, in AnimTask_SwitchOutShrinkMon). +// Those with explicit indexes are referenced elsewhere. + +static const union AffineAnimCmd sAffineAnim_Battler_Normal[] = { - AFFINEANIMCMD_FRAME(0x0100, 0x0100, 0x00, 0x00), + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gSpriteAffineAnim_8234808[] = +static const union AffineAnimCmd sAffineAnim_Battler_Flipped[] = { - AFFINEANIMCMD_FRAME(0xff00, 0x0100, 0x00, 0x00), + AFFINEANIMCMD_FRAME(-0x100, 0x0100, 0, 0), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gSpriteAffineAnim_8234818[] = +static const union AffineAnimCmd sAffineAnim_Battler_Emerge[] = { - AFFINEANIMCMD_FRAME(0x0028, 0x0028, 0x00, 0x00), - AFFINEANIMCMD_FRAME(0x0012, 0x0012, 0x00, 0x0c), + AFFINEANIMCMD_FRAME(0x28, 0x28, 0, 0), + AFFINEANIMCMD_FRAME(0x12, 0x12, 0, 12), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gSpriteAffineAnim_8234830[] = +static const union AffineAnimCmd sAffineAnim_Battler_Return[] = { - AFFINEANIMCMD_FRAME(0xfffe, 0xfffe, 0x00, 0x12), - AFFINEANIMCMD_FRAME(0xfff0, 0xfff0, 0x00, 0x0f), + AFFINEANIMCMD_FRAME(-0x2, -0x2, 0, 18), + AFFINEANIMCMD_FRAME(-0x10, -0x10, 0, 15), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gSpriteAffineAnim_8234848[] = +static const union AffineAnimCmd sAffineAnim_Battler_HorizontalSquishLoop[] = { - AFFINEANIMCMD_FRAME(0x00a0, 0x0100, 0x00, 0x00), - AFFINEANIMCMD_FRAME(0x0004, 0x0000, 0x00, 0x08), - AFFINEANIMCMD_FRAME(0xfffc, 0x0000, 0x00, 0x08), + AFFINEANIMCMD_FRAME(0xA0, 0x100, 0, 0), + AFFINEANIMCMD_FRAME( 0x4, 0x0, 0, 8), + AFFINEANIMCMD_FRAME(-0x4, 0x0, 0, 8), AFFINEANIMCMD_JUMP(1), }; -static const union AffineAnimCmd gSpriteAffineAnim_8234868[] = +static const union AffineAnimCmd sAffineAnim_Battler_Grow[] = { - AFFINEANIMCMD_FRAME(0x0002, 0x0002, 0x00, 0x14), + AFFINEANIMCMD_FRAME(0x2, 0x2, 0, 20), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gSpriteAffineAnim_8234878[] = +static const union AffineAnimCmd sAffineAnim_Battler_Shrink[] = { - AFFINEANIMCMD_FRAME(0xfffe, 0xfffe, 0x00, 0x14), + AFFINEANIMCMD_FRAME(-0x2, -0x2, 0, 20), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gSpriteAffineAnim_8234888[] = +static const union AffineAnimCmd sAffineAnim_Battler_BigToSmall[] = { - AFFINEANIMCMD_FRAME(0x0100, 0x0100, 0x00, 0000), - AFFINEANIMCMD_FRAME(0xfff0, 0xfff0, 0x00, 0x09), + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(-0x10, -0x10, 0, 9), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gSpriteAffineAnim_82348A0[] = +static const union AffineAnimCmd sAffineAnim_Battler_GrowLarge[] = { - AFFINEANIMCMD_FRAME(0x0004, 0x0004, 0x00, 0x3f), + AFFINEANIMCMD_FRAME(0x4, 0x4, 0, 63), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gSpriteAffineAnim_82348B0[] = +static const union AffineAnimCmd sAffineAnim_Battler_TipRight[] = { - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0xfd, 0x05), - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0x03, 0x05), + AFFINEANIMCMD_FRAME(0x0, 0x0, -3, 5), + AFFINEANIMCMD_FRAME(0x0, 0x0, 3, 5), AFFINEANIMCMD_END, }; -const union AffineAnimCmd *const gSpriteAffineAnimTable_BattlerPlayer[] = +const union AffineAnimCmd *const gAffineAnims_BattleSpritePlayerSide[] = { - gSpriteAffineAnim_82347F8, - gSpriteAffineAnim_8234818, - gSpriteAffineAnim_8234830, - gSpriteAffineAnim_8234848, - gSpriteAffineAnim_8234868, - gSpriteAffineAnim_8234878, - gSpriteAffineAnim_82348A0, - gSpriteAffineAnim_82348B0, - gSpriteAffineAnim_8234888, + [BATTLER_AFFINE_NORMAL] = sAffineAnim_Battler_Normal, + [BATTLER_AFFINE_EMERGE] = sAffineAnim_Battler_Emerge, + [BATTLER_AFFINE_RETURN] = sAffineAnim_Battler_Return, + sAffineAnim_Battler_HorizontalSquishLoop, + sAffineAnim_Battler_Grow, + sAffineAnim_Battler_Shrink, + sAffineAnim_Battler_GrowLarge, + sAffineAnim_Battler_TipRight, + sAffineAnim_Battler_BigToSmall, }; -static const union AffineAnimCmd gSpriteAffineAnim_82348EC[] = +static const union AffineAnimCmd sAffineAnim_Battler_SpinShrink[] = { - AFFINEANIMCMD_FRAME(0xfffc, 0xfffc, 0x04, 0x3f), + AFFINEANIMCMD_FRAME(-0x4, -0x4, 4, 63), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gSpriteAffineAnim_82348FC[] = +static const union AffineAnimCmd sAffineAnim_Battler_TipLeft[] = { - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0x03, 0x05), - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0xfd, 0x05), + AFFINEANIMCMD_FRAME(0x0, 0x0, 3, 5), + AFFINEANIMCMD_FRAME(0x0, 0x0, -3, 5), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gSpriteAffineAnim_8234914[] = +static const union AffineAnimCmd sAffineAnim_Battler_RotateUpAndBack[] = { - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0xfb, 0x14), - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0x00, 0x14), - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0x05, 0x14), + AFFINEANIMCMD_FRAME(0x0, 0x0, -5, 20), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 20), + AFFINEANIMCMD_FRAME(0x0, 0x0, 5, 20), AFFINEANIMCMD_END, }; -static const union AffineAnimCmd gSpriteAffineAnim_8234934[] = +static const union AffineAnimCmd sAffineAnim_Battler_Spin[] = { - AFFINEANIMCMD_FRAME(0x0000, 0x0000, 0x09, 0x6e), + AFFINEANIMCMD_FRAME(0x0, 0x0, 9, 110), AFFINEANIMCMD_END, }; -const union AffineAnimCmd *const gSpriteAffineAnimTable_BattlerOpponent[] = +const union AffineAnimCmd *const gAffineAnims_BattleSpriteOpponentSide[] = { - gSpriteAffineAnim_82347F8, - gSpriteAffineAnim_8234818, - gSpriteAffineAnim_8234830, - gSpriteAffineAnim_8234848, - gSpriteAffineAnim_8234868, - gSpriteAffineAnim_8234878, - gSpriteAffineAnim_82348EC, - gSpriteAffineAnim_82348FC, - gSpriteAffineAnim_8234914, - gSpriteAffineAnim_8234888, - gSpriteAffineAnim_8234934, + [BATTLER_AFFINE_NORMAL] = sAffineAnim_Battler_Normal, + [BATTLER_AFFINE_EMERGE] = sAffineAnim_Battler_Emerge, + [BATTLER_AFFINE_RETURN] = sAffineAnim_Battler_Return, + sAffineAnim_Battler_HorizontalSquishLoop, + sAffineAnim_Battler_Grow, + sAffineAnim_Battler_Shrink, + sAffineAnim_Battler_SpinShrink, + sAffineAnim_Battler_TipLeft, + sAffineAnim_Battler_RotateUpAndBack, + sAffineAnim_Battler_BigToSmall, + sAffineAnim_Battler_Spin, }; -const union AffineAnimCmd *const gSpriteAffineAnimTable_82349470[] = +const union AffineAnimCmd *const gAffineAnims_BattleSpriteContest[] = { - gSpriteAffineAnim_8234808, - gSpriteAffineAnim_8234818, - gSpriteAffineAnim_8234830, - gSpriteAffineAnim_8234848, - gSpriteAffineAnim_8234868, - gSpriteAffineAnim_8234878, - gSpriteAffineAnim_82348EC, - gSpriteAffineAnim_82348FC, - gSpriteAffineAnim_8234914, - gSpriteAffineAnim_8234888, - gSpriteAffineAnim_8234934, + [BATTLER_AFFINE_NORMAL] = sAffineAnim_Battler_Flipped, + [BATTLER_AFFINE_EMERGE] = sAffineAnim_Battler_Emerge, + [BATTLER_AFFINE_RETURN] = sAffineAnim_Battler_Return, + sAffineAnim_Battler_HorizontalSquishLoop, + sAffineAnim_Battler_Grow, + sAffineAnim_Battler_Shrink, + sAffineAnim_Battler_SpinShrink, + sAffineAnim_Battler_TipLeft, + sAffineAnim_Battler_RotateUpAndBack, + sAffineAnim_Battler_BigToSmall, + sAffineAnim_Battler_Spin, }; -static const union AnimCmd gSpriteAnim_823499C[] = +static const union AnimCmd sAnim_MonPic_0[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, }; -static const union AnimCmd gSpriteAnim_82349A4[] = +static const union AnimCmd sAnim_MonPic_1[] = { ANIMCMD_FRAME(1, 0), ANIMCMD_END, }; -static const union AnimCmd gSpriteAnim_82349AC[] = +static const union AnimCmd sAnim_MonPic_2[] = { ANIMCMD_FRAME(2, 0), ANIMCMD_END, }; -static const union AnimCmd gSpriteAnim_82349B4[] = +static const union AnimCmd sAnim_MonPic_3[] = { ANIMCMD_FRAME(3, 0), ANIMCMD_END, }; -const union AnimCmd *const gSpriteAnimTable_82349BC[] = +const union AnimCmd *const gAnims_MonPic[] = { - gSpriteAnim_823499C, - gSpriteAnim_82349A4, - gSpriteAnim_82349AC, - gSpriteAnim_82349B4, + sAnim_MonPic_0, + sAnim_MonPic_1, + sAnim_MonPic_2, + sAnim_MonPic_3, }; #define SPECIES_SPRITE(species, sprite) [SPECIES_##species] = {sprite, 0x800, SPECIES_##species} diff --git a/src/data/dodrio_berry_picking.h b/src/data/dodrio_berry_picking.h deleted file mode 100644 index e71ce13cf..000000000 --- a/src/data/dodrio_berry_picking.h +++ /dev/null @@ -1,247 +0,0 @@ -#ifndef GUARD_DATA_DODRIO_BERRY_PICKING_H -#define GUARD_DATA_DODRIO_BERRY_PICKING_H - -static const struct BgTemplate sUnknown_847565C[] = -{ - { - .bg = 0, - .charBaseIndex = 0, - .mapBaseIndex = 30, - .screenSize = 0, - .paletteMode = 0, - .priority = 0, - .baseTile = 0 - }, - { - .bg = 1, - .charBaseIndex = 2, - .mapBaseIndex = 12, - .screenSize = 1, - .paletteMode = 0, - .priority = 1, - .baseTile = 0 - }, - { - .bg = 2, - .charBaseIndex = 2, - .mapBaseIndex = 14, - .screenSize = 1, - .paletteMode = 0, - .priority = 1, - .baseTile = 0 - }, - { - .bg = 3, - .charBaseIndex = 3, - .mapBaseIndex = 31, - .screenSize = 0, - .paletteMode = 0, - .priority = 2, - .baseTile = 0 - }, -}; - -// Unknown unreferenced data, feel free to remove. -static const u32 sUnused[] = {255, 0}; - -static const struct WindowTemplate sUnknown_8475674[] = -{ - { - .bg = 0, - .tilemapLeft = 1, - .tilemapTop = 1, - .width = 28, - .height = 3, - .paletteNum = 13, - .baseBlock = 0x13, - }, - { - .bg = 0, - .tilemapLeft = 1, - .tilemapTop = 6, - .width = 28, - .height = 13, - .paletteNum = 13, - .baseBlock = 0x67, - } -}; - -static const struct WindowTemplate sUnknown_8475684 = -{ - .bg = 0, - .tilemapLeft = 1, - .tilemapTop = 6, - .width = 28, - .height = 7, - .paletteNum = 13, - .baseBlock = 0x67, -}; - -static const struct WindowTemplate sUnknown_847568C[] = -{ - { - .bg = 0, - .tilemapLeft = 1, - .tilemapTop = 8, - .width = 19, - .height = 3, - .paletteNum = 13, - .baseBlock = 0x13, - }, - { - .bg = 0, - .tilemapLeft = 22, - .tilemapTop = 7, - .width = 6, - .height = 4, - .paletteNum = 13, - .baseBlock = 0x4C, - } -}; - -static const struct WindowTemplate sUnknown_847569C = -{ - .bg = 0, - .tilemapLeft = 4, - .tilemapTop = 6, - .width = 22, - .height = 5, - .paletteNum = 13, - .baseBlock = 0x13, -}; - -static const struct WindowTemplate sUnknown_84756A4 = -{ - .bg = 0, - .tilemapLeft = 5, - .tilemapTop = 8, - .width = 19, - .height = 3, - .paletteNum = 13, - .baseBlock = 0x13, -}; - -static const u8 sUnknown_8471F50[5][5][11] = -{ - { - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, - }, - { - {0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 0}, - {0, 1, 2, 5, 6, 3, 4, 5, 8, 9, 0}, - }, - { - {0, 1, 2, 3, 4, 5, 6, 7, 2, 9, 0}, - {0, 1, 4, 5, 6, 7, 2, 3, 4, 9, 0}, - {0, 1, 6, 7, 2, 3, 4, 5, 6, 9, 0}, - }, - { - {0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 0}, - {0, 3, 4, 5, 6, 7, 8, 1, 2, 3, 0}, - {0, 5, 6, 7, 8, 1, 2, 3, 4, 5, 0}, - {0, 7, 8, 1, 2, 3, 4, 5, 6, 7, 0}, - }, - { - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, - {2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}, - {4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4}, - {6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6}, - {8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8}, - }, -}; - -static const u8 sUnknown_8472063[5][5][3] = -{ - { - {4, 5, 6}, - }, - { - {3, 4, 5}, - {5, 6, 3}, - }, - { - {4, 5, 6}, - {6, 7, 2}, - {2, 3, 4}, - }, - { - {3, 4, 5}, - {5, 6, 7}, - {7, 8, 1}, - {1, 2, 3}, - }, - { - {4, 5, 6}, - {6, 7, 8}, - {8, 9, 0}, - {0, 1, 2}, - {2, 3, 4}, - }, -}; - -static const u8 sUnknown_84720AE[5][5][3] = -{ - { - {1, 0, 1}, - }, - { - {1, 0, 1}, - {0, 1, 0}, - }, - { - {2, 0, 1}, - {0, 1, 2}, - {1, 2, 0}, - }, - { - {3, 0, 1}, - {0, 1, 2}, - {1, 2, 3}, - {2, 3, 0}, - }, - { - {4, 0, 1}, - {0, 1, 2}, - {1, 2, 3}, - {2, 3, 4}, - {3, 4, 0}, - }, -}; - -ALIGNED(4) -static const u8 sUnknown_84720FC[5][11] = -{ - {9, 9, 9, 9, 1, 1, 1, 9, 9, 9, 9}, - {9, 9, 9, 0, 0, 1, 1, 0, 9, 9, 9}, - {9, 9, 2, 2, 0, 0, 1, 1, 1, 9, 9}, - {9, 3, 3, 0, 0, 1, 1, 2, 2, 3, 9}, - {3, 3, 4, 4, 0, 0, 1, 1, 2, 2, 3}, -}; - -static const u8 sUnknown_8472133[5][5] = -{ - {5}, - {4, 6}, - {3, 5, 7}, - {2, 4, 6, 8}, - {1, 3, 5, 6, 9}, -}; - -static const u16 sDodrioBerryBgPal1[] = INCBIN_U16("graphics/link_games/dodrioberry_bg1.gbapal", - "graphics/link_games/dodrioberry_bg2.gbapal"); -static const u16 sDodrioBerryPkmnPal[] = INCBIN_U16("graphics/link_games/dodrioberry_pkmn.gbapal"); -static const u16 sDodrioBerryShinyPal[] = INCBIN_U16("graphics/link_games/dodrioberry_shiny.gbapal"); -static const u16 sDodrioBerryStatusPal[] = INCBIN_U16("graphics/link_games/dodrioberry_status.gbapal"); -static const u16 sDodrioBerrySpritesPal[] = INCBIN_U16("graphics/link_games/dodrioberry_berrysprites.gbapal"); -static const u32 sDodrioBerrySpritesGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_berrysprites.4bpp.lz"); -static const u16 sDodrioBerryPlatformPal[] = INCBIN_U16("graphics/link_games/dodrioberry_platform.gbapal"); -static const u32 sDodrioBerryBgGfx1[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.4bpp.lz"); -static const u32 sDodrioBerryBgGfx2[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2.4bpp.lz"); -static const u32 sDodrioBerryStatusGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_status.4bpp.lz"); -static const u32 sDodrioBerryPlatformGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_platform.4bpp.lz"); -static const u32 sDodrioBerryPkmnGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_pkmn.4bpp.lz"); -static const u32 sDodrioBerryBgTilemap1[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.bin.lz"); -static const u32 sDodrioBerryBgTilemap2Right[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2right.bin.lz"); -static const u32 sDodrioBerryBgTilemap2Left[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2left.bin.lz"); - -#endif //GUARD_DATA_DODRIO_BERRY_PICKING_H diff --git a/src/data/object_events/movement_action_func_tables.h b/src/data/object_events/movement_action_func_tables.h index 9abd6452a..2a1c496f7 100644 --- a/src/data/object_events/movement_action_func_tables.h +++ b/src/data/object_events/movement_action_func_tables.h @@ -1,87 +1,28 @@ -static bool8 MovementActionFunc_x04_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x05_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x06_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x07_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x08_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x08_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x09_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x09_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x0A_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x0A_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x0B_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x0B_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x0C_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x0C_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x0D_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x0D_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x0E_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x0E_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x0F_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x0F_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x41_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x41_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x42_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x42_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x43_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x43_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x44_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x44_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x70_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x71_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x72_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x73_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x88_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x89_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x8A_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x8B_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x94_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x94_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x95_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x95_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x96_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x96_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x97_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x97_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x98_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x98_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x99_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x9A_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x9B_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x9B_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x9C_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x9C_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x9D_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x9D_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x9E_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x9E_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x9F_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_x9F_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA0_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA0_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA1_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA1_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA2_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA2_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA3_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA3_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA4_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA4_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA4_2(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA5_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA5_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA6_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA6_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA7_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA7_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA8_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA8_1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA9_0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementActionFunc_xA9_1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_FaceDown_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_FaceUp_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_FaceLeft_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_FaceRight_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_PauseSpriteAnim(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_FaceDownFast_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_FaceUpFast_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_FaceLeftFast_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_FaceRightFast_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowerDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowerDown_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowerUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowerUp_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowerLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowerLeft_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowerRight_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowerRight_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowDown_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowUp_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowLeft_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowRight_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowRight_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WalkNormalDown_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WalkNormalDown_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WalkNormalUp_Step0(struct ObjectEvent *, struct Sprite *); @@ -104,10 +45,10 @@ static bool8 MovementAction_WalkInPlaceFastDown_Step0(struct ObjectEvent *, stru static bool8 MovementAction_WalkInPlaceFastUp_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WalkInPlaceFastLeft_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WalkInPlaceFastRight_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_WalkInPlaceFastestDown_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_WalkInPlaceFastestUp_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_WalkInPlaceFastestLeft_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_WalkInPlaceFastestRight_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkInPlaceFasterDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkInPlaceFasterUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkInPlaceFasterLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkInPlaceFasterRight_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_Jump2Down_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_Jump2Down_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_Jump2Up_Step0(struct ObjectEvent *, struct Sprite *); @@ -116,6 +57,12 @@ static bool8 MovementAction_Jump2Left_Step0(struct ObjectEvent *, struct Sprite static bool8 MovementAction_Jump2Left_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_Jump2Right_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_Jump2Right_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_Delay1_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_Delay2_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_Delay4_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_Delay8_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_Delay16_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_Delay_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WalkFastDown_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WalkFastDown_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WalkFastUp_Step0(struct ObjectEvent *, struct Sprite *); @@ -132,14 +79,14 @@ static bool8 MovementAction_RideWaterCurrentLeft_Step0(struct ObjectEvent *, str static bool8 MovementAction_RideWaterCurrentLeft_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_RideWaterCurrentRight_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_RideWaterCurrentRight_Step1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_WalkFastestDown_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_WalkFastestDown_Step1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_WalkFastestUp_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_WalkFastestUp_Step1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_WalkFastestLeft_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_WalkFastestLeft_Step1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_WalkFastestRight_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_WalkFastestRight_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkFasterDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkFasterDown_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkFasterUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkFasterUp_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkFasterLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkFasterLeft_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkFasterRight_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkFasterRight_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_SlideDown_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_SlideDown_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_SlideUp_Step0(struct ObjectEvent *, struct Sprite *); @@ -156,6 +103,15 @@ static bool8 MovementAction_PlayerRunLeft_Step0(struct ObjectEvent *, struct Spr static bool8 MovementAction_PlayerRunLeft_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_PlayerRunRight_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_PlayerRunRight_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RunDownSlow_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RunDownSlow_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RunUpSlow_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RunUpSlow_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RunLeftSlow_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RunLeftSlow_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RunRightSlow_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RunRightSlow_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_StartAnimInDirection_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_JumpSpecialDown_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_JumpSpecialDown_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_JumpSpecialUp_Step0(struct ObjectEvent *, struct Sprite *); @@ -164,6 +120,10 @@ static bool8 MovementAction_JumpSpecialLeft_Step0(struct ObjectEvent *, struct S static bool8 MovementAction_JumpSpecialLeft_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_JumpSpecialRight_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_JumpSpecialRight_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_FacePlayer_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_FaceAwayPlayer_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_LockFacingDirection_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_UnlockFacingDirection_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_JumpDown_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_JumpDown_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_JumpUp_Step0(struct ObjectEvent *, struct Sprite *); @@ -188,12 +148,55 @@ static bool8 MovementAction_JumpInPlaceLeftRight_Step0(struct ObjectEvent *, str static bool8 MovementAction_JumpInPlaceLeftRight_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_JumpInPlaceRightLeft_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_JumpInPlaceRightLeft_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_FaceOriginalDirection_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_NurseJoyBowDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_EnableJumpLandingGroundEffect_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_DisableJumpLandingGroundEffect_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_DisableAnimation_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RestoreAnimation_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_SetInvisible_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_SetVisible_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_EmoteExclamationMark_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_EmoteQuestionMark_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_EmoteX_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_EmoteDoubleExclamationMark_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_EmoteSmile_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_RevealTrainer_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_RevealTrainer_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RockSmashBreak_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RockSmashBreak_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RockSmashBreak_Step2(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_CutTree_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_CutTree_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_CutTree_Step2(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_SetFixedPriority_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_ClearFixedPriority_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_InitAffineAnim_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_ClearAffineAnim_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WalkDownStartAffine_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WalkDownStartAffine_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WalkDownAffine_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WalkDownAffine_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroWheelieFaceDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroWheelieFaceUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroWheelieFaceLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroWheelieFaceRight_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroPopWheelieDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroPopWheelieDown_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroPopWheelieUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroPopWheelieUp_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroPopWheelieLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroPopWheelieLeft_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroPopWheelieRight_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroPopWheelieRight_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroEndWheelieFaceDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroEndWheelieFaceUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroEndWheelieFaceLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroEndWheelieFaceRight_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_UnusedAcroActionDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_UnusedAcroActionUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_UnusedAcroActionLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_UnusedAcroActionRight_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_AcroWheelieHopFaceDown_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_AcroWheelieHopFaceDown_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_AcroWheelieHopFaceUp_Step0(struct ObjectEvent *, struct Sprite *); @@ -218,14 +221,10 @@ static bool8 MovementAction_AcroWheelieJumpLeft_Step0(struct ObjectEvent *, stru static bool8 MovementAction_AcroWheelieJumpLeft_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_AcroWheelieJumpRight_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_AcroWheelieJumpRight_Step1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_AcroPopWheelieDown_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_AcroPopWheelieDown_Step1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_AcroPopWheelieUp_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_AcroPopWheelieUp_Step1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_AcroPopWheelieLeft_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_AcroPopWheelieLeft_Step1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_AcroPopWheelieRight_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_AcroPopWheelieRight_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroWheelieInPlaceDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroWheelieInPlaceUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroWheelieInPlaceLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_AcroWheelieInPlaceRight_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_AcroPopWheelieMoveDown_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_AcroPopWheelieMoveDown_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_AcroPopWheelieMoveUp_Step0(struct ObjectEvent *, struct Sprite *); @@ -242,1404 +241,1426 @@ static bool8 MovementAction_AcroWheelieMoveLeft_Step0(struct ObjectEvent *, stru static bool8 MovementAction_AcroWheelieMoveLeft_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_AcroWheelieMoveRight_Step0(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_AcroWheelieMoveRight_Step1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_AcroEndWheelieFaceDown_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_AcroEndWheelieFaceUp_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_AcroEndWheelieFaceLeft_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_AcroEndWheelieFaceRight_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_UnusedAcroActionDown_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_UnusedAcroActionUp_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_UnusedAcroActionLeft_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_UnusedAcroActionRight_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_RockSmashBreak_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_RockSmashBreak_Step1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_RockSmashBreak_Step2(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_CutTree_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_CutTree_Step1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_CutTree_Step2(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_SpinDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_SpinDown_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_SpinUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_SpinUp_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_SpinLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_SpinLeft_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_SpinRight_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_SpinRight_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RaiseHand_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RaiseHandAndStop_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RaiseHandAndJump_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_RaiseHandAndSwim_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowestDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowestDown_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowestUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowestUp_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowestLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowestLeft_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowestRight_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_WalkSlowestRight_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_ShakeHeadOrWalkInPlace_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_ShakeHeadOrWalkInPlace_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_GlideDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_GlideDown_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_GlideUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_GlideUp_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_GlideLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_GlideLeft_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_GlideRight_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_GlideRight_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_FlyUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_FlyUp_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_FlyUp_Step2(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_FlyDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_FlyDown_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_JumpSpecialWithEffectDown_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_JumpSpecialWithEffectDown_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_JumpSpecialWithEffectUp_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_JumpSpecialWithEffectUp_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_JumpSpecialWithEffectLeft_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_JumpSpecialWithEffectLeft_Step1(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_JumpSpecialWithEffectRight_Step0(struct ObjectEvent *, struct Sprite *); +static bool8 MovementAction_JumpSpecialWithEffectRight_Step1(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_WaitSpriteAnim(struct ObjectEvent *, struct Sprite *); static bool8 MovementAction_Finish(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_Delay_Step1(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_Delay1_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_Delay2_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_Delay4_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_Delay8_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_Delay16_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_FacePlayer_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_FaceAwayPlayer_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_FaceOriginalDirection_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_LockFacingDirection_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_UnlockFacingDirection_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_DisableAnimation_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_RestoreAnimation_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_SetInvisible_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_SetVisible_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_StartAnimInDirection_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_NurseJoyBowDown_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_EnableJumpLandingGroundEffect_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_DisableJumpLandingGroundEffect_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_EmoteExclamationMark_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_EmoteQuestionMark_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_EmoteHeart_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 do_double_excl_bubble(struct ObjectEvent *, struct Sprite *); -static bool8 do_smile_bubble(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_SetFixedPriority_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_ClearFixedPriority_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_InitAffineAnim_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 MovementAction_ClearAffineAnim_Step0(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x00[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x01[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x02[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x03[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x04[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x05[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x06[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x07[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x08[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x09[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x0A[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x0B[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x0D[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x0C[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x0E[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x0F[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x10[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x11[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x12[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x13[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x14[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x15[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x16[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x17[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x18[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x19[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x1A[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x1B[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x1C[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x1D[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x1E[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x1F[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x20[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x21[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x22[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x23[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x24[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x25[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x26[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x27[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x28[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x29[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x2A[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x2B[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x2C[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x2D[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x2E[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x2F[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x30[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x31[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x32[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x33[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x34[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x35[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x36[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x37[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x38[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x39[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x3A[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x3B[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x3C[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x3D[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x3E[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x3F[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x40[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x41[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x42[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x43[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x44[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x45[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x46[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x47[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x48[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x49[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x4A[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x4B[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x4C[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x4D[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x4E[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x4F[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x50[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x51[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x52[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x53[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x54[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x55[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x56[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x57[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x58[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x59[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x5A[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x5B[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x5C[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x5D[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x5E[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x5F[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x60[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x61[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x62[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x63[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x64[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x65[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x66[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x67[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x68[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x69[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x6A[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x6B[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x6C[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x6D[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x6E[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x6F[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x70[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x71[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x72[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x73[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x74[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x75[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x76[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x77[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x78[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x79[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x7A[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x7B[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x7C[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x7D[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x7E[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x7F[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x80[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x81[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x82[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x83[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x84[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x85[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x86[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x87[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x88[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x89[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x8A[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x8B[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x8C[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x8D[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x8E[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x8F[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x90[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x91[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x92[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x93[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x94[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x95[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x96[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x97[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x98[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x99[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x9A[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x9B[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x9C[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x9D[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x9E[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_x9F[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_xA0[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_xA1[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_xA2[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_xA3[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_xA4[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_xA5[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_xA6[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_xA7[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_xA8[])(struct ObjectEvent *, struct Sprite *); -static bool8 (*const sMovementActionFuncs_xA9[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FaceDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FaceUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FaceLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FaceRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FaceDownFast[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FaceUpFast[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FaceLeftFast[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FaceRightFast[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkSlowerDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkSlowerUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkSlowerLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkSlowerRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkSlowUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkSlowDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkSlowLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkSlowRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkNormalDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkNormalUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkNormalLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkNormalRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_Jump2Down[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_Jump2Up[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_Jump2Left[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_Jump2Right[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_Delay1[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_Delay2[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_Delay4[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_Delay8[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_Delay16[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkFastDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkFastUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkFastLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkFastRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceSlowDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceSlowUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceSlowLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceSlowRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceNormalDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceNormalUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceNormalLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceNormalRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceFastDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceFastUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceFastLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceFastRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceFasterDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceFasterUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceFasterLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkInPlaceFasterRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_RideWaterCurrentDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_RideWaterCurrentUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_RideWaterCurrentLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_RideWaterCurrentRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkFasterDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkFasterUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkFasterLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkFasterRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_SlideDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_SlideUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_SlideLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_SlideRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_PlayerRunDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_PlayerRunUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_PlayerRunLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_PlayerRunRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_PlayerRunDownSlow[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_PlayerRunUpSlow[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_PlayerRunLeftSlow[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_PlayerRunRightSlow[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_StartAnimInDirection[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpSpecialDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpSpecialUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpSpecialLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpSpecialRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FacePlayer[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FaceAwayPlayer[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_LockFacingDirection[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_UnlockFacingDirection[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpInPlaceDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpInPlaceUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpInPlaceLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpInPlaceRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpInPlaceDownUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpInPlaceUpDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpInPlaceLeftRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpInPlaceRightLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FaceOriginalDirection[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_NurseJoyBowDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_EnableJumpLandingGroundEffect[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_DisableJumpLandingGroundEffect[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_DisableAnimation[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_RestoreAnimation[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_SetInvisible[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_SetVisible[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_EmoteExclamationMark[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_EmoteQuestionMark[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_EmoteX[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_EmoteDoubleExclMark[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_EmoteSmile[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_RevealTrainer[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_RockSmashBreak[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_CutTree[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_SetFixedPriority[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_ClearFixedPriority[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_InitAffineAnim[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_ClearAffineAnim[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkDownStartAffine[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkDownAffine[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieFaceDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieFaceUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieFaceLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieFaceRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroPopWheelieDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroPopWheelieUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroPopWheelieLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroPopWheelieRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroEndWheelieFaceDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroEndWheelieFaceUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroEndWheelieFaceLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroEndWheelieFaceRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieHopFaceDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieHopFaceUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieHopFaceLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieHopFaceRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieHopDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieHopUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieHopLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieHopRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieJumpDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieJumpUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieJumpLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieJumpRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieInPlaceDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieInPlaceUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieInPlaceLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieInPlaceRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroPopWheelieMoveDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroPopWheelieMoveUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroPopWheelieMoveLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroPopWheelieMoveRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieMoveDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieMoveUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieMoveLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_AcroWheelieMoveRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_SpinDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_SpinUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_SpinLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_SpinRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_RaiseHandAndStop[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_RaiseHandAndJump[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_RaiseHandAndSwim[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkSlowestDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkSlowestUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkSlowestLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_WalkSlowestRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_ShakeHeadOrWalkInPlace[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_GlideDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_GlideUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_GlideLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_GlideRight[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FlyUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_FlyDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpSpecialWithEffectDown[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpSpecialWithEffectUp[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpSpecialWithEffectLeft[])(struct ObjectEvent *, struct Sprite *); +static bool8 (*const sMovementActionFuncs_JumpSpecialWithEffectRight[])(struct ObjectEvent *, struct Sprite *); static u8 GetMoveDirectionFastAnimNum(u8 direction); static u8 GetMoveDirectionFasterAnimNum(u8 direction); static u8 GetMoveDirectionFastestAnimNum(u8 direction); -bool8 (*const *const gMovementActionFuncs[])(struct ObjectEvent *, struct Sprite *) = { - [MOVEMENT_ACTION_FACE_DOWN] = sMovementActionFuncs_x00, - [MOVEMENT_ACTION_FACE_UP] = sMovementActionFuncs_x01, - [MOVEMENT_ACTION_FACE_LEFT] = sMovementActionFuncs_x02, - [MOVEMENT_ACTION_FACE_RIGHT] = sMovementActionFuncs_x03, - [MOVEMENT_ACTION_FACE_DOWN_FAST] = sMovementActionFuncs_x04, - [MOVEMENT_ACTION_FACE_UP_FAST] = sMovementActionFuncs_x05, - [MOVEMENT_ACTION_FACE_LEFT_FAST] = sMovementActionFuncs_x06, - [MOVEMENT_ACTION_FACE_RIGHT_FAST] = sMovementActionFuncs_x07, - [MOVEMENT_ACTION_WALK_SLOWER_DOWN] = sMovementActionFuncs_x08, - [MOVEMENT_ACTION_WALK_SLOWER_UP] = sMovementActionFuncs_x09, - [MOVEMENT_ACTION_WALK_SLOWER_LEFT] = sMovementActionFuncs_x0A, - [MOVEMENT_ACTION_WALK_SLOWER_RIGHT] = sMovementActionFuncs_x0B, - [MOVEMENT_ACTION_WALK_SLOW_DOWN] = sMovementActionFuncs_x0C, - [MOVEMENT_ACTION_WALK_SLOW_UP] = sMovementActionFuncs_x0D, - [MOVEMENT_ACTION_WALK_SLOW_LEFT] = sMovementActionFuncs_x0E, - [MOVEMENT_ACTION_WALK_SLOW_RIGHT] = sMovementActionFuncs_x0F, - [MOVEMENT_ACTION_WALK_NORMAL_DOWN] = sMovementActionFuncs_x10, - [MOVEMENT_ACTION_WALK_NORMAL_UP] = sMovementActionFuncs_x11, - [MOVEMENT_ACTION_WALK_NORMAL_LEFT] = sMovementActionFuncs_x12, - [MOVEMENT_ACTION_WALK_NORMAL_RIGHT] = sMovementActionFuncs_x13, - [MOVEMENT_ACTION_JUMP_2_DOWN] = sMovementActionFuncs_x14, - [MOVEMENT_ACTION_JUMP_2_UP] = sMovementActionFuncs_x15, - [MOVEMENT_ACTION_JUMP_2_LEFT] = sMovementActionFuncs_x16, - [MOVEMENT_ACTION_JUMP_2_RIGHT] = sMovementActionFuncs_x17, - [MOVEMENT_ACTION_DELAY_1] = sMovementActionFuncs_x18, - [MOVEMENT_ACTION_DELAY_2] = sMovementActionFuncs_x19, - [MOVEMENT_ACTION_DELAY_4] = sMovementActionFuncs_x1A, - [MOVEMENT_ACTION_DELAY_8] = sMovementActionFuncs_x1B, - [MOVEMENT_ACTION_DELAY_16] = sMovementActionFuncs_x1C, - [MOVEMENT_ACTION_WALK_FAST_DOWN] = sMovementActionFuncs_x1D, - [MOVEMENT_ACTION_WALK_FAST_UP] = sMovementActionFuncs_x1E, - [MOVEMENT_ACTION_WALK_FAST_LEFT] = sMovementActionFuncs_x1F, - [MOVEMENT_ACTION_WALK_FAST_RIGHT] = sMovementActionFuncs_x20, - [MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_DOWN] = sMovementActionFuncs_x21, - [MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_UP] = sMovementActionFuncs_x22, - [MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_LEFT] = sMovementActionFuncs_x23, - [MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_RIGHT] = sMovementActionFuncs_x24, - [MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_DOWN] = sMovementActionFuncs_x25, - [MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_UP] = sMovementActionFuncs_x26, - [MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_LEFT] = sMovementActionFuncs_x27, - [MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_RIGHT] = sMovementActionFuncs_x28, - [MOVEMENT_ACTION_WALK_IN_PLACE_FAST_DOWN] = sMovementActionFuncs_x29, - [MOVEMENT_ACTION_WALK_IN_PLACE_FAST_UP] = sMovementActionFuncs_x2A, - [MOVEMENT_ACTION_WALK_IN_PLACE_FAST_LEFT] = sMovementActionFuncs_x2B, - [MOVEMENT_ACTION_WALK_IN_PLACE_FAST_RIGHT] = sMovementActionFuncs_x2C, - [MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_DOWN] = sMovementActionFuncs_x2D, - [MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_UP] = sMovementActionFuncs_x2E, - [MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_LEFT] = sMovementActionFuncs_x2F, - [MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_RIGHT] = sMovementActionFuncs_x30, - [MOVEMENT_ACTION_RIDE_WATER_CURRENT_DOWN] = sMovementActionFuncs_x31, - [MOVEMENT_ACTION_RIDE_WATER_CURRENT_UP] = sMovementActionFuncs_x32, - [MOVEMENT_ACTION_RIDE_WATER_CURRENT_LEFT] = sMovementActionFuncs_x33, - [MOVEMENT_ACTION_RIDE_WATER_CURRENT_RIGHT] = sMovementActionFuncs_x34, - [MOVEMENT_ACTION_WALK_FASTEST_DOWN] = sMovementActionFuncs_x35, - [MOVEMENT_ACTION_WALK_FASTEST_UP] = sMovementActionFuncs_x36, - [MOVEMENT_ACTION_WALK_FASTEST_LEFT] = sMovementActionFuncs_x37, - [MOVEMENT_ACTION_WALK_FASTEST_RIGHT] = sMovementActionFuncs_x38, - [MOVEMENT_ACTION_SLIDE_DOWN] = sMovementActionFuncs_x39, - [MOVEMENT_ACTION_SLIDE_UP] = sMovementActionFuncs_x3A, - [MOVEMENT_ACTION_SLIDE_LEFT] = sMovementActionFuncs_x3B, - [MOVEMENT_ACTION_SLIDE_RIGHT] = sMovementActionFuncs_x3C, - [MOVEMENT_ACTION_PLAYER_RUN_DOWN] = sMovementActionFuncs_x3D, - [MOVEMENT_ACTION_PLAYER_RUN_UP] = sMovementActionFuncs_x3E, - [MOVEMENT_ACTION_PLAYER_RUN_LEFT] = sMovementActionFuncs_x3F, - [MOVEMENT_ACTION_PLAYER_RUN_RIGHT] = sMovementActionFuncs_x40, - [MOVEMENT_ACTION_PLAYER_RUN_DOWN_SLOW] = sMovementActionFuncs_x41, - [MOVEMENT_ACTION_PLAYER_RUN_UP_SLOW] = sMovementActionFuncs_x42, - [MOVEMENT_ACTION_PLAYER_RUN_LEFT_SLOW] = sMovementActionFuncs_x43, - [MOVEMENT_ACTION_PLAYER_RUN_RIGHT_SLOW] = sMovementActionFuncs_x44, - [MOVEMENT_ACTION_START_ANIM_IN_DIRECTION] = sMovementActionFuncs_x45, - [MOVEMENT_ACTION_JUMP_SPECIAL_DOWN] = sMovementActionFuncs_x46, - [MOVEMENT_ACTION_JUMP_SPECIAL_UP] = sMovementActionFuncs_x47, - [MOVEMENT_ACTION_JUMP_SPECIAL_LEFT] = sMovementActionFuncs_x48, - [MOVEMENT_ACTION_JUMP_SPECIAL_RIGHT] = sMovementActionFuncs_x49, - [MOVEMENT_ACTION_FACE_PLAYER] = sMovementActionFuncs_x4A, - [MOVEMENT_ACTION_FACE_AWAY_PLAYER] = sMovementActionFuncs_x4B, - [MOVEMENT_ACTION_LOCK_FACING_DIRECTION] = sMovementActionFuncs_x4C, - [MOVEMENT_ACTION_UNLOCK_FACING_DIRECTION] = sMovementActionFuncs_x4D, - [MOVEMENT_ACTION_JUMP_DOWN] = sMovementActionFuncs_x4E, - [MOVEMENT_ACTION_JUMP_UP] = sMovementActionFuncs_x4F, - [MOVEMENT_ACTION_JUMP_LEFT] = sMovementActionFuncs_x50, - [MOVEMENT_ACTION_JUMP_RIGHT] = sMovementActionFuncs_x51, - [MOVEMENT_ACTION_JUMP_IN_PLACE_DOWN] = sMovementActionFuncs_x52, - [MOVEMENT_ACTION_JUMP_IN_PLACE_UP] = sMovementActionFuncs_x53, - [MOVEMENT_ACTION_JUMP_IN_PLACE_LEFT] = sMovementActionFuncs_x54, - [MOVEMENT_ACTION_JUMP_IN_PLACE_RIGHT] = sMovementActionFuncs_x55, - [MOVEMENT_ACTION_JUMP_IN_PLACE_DOWN_UP] = sMovementActionFuncs_x56, - [MOVEMENT_ACTION_JUMP_IN_PLACE_UP_DOWN] = sMovementActionFuncs_x57, - [MOVEMENT_ACTION_JUMP_IN_PLACE_LEFT_RIGHT] = sMovementActionFuncs_x58, - [MOVEMENT_ACTION_JUMP_IN_PLACE_RIGHT_LEFT] = sMovementActionFuncs_x59, - [MOVEMENT_ACTION_FACE_ORIGINAL_DIRECTION] = sMovementActionFuncs_x5A, - [MOVEMENT_ACTION_NURSE_JOY_BOW_DOWN] = sMovementActionFuncs_x5B, - [MOVEMENT_ACTION_ENABLE_JUMP_LANDING_GROUND_EFFECT] = sMovementActionFuncs_x5C, - [MOVEMENT_ACTION_DISABLE_JUMP_LANDING_GROUND_EFFECT] = sMovementActionFuncs_x5D, - [MOVEMENT_ACTION_DISABLE_ANIMATION] = sMovementActionFuncs_x5E, - [MOVEMENT_ACTION_RESTORE_ANIMATION] = sMovementActionFuncs_x5F, - [MOVEMENT_ACTION_SET_INVISIBLE] = sMovementActionFuncs_x60, - [MOVEMENT_ACTION_SET_VISIBLE] = sMovementActionFuncs_x61, - [MOVEMENT_ACTION_EMOTE_EXCLAMATION_MARK] = sMovementActionFuncs_x62, - [MOVEMENT_ACTION_EMOTE_QUESTION_MARK] = sMovementActionFuncs_x63, - [MOVEMENT_ACTION_EMOTE_X] = sMovementActionFuncs_x64, - [MOVEMENT_ACTION_EMOTE_DOUBLE_EXCL_MARK] = sMovementActionFuncs_x65, - [MOVEMENT_ACTION_EMOTE_SMILE] = sMovementActionFuncs_x66, - [MOVEMENT_ACTION_REVEAL_TRAINER] = sMovementActionFuncs_x67, - [MOVEMENT_ACTION_ROCK_SMASH_BREAK] = sMovementActionFuncs_x68, - [MOVEMENT_ACTION_CUT_TREE] = sMovementActionFuncs_x69, - [MOVEMENT_ACTION_SET_FIXED_PRIORITY] = sMovementActionFuncs_x6A, - [MOVEMENT_ACTION_CLEAR_FIXED_PRIORITY] = sMovementActionFuncs_x6B, - [MOVEMENT_ACTION_INIT_AFFINE_ANIM] = sMovementActionFuncs_x6C, - [MOVEMENT_ACTION_CLEAR_AFFINE_ANIM] = sMovementActionFuncs_x6D, - [MOVEMENT_ACTION_WALK_DOWN_START_AFFINE] = sMovementActionFuncs_x6E, - [MOVEMENT_ACTION_WALK_DOWN_AFFINE] = sMovementActionFuncs_x6F, - [MOVEMENT_ACTION_ACRO_WHEELIE_FACE_DOWN] = sMovementActionFuncs_x70, - [MOVEMENT_ACTION_ACRO_WHEELIE_FACE_UP] = sMovementActionFuncs_x71, - [MOVEMENT_ACTION_ACRO_WHEELIE_FACE_LEFT] = sMovementActionFuncs_x72, - [MOVEMENT_ACTION_ACRO_WHEELIE_FACE_RIGHT] = sMovementActionFuncs_x73, - [MOVEMENT_ACTION_ACRO_POP_WHEELIE_DOWN] = sMovementActionFuncs_x74, - [MOVEMENT_ACTION_ACRO_POP_WHEELIE_UP] = sMovementActionFuncs_x75, - [MOVEMENT_ACTION_ACRO_POP_WHEELIE_LEFT] = sMovementActionFuncs_x76, - [MOVEMENT_ACTION_ACRO_POP_WHEELIE_RIGHT] = sMovementActionFuncs_x77, - [MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_DOWN] = sMovementActionFuncs_x78, - [MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_UP] = sMovementActionFuncs_x79, - [MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_LEFT] = sMovementActionFuncs_x7A, - [MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_RIGHT] = sMovementActionFuncs_x7B, - [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_DOWN] = sMovementActionFuncs_x7C, - [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_UP] = sMovementActionFuncs_x7D, - [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_LEFT] = sMovementActionFuncs_x7E, - [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_RIGHT] = sMovementActionFuncs_x7F, - [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_DOWN] = sMovementActionFuncs_x80, - [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_UP] = sMovementActionFuncs_x81, - [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_LEFT] = sMovementActionFuncs_x82, - [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_RIGHT] = sMovementActionFuncs_x83, - [MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_DOWN] = sMovementActionFuncs_x84, - [MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_UP] = sMovementActionFuncs_x85, - [MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_LEFT] = sMovementActionFuncs_x86, - [MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_RIGHT] = sMovementActionFuncs_x87, - [MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_DOWN] = sMovementActionFuncs_x88, - [MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_UP] = sMovementActionFuncs_x89, - [MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_LEFT] = sMovementActionFuncs_x8A, - [MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_RIGHT] = sMovementActionFuncs_x8B, - [MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_DOWN] = sMovementActionFuncs_x8C, - [MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_UP] = sMovementActionFuncs_x8D, - [MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_LEFT] = sMovementActionFuncs_x8E, - [MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_RIGHT] = sMovementActionFuncs_x8F, - [MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_DOWN] = sMovementActionFuncs_x90, - [MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_UP] = sMovementActionFuncs_x91, - [MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_LEFT] = sMovementActionFuncs_x92, - [MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_RIGHT] = sMovementActionFuncs_x93, - [MOVEMENT_ACTION_SPIN_DOWN] = sMovementActionFuncs_x94, - [MOVEMENT_ACTION_SPIN_UP] = sMovementActionFuncs_x95, - [MOVEMENT_ACTION_SPIN_LEFT] = sMovementActionFuncs_x96, - [MOVEMENT_ACTION_SPIN_RIGHT] = sMovementActionFuncs_x97, - [MOVEMENT_ACTION_0x98] = sMovementActionFuncs_x98, - [MOVEMENT_ACTION_0x99] = sMovementActionFuncs_x99, - [MOVEMENT_ACTION_0x9A] = sMovementActionFuncs_x9A, - [MOVEMENT_ACTION_WALK_SLOWEST_DOWN] = sMovementActionFuncs_x9B, - [MOVEMENT_ACTION_WALK_SLOWEST_UP] = sMovementActionFuncs_x9C, - [MOVEMENT_ACTION_WALK_SLOWEST_LEFT] = sMovementActionFuncs_x9D, - [MOVEMENT_ACTION_WALK_SLOWEST_RIGHT] = sMovementActionFuncs_x9E, - [MOVEMENT_ACTION_SHAKE_HEAD_OR_WALK_IN_PLACE] = sMovementActionFuncs_x9F, - [MOVEMENT_ACTION_0xA0] = sMovementActionFuncs_xA0, - [MOVEMENT_ACTION_0xA1] = sMovementActionFuncs_xA1, - [MOVEMENT_ACTION_0xA2] = sMovementActionFuncs_xA2, - [MOVEMENT_ACTION_0xA3] = sMovementActionFuncs_xA3, - [MOVEMENT_ACTION_FLY_UP] = sMovementActionFuncs_xA4, - [MOVEMENT_ACTION_FLY_DOWN] = sMovementActionFuncs_xA5, - [MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_DOWN] = sMovementActionFuncs_xA6, - [MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_UP] = sMovementActionFuncs_xA7, - [MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_LEFT] = sMovementActionFuncs_xA8, - [MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_RIGHT] = sMovementActionFuncs_xA9, +static bool8 (*const *const sMovementActionFuncs[])(struct ObjectEvent *, struct Sprite *) = { + [MOVEMENT_ACTION_FACE_DOWN] = sMovementActionFuncs_FaceDown, + [MOVEMENT_ACTION_FACE_UP] = sMovementActionFuncs_FaceUp, + [MOVEMENT_ACTION_FACE_LEFT] = sMovementActionFuncs_FaceLeft, + [MOVEMENT_ACTION_FACE_RIGHT] = sMovementActionFuncs_FaceRight, + [MOVEMENT_ACTION_FACE_DOWN_FAST] = sMovementActionFuncs_FaceDownFast, + [MOVEMENT_ACTION_FACE_UP_FAST] = sMovementActionFuncs_FaceUpFast, + [MOVEMENT_ACTION_FACE_LEFT_FAST] = sMovementActionFuncs_FaceLeftFast, + [MOVEMENT_ACTION_FACE_RIGHT_FAST] = sMovementActionFuncs_FaceRightFast, + [MOVEMENT_ACTION_WALK_SLOWER_DOWN] = sMovementActionFuncs_WalkSlowerDown, + [MOVEMENT_ACTION_WALK_SLOWER_UP] = sMovementActionFuncs_WalkSlowerUp, + [MOVEMENT_ACTION_WALK_SLOWER_LEFT] = sMovementActionFuncs_WalkSlowerLeft, + [MOVEMENT_ACTION_WALK_SLOWER_RIGHT] = sMovementActionFuncs_WalkSlowerRight, + [MOVEMENT_ACTION_WALK_SLOW_DOWN] = sMovementActionFuncs_WalkSlowDown, + [MOVEMENT_ACTION_WALK_SLOW_UP] = sMovementActionFuncs_WalkSlowUp, + [MOVEMENT_ACTION_WALK_SLOW_LEFT] = sMovementActionFuncs_WalkSlowLeft, + [MOVEMENT_ACTION_WALK_SLOW_RIGHT] = sMovementActionFuncs_WalkSlowRight, + [MOVEMENT_ACTION_WALK_NORMAL_DOWN] = sMovementActionFuncs_WalkNormalDown, + [MOVEMENT_ACTION_WALK_NORMAL_UP] = sMovementActionFuncs_WalkNormalUp, + [MOVEMENT_ACTION_WALK_NORMAL_LEFT] = sMovementActionFuncs_WalkNormalLeft, + [MOVEMENT_ACTION_WALK_NORMAL_RIGHT] = sMovementActionFuncs_WalkNormalRight, + [MOVEMENT_ACTION_JUMP_2_DOWN] = sMovementActionFuncs_Jump2Down, + [MOVEMENT_ACTION_JUMP_2_UP] = sMovementActionFuncs_Jump2Up, + [MOVEMENT_ACTION_JUMP_2_LEFT] = sMovementActionFuncs_Jump2Left, + [MOVEMENT_ACTION_JUMP_2_RIGHT] = sMovementActionFuncs_Jump2Right, + [MOVEMENT_ACTION_DELAY_1] = sMovementActionFuncs_Delay1, + [MOVEMENT_ACTION_DELAY_2] = sMovementActionFuncs_Delay2, + [MOVEMENT_ACTION_DELAY_4] = sMovementActionFuncs_Delay4, + [MOVEMENT_ACTION_DELAY_8] = sMovementActionFuncs_Delay8, + [MOVEMENT_ACTION_DELAY_16] = sMovementActionFuncs_Delay16, + [MOVEMENT_ACTION_WALK_FAST_DOWN] = sMovementActionFuncs_WalkFastDown, + [MOVEMENT_ACTION_WALK_FAST_UP] = sMovementActionFuncs_WalkFastUp, + [MOVEMENT_ACTION_WALK_FAST_LEFT] = sMovementActionFuncs_WalkFastLeft, + [MOVEMENT_ACTION_WALK_FAST_RIGHT] = sMovementActionFuncs_WalkFastRight, + [MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_DOWN] = sMovementActionFuncs_WalkInPlaceSlowDown, + [MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_UP] = sMovementActionFuncs_WalkInPlaceSlowUp, + [MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_LEFT] = sMovementActionFuncs_WalkInPlaceSlowLeft, + [MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_RIGHT] = sMovementActionFuncs_WalkInPlaceSlowRight, + [MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_DOWN] = sMovementActionFuncs_WalkInPlaceNormalDown, + [MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_UP] = sMovementActionFuncs_WalkInPlaceNormalUp, + [MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_LEFT] = sMovementActionFuncs_WalkInPlaceNormalLeft, + [MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_RIGHT] = sMovementActionFuncs_WalkInPlaceNormalRight, + [MOVEMENT_ACTION_WALK_IN_PLACE_FAST_DOWN] = sMovementActionFuncs_WalkInPlaceFastDown, + [MOVEMENT_ACTION_WALK_IN_PLACE_FAST_UP] = sMovementActionFuncs_WalkInPlaceFastUp, + [MOVEMENT_ACTION_WALK_IN_PLACE_FAST_LEFT] = sMovementActionFuncs_WalkInPlaceFastLeft, + [MOVEMENT_ACTION_WALK_IN_PLACE_FAST_RIGHT] = sMovementActionFuncs_WalkInPlaceFastRight, + [MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_DOWN] = sMovementActionFuncs_WalkInPlaceFasterDown, + [MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_UP] = sMovementActionFuncs_WalkInPlaceFasterUp, + [MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_LEFT] = sMovementActionFuncs_WalkInPlaceFasterLeft, + [MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_RIGHT] = sMovementActionFuncs_WalkInPlaceFasterRight, + [MOVEMENT_ACTION_RIDE_WATER_CURRENT_DOWN] = sMovementActionFuncs_RideWaterCurrentDown, + [MOVEMENT_ACTION_RIDE_WATER_CURRENT_UP] = sMovementActionFuncs_RideWaterCurrentUp, + [MOVEMENT_ACTION_RIDE_WATER_CURRENT_LEFT] = sMovementActionFuncs_RideWaterCurrentLeft, + [MOVEMENT_ACTION_RIDE_WATER_CURRENT_RIGHT] = sMovementActionFuncs_RideWaterCurrentRight, + [MOVEMENT_ACTION_WALK_FASTER_DOWN] = sMovementActionFuncs_WalkFasterDown, + [MOVEMENT_ACTION_WALK_FASTER_UP] = sMovementActionFuncs_WalkFasterUp, + [MOVEMENT_ACTION_WALK_FASTER_LEFT] = sMovementActionFuncs_WalkFasterLeft, + [MOVEMENT_ACTION_WALK_FASTER_RIGHT] = sMovementActionFuncs_WalkFasterRight, + [MOVEMENT_ACTION_SLIDE_DOWN] = sMovementActionFuncs_SlideDown, + [MOVEMENT_ACTION_SLIDE_UP] = sMovementActionFuncs_SlideUp, + [MOVEMENT_ACTION_SLIDE_LEFT] = sMovementActionFuncs_SlideLeft, + [MOVEMENT_ACTION_SLIDE_RIGHT] = sMovementActionFuncs_SlideRight, + [MOVEMENT_ACTION_PLAYER_RUN_DOWN] = sMovementActionFuncs_PlayerRunDown, + [MOVEMENT_ACTION_PLAYER_RUN_UP] = sMovementActionFuncs_PlayerRunUp, + [MOVEMENT_ACTION_PLAYER_RUN_LEFT] = sMovementActionFuncs_PlayerRunLeft, + [MOVEMENT_ACTION_PLAYER_RUN_RIGHT] = sMovementActionFuncs_PlayerRunRight, + [MOVEMENT_ACTION_PLAYER_RUN_DOWN_SLOW] = sMovementActionFuncs_PlayerRunDownSlow, + [MOVEMENT_ACTION_PLAYER_RUN_UP_SLOW] = sMovementActionFuncs_PlayerRunUpSlow, + [MOVEMENT_ACTION_PLAYER_RUN_LEFT_SLOW] = sMovementActionFuncs_PlayerRunLeftSlow, + [MOVEMENT_ACTION_PLAYER_RUN_RIGHT_SLOW] = sMovementActionFuncs_PlayerRunRightSlow, + [MOVEMENT_ACTION_START_ANIM_IN_DIRECTION] = sMovementActionFuncs_StartAnimInDirection, + [MOVEMENT_ACTION_JUMP_SPECIAL_DOWN] = sMovementActionFuncs_JumpSpecialDown, + [MOVEMENT_ACTION_JUMP_SPECIAL_UP] = sMovementActionFuncs_JumpSpecialUp, + [MOVEMENT_ACTION_JUMP_SPECIAL_LEFT] = sMovementActionFuncs_JumpSpecialLeft, + [MOVEMENT_ACTION_JUMP_SPECIAL_RIGHT] = sMovementActionFuncs_JumpSpecialRight, + [MOVEMENT_ACTION_FACE_PLAYER] = sMovementActionFuncs_FacePlayer, + [MOVEMENT_ACTION_FACE_AWAY_PLAYER] = sMovementActionFuncs_FaceAwayPlayer, + [MOVEMENT_ACTION_LOCK_FACING_DIRECTION] = sMovementActionFuncs_LockFacingDirection, + [MOVEMENT_ACTION_UNLOCK_FACING_DIRECTION] = sMovementActionFuncs_UnlockFacingDirection, + [MOVEMENT_ACTION_JUMP_DOWN] = sMovementActionFuncs_JumpDown, + [MOVEMENT_ACTION_JUMP_UP] = sMovementActionFuncs_JumpUp, + [MOVEMENT_ACTION_JUMP_LEFT] = sMovementActionFuncs_JumpLeft, + [MOVEMENT_ACTION_JUMP_RIGHT] = sMovementActionFuncs_JumpRight, + [MOVEMENT_ACTION_JUMP_IN_PLACE_DOWN] = sMovementActionFuncs_JumpInPlaceDown, + [MOVEMENT_ACTION_JUMP_IN_PLACE_UP] = sMovementActionFuncs_JumpInPlaceUp, + [MOVEMENT_ACTION_JUMP_IN_PLACE_LEFT] = sMovementActionFuncs_JumpInPlaceLeft, + [MOVEMENT_ACTION_JUMP_IN_PLACE_RIGHT] = sMovementActionFuncs_JumpInPlaceRight, + [MOVEMENT_ACTION_JUMP_IN_PLACE_DOWN_UP] = sMovementActionFuncs_JumpInPlaceDownUp, + [MOVEMENT_ACTION_JUMP_IN_PLACE_UP_DOWN] = sMovementActionFuncs_JumpInPlaceUpDown, + [MOVEMENT_ACTION_JUMP_IN_PLACE_LEFT_RIGHT] = sMovementActionFuncs_JumpInPlaceLeftRight, + [MOVEMENT_ACTION_JUMP_IN_PLACE_RIGHT_LEFT] = sMovementActionFuncs_JumpInPlaceRightLeft, + [MOVEMENT_ACTION_FACE_ORIGINAL_DIRECTION] = sMovementActionFuncs_FaceOriginalDirection, + [MOVEMENT_ACTION_NURSE_JOY_BOW_DOWN] = sMovementActionFuncs_NurseJoyBowDown, + [MOVEMENT_ACTION_ENABLE_JUMP_LANDING_GROUND_EFFECT] = sMovementActionFuncs_EnableJumpLandingGroundEffect, + [MOVEMENT_ACTION_DISABLE_JUMP_LANDING_GROUND_EFFECT] = sMovementActionFuncs_DisableJumpLandingGroundEffect, + [MOVEMENT_ACTION_DISABLE_ANIMATION] = sMovementActionFuncs_DisableAnimation, + [MOVEMENT_ACTION_RESTORE_ANIMATION] = sMovementActionFuncs_RestoreAnimation, + [MOVEMENT_ACTION_SET_INVISIBLE] = sMovementActionFuncs_SetInvisible, + [MOVEMENT_ACTION_SET_VISIBLE] = sMovementActionFuncs_SetVisible, + [MOVEMENT_ACTION_EMOTE_EXCLAMATION_MARK] = sMovementActionFuncs_EmoteExclamationMark, + [MOVEMENT_ACTION_EMOTE_QUESTION_MARK] = sMovementActionFuncs_EmoteQuestionMark, + [MOVEMENT_ACTION_EMOTE_X] = sMovementActionFuncs_EmoteX, + [MOVEMENT_ACTION_EMOTE_DOUBLE_EXCL_MARK] = sMovementActionFuncs_EmoteDoubleExclMark, + [MOVEMENT_ACTION_EMOTE_SMILE] = sMovementActionFuncs_EmoteSmile, + [MOVEMENT_ACTION_REVEAL_TRAINER] = sMovementActionFuncs_RevealTrainer, + [MOVEMENT_ACTION_ROCK_SMASH_BREAK] = sMovementActionFuncs_RockSmashBreak, + [MOVEMENT_ACTION_CUT_TREE] = sMovementActionFuncs_CutTree, + [MOVEMENT_ACTION_SET_FIXED_PRIORITY] = sMovementActionFuncs_SetFixedPriority, + [MOVEMENT_ACTION_CLEAR_FIXED_PRIORITY] = sMovementActionFuncs_ClearFixedPriority, + [MOVEMENT_ACTION_INIT_AFFINE_ANIM] = sMovementActionFuncs_InitAffineAnim, + [MOVEMENT_ACTION_CLEAR_AFFINE_ANIM] = sMovementActionFuncs_ClearAffineAnim, + [MOVEMENT_ACTION_WALK_DOWN_START_AFFINE] = sMovementActionFuncs_WalkDownStartAffine, + [MOVEMENT_ACTION_WALK_DOWN_AFFINE] = sMovementActionFuncs_WalkDownAffine, + [MOVEMENT_ACTION_ACRO_WHEELIE_FACE_DOWN] = sMovementActionFuncs_AcroWheelieFaceDown, + [MOVEMENT_ACTION_ACRO_WHEELIE_FACE_UP] = sMovementActionFuncs_AcroWheelieFaceUp, + [MOVEMENT_ACTION_ACRO_WHEELIE_FACE_LEFT] = sMovementActionFuncs_AcroWheelieFaceLeft, + [MOVEMENT_ACTION_ACRO_WHEELIE_FACE_RIGHT] = sMovementActionFuncs_AcroWheelieFaceRight, + [MOVEMENT_ACTION_ACRO_POP_WHEELIE_DOWN] = sMovementActionFuncs_AcroPopWheelieDown, + [MOVEMENT_ACTION_ACRO_POP_WHEELIE_UP] = sMovementActionFuncs_AcroPopWheelieUp, + [MOVEMENT_ACTION_ACRO_POP_WHEELIE_LEFT] = sMovementActionFuncs_AcroPopWheelieLeft, + [MOVEMENT_ACTION_ACRO_POP_WHEELIE_RIGHT] = sMovementActionFuncs_AcroPopWheelieRight, + [MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_DOWN] = sMovementActionFuncs_AcroEndWheelieFaceDown, + [MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_UP] = sMovementActionFuncs_AcroEndWheelieFaceUp, + [MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_LEFT] = sMovementActionFuncs_AcroEndWheelieFaceLeft, + [MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_RIGHT] = sMovementActionFuncs_AcroEndWheelieFaceRight, + [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_DOWN] = sMovementActionFuncs_AcroWheelieHopFaceDown, + [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_UP] = sMovementActionFuncs_AcroWheelieHopFaceUp, + [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_LEFT] = sMovementActionFuncs_AcroWheelieHopFaceLeft, + [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_FACE_RIGHT] = sMovementActionFuncs_AcroWheelieHopFaceRight, + [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_DOWN] = sMovementActionFuncs_AcroWheelieHopDown, + [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_UP] = sMovementActionFuncs_AcroWheelieHopUp, + [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_LEFT] = sMovementActionFuncs_AcroWheelieHopLeft, + [MOVEMENT_ACTION_ACRO_WHEELIE_HOP_RIGHT] = sMovementActionFuncs_AcroWheelieHopRight, + [MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_DOWN] = sMovementActionFuncs_AcroWheelieJumpDown, + [MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_UP] = sMovementActionFuncs_AcroWheelieJumpUp, + [MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_LEFT] = sMovementActionFuncs_AcroWheelieJumpLeft, + [MOVEMENT_ACTION_ACRO_WHEELIE_JUMP_RIGHT] = sMovementActionFuncs_AcroWheelieJumpRight, + [MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_DOWN] = sMovementActionFuncs_AcroWheelieInPlaceDown, + [MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_UP] = sMovementActionFuncs_AcroWheelieInPlaceUp, + [MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_LEFT] = sMovementActionFuncs_AcroWheelieInPlaceLeft, + [MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_RIGHT] = sMovementActionFuncs_AcroWheelieInPlaceRight, + [MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_DOWN] = sMovementActionFuncs_AcroPopWheelieMoveDown, + [MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_UP] = sMovementActionFuncs_AcroPopWheelieMoveUp, + [MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_LEFT] = sMovementActionFuncs_AcroPopWheelieMoveLeft, + [MOVEMENT_ACTION_ACRO_POP_WHEELIE_MOVE_RIGHT] = sMovementActionFuncs_AcroPopWheelieMoveRight, + [MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_DOWN] = sMovementActionFuncs_AcroWheelieMoveDown, + [MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_UP] = sMovementActionFuncs_AcroWheelieMoveUp, + [MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_LEFT] = sMovementActionFuncs_AcroWheelieMoveLeft, + [MOVEMENT_ACTION_ACRO_WHEELIE_MOVE_RIGHT] = sMovementActionFuncs_AcroWheelieMoveRight, + [MOVEMENT_ACTION_SPIN_DOWN] = sMovementActionFuncs_SpinDown, + [MOVEMENT_ACTION_SPIN_UP] = sMovementActionFuncs_SpinUp, + [MOVEMENT_ACTION_SPIN_LEFT] = sMovementActionFuncs_SpinLeft, + [MOVEMENT_ACTION_SPIN_RIGHT] = sMovementActionFuncs_SpinRight, + [MOVEMENT_ACTION_RAISE_HAND_AND_STOP] = sMovementActionFuncs_RaiseHandAndStop, + [MOVEMENT_ACTION_RAISE_HAND_AND_JUMP] = sMovementActionFuncs_RaiseHandAndJump, + [MOVEMENT_ACTION_RAISE_HAND_AND_SWIM] = sMovementActionFuncs_RaiseHandAndSwim, + [MOVEMENT_ACTION_WALK_SLOWEST_DOWN] = sMovementActionFuncs_WalkSlowestDown, + [MOVEMENT_ACTION_WALK_SLOWEST_UP] = sMovementActionFuncs_WalkSlowestUp, + [MOVEMENT_ACTION_WALK_SLOWEST_LEFT] = sMovementActionFuncs_WalkSlowestLeft, + [MOVEMENT_ACTION_WALK_SLOWEST_RIGHT] = sMovementActionFuncs_WalkSlowestRight, + [MOVEMENT_ACTION_SHAKE_HEAD_OR_WALK_IN_PLACE] = sMovementActionFuncs_ShakeHeadOrWalkInPlace, + [MOVEMENT_ACTION_GLIDE_DOWN] = sMovementActionFuncs_GlideDown, + [MOVEMENT_ACTION_GLIDE_UP] = sMovementActionFuncs_GlideUp, + [MOVEMENT_ACTION_GLIDE_LEFT] = sMovementActionFuncs_GlideLeft, + [MOVEMENT_ACTION_GLIDE_RIGHT] = sMovementActionFuncs_GlideRight, + [MOVEMENT_ACTION_FLY_UP] = sMovementActionFuncs_FlyUp, + [MOVEMENT_ACTION_FLY_DOWN] = sMovementActionFuncs_FlyDown, + [MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_DOWN] = sMovementActionFuncs_JumpSpecialWithEffectDown, + [MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_UP] = sMovementActionFuncs_JumpSpecialWithEffectUp, + [MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_LEFT] = sMovementActionFuncs_JumpSpecialWithEffectLeft, + [MOVEMENT_ACTION_JUMP_SPECIAL_WITH_EFFECT_RIGHT] = sMovementActionFuncs_JumpSpecialWithEffectRight, }; -static bool8 (*const sMovementActionFuncs_x00[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_FaceDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_FaceDown_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x01[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_FaceUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_FaceUp_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x02[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_FaceLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_FaceLeft_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x03[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_FaceRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_FaceRight_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const gUnknown_83A6884[])(u8) = { - GetMoveDirectionAnimNum, - GetMoveDirectionFastAnimNum, - GetMoveDirectionFastAnimNum, - GetMoveDirectionFasterAnimNum, - GetMoveDirectionFastestAnimNum, +static bool8 (*const sDirectionAnimFuncsBySpeed[])(u8) = { + [MOVE_SPEED_NORMAL] = GetMoveDirectionAnimNum, + [MOVE_SPEED_FAST_1] = GetMoveDirectionFastAnimNum, + [MOVE_SPEED_FAST_2] = GetMoveDirectionFastAnimNum, + [MOVE_SPEED_FASTER] = GetMoveDirectionFasterAnimNum, + [MOVE_SPEED_FASTEST] = GetMoveDirectionFastestAnimNum, }; -static bool8 (*const sMovementActionFuncs_x9B[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x9B_0, - MovementActionFunc_x9B_1, +static bool8 (*const sMovementActionFuncs_WalkSlowestDown[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkSlowestDown_Step0, + MovementAction_WalkSlowestDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x9C[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x9C_0, - MovementActionFunc_x9C_1, +static bool8 (*const sMovementActionFuncs_WalkSlowestUp[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkSlowestUp_Step0, + MovementAction_WalkSlowestUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x9D[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x9D_0, - MovementActionFunc_x9D_1, +static bool8 (*const sMovementActionFuncs_WalkSlowestLeft[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkSlowestLeft_Step0, + MovementAction_WalkSlowestLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x9E[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x9E_0, - MovementActionFunc_x9E_1, +static bool8 (*const sMovementActionFuncs_WalkSlowestRight[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkSlowestRight_Step0, + MovementAction_WalkSlowestRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x08[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x08_0, - MovementActionFunc_x08_1, +static bool8 (*const sMovementActionFuncs_WalkSlowerDown[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkSlowerDown_Step0, + MovementAction_WalkSlowerDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x09[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x09_0, - MovementActionFunc_x09_1, +static bool8 (*const sMovementActionFuncs_WalkSlowerUp[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkSlowerUp_Step0, + MovementAction_WalkSlowerUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x0A[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x0A_0, - MovementActionFunc_x0A_1, +static bool8 (*const sMovementActionFuncs_WalkSlowerLeft[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkSlowerLeft_Step0, + MovementAction_WalkSlowerLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x0B[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x0B_0, - MovementActionFunc_x0B_1, +static bool8 (*const sMovementActionFuncs_WalkSlowerRight[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkSlowerRight_Step0, + MovementAction_WalkSlowerRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x0D[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x0D_0, - MovementActionFunc_x0D_1, +static bool8 (*const sMovementActionFuncs_WalkSlowUp[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkSlowUp_Step0, + MovementAction_WalkSlowUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x0C[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x0C_0, - MovementActionFunc_x0C_1, +static bool8 (*const sMovementActionFuncs_WalkSlowDown[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkSlowDown_Step0, + MovementAction_WalkSlowDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x0E[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x0E_0, - MovementActionFunc_x0E_1, +static bool8 (*const sMovementActionFuncs_WalkSlowLeft[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkSlowLeft_Step0, + MovementAction_WalkSlowLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x0F[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x0F_0, - MovementActionFunc_x0F_1, +static bool8 (*const sMovementActionFuncs_WalkSlowRight[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkSlowRight_Step0, + MovementAction_WalkSlowRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x10[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkNormalDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkNormalDown_Step0, MovementAction_WalkNormalDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x11[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkNormalUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkNormalUp_Step0, MovementAction_WalkNormalUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x12[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkNormalLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkNormalLeft_Step0, MovementAction_WalkNormalLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x13[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkNormalRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkNormalRight_Step0, MovementAction_WalkNormalRight_Step1, MovementAction_PauseSpriteAnim, }; -const s16 gUnknown_83A6958[] = {0, 1, 1}; -const s16 gUnknown_83A695E[] = {0, 0, 1}; +static const s16 sJumpInitDisplacements[] = { + [JUMP_DISTANCE_IN_PLACE] = 0, + [JUMP_DISTANCE_NORMAL] = 1, + [JUMP_DISTANCE_FAR] = 1, +}; -static bool8 (*const sMovementActionFuncs_x14[])(struct ObjectEvent *, struct Sprite *) = { +static const s16 sJumpDisplacements[] = { + [JUMP_DISTANCE_IN_PLACE] = 0, + [JUMP_DISTANCE_NORMAL] = 0, + [JUMP_DISTANCE_FAR] = 1, +}; + +static bool8 (*const sMovementActionFuncs_Jump2Down[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_Jump2Down_Step0, MovementAction_Jump2Down_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x15[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_Jump2Up[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_Jump2Up_Step0, MovementAction_Jump2Up_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x16[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_Jump2Left[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_Jump2Left_Step0, MovementAction_Jump2Left_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x17[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_Jump2Right[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_Jump2Right_Step0, MovementAction_Jump2Right_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x18[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_Delay1[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_Delay1_Step0, MovementAction_Delay_Step1, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x19[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_Delay2[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_Delay2_Step0, MovementAction_Delay_Step1, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x1A[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_Delay4[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_Delay4_Step0, MovementAction_Delay_Step1, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x1B[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_Delay8[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_Delay8_Step0, MovementAction_Delay_Step1, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x1C[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_Delay16[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_Delay16_Step0, MovementAction_Delay_Step1, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x1D[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkFastDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkFastDown_Step0, MovementAction_WalkFastDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x1E[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkFastUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkFastUp_Step0, MovementAction_WalkFastUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x1F[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkFastLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkFastLeft_Step0, MovementAction_WalkFastLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x20[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkFastRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkFastRight_Step0, MovementAction_WalkFastRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_xA0[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_xA0_0, - MovementActionFunc_xA0_1, +static bool8 (*const sMovementActionFuncs_GlideDown[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_GlideDown_Step0, + MovementAction_GlideDown_Step1, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_xA1[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_xA1_0, - MovementActionFunc_xA1_1, +static bool8 (*const sMovementActionFuncs_GlideUp[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_GlideUp_Step0, + MovementAction_GlideUp_Step1, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_xA2[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_xA2_0, - MovementActionFunc_xA2_1, +static bool8 (*const sMovementActionFuncs_GlideLeft[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_GlideLeft_Step0, + MovementAction_GlideLeft_Step1, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_xA3[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_xA3_0, - MovementActionFunc_xA3_1, +static bool8 (*const sMovementActionFuncs_GlideRight[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_GlideRight_Step0, + MovementAction_GlideRight_Step1, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x04[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x04_0, +static bool8 (*const sMovementActionFuncs_FaceDownFast[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_FaceDownFast_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x05[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x05_0, +static bool8 (*const sMovementActionFuncs_FaceUpFast[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_FaceUpFast_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x06[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x06_0, +static bool8 (*const sMovementActionFuncs_FaceLeftFast[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_FaceLeftFast_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x07[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x07_0, +static bool8 (*const sMovementActionFuncs_FaceRightFast[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_FaceRightFast_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x21[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkInPlaceSlowDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkInPlaceSlowDown_Step0, MovementAction_WalkInPlaceSlow_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x22[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkInPlaceSlowUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkInPlaceSlowUp_Step0, MovementAction_WalkInPlaceSlow_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x23[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkInPlaceSlowLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkInPlaceSlowLeft_Step0, MovementAction_WalkInPlaceSlow_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x24[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkInPlaceSlowRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkInPlaceSlowRight_Step0, MovementAction_WalkInPlaceSlow_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x25[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkInPlaceNormalDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkInPlaceNormalDown_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x26[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkInPlaceNormalUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkInPlaceNormalUp_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x27[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkInPlaceNormalLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkInPlaceNormalLeft_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x28[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkInPlaceNormalRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkInPlaceNormalRight_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x29[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkInPlaceFastDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkInPlaceFastDown_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x2A[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkInPlaceFastUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkInPlaceFastUp_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x2B[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkInPlaceFastLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkInPlaceFastLeft_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x2C[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkInPlaceFastRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkInPlaceFastRight_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x2D[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_WalkInPlaceFastestDown_Step0, +static bool8 (*const sMovementActionFuncs_WalkInPlaceFasterDown[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkInPlaceFasterDown_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x2E[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_WalkInPlaceFastestUp_Step0, +static bool8 (*const sMovementActionFuncs_WalkInPlaceFasterUp[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkInPlaceFasterUp_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x2F[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_WalkInPlaceFastestLeft_Step0, +static bool8 (*const sMovementActionFuncs_WalkInPlaceFasterLeft[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkInPlaceFasterLeft_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x30[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_WalkInPlaceFastestRight_Step0, +static bool8 (*const sMovementActionFuncs_WalkInPlaceFasterRight[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkInPlaceFasterRight_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x31[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_RideWaterCurrentDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_RideWaterCurrentDown_Step0, MovementAction_RideWaterCurrentDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x32[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_RideWaterCurrentUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_RideWaterCurrentUp_Step0, MovementAction_RideWaterCurrentUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x33[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_RideWaterCurrentLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_RideWaterCurrentLeft_Step0, MovementAction_RideWaterCurrentLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x34[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_RideWaterCurrentRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_RideWaterCurrentRight_Step0, MovementAction_RideWaterCurrentRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x35[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_WalkFastestDown_Step0, - MovementAction_WalkFastestDown_Step1, +static bool8 (*const sMovementActionFuncs_WalkFasterDown[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkFasterDown_Step0, + MovementAction_WalkFasterDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x36[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_WalkFastestUp_Step0, - MovementAction_WalkFastestUp_Step1, +static bool8 (*const sMovementActionFuncs_WalkFasterUp[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkFasterUp_Step0, + MovementAction_WalkFasterUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x37[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_WalkFastestLeft_Step0, - MovementAction_WalkFastestLeft_Step1, +static bool8 (*const sMovementActionFuncs_WalkFasterLeft[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkFasterLeft_Step0, + MovementAction_WalkFasterLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x38[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_WalkFastestRight_Step0, - MovementAction_WalkFastestRight_Step1, +static bool8 (*const sMovementActionFuncs_WalkFasterRight[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkFasterRight_Step0, + MovementAction_WalkFasterRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x39[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_SlideDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_SlideDown_Step0, MovementAction_SlideDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x3A[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_SlideUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_SlideUp_Step0, MovementAction_SlideUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x3B[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_SlideLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_SlideLeft_Step0, MovementAction_SlideLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x3C[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_SlideRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_SlideRight_Step0, MovementAction_SlideRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x3D[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_PlayerRunDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_PlayerRunDown_Step0, MovementAction_PlayerRunDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x3E[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_PlayerRunUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_PlayerRunUp_Step0, MovementAction_PlayerRunUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x3F[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_PlayerRunLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_PlayerRunLeft_Step0, MovementAction_PlayerRunLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x40[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_PlayerRunRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_PlayerRunRight_Step0, MovementAction_PlayerRunRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x41[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x41_0, - MovementActionFunc_x41_1, +static bool8 (*const sMovementActionFuncs_PlayerRunDownSlow[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_RunDownSlow_Step0, + MovementAction_RunDownSlow_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x42[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x42_0, - MovementActionFunc_x42_1, +static bool8 (*const sMovementActionFuncs_PlayerRunUpSlow[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_RunUpSlow_Step0, + MovementAction_RunUpSlow_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x43[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x43_0, - MovementActionFunc_x43_1, +static bool8 (*const sMovementActionFuncs_PlayerRunLeftSlow[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_RunLeftSlow_Step0, + MovementAction_RunLeftSlow_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x44[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x44_0, - MovementActionFunc_x44_1, +static bool8 (*const sMovementActionFuncs_PlayerRunRightSlow[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_RunRightSlow_Step0, + MovementAction_RunRightSlow_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x45[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_StartAnimInDirection[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_StartAnimInDirection_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x46[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpSpecialDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpSpecialDown_Step0, MovementAction_JumpSpecialDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x47[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpSpecialUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpSpecialUp_Step0, MovementAction_JumpSpecialUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x48[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpSpecialLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpSpecialLeft_Step0, MovementAction_JumpSpecialLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x49[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpSpecialRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpSpecialRight_Step0, MovementAction_JumpSpecialRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_xA6[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_xA6_0, - MovementActionFunc_xA6_1, +static bool8 (*const sMovementActionFuncs_JumpSpecialWithEffectDown[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_JumpSpecialWithEffectDown_Step0, + MovementAction_JumpSpecialWithEffectDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_xA7[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_xA7_0, - MovementActionFunc_xA7_1, +static bool8 (*const sMovementActionFuncs_JumpSpecialWithEffectUp[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_JumpSpecialWithEffectUp_Step0, + MovementAction_JumpSpecialWithEffectUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_xA8[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_xA8_0, - MovementActionFunc_xA8_1, +static bool8 (*const sMovementActionFuncs_JumpSpecialWithEffectLeft[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_JumpSpecialWithEffectLeft_Step0, + MovementAction_JumpSpecialWithEffectLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_xA9[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_xA9_0, - MovementActionFunc_xA9_1, +static bool8 (*const sMovementActionFuncs_JumpSpecialWithEffectRight[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_JumpSpecialWithEffectRight_Step0, + MovementAction_JumpSpecialWithEffectRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x4A[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_FacePlayer[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_FacePlayer_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x4B[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_FaceAwayPlayer[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_FaceAwayPlayer_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x4C[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_LockFacingDirection[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_LockFacingDirection_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x4D[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_UnlockFacingDirection[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_UnlockFacingDirection_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x4E[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpDown_Step0, MovementAction_JumpDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x4F[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpUp_Step0, MovementAction_JumpUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x50[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpLeft_Step0, MovementAction_JumpLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x51[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpRight_Step0, MovementAction_JumpRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x52[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpInPlaceDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpInPlaceDown_Step0, MovementAction_JumpInPlaceDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x53[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpInPlaceUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpInPlaceUp_Step0, MovementAction_JumpInPlaceUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x54[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpInPlaceLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpInPlaceLeft_Step0, MovementAction_JumpInPlaceLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x55[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpInPlaceRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpInPlaceRight_Step0, MovementAction_JumpInPlaceRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x56[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpInPlaceDownUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpInPlaceDownUp_Step0, MovementAction_JumpInPlaceDownUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x57[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpInPlaceUpDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpInPlaceUpDown_Step0, MovementAction_JumpInPlaceUpDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x58[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpInPlaceLeftRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpInPlaceLeftRight_Step0, MovementAction_JumpInPlaceLeftRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x59[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_JumpInPlaceRightLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_JumpInPlaceRightLeft_Step0, MovementAction_JumpInPlaceRightLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x5A[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_FaceOriginalDirection[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_FaceOriginalDirection_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x5B[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_NurseJoyBowDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_NurseJoyBowDown_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x5C[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_EnableJumpLandingGroundEffect[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_EnableJumpLandingGroundEffect_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x5D[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_DisableJumpLandingGroundEffect[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_DisableJumpLandingGroundEffect_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x5E[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_DisableAnimation[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_DisableAnimation_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x5F[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_RestoreAnimation[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_RestoreAnimation_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x60[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_SetInvisible[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_SetInvisible_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x61[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_SetVisible[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_SetVisible_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x62[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_EmoteExclamationMark[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_EmoteExclamationMark_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x63[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_EmoteQuestionMark[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_EmoteQuestionMark_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x64[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_EmoteHeart_Step0, +static bool8 (*const sMovementActionFuncs_EmoteX[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_EmoteX_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x65[])(struct ObjectEvent *, struct Sprite *) = { - do_double_excl_bubble, +static bool8 (*const sMovementActionFuncs_EmoteDoubleExclMark[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_EmoteDoubleExclamationMark_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x66[])(struct ObjectEvent *, struct Sprite *) = { - do_smile_bubble, +static bool8 (*const sMovementActionFuncs_EmoteSmile[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_EmoteSmile_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x67[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_RevealTrainer[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_RevealTrainer_Step0, MovementAction_RevealTrainer_Step1, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x68[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_RockSmashBreak[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_RockSmashBreak_Step0, MovementAction_RockSmashBreak_Step1, MovementAction_RockSmashBreak_Step2, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x69[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_CutTree[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_CutTree_Step0, MovementAction_CutTree_Step1, MovementAction_CutTree_Step2, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x6A[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_SetFixedPriority[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_SetFixedPriority_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x6B[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_ClearFixedPriority[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_ClearFixedPriority_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x6C[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_InitAffineAnim[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_InitAffineAnim_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x6D[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_ClearAffineAnim[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_ClearAffineAnim_Step0, MovementAction_Finish, }; -static bool8 (*const sMovementActionFuncs_x6E[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkDownStartAffine[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkDownStartAffine_Step0, MovementAction_WalkDownStartAffine_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x6F[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_WalkDownAffine[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_WalkDownAffine_Step0, MovementAction_WalkDownAffine_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x70[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x70_0, +static bool8 (*const sMovementActionFuncs_AcroWheelieFaceDown[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_AcroWheelieFaceDown_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x71[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x71_0, +static bool8 (*const sMovementActionFuncs_AcroWheelieFaceUp[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_AcroWheelieFaceUp_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x72[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x72_0, +static bool8 (*const sMovementActionFuncs_AcroWheelieFaceLeft[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_AcroWheelieFaceLeft_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x73[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x73_0, +static bool8 (*const sMovementActionFuncs_AcroWheelieFaceRight[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_AcroWheelieFaceRight_Step0, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x74[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroPopWheelieDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroPopWheelieDown_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x75[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroPopWheelieUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroPopWheelieUp_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x76[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroPopWheelieLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroPopWheelieLeft_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x77[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroPopWheelieRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroPopWheelieRight_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x78[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroEndWheelieFaceDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroEndWheelieFaceDown_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x79[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroEndWheelieFaceUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroEndWheelieFaceUp_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x7A[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroEndWheelieFaceLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroEndWheelieFaceLeft_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x7B[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroEndWheelieFaceRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroEndWheelieFaceRight_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, +}; + +static bool8 (*const MovementActionFuncs_UnusedAcroActionDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_UnusedAcroActionDown_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, +}; + +static bool8 (*const MovementActionFuncs_UnusedAcroActionUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_UnusedAcroActionUp_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, +}; + +static bool8 (*const MovementActionFuncs_UnusedAcroActionLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_UnusedAcroActionLeft_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, +}; + +static bool8 (*const MovementActionFuncs_UnusedAcroActionRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_UnusedAcroActionRight_Step0, MovementAction_WaitSpriteAnim, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x7C[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieHopFaceDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieHopFaceDown_Step0, MovementAction_AcroWheelieHopFaceDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x7D[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieHopFaceUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieHopFaceUp_Step0, MovementAction_AcroWheelieHopFaceUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x7E[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieHopFaceLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieHopFaceLeft_Step0, MovementAction_AcroWheelieHopFaceLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x7F[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieHopFaceRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieHopFaceRight_Step0, MovementAction_AcroWheelieHopFaceRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x80[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieHopDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieHopDown_Step0, MovementAction_AcroWheelieHopDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x81[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieHopUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieHopUp_Step0, MovementAction_AcroWheelieHopUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x82[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieHopLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieHopLeft_Step0, MovementAction_AcroWheelieHopLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x83[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieHopRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieHopRight_Step0, MovementAction_AcroWheelieHopRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x84[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieJumpDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieJumpDown_Step0, MovementAction_AcroWheelieJumpDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x85[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieJumpUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieJumpUp_Step0, MovementAction_AcroWheelieJumpUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x86[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieJumpLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieJumpLeft_Step0, MovementAction_AcroWheelieJumpLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x87[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieJumpRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieJumpRight_Step0, MovementAction_AcroWheelieJumpRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x88[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x88_0, +static bool8 (*const sMovementActionFuncs_AcroWheelieInPlaceDown[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_AcroWheelieInPlaceDown_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x89[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x89_0, +static bool8 (*const sMovementActionFuncs_AcroWheelieInPlaceUp[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_AcroWheelieInPlaceUp_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x8A[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x8A_0, +static bool8 (*const sMovementActionFuncs_AcroWheelieInPlaceLeft[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_AcroWheelieInPlaceLeft_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x8B[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x8B_0, +static bool8 (*const sMovementActionFuncs_AcroWheelieInPlaceRight[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_AcroWheelieInPlaceRight_Step0, MovementAction_WalkInPlace_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x8C[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroPopWheelieMoveDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroPopWheelieMoveDown_Step0, MovementAction_AcroPopWheelieMoveDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x8D[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroPopWheelieMoveUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroPopWheelieMoveUp_Step0, MovementAction_AcroPopWheelieMoveUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x8E[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroPopWheelieMoveLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroPopWheelieMoveLeft_Step0, MovementAction_AcroPopWheelieMoveLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x8F[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroPopWheelieMoveRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroPopWheelieMoveRight_Step0, MovementAction_AcroPopWheelieMoveRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x90[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieMoveDown[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieMoveDown_Step0, MovementAction_AcroWheelieMoveDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x91[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieMoveUp[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieMoveUp_Step0, MovementAction_AcroWheelieMoveUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x92[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieMoveLeft[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieMoveLeft_Step0, MovementAction_AcroWheelieMoveLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x93[])(struct ObjectEvent *, struct Sprite *) = { +static bool8 (*const sMovementActionFuncs_AcroWheelieMoveRight[])(struct ObjectEvent *, struct Sprite *) = { MovementAction_AcroWheelieMoveRight_Step0, MovementAction_AcroWheelieMoveRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x94[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x94_0, - MovementActionFunc_x94_1, +static bool8 (*const sMovementActionFuncs_SpinDown[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_SpinDown_Step0, + MovementAction_SpinDown_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x95[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x95_0, - MovementActionFunc_x95_1, +static bool8 (*const sMovementActionFuncs_SpinUp[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_SpinUp_Step0, + MovementAction_SpinUp_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x96[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x96_0, - MovementActionFunc_x96_1, +static bool8 (*const sMovementActionFuncs_SpinLeft[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_SpinLeft_Step0, + MovementAction_SpinLeft_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x97[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x97_0, - MovementActionFunc_x97_1, +static bool8 (*const sMovementActionFuncs_SpinRight[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_SpinRight_Step0, + MovementAction_SpinRight_Step1, MovementAction_PauseSpriteAnim, }; -static bool8 (*const sMovementActionFuncs_x98[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x98_0, - MovementActionFunc_x98_1, +static bool8 (*const sMovementActionFuncs_RaiseHandAndStop[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_RaiseHand_Step0, + MovementAction_RaiseHandAndStop_Step1, }; -static bool8 (*const sMovementActionFuncs_x99[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x98_0, - MovementActionFunc_x99_1, +static bool8 (*const sMovementActionFuncs_RaiseHandAndJump[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_RaiseHand_Step0, + MovementAction_RaiseHandAndJump_Step1, }; -static bool8 (*const sMovementActionFuncs_x9A[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x98_0, - MovementActionFunc_x9A_1, +static bool8 (*const sMovementActionFuncs_RaiseHandAndSwim[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_RaiseHand_Step0, + MovementAction_RaiseHandAndSwim_Step1, }; -static bool8 (*const sMovementActionFuncs_x9F[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_x9F_0, - MovementActionFunc_x9F_1, +static bool8 (*const sMovementActionFuncs_ShakeHeadOrWalkInPlace[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_ShakeHeadOrWalkInPlace_Step0, + MovementAction_ShakeHeadOrWalkInPlace_Step1, }; -static bool8 (*const sMovementActionFuncs_xA4[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_xA4_0, - MovementActionFunc_xA4_1, - MovementActionFunc_xA4_2, +static bool8 (*const sMovementActionFuncs_FlyUp[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_FlyUp_Step0, + MovementAction_FlyUp_Step1, + MovementAction_FlyUp_Step2, }; -static bool8 (*const sMovementActionFuncs_xA5[])(struct ObjectEvent *, struct Sprite *) = { - MovementActionFunc_xA5_0, - MovementActionFunc_xA5_1, - MovementActionFunc_xA4_2, +static bool8 (*const sMovementActionFuncs_FlyDown[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_FlyDown_Step0, + MovementAction_FlyDown_Step1, + MovementAction_FlyUp_Step2, }; diff --git a/src/data/object_events/movement_type_func_tables.h b/src/data/object_events/movement_type_func_tables.h index 627d1bc51..4799a7edd 100644 --- a/src/data/object_events/movement_type_func_tables.h +++ b/src/data/object_events/movement_type_func_tables.h @@ -141,12 +141,12 @@ static bool8 MovementType_MoveInPlace_Step1(struct ObjectEvent *objectEvent, str static bool8 MovementType_Invisible_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); static bool8 MovementType_Invisible_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); static bool8 MovementType_Invisible_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); -static bool8 MovementType_VsSeeker4D_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); -static bool8 MovementType_VsSeeker4D_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); -static bool8 MovementType_VsSeeker4D_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); -static bool8 MovementType_VsSeeker4E_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); -static bool8 MovementType_VsSeeker4F_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); -static bool8 MovementType_VsSeeker4E_VsSeeker4F_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +static bool8 MovementType_RaiseHandAndStop_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +static bool8 MovementType_RaiseHandAndStop_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); +static bool8 MovementType_RaiseHandAndStop_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite); +static bool8 MovementType_RaiseHandAndJump_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +static bool8 MovementType_RaiseHandAndSwim_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite); +static bool8 MovementType_RaiseHandAndMove_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite); static u8 GetVectorDirection(s16 dx, s16 dy, s16 absdx, s16 absdy); static u8 GetLimitedVectorDirection_SouthNorth(s16 dx, s16 dy, s16 absdx, s16 absdy); @@ -596,18 +596,18 @@ u8 (*const gMovementTypeFuncs_Invisible[])(struct ObjectEvent *, struct Sprite * MovementType_Invisible_Step2, }; -u8 (*const gMovementTypeFuncs_VsSeeker4D[])(struct ObjectEvent *, struct Sprite *) = { - MovementType_VsSeeker4D_Step0, - MovementType_VsSeeker4D_Step1, - MovementType_VsSeeker4D_Step2, +u8 (*const gMovementTypeFuncs_RaiseHandAndStop[])(struct ObjectEvent *, struct Sprite *) = { + MovementType_RaiseHandAndStop_Step0, + MovementType_RaiseHandAndStop_Step1, + MovementType_RaiseHandAndStop_Step2, }; -u8 (*const gMovementTypeFuncs_VsSeeker4E[])(struct ObjectEvent *, struct Sprite *) = { - MovementType_VsSeeker4E_Step0, - MovementType_VsSeeker4E_VsSeeker4F_Step1, +u8 (*const gMovementTypeFuncs_RaiseHandAndJump[])(struct ObjectEvent *, struct Sprite *) = { + MovementType_RaiseHandAndJump_Step0, + MovementType_RaiseHandAndMove_Step1, }; -u8 (*const gMovementTypeFuncs_VsSeeker4F[])(struct ObjectEvent *, struct Sprite *) = { - MovementType_VsSeeker4F_Step0, - MovementType_VsSeeker4E_VsSeeker4F_Step1, +u8 (*const gMovementTypeFuncs_RaiseHandAndSwim[])(struct ObjectEvent *, struct Sprite *) = { + MovementType_RaiseHandAndSwim_Step0, + MovementType_RaiseHandAndMove_Step1, }; diff --git a/src/data/trainer_graphics/front_pic_anims.h b/src/data/trainer_graphics/front_pic_anims.h index 32d38068a..2013ebb4b 100644 --- a/src/data/trainer_graphics/front_pic_anims.h +++ b/src/data/trainer_graphics/front_pic_anims.h @@ -1,891 +1,891 @@ -static const union AnimCmd *const sAnims_8238E8C[] = +static const union AnimCmd *const sAnims_AquaLeaderArchie[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238E90[] = +static const union AnimCmd *const sAnims_AquaGruntM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238E94[] = +static const union AnimCmd *const sAnims_AquaGruntF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238E98[] = +static const union AnimCmd *const sAnims_RSAromaLady[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238E9C[] = +static const union AnimCmd *const sAnims_RSRuinManiac[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EA0[] = +static const union AnimCmd *const sAnims_Interviewer[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EA4[] = +static const union AnimCmd *const sAnims_RSTuberF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EA8[] = +static const union AnimCmd *const sAnims_RSTuberM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EAC[] = +static const union AnimCmd *const sAnims_RSCooltrainerM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EB0[] = +static const union AnimCmd *const sAnims_RSCooltrainerF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EB4[] = +static const union AnimCmd *const sAnims_HexManiac[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EB8[] = +static const union AnimCmd *const sAnims_RSLady[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EBC[] = +static const union AnimCmd *const sAnims_RSBeauty[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EC0[] = +static const union AnimCmd *const sAnims_RichBoy[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EC4[] = +static const union AnimCmd *const sAnims_RSPokemaniac[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EC8[] = +static const union AnimCmd *const sAnims_RSSwimmerM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238ECC[] = +static const union AnimCmd *const sAnims_RSBlackBelt[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238ED0[] = +static const union AnimCmd *const sAnims_Guitarist[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238ED4[] = +static const union AnimCmd *const sAnims_Kindler[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238ED8[] = +static const union AnimCmd *const sAnims_RSCamper[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EDC[] = +static const union AnimCmd *const sAnims_BugManiac[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EE0[] = +static const union AnimCmd *const sAnims_RSPsychicM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EE4[] = +static const union AnimCmd *const sAnims_RSPsychicF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EE8[] = +static const union AnimCmd *const sAnims_RSGentleman[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EEC[] = +static const union AnimCmd *const sAnims_EliteFourSidney[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EF0[] = +static const union AnimCmd *const sAnims_EliteFourPhoebe[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EF4[] = +static const union AnimCmd *const sAnims_LeaderRoxanne[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EF8[] = +static const union AnimCmd *const sAnims_LeaderBrawly[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238EFC[] = +static const union AnimCmd *const sAnims_LeaderTateAndLiza[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F00[] = +static const union AnimCmd *const sAnims_SchoolKidM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F04[] = +static const union AnimCmd *const sAnims_SchoolKidF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F08[] = +static const union AnimCmd *const sAnims_SrAndJr[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F0C[] = +static const union AnimCmd *const sAnims_PokefanM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F10[] = +static const union AnimCmd *const sAnims_PokefanF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F14[] = +static const union AnimCmd *const sAnims_ExpertM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F18[] = +static const union AnimCmd *const sAnims_ExpertF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F1C[] = +static const union AnimCmd *const sAnims_RSYoungster[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F20[] = +static const union AnimCmd *const sAnims_ChampionSteven[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F24[] = +static const union AnimCmd *const sAnims_RSFisherman[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F28[] = +static const union AnimCmd *const sAnims_CyclingTriathleteM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F2C[] = +static const union AnimCmd *const sAnims_CyclingTriathleteF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F30[] = +static const union AnimCmd *const sAnims_RunningTriathleteM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F34[] = +static const union AnimCmd *const sAnims_RunningTriathleteF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F38[] = +static const union AnimCmd *const sAnims_SwimmingTriathleteM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F3C[] = +static const union AnimCmd *const sAnims_SwimmingTriathleteF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F40[] = +static const union AnimCmd *const sAnims_DragonTamer[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F44[] = +static const union AnimCmd *const sAnims_RSBirdKeeper[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F48[] = +static const union AnimCmd *const sAnims_NinjaBoy[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F4C[] = +static const union AnimCmd *const sAnims_BattleGirl[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F50[] = +static const union AnimCmd *const sAnims_ParasolLady[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F54[] = +static const union AnimCmd *const sAnims_RSSwimmerF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F58[] = +static const union AnimCmd *const sAnims_RSPicnicker[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F5C[] = +static const union AnimCmd *const sAnims_RSTwins[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F60[] = +static const union AnimCmd *const sAnims_RSSailor[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F64[] = +static const union AnimCmd *const sAnims_Collector[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F68[] = +static const union AnimCmd *const sAnims_Wally[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F6C[] = +static const union AnimCmd *const sAnims_RSBrendan1[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F70[] = +static const union AnimCmd *const sAnims_RSMay1[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F74[] = +static const union AnimCmd *const sAnims_RSPokemonBreederM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F78[] = +static const union AnimCmd *const sAnims_RSPokemonBreederF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F7C[] = +static const union AnimCmd *const sAnims_RSPokemonRangerM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F80[] = +static const union AnimCmd *const sAnims_RSPokemonRangerF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F84[] = +static const union AnimCmd *const sAnims_MagmaLeaderMaxie[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F88[] = +static const union AnimCmd *const sAnims_MagmaGruntM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F8C[] = +static const union AnimCmd *const sAnims_MagmaGruntF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F90[] = +static const union AnimCmd *const sAnims_RSLass[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F94[] = +static const union AnimCmd *const sAnims_RSBugCatcher[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F98[] = +static const union AnimCmd *const sAnims_RSHiker[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238F9C[] = +static const union AnimCmd *const sAnims_RSYoungCouple[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FA0[] = +static const union AnimCmd *const sAnims_OldCouple[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FA4[] = +static const union AnimCmd *const sAnims_RSSisAndBro[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FA8[] = +static const union AnimCmd *const sAnims_AquaAdminM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FAC[] = +static const union AnimCmd *const sAnims_AquaAdminF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FB0[] = +static const union AnimCmd *const sAnims_MagmaAdminM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FB4[] = +static const union AnimCmd *const sAnims_MagmaAdminF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FB8[] = +static const union AnimCmd *const sAnims_LeaderWattson[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FBC[] = +static const union AnimCmd *const sAnims_LeaderFlannery[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FC0[] = +static const union AnimCmd *const sAnims_LeaderNorman[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FC4[] = +static const union AnimCmd *const sAnims_LeaderWinona[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FC8[] = +static const union AnimCmd *const sAnims_LeaderWallace[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FCC[] = +static const union AnimCmd *const sAnims_EliteFourGlacia[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FD0[] = +static const union AnimCmd *const sAnims_EliteFourDrake[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FD4[] = +static const union AnimCmd *const sAnims_Youngster[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FD8[] = +static const union AnimCmd *const sAnims_BugCatcher[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FDC[] = +static const union AnimCmd *const sAnims_Lass[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FE0[] = +static const union AnimCmd *const sAnims_Sailor[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FE4[] = +static const union AnimCmd *const sAnims_Camper[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FE8[] = +static const union AnimCmd *const sAnims_Picnicker[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FEC[] = +static const union AnimCmd *const sAnims_Pokemaniac[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FF0[] = +static const union AnimCmd *const sAnims_SuperNerd[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FF4[] = +static const union AnimCmd *const sAnims_Hiker[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FF8[] = +static const union AnimCmd *const sAnims_Biker[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8238FFC[] = +static const union AnimCmd *const sAnims_Burglar[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239000[] = +static const union AnimCmd *const sAnims_Engineer[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239004[] = +static const union AnimCmd *const sAnims_Fisherman[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239008[] = +static const union AnimCmd *const sAnims_SwimmerM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_823900C[] = +static const union AnimCmd *const sAnims_CueBall[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239010[] = +static const union AnimCmd *const sAnims_Gamer[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239014[] = +static const union AnimCmd *const sAnims_Beauty[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239018[] = +static const union AnimCmd *const sAnims_SwimmerF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_823901C[] = +static const union AnimCmd *const sAnims_PsychicM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239020[] = +static const union AnimCmd *const sAnims_Rocker[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239024[] = +static const union AnimCmd *const sAnims_Juggler[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239028[] = +static const union AnimCmd *const sAnims_Tamer[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_823902C[] = +static const union AnimCmd *const sAnims_BirdKeeper[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239030[] = +static const union AnimCmd *const sAnims_BlackBelt[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239034[] = +static const union AnimCmd *const sAnims_RivalEarly[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239038[] = +static const union AnimCmd *const sAnims_Scientist[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_823903C[] = +static const union AnimCmd *const sAnims_LeaderGiovanni[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239040[] = +static const union AnimCmd *const sAnims_RocketGruntM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239044[] = +static const union AnimCmd *const sAnims_CooltrainerM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239048[] = +static const union AnimCmd *const sAnims_CooltrainerF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_823904C[] = +static const union AnimCmd *const sAnims_EliteFourLorelei[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239050[] = +static const union AnimCmd *const sAnims_EliteFourBruno[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239054[] = +static const union AnimCmd *const sAnims_EliteFourAgatha[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239058[] = +static const union AnimCmd *const sAnims_EliteFourLance[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_823905C[] = +static const union AnimCmd *const sAnims_LeaderBrock[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239060[] = +static const union AnimCmd *const sAnims_LeaderMisty[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239064[] = +static const union AnimCmd *const sAnims_LeaderLtSurge[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239068[] = +static const union AnimCmd *const sAnims_LeaderErika[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_823906C[] = +static const union AnimCmd *const sAnims_LeaderKoga[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239070[] = +static const union AnimCmd *const sAnims_LeaderBlaine[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239074[] = +static const union AnimCmd *const sAnims_LeaderSabrina[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239078[] = +static const union AnimCmd *const sAnims_Gentleman[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_823907C[] = +static const union AnimCmd *const sAnims_RivalLate[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239080[] = +static const union AnimCmd *const sAnims_ChampionRival[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239084[] = +static const union AnimCmd *const sAnims_Channeler[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239088[] = +static const union AnimCmd *const sAnims_Twins[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_823908C[] = +static const union AnimCmd *const sAnims_CoolCouple[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239090[] = +static const union AnimCmd *const sAnims_YoungCouple[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239094[] = +static const union AnimCmd *const sAnims_CrushKin[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_8239098[] = +static const union AnimCmd *const sAnims_SisAndBro[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_823909C[] = +static const union AnimCmd *const sAnims_ProfessorOak[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390A0[] = +static const union AnimCmd *const sAnims_RSBrendan2[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390A4[] = +static const union AnimCmd *const sAnims_RSMay2[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390A8[] = +static const union AnimCmd *const sAnims_Red[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390AC[] = +static const union AnimCmd *const sAnims_Leaf[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390B0[] = +static const union AnimCmd *const sAnims_RocketGruntF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390B4[] = +static const union AnimCmd *const sAnims_PsychicF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390B8[] = +static const union AnimCmd *const sAnims_CrushGirl[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390BC[] = +static const union AnimCmd *const sAnims_TuberF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390C0[] = +static const union AnimCmd *const sAnims_PokemonBreeder[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390C4[] = +static const union AnimCmd *const sAnims_PokemonRangerM[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390C8[] = +static const union AnimCmd *const sAnims_PokemonRangerF[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390CC[] = +static const union AnimCmd *const sAnims_AromaLady[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390D0[] = +static const union AnimCmd *const sAnims_RuinManiac[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390D4[] = +static const union AnimCmd *const sAnims_Lady[] = { sAnim_GeneralFrame0, }; -static const union AnimCmd *const sAnims_82390D8[] = +static const union AnimCmd *const sAnims_Painter[] = { sAnim_GeneralFrame0, }; const union AnimCmd *const *const gTrainerFrontAnimsPtrTable[] = { - sAnims_8238E8C, - sAnims_8238E90, - sAnims_8238E94, - sAnims_8238E98, - sAnims_8238E9C, - sAnims_8238EA0, - sAnims_8238EA4, - sAnims_8238EA8, - sAnims_8238EAC, - sAnims_8238EB0, - sAnims_8238EB4, - sAnims_8238EB8, - sAnims_8238EBC, - sAnims_8238EC0, - sAnims_8238EC4, - sAnims_8238EC8, - sAnims_8238ECC, - sAnims_8238ED0, - sAnims_8238ED4, - sAnims_8238ED8, - sAnims_8238EDC, - sAnims_8238EE0, - sAnims_8238EE4, - sAnims_8238EE8, - sAnims_8238EEC, - sAnims_8238EF0, - sAnims_8238EF4, - sAnims_8238EF8, - sAnims_8238EFC, - sAnims_8238F00, - sAnims_8238F04, - sAnims_8238F08, - sAnims_8238F0C, - sAnims_8238F10, - sAnims_8238F14, - sAnims_8238F18, - sAnims_8238F1C, - sAnims_8238F20, - sAnims_8238F24, - sAnims_8238F28, - sAnims_8238F2C, - sAnims_8238F30, - sAnims_8238F34, - sAnims_8238F38, - sAnims_8238F3C, - sAnims_8238F40, - sAnims_8238F44, - sAnims_8238F48, - sAnims_8238F4C, - sAnims_8238F50, - sAnims_8238F54, - sAnims_8238F58, - sAnims_8238F5C, - sAnims_8238F60, - sAnims_8238F64, - sAnims_8238F68, - sAnims_8238F6C, - sAnims_8238F70, - sAnims_8238F74, - sAnims_8238F78, - sAnims_8238F7C, - sAnims_8238F80, - sAnims_8238F84, - sAnims_8238F88, - sAnims_8238F8C, - sAnims_8238F90, - sAnims_8238F94, - sAnims_8238F98, - sAnims_8238F9C, - sAnims_8238FA0, - sAnims_8238FA4, - sAnims_8238FA8, - sAnims_8238FAC, - sAnims_8238FB0, - sAnims_8238FB4, - sAnims_8238FB8, - sAnims_8238FBC, - sAnims_8238FC0, - sAnims_8238FC4, - sAnims_8238FC8, - sAnims_8238FCC, - sAnims_8238FD0, - sAnims_8238FD4, - sAnims_8238FD8, - sAnims_8238FDC, - sAnims_8238FE0, - sAnims_8238FE4, - sAnims_8238FE8, - sAnims_8238FEC, - sAnims_8238FF0, - sAnims_8238FF4, - sAnims_8238FF8, - sAnims_8238FFC, - sAnims_8239000, - sAnims_8239004, - sAnims_8239008, - sAnims_823900C, - sAnims_8239010, - sAnims_8239014, - sAnims_8239018, - sAnims_823901C, - sAnims_8239020, - sAnims_8239024, - sAnims_8239028, - sAnims_823902C, - sAnims_8239030, - sAnims_8239034, - sAnims_8239038, - sAnims_823903C, - sAnims_8239040, - sAnims_8239044, - sAnims_8239048, - sAnims_823904C, - sAnims_8239050, - sAnims_8239054, - sAnims_8239058, - sAnims_823905C, - sAnims_8239060, - sAnims_8239064, - sAnims_8239068, - sAnims_823906C, - sAnims_8239070, - sAnims_8239074, - sAnims_8239078, - sAnims_823907C, - sAnims_8239080, - sAnims_8239084, - sAnims_8239088, - sAnims_823908C, - sAnims_8239090, - sAnims_8239094, - sAnims_8239098, - sAnims_823909C, - sAnims_82390A0, - sAnims_82390A4, - sAnims_82390A8, - sAnims_82390AC, - sAnims_82390B0, - sAnims_82390B4, - sAnims_82390B8, - sAnims_82390BC, - sAnims_82390C0, - sAnims_82390C4, - sAnims_82390C8, - sAnims_82390CC, - sAnims_82390D0, - sAnims_82390D4, - sAnims_82390D8, + [TRAINER_PIC_AQUA_LEADER_ARCHIE] = sAnims_AquaLeaderArchie, + [TRAINER_PIC_AQUA_GRUNT_M] = sAnims_AquaGruntM, + [TRAINER_PIC_AQUA_GRUNT_F] = sAnims_AquaGruntF, + [TRAINER_PIC_RS_AROMA_LADY] = sAnims_RSAromaLady, + [TRAINER_PIC_RS_RUIN_MANIAC] = sAnims_RSRuinManiac, + [TRAINER_PIC_INTERVIEWER] = sAnims_Interviewer, + [TRAINER_PIC_RS_TUBER_F] = sAnims_RSTuberF, + [TRAINER_PIC_RS_TUBER_M] = sAnims_RSTuberM, + [TRAINER_PIC_RS_COOLTRAINER_M] = sAnims_RSCooltrainerM, + [TRAINER_PIC_RS_COOLTRAINER_F] = sAnims_RSCooltrainerF, + [TRAINER_PIC_HEX_MANIAC] = sAnims_HexManiac, + [TRAINER_PIC_RS_LADY] = sAnims_RSLady, + [TRAINER_PIC_RS_BEAUTY] = sAnims_RSBeauty, + [TRAINER_PIC_RICH_BOY] = sAnims_RichBoy, + [TRAINER_PIC_RS_POKEMANIAC] = sAnims_RSPokemaniac, + [TRAINER_PIC_RS_SWIMMER_M] = sAnims_RSSwimmerM, + [TRAINER_PIC_RS_BLACK_BELT] = sAnims_RSBlackBelt, + [TRAINER_PIC_GUITARIST] = sAnims_Guitarist, + [TRAINER_PIC_KINDLER] = sAnims_Kindler, + [TRAINER_PIC_RS_CAMPER] = sAnims_RSCamper, + [TRAINER_PIC_BUG_MANIAC] = sAnims_BugManiac, + [TRAINER_PIC_RS_PSYCHIC_M] = sAnims_RSPsychicM, + [TRAINER_PIC_RS_PSYCHIC_F] = sAnims_RSPsychicF, + [TRAINER_PIC_RS_GENTLEMAN] = sAnims_RSGentleman, + [TRAINER_PIC_ELITE_FOUR_SIDNEY] = sAnims_EliteFourSidney, + [TRAINER_PIC_ELITE_FOUR_PHOEBE] = sAnims_EliteFourPhoebe, + [TRAINER_PIC_LEADER_ROXANNE] = sAnims_LeaderRoxanne, + [TRAINER_PIC_LEADER_BRAWLY] = sAnims_LeaderBrawly, + [TRAINER_PIC_LEADER_TATE_AND_LIZA] = sAnims_LeaderTateAndLiza, + [TRAINER_PIC_SCHOOL_KID_M] = sAnims_SchoolKidM, + [TRAINER_PIC_SCHOOL_KID_F] = sAnims_SchoolKidF, + [TRAINER_PIC_SR_AND_JR] = sAnims_SrAndJr, + [TRAINER_PIC_POKEFAN_M] = sAnims_PokefanM, + [TRAINER_PIC_POKEFAN_F] = sAnims_PokefanF, + [TRAINER_PIC_EXPERT_M] = sAnims_ExpertM, + [TRAINER_PIC_EXPERT_F] = sAnims_ExpertF, + [TRAINER_PIC_RS_YOUNGSTER] = sAnims_RSYoungster, + [TRAINER_PIC_CHAMPION_STEVEN] = sAnims_ChampionSteven, + [TRAINER_PIC_RS_FISHERMAN] = sAnims_RSFisherman, + [TRAINER_PIC_CYCLING_TRIATHLETE_M] = sAnims_CyclingTriathleteM, + [TRAINER_PIC_CYCLING_TRIATHLETE_F] = sAnims_CyclingTriathleteF, + [TRAINER_PIC_RUNNING_TRIATHLETE_M] = sAnims_RunningTriathleteM, + [TRAINER_PIC_RUNNING_TRIATHLETE_F] = sAnims_RunningTriathleteF, + [TRAINER_PIC_SWIMMING_TRIATHLETE_M] = sAnims_SwimmingTriathleteM, + [TRAINER_PIC_SWIMMING_TRIATHLETE_F] = sAnims_SwimmingTriathleteF, + [TRAINER_PIC_DRAGON_TAMER] = sAnims_DragonTamer, + [TRAINER_PIC_RS_BIRD_KEEPER] = sAnims_RSBirdKeeper, + [TRAINER_PIC_NINJA_BOY] = sAnims_NinjaBoy, + [TRAINER_PIC_BATTLE_GIRL] = sAnims_BattleGirl, + [TRAINER_PIC_PARASOL_LADY] = sAnims_ParasolLady, + [TRAINER_PIC_RS_SWIMMER_F] = sAnims_RSSwimmerF, + [TRAINER_PIC_RS_PICNICKER] = sAnims_RSPicnicker, + [TRAINER_PIC_RS_TWINS] = sAnims_RSTwins, + [TRAINER_PIC_RS_SAILOR] = sAnims_RSSailor, + [TRAINER_PIC_COLLECTOR] = sAnims_Collector, + [TRAINER_PIC_WALLY] = sAnims_Wally, + [TRAINER_PIC_RS_BRENDAN_1] = sAnims_RSBrendan1, + [TRAINER_PIC_RS_MAY_1] = sAnims_RSMay1, + [TRAINER_PIC_RS_POKEMON_BREEDER_M] = sAnims_RSPokemonBreederM, + [TRAINER_PIC_RS_POKEMON_BREEDER_F] = sAnims_RSPokemonBreederF, + [TRAINER_PIC_RS_POKEMON_RANGER_M] = sAnims_RSPokemonRangerM, + [TRAINER_PIC_RS_POKEMON_RANGER_F] = sAnims_RSPokemonRangerF, + [TRAINER_PIC_MAGMA_LEADER_MAXIE] = sAnims_MagmaLeaderMaxie, + [TRAINER_PIC_MAGMA_GRUNT_M] = sAnims_MagmaGruntM, + [TRAINER_PIC_MAGMA_GRUNT_F] = sAnims_MagmaGruntF, + [TRAINER_PIC_RS_LASS] = sAnims_RSLass, + [TRAINER_PIC_RS_BUG_CATCHER] = sAnims_RSBugCatcher, + [TRAINER_PIC_RS_HIKER] = sAnims_RSHiker, + [TRAINER_PIC_RS_YOUNG_COUPLE] = sAnims_RSYoungCouple, + [TRAINER_PIC_OLD_COUPLE] = sAnims_OldCouple, + [TRAINER_PIC_RS_SIS_AND_BRO] = sAnims_RSSisAndBro, + [TRAINER_PIC_AQUA_ADMIN_M] = sAnims_AquaAdminM, + [TRAINER_PIC_AQUA_ADMIN_F] = sAnims_AquaAdminF, + [TRAINER_PIC_MAGMA_ADMIN_M] = sAnims_MagmaAdminM, + [TRAINER_PIC_MAGMA_ADMIN_F] = sAnims_MagmaAdminF, + [TRAINER_PIC_LEADER_WATTSON] = sAnims_LeaderWattson, + [TRAINER_PIC_LEADER_FLANNERY] = sAnims_LeaderFlannery, + [TRAINER_PIC_LEADER_NORMAN] = sAnims_LeaderNorman, + [TRAINER_PIC_LEADER_WINONA] = sAnims_LeaderWinona, + [TRAINER_PIC_LEADER_WALLACE] = sAnims_LeaderWallace, + [TRAINER_PIC_ELITE_FOUR_GLACIA] = sAnims_EliteFourGlacia, + [TRAINER_PIC_ELITE_FOUR_DRAKE] = sAnims_EliteFourDrake, + [TRAINER_PIC_YOUNGSTER] = sAnims_Youngster, + [TRAINER_PIC_BUG_CATCHER] = sAnims_BugCatcher, + [TRAINER_PIC_LASS] = sAnims_Lass, + [TRAINER_PIC_SAILOR] = sAnims_Sailor, + [TRAINER_PIC_CAMPER] = sAnims_Camper, + [TRAINER_PIC_PICNICKER] = sAnims_Picnicker, + [TRAINER_PIC_POKEMANIAC] = sAnims_Pokemaniac, + [TRAINER_PIC_SUPER_NERD] = sAnims_SuperNerd, + [TRAINER_PIC_HIKER] = sAnims_Hiker, + [TRAINER_PIC_BIKER] = sAnims_Biker, + [TRAINER_PIC_BURGLAR] = sAnims_Burglar, + [TRAINER_PIC_ENGINEER] = sAnims_Engineer, + [TRAINER_PIC_FISHERMAN] = sAnims_Fisherman, + [TRAINER_PIC_SWIMMER_M] = sAnims_SwimmerM, + [TRAINER_PIC_CUE_BALL] = sAnims_CueBall, + [TRAINER_PIC_GAMER] = sAnims_Gamer, + [TRAINER_PIC_BEAUTY] = sAnims_Beauty, + [TRAINER_PIC_SWIMMER_F] = sAnims_SwimmerF, + [TRAINER_PIC_PSYCHIC_M] = sAnims_PsychicM, + [TRAINER_PIC_ROCKER] = sAnims_Rocker, + [TRAINER_PIC_JUGGLER] = sAnims_Juggler, + [TRAINER_PIC_TAMER] = sAnims_Tamer, + [TRAINER_PIC_BIRD_KEEPER] = sAnims_BirdKeeper, + [TRAINER_PIC_BLACK_BELT] = sAnims_BlackBelt, + [TRAINER_PIC_RIVAL_EARLY] = sAnims_RivalEarly, + [TRAINER_PIC_SCIENTIST] = sAnims_Scientist, + [TRAINER_PIC_LEADER_GIOVANNI] = sAnims_LeaderGiovanni, + [TRAINER_PIC_ROCKET_GRUNT_M] = sAnims_RocketGruntM, + [TRAINER_PIC_COOLTRAINER_M] = sAnims_CooltrainerM, + [TRAINER_PIC_COOLTRAINER_F] = sAnims_CooltrainerF, + [TRAINER_PIC_ELITE_FOUR_LORELEI] = sAnims_EliteFourLorelei, + [TRAINER_PIC_ELITE_FOUR_BRUNO] = sAnims_EliteFourBruno, + [TRAINER_PIC_ELITE_FOUR_AGATHA] = sAnims_EliteFourAgatha, + [TRAINER_PIC_ELITE_FOUR_LANCE] = sAnims_EliteFourLance, + [TRAINER_PIC_LEADER_BROCK] = sAnims_LeaderBrock, + [TRAINER_PIC_LEADER_MISTY] = sAnims_LeaderMisty, + [TRAINER_PIC_LEADER_LT_SURGE] = sAnims_LeaderLtSurge, + [TRAINER_PIC_LEADER_ERIKA] = sAnims_LeaderErika, + [TRAINER_PIC_LEADER_KOGA] = sAnims_LeaderKoga, + [TRAINER_PIC_LEADER_BLAINE] = sAnims_LeaderBlaine, + [TRAINER_PIC_LEADER_SABRINA] = sAnims_LeaderSabrina, + [TRAINER_PIC_GENTLEMAN] = sAnims_Gentleman, + [TRAINER_PIC_RIVAL_LATE] = sAnims_RivalLate, + [TRAINER_PIC_CHAMPION_RIVAL] = sAnims_ChampionRival, + [TRAINER_PIC_CHANNELER] = sAnims_Channeler, + [TRAINER_PIC_TWINS] = sAnims_Twins, + [TRAINER_PIC_COOL_COUPLE] = sAnims_CoolCouple, + [TRAINER_PIC_YOUNG_COUPLE] = sAnims_YoungCouple, + [TRAINER_PIC_CRUSH_KIN] = sAnims_CrushKin, + [TRAINER_PIC_SIS_AND_BRO] = sAnims_SisAndBro, + [TRAINER_PIC_PROFESSOR_OAK] = sAnims_ProfessorOak, + [TRAINER_PIC_RS_BRENDAN_2] = sAnims_RSBrendan2, + [TRAINER_PIC_RS_MAY_2] = sAnims_RSMay2, + [TRAINER_PIC_RED] = sAnims_Red, + [TRAINER_PIC_LEAF] = sAnims_Leaf, + [TRAINER_PIC_ROCKET_GRUNT_F] = sAnims_RocketGruntF, + [TRAINER_PIC_PSYCHIC_F] = sAnims_PsychicF, + [TRAINER_PIC_CRUSH_GIRL] = sAnims_CrushGirl, + [TRAINER_PIC_TUBER_F] = sAnims_TuberF, + [TRAINER_PIC_POKEMON_BREEDER] = sAnims_PokemonBreeder, + [TRAINER_PIC_POKEMON_RANGER_M] = sAnims_PokemonRangerM, + [TRAINER_PIC_POKEMON_RANGER_F] = sAnims_PokemonRangerF, + [TRAINER_PIC_AROMA_LADY] = sAnims_AromaLady, + [TRAINER_PIC_RUIN_MANIAC] = sAnims_RuinManiac, + [TRAINER_PIC_LADY] = sAnims_Lady, + [TRAINER_PIC_PAINTER] = sAnims_Painter, }; diff --git a/src/daycare.c b/src/daycare.c index 482fc413e..f45aaceff 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -1969,7 +1969,7 @@ static void CB2_EggHatch_1(void) species = GetMonData(&gPlayerParty[sEggHatchData->eggPartyID], MON_DATA_SPECIES); gender = GetMonGender(&gPlayerParty[sEggHatchData->eggPartyID]); personality = GetMonData(&gPlayerParty[sEggHatchData->eggPartyID], MON_DATA_PERSONALITY, 0); - DoNamingScreen(NAMING_SCREEN_NAME_RATER, gStringVar3, species, gender, personality, EggHatchSetMonNickname); + DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar3, species, gender, personality, EggHatchSetMonNickname); break; case 1: case -1: diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 15bc18c2b..24f5bc8e6 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -1,306 +1,834 @@ #include "global.h" #include "gflib.h" #include "dodrio_berry_picking.h" +#include "dynamic_placeholder_text_util.h" #include "event_data.h" #include "item.h" #include "link.h" #include "link_rfu.h" #include "m4a.h" +#include "menu.h" #include "minigame_countdown.h" +#include "new_menu_helpers.h" #include "random.h" +#include "save.h" #include "script.h" #include "strings.h" #include "task.h" #include "text_window.h" +#include "text_window_graphics.h" #include "constants/songs.h" #include "constants/sound.h" #include "constants/items.h" -struct DodrioStruct +// Note that in this file 'Dodrio Berry Picking' is often +// shortened to DodrioGame or just Game for convenience + +#define MAX_SCORE 999990 +#define MAX_BERRIES 9999 + +// The minimum score needed to receive a prize +#define PRIZE_SCORE 3000 + +// Difficulty increases as berries are eaten. The rate of new berries increases and the types of berries changes +// When the max difficulty is reached it starts again from the beginning +#define NUM_DIFFICULTIES 7 + +#define MAX_FALL_DIST 10 // The number of times a berry needs to fall before hitting the ground +#define EAT_FALL_DIST 7 // The number of times a berry needs to fall to be available to eat + +enum { + BG_INTERFACE, + BG_TREE_LEFT, + BG_TREE_RIGHT, + BG_SCENERY +}; + +enum { + FUNC_INTRO, + FUNC_INIT_COUNTDOWN, + FUNC_COUNTDOWN, + FUNC_WAIT_START, + FUNC_PLAY_GAME, + FUNC_INIT_RESULTS, + FUNC_RESULTS, + FUNC_ASK_PLAY_AGAIN, + FUNC_END_LINK, + FUNC_EXIT, + FUNC_RESET_GAME, + FUNC_WAIT_END_GAME, +}; + +enum { + GFXFUNC_LOAD, + GFXFUNC_SHOW_NAMES, + GFXFUNC_SHOW_RESULTS, + GFXFUNC_MSG_PLAY_AGAIN, + GFXFUNC_MSG_SAVING, + GFXFUNC_MSG_COMM_STANDBY, + GFXFUNC_ERASE_MSG, + GFXFUNC_MSG_PLAYER_DROPPED, + GFXFUNC_STOP, + GFXFUNC_IDLE, +}; + +enum { + PLAY_AGAIN_NONE, + PLAY_AGAIN_YES, + PLAY_AGAIN_NO, + PLAY_AGAIN_DROPPED = 5, +}; + +enum { + PICK_NONE, // Dodrio standing still + PICK_RIGHT, // Dodrio reaching right + PICK_MIDDLE, // Dodrio reaching up + PICK_LEFT, // Dodrio reaching left + PICK_DISABLED, // Dodrio down after game over +}; + +enum { + BERRY_BLUE, + BERRY_GREEN, + BERRY_GOLD, + BERRY_MISSED, + BERRY_PRIZE, + BERRY_IN_ROW, + NUM_BERRY_IDS +}; + +#define NUM_BERRY_TYPES 4 // Blue, Green, Gold, and 'missed' + + // Eaten anim comes after the normal & missed versions of other berries +#define ANIM_EATEN (BERRY_MISSED * 2) + +enum { + BERRYSTATE_NONE, + BERRYSTATE_PICKED, // Berry has been picked by a Dodrio, replaced with blue hit sprite (still falling) + BERRYSTATE_EATEN, // Berry has been eaten (after being picked), berry is gone now + BERRYSTATE_SQUISHED, // Berry has hit the ground +}; + +enum { + INPUTSTATE_NONE, + INPUTSTATE_TRY_PICK, + INPUTSTATE_PICKED, + INPUTSTATE_ATE_BERRY, + INPUTSTATE_BAD_MISS, +}; + +// Colors for status bar squares +// Colored gray when a berry is missed +// Flash red when few yellow squares remain +enum { + STATUS_YELLOW, + STATUS_GRAY, + STATUS_RED, +}; + +#define NUM_STATUS_SQUARES 10 + +#define GFXTAG_DODRIO 0 +#define GFXTAG_STATUS 1 +#define GFXTAG_BERRIES 2 +#define GFXTAG_CLOUD 5 +#define GFXTAG_COUNTDOWN 7 + +#define PALTAG_DODRIO_NORMAL 0 +#define PALTAG_DODRIO_SHINY 1 +#define PALTAG_STATUS 2 +#define PALTAG_BERRIES 3 +#define PALTAG_CLOUD 6 +#define PALTAG_COUNTDOWN 8 + +#define NUM_CLOUDS 2 + +#define PLAYER_NONE 0xFF + +struct DodrioGame_Gfx { - /*0x0000*/ void (*savedCallback)(void); - /*0x0004*/ u8 ALIGNED(4) unk04; - /*0x0008*/ u8 ALIGNED(4) unk08; - /*0x000C*/ u8 ALIGNED(4) unk0C; - /*0x0010*/ u8 ALIGNED(4) unk10; - /*0x0014*/ u8 ALIGNED(4) unk14; - /*0x0018*/ u8 ALIGNED(4) unk18; - /*0x001C*/ u8 ALIGNED(4) unk1C; - /*0x0020*/ u8 ALIGNED(4) unk20; - /*0x0024*/ u8 ALIGNED(4) unk24; + u16 ALIGNED(4) tilemapBuffers[3][BG_SCREEN_SIZE]; + bool32 finished; + u8 ALIGNED(4) taskId; + u8 ALIGNED(4) windowIds[MAX_RFU_PLAYERS + 5]; // The latter 5 are never used + u8 ALIGNED(4) state; + u8 ALIGNED(4) loadState; + u16 ALIGNED(4) timer; + u8 ALIGNED(4) cursorSelection; + u8 ALIGNED(4) playAgainState; + void (*func)(void); +}; // size = 0x302C + +struct StatusBar +{ + u8 unused[12]; + bool8 entered[NUM_STATUS_SQUARES]; + s16 yChange[NUM_STATUS_SQUARES]; + u16 spriteIds[NUM_STATUS_SQUARES]; + u16 flashTimer; +}; // size = 0x40 + +// Because Dodrio is required for this minigame, +// the only relevant information about the selected +// Pokémon is whether or not it's shiny +struct DodrioGame_MonInfo +{ + bool8 isShiny; +}; + +struct DodrioGame_ScoreResults +{ + u8 ranking; + u32 score; +}; + +struct DodrioGame +{ + /*0x0000*/ void (*exitCallback)(void); + /*0x0004*/ u8 ALIGNED(4) taskId; + /*0x0008*/ u8 ALIGNED(4) playersReceived; + /*0x000C*/ u8 ALIGNED(4) startState; + /*0x0010*/ u8 ALIGNED(4) state; + /*0x0014*/ u8 ALIGNED(4) timer; + /*0x0018*/ u8 ALIGNED(4) funcId; + /*0x001C*/ u8 ALIGNED(4) prevFuncId; // Set, never read + /*0x0020*/ bool8 ALIGNED(4) isLeader; + /*0x0024*/ u8 ALIGNED(4) numPlayers; /*0x0028*/ u8 ALIGNED(4) multiplayerId; - /*0x0030*/ u8 ALIGNED(8) unk30; - /*0x0034*/ u8 ALIGNED(4) unk34[5]; - /*0x003C*/ u8 ALIGNED(4) unk3C; - /*0x0040*/ u8 ALIGNED(4) unk40; - /*0x0044*/ u8 ALIGNED(4) unk44; - /*0x0048*/ u8 ALIGNED(4) unk48; - /*0x004A*/ u16 unk4A[5][6]; - /*0x0086*/ u16 unk86[5]; - /*0x0090*/ u8 ALIGNED(4) unk90[5]; - /*0x0098*/ u8 ALIGNED(4) unk98[4]; - /*0x009C*/ u8 ALIGNED(4) unk9C[11]; - /*0x00A8*/ u8 ALIGNED(4) unkA8[5]; - /*0x00B0*/ u8 ALIGNED(4) unkB0[5]; - /*0x00B8*/ u8 ALIGNED(4) unkB8[11]; - /*0x00C4*/ u8 ALIGNED(4) unkC4[11]; - /*0x00D0*/ u8 ALIGNED(4) unkD0[11]; - /*0x00DC*/ u8 ALIGNED(4) unkDC[11]; - /*0x00E8*/ u8 ALIGNED(4) unkE8[11]; - /*0x00F4*/ u8 ALIGNED(4) unkF4[11][2]; - /*0x010C*/ u8 ALIGNED(4) unk10C[5]; - /*0x0112*/ u16 unk112; - /*0x0114*/ u16 unk114; - /*0x0118*/ u32 unk118; - /*0x011C*/ u32 unk11C; - /*0x0120*/ u32 unk120; - /*0x0124*/ u8 ALIGNED(4) unk124; - /*0x0128*/ u8 ALIGNED(4) unk128; - /*0x012C*/ u32 unk12C; - /*0x0130*/ u32 unk130[5]; - /*0x0144*/ u8 ALIGNED(4) unk144; - /*0x0148*/ u8 ALIGNED(4) unk148[11]; - /*0x0154*/ u8 ALIGNED(4) unk154; - /*0x0158*/ u8 ALIGNED(4) unk158[5]; - /*0x0160*/ struct DodrioSubstruct_0160 unk160; - /*0x318C*/ struct DodrioSubstruct_318C unk318C[5]; - /*0x31A0*/ struct DodrioSubstruct_31A0 unk31A0[5]; - /*0x32CC*/ struct DodrioSubstruct_31A0 unk32CC; - /*0x3308*/ struct DodrioSubstruct_3308 unk3308[5]; + /*0x0030*/ u8 ALIGNED(8) countdownEndDelay; + /*0x0034*/ u8 ALIGNED(4) posToPlayerId[MAX_RFU_PLAYERS]; + /*0x003C*/ u8 ALIGNED(4) unused2; // Set to 0, never read + /*0x0040*/ u8 ALIGNED(4) numGraySquares; + /*0x0044*/ u8 ALIGNED(4) berryColStart; + /*0x0048*/ u8 ALIGNED(4) berryColEnd; + /*0x004A*/ u16 berryResults[MAX_RFU_PLAYERS][NUM_BERRY_IDS]; + /*0x0086*/ u16 berriesEaten[MAX_RFU_PLAYERS]; + /*0x0090*/ u8 ALIGNED(4) difficulty[MAX_RFU_PLAYERS]; + /*0x0098*/ u8 ALIGNED(4) pickStateQueue[4]; + /*0x009C*/ u8 ALIGNED(4) eatTimer[NUM_BERRY_COLUMNS]; + /*0x00A8*/ u8 ALIGNED(4) inputState[MAX_RFU_PLAYERS]; + /*0x00B0*/ u8 ALIGNED(4) inputDelay[MAX_RFU_PLAYERS]; + /*0x00B8*/ u8 ALIGNED(4) berryEatenBy[NUM_BERRY_COLUMNS]; + /*0x00C4*/ u8 ALIGNED(4) berryState[NUM_BERRY_COLUMNS]; + /*0x00D0*/ u8 ALIGNED(4) fallTimer[NUM_BERRY_COLUMNS]; + /*0x00DC*/ u8 ALIGNED(4) newBerryTimer[NUM_BERRY_COLUMNS]; + /*0x00E8*/ u8 ALIGNED(4) prevBerryIds[NUM_BERRY_COLUMNS]; + /*0x00F4*/ u8 ALIGNED(4) playersAttemptingPick[NUM_BERRY_COLUMNS][2]; + /*0x010C*/ u8 ALIGNED(4) playAgainStates[MAX_RFU_PLAYERS]; + /*0x0112*/ u16 berriesPickedInRow; + /*0x0114*/ u16 maxBerriesPickedInRow; + /*0x0118*/ bool32 startCountdown; // Never read + /*0x011C*/ bool32 startGame; + /*0x0120*/ bool32 berriesFalling; + /*0x0124*/ u8 ALIGNED(4) clearRecvCmdTimer; + /*0x0128*/ u8 ALIGNED(4) clearRecvCmds; + /*0x012C*/ bool32 allReadyToEnd; + /*0x0130*/ bool32 readyToEnd[MAX_RFU_PLAYERS]; + /*0x0144*/ bool8 ALIGNED(4) playingPickSound; + /*0x0148*/ bool8 ALIGNED(4) playingSquishSound[NUM_BERRY_COLUMNS]; + /*0x0154*/ u8 ALIGNED(4) endSoundState; + /*0x0158*/ bool8 ALIGNED(4) readyToStart[MAX_RFU_PLAYERS]; + /*0x0160*/ struct DodrioGame_Gfx gfx; + /*0x318C*/ struct DodrioGame_MonInfo monInfo[MAX_RFU_PLAYERS]; + /*0x31A0*/ struct DodrioGame_Player players[MAX_RFU_PLAYERS]; + /*0x32CC*/ struct DodrioGame_Player player; + /*0x3308*/ struct DodrioGame_ScoreResults scoreResults[MAX_RFU_PLAYERS]; }; // size = 0x3330 -static EWRAM_DATA struct DodrioStruct * gUnknown_203F3E0 = NULL; +static EWRAM_DATA struct DodrioGame * sGame = NULL; +static EWRAM_DATA u16 *sDodrioSpriteIds[MAX_RFU_PLAYERS] = {NULL}; +static EWRAM_DATA u16 *sCloudSpriteIds[NUM_CLOUDS] = {NULL}; +static EWRAM_DATA u16 *sBerrySpriteIds[NUM_BERRY_COLUMNS] = {NULL}; +static EWRAM_DATA u16 *sBerryIconSpriteIds[NUM_BERRY_TYPES] = {NULL}; +static EWRAM_DATA struct StatusBar * sStatusBar = NULL; +static EWRAM_DATA struct DodrioGame_Gfx * sGfx = NULL; -static bool32 gUnknown_3002044; +static bool32 sExitingGame; -static void sub_81508D8(void); -static void sub_81508EC(struct DodrioStruct * dodrio); -static void sub_8150A84(u8 taskId); -static void sub_8150C78(void); -static void sub_8150CBC(void); -static void sub_8150CF4(void); -static void sub_8150D7C(void); -static void sub_8150DA4(void); -static void sub_8150E68(void); -static void sub_8150F40(void); -static void sub_8150FC4(void); -static void sub_8150FDC(void); -static void sub_815109C(void); -static void sub_8151198(void); -static void sub_81512B4(void); -static void sub_8151488(void); -static void sub_81514F0(void); -static void sub_815159C(void); -static void sub_81516DC(u8 taskId); -static void sub_8151750(u8 taskId); -static void sub_8151B54(void); -static void sub_8151BA0(void); -static void sub_8151C5C(void); -static void sub_8151D28(void); -static void sub_8151D98(void); -static void sub_8151E94(void); -static void sub_815201C(void); -static void sub_8152034(void); -static void sub_8152048(struct DodrioSubstruct_318C * dodrioMon, struct Pokemon * partyMon); -static void sub_815205C(TaskFunc func, u8 priority); -static void sub_815206C(TaskFunc func); -static void sub_8152090(u8 a0); -static bool32 sub_81520B4(void); -static void sub_8152110(void); -static bool32 sub_8152484(u8 a0, u8 a1, u8 a2); -static void sub_815256C(void); -static void sub_815293C(void); -static void sub_8152970(void); -static bool32 sub_8152A00(void); -static void sub_8152A70(void); -static void sub_81529A4(u8 a0, u8 *a1, u8 *a2); -static bool32 sub_8152A98(void); -static bool32 sub_8152AD8(void); -static void sub_8152B64(u8 a0); -static u8 sub_8152BD4(u8 a0); -static u8 sub_8152BF8(u8 a0, u8 a1); -static u8 sub_8152CB8(u8 arg0, u8 arg1); -static void sub_8152D34(u8 a0, u8 a1, u8 a2); -static void sub_8152F94(bool32 a0); -static void sub_8153004(void); -static void sub_8153048(void); -static void sub_8153150(void); -static void sub_81531FC(void); -static u8 sub_815327C(u8); -static void sub_81532B8(void); -static void sub_815336C(void); -static u32 sub_8153424(u8 mpId); -static void Task_ShowDodrioBerryPickingRecords(u8 taskId); -static void sub_81538D0(u8 windowId); +static void ResetTasksAndSprites(void); +static void InitDodrioGame(struct DodrioGame *); +static void Task_StartDodrioGame(u8); +static void DoGameIntro(void); +static void InitCountdown(void); +static void DoCountdown(void); +static void WaitGameStart(void); +static void PlayGame_Leader(void); +static void PlayGame_Member(void); +static void WaitEndGame_Leader(void); +static void WaitEndGame_Member(void); +static void InitResults_Leader(void); +static void InitResults_Member(void); +static void DoResults(void); +static void AskPlayAgain(void); +static void EndLink(void); +static void ExitGame(void); +static void ResetGame(void); +static void Task_NewGameIntro(u8); +static void Task_CommunicateMonInfo(u8); +static void RecvLinkData_Leader(void); +static void SendLinkData_Leader(void); +static void RecvLinkData_Member(void); +static void SendLinkData_Member(void); +static void HandleSound_Leader(void); +static void HandleSound_Member(void); +static void CB2_DodrioGame(void); +static void VBlankCB_DodrioGame(void); +static void InitMonInfo(struct DodrioGame_MonInfo *, struct Pokemon *); +static void CreateTask_(TaskFunc, u8); +static void CreateDodrioGameTask(TaskFunc); +static void SetGameFunc(u8); +static bool32 SlideTreeBordersOut(void); +static void InitFirstWaveOfBerries(void); +static bool32 TryPickBerry(u8, u8, u8); +static void UpdateFallingBerries(void); +static void UpdateGame_Leader(void); +static void UpdateGame_Member(void); +static bool32 AllPlayersReadyToStart(void); +static void ResetReadyToStart(void); +static void GetActiveBerryColumns(u8, u8 *, u8 *); +static bool32 ReadyToEndGame_Leader(void); +static bool32 ReadyToEndGame_Member(void); +static void TryIncrementDifficulty(u8); +static u8 GetPlayerIdAtColumn(u8); +static u8 GetNewBerryId(u8, u8); +static u8 GetNewBerryIdByDifficulty(u8, u8); +static void IncrementBerryResult(u8, u8, u8); +static void UpdateBerriesPickedInRow(bool32); +static void SetMaxBerriesPickedInRow(void); +static void ResetForPlayAgainPrompt(void); +static void SetRandomPrize(void); +static void TryUpdateRecords(void); +static u8 UpdatePickStateQueue(u8); +static void HandleWaitPlayAgainInput(void); +static void ResetPickState(void); +static u32 GetScore(u8); +static void Task_ShowDodrioBerryPickingRecords(u8); +static void PrintRecordsText(u8); +static void SpriteCB_Dodrio(struct Sprite *); +static u32 DoDodrioMissedAnim(struct Sprite *); +static u32 DoDodrioIntroAnim(struct Sprite *); +static void SetDodrioInvisibility(bool8, u8); +static void SpriteCB_Status(struct Sprite *); +static void SetBerryIconsInvisibility(bool8); +static void SpriteCB_Cloud(struct Sprite *); +static s16 GetDodrioXPos(u8, u8); +static void Task_TryRunGfxFunc(u8); +static void LoadGfx(void); +static void ShowNames(void); +static void ShowResults(void); +static void Msg_WantToPlayAgain(void); +static void Msg_SavingDontTurnOff(void); +static void Msg_CommunicationStandby(void); +static void EraseMessage(void); +static void Msg_SomeoneDroppedOut(void); +static void StopGfxFuncs(void); +static void GfxIdle(void); +static void SetGfxFunc(MainCallback); +static MainCallback GetGfxFunc(void); +static void InitBgs(void); +static bool32 LoadBgGfx(void); +static void InitGameGfx(struct DodrioGame_Gfx *); +static void LoadDodrioGfx(void); +static void CreateDodrioSprite(struct DodrioGame_MonInfo *, u8, u8, u8); +static void SetAllDodrioInvisibility(bool8, u8); +static void LoadBerryGfx(void); +static void CreateBerrySprites(void); +static void CreateCloudSprites(void); +static void CreateStatusBarSprites(void); +static void StartDodrioIntroAnim(u8); +static void SetGfxFuncById(u8); +static void SetStatusBarInvisibility(bool8); +static void ResetCloudPos(void); +static void SetCloudInvisibility(bool8); +static u8 GetPlayAgainState(void); +static u32 GetHighestScore(void); +static void ResetBerryAndStatusBarSprites(void); +static void FreeBerrySprites(void); +static void FreeStatusBar(void); +static void FreeDodrioSprites(u8); +static void FreeCloudSprites(void); +static void StartCloudMovement(void); +static void ResetGfxState(void); +static void InitStatusBarPos(void); +static bool32 DoStatusBarIntro(void); +static void StartDodrioMissedAnim(u8); +static void SetBerryInvisibility(u8, bool8); +static void SetBerryAnim(u16, u8); +static void SetBerryYPos(u8, u8); +static void SetDodrioAnim(u8, u8); +static void UpdateStatusBarAnim(u8); +static bool32 IsGfxFuncActive(void); +static u32 IncrementWithLimit(u32, u32); +static u32 Min(u32, u32); -// const rom data - -// Assets in this header are duplicated -#include "data/dodrio_berry_picking.h" - -static const u8 sUnknown_847553C[][3] = +// Unused duplicate +static const struct BgTemplate sBgTemplates_Duplicate[] = { - {40, 24, 13}, - {32, 19, 10}, - {22, 13, 7}, -}; - -ALIGNED(4) -static const u8 sUnknown_8475548[] = {8, 5, 8, 11, 15}; - -ALIGNED(4) -static const u8 sUnknown_8475550[] = {5, 10, 20, 30, 50, 70, 100}; - -ALIGNED(4) -static const u8 sUnknown_8475558[][10] = -{ - {15, 16, 17, 18, 19, 19, 18, 17, 16, 15}, - {20, 21, 22, 23, 24, 25, 26, 27, 28, 29}, - {30, 31, 32, 33, 34, 34, 33, 32, 31, 30}, -}; - -static void (*const sUnknown_8475578[])(void) = -{ - sub_8150C78, - sub_8150CBC, - sub_8150CF4, - sub_8150D7C, - sub_8150DA4, - sub_8150FDC, - sub_8151198, - sub_81512B4, - sub_8151488, - sub_81514F0, - sub_815159C, - sub_8150F40 -}; - -static void (*const sUnknown_84755A8[])(void) = -{ - sub_8150C78, - sub_8150CBC, - sub_8150CF4, - sub_8150D7C, - sub_8150E68, - sub_815109C, - sub_8151198, - sub_81512B4, - sub_8151488, - sub_81514F0, - sub_815159C, - sub_8150FC4 -}; - -void StartDodrioBerryPicking(u16 a0, MainCallback callback) -{ - gUnknown_3002044 = FALSE; - - if (gReceivedRemoteLinkPlayers && (gUnknown_203F3E0 = AllocZeroed(sizeof(*gUnknown_203F3E0))) != NULL) { - sub_81508D8(); - sub_81508EC(gUnknown_203F3E0); - gUnknown_203F3E0->savedCallback = callback; - gUnknown_203F3E0->multiplayerId = GetMultiplayerId(); - gUnknown_203F3E0->unk32CC = gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId]; - sub_8152048(&gUnknown_203F3E0->unk318C[gUnknown_203F3E0->multiplayerId], &gPlayerParty[a0]); - CreateTask(sub_8150A84, 1); - SetMainCallback2(sub_815201C); - sub_8153150(); - sub_81529A4(gUnknown_203F3E0->unk24, &gUnknown_203F3E0->unk44, &gUnknown_203F3E0->unk48); + .bg = BG_INTERFACE, + .charBaseIndex = 0, + .mapBaseIndex = 30, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = BG_TREE_LEFT, + .charBaseIndex = 2, + .mapBaseIndex = 12, + .screenSize = 1, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = BG_TREE_RIGHT, + .charBaseIndex = 2, + .mapBaseIndex = 14, + .screenSize = 1, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = BG_SCENERY, + .charBaseIndex = 3, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, +}; + +static const struct WindowTemplate sWindowTemplate_Dummy_Duplicate = DUMMY_WIN_TEMPLATE; + +static const struct WindowTemplate sWindowTemplates_Results_Duplicate[] = +{ + { + .bg = BG_INTERFACE, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 28, + .height = 3, + .paletteNum = 13, + .baseBlock = 0x13, + }, + { + .bg = BG_INTERFACE, + .tilemapLeft = 1, + .tilemapTop = 6, + .width = 28, + .height = 13, + .paletteNum = 13, + .baseBlock = 0x67, + } +}; + +static const struct WindowTemplate sWindowTemplate_Prize_Duplicate = +{ + .bg = BG_INTERFACE, + .tilemapLeft = 1, + .tilemapTop = 6, + .width = 28, + .height = 7, + .paletteNum = 13, + .baseBlock = 0x67, +}; + +static const struct WindowTemplate sWindowTemplates_PlayAgain_Duplicate[] = +{ + { + .bg = BG_INTERFACE, + .tilemapLeft = 1, + .tilemapTop = 8, + .width = 19, + .height = 3, + .paletteNum = 13, + .baseBlock = 0x13, + }, + { + .bg = BG_INTERFACE, + .tilemapLeft = 22, + .tilemapTop = 7, + .width = 6, + .height = 4, + .paletteNum = 13, + .baseBlock = 0x4C, + } +}; + +static const struct WindowTemplate sWindowTemplate_DroppedOut_Duplicate = +{ + .bg = BG_INTERFACE, + .tilemapLeft = 4, + .tilemapTop = 6, + .width = 22, + .height = 5, + .paletteNum = 13, + .baseBlock = 0x13, +}; + +static const struct WindowTemplate sWindowTemplate_CommStandby_Duplicate = +{ + .bg = BG_INTERFACE, + .tilemapLeft = 5, + .tilemapTop = 8, + .width = 19, + .height = 3, + .paletteNum = 13, + .baseBlock = 0x13, +}; + +// For each player, the array is a list of all the columns starting with the column to their left +// Only the range of active columns is read from the array (dependent on the number of players), +// so the arrays are spaced such that the numbers in the center are where the data that's read starts and end. +static const u8 sActiveColumnMap[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS][NUM_BERRY_COLUMNS] = +{ + { // 1 player (never used), columns 4-6. + // Sometimes read to get default order regardless of the current number of players + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, + }, + { // 2 players (never used), columns 3-6 + {0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 0}, + {0, 1, 2, 5, 6, 3, 4, 5, 8, 9, 0}, + }, + { // 3 players, columns 2-7 + {0, 1, 2, 3, 4, 5, 6, 7, 2, 9, 0}, + {0, 1, 4, 5, 6, 7, 2, 3, 4, 9, 0}, + {0, 1, 6, 7, 2, 3, 4, 5, 6, 9, 0}, + }, + { // 4 players, columns 1-8 + {0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 0}, + {0, 3, 4, 5, 6, 7, 8, 1, 2, 3, 0}, + {0, 5, 6, 7, 8, 1, 2, 3, 4, 5, 0}, + {0, 7, 8, 1, 2, 3, 4, 5, 6, 7, 0}, + }, + { // 5 players, all columns (0-9) + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }, + { 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2 }, + { 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4 }, + { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6 }, + { 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8 }, + }, +}; + +// A table for which falling berry column corresponds to which Dodrio head for each player +// The numbers in each array are the column number for each head, {left, middle, right} +// Dependent on the number of players +static const u8 sDodrioHeadToColumnMap[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS][3] = +{ + { // 1 player (never used) + {4, 5, 6}, + }, + { // 2 players (never used) + {3, 4, 5}, + {5, 6, 3}, + }, + { // 3 players + {4, 5, 6}, + {6, 7, 2}, + {2, 3, 4}, + }, + { // 4 players + {3, 4, 5}, + {5, 6, 7}, + {7, 8, 1}, + {1, 2, 3}, + }, + { // 5 players + {4, 5, 6}, + {6, 7, 8}, + {8, 9, 0}, + {0, 1, 2}, + {2, 3, 4}, + }, +}; + +// A table of player ids and their neighbor, dependent on the total number of players +// {L, M, R}, where M is the player in question, L is their neighbor to the left, and R is their neighbor to the right +static const u8 sDodrioNeighborMap[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS][3] = +{ + { // 1 player (never used) + {1, 0, 1}, + }, + { // 2 players (never used) + {1, 0, 1}, + {0, 1, 0}, + }, + { // 3 players + {2, 0, 1}, + {0, 1, 2}, + {1, 2, 0}, + }, + { // 4 players + {3, 0, 1}, + {0, 1, 2}, + {1, 2, 3}, + {2, 3, 0}, + }, + { // 5 players + {4, 0, 1}, + {0, 1, 2}, + {1, 2, 3}, + {2, 3, 4}, + {3, 4, 0}, + }, +}; + +#define x 9 // No player at this column. This may go out of bounds if this is returned + +// Takes the number of players and a column and returns the player id at that column. +// Note that the assignment is somewhat arbitrary as players share neighboring columns. +ALIGNED(4) +static const u8 sPlayerIdAtColumn[MAX_RFU_PLAYERS][NUM_BERRY_COLUMNS] = +{ + {x, x, x, x, 1, 1, 1, x, x, x, x}, // 1 player + {x, x, x, 0, 0, 1, 1, 0, x, x, x}, // 2 players + {x, x, 2, 2, 0, 0, 1, 1, 1, x, x}, // 3 players + {x, 3, 3, 0, 0, 1, 1, 2, 2, 3, x}, // 4 players + {3, 3, 4, 4, 0, 0, 1, 1, 2, 2, 3}, // 5 players +}; + +#undef x + +// Each array contains the columns that belong solely to one player, dependent on the number of players +// When determing how difficult the berries in a column should be, the highest +// difficulty of the players sharing that column is used. +// This table is used to skip that check, and instead automatically use the +// difficulty of the only player who can use the column. +static const u8 sUnsharedColumns[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS] = +{ + {5}, + {4, 6}, + {3, 5, 7}, + {2, 4, 6, 8}, +#ifndef BUGFIX + {1, 3, 5, 6, 9}, // BUG: Column 6 is shared, 7 is not. As a result, the player in column 7 will have their difficulty influenced by their neighbors +#else + {1, 3, 5, 7, 9}, +#endif +}; + +// Duplicate and unused gfx. +static const u32 sDuplicateGfx[] = INCBIN_U32("graphics/dodrio_berry_picking/bg.gbapal", + "graphics/dodrio_berry_picking/tree_border.gbapal", + "graphics/dodrio_berry_picking/dodrio.gbapal", + "graphics/dodrio_berry_picking/shiny.gbapal", + "graphics/dodrio_berry_picking/status.gbapal", + "graphics/dodrio_berry_picking/berries.gbapal", + "graphics/dodrio_berry_picking/berries.4bpp.lz", + "graphics/dodrio_berry_picking/cloud.gbapal", + "graphics/dodrio_berry_picking/bg.4bpp.lz", + "graphics/dodrio_berry_picking/tree_border.4bpp.lz", + "graphics/dodrio_berry_picking/status.4bpp.lz", + "graphics/dodrio_berry_picking/cloud.4bpp.lz", + "graphics/dodrio_berry_picking/dodrio.4bpp.lz", + "graphics/dodrio_berry_picking/bg.bin.lz", + "graphics/dodrio_berry_picking/tree_border_right.bin.lz", + "graphics/dodrio_berry_picking/tree_border_left.bin.lz"); + +static const u8 sBerryFallDelays[][3] = +{ + { [BERRY_BLUE] = 40, [BERRY_GREEN] = 24, [BERRY_GOLD] = 13 }, + { [BERRY_BLUE] = 32, [BERRY_GREEN] = 19, [BERRY_GOLD] = 10 }, + { [BERRY_BLUE] = 22, [BERRY_GREEN] = 13, [BERRY_GOLD] = 7 }, +}; + +// How far the outer tree borders should slide to reveal the game screen. +// Dependent on how many players are playing. +// Curiously the 2-player screen is narrower than the 1-player, though neither +// gets used as there's a 3 player minimum +ALIGNED(4) +static const u8 sTreeBorderXPos[MAX_RFU_PLAYERS] = {8, 5, 8, 11, 15}; + +// The number of berries eaten needed to progress to the next difficulty +ALIGNED(4) +static const u8 sDifficultyThresholds[NUM_DIFFICULTIES] = {5, 10, 20, 30, 50, 70, 100}; + +ALIGNED(4) +static const u8 sPrizeBerryIds[][10] = +{ + { // Possible prizes with 3 players + ITEM_TO_BERRY(ITEM_RAZZ_BERRY) - 1, + ITEM_TO_BERRY(ITEM_BLUK_BERRY) - 1, + ITEM_TO_BERRY(ITEM_NANAB_BERRY) - 1, + ITEM_TO_BERRY(ITEM_WEPEAR_BERRY) - 1, + ITEM_TO_BERRY(ITEM_PINAP_BERRY) - 1, + ITEM_TO_BERRY(ITEM_PINAP_BERRY) - 1, + ITEM_TO_BERRY(ITEM_WEPEAR_BERRY) - 1, + ITEM_TO_BERRY(ITEM_NANAB_BERRY) - 1, + ITEM_TO_BERRY(ITEM_BLUK_BERRY) - 1, + ITEM_TO_BERRY(ITEM_RAZZ_BERRY) - 1 + }, + { // Possible prizes with 4 players + ITEM_TO_BERRY(ITEM_POMEG_BERRY) - 1, + ITEM_TO_BERRY(ITEM_KELPSY_BERRY) - 1, + ITEM_TO_BERRY(ITEM_QUALOT_BERRY) - 1, + ITEM_TO_BERRY(ITEM_HONDEW_BERRY) - 1, + ITEM_TO_BERRY(ITEM_GREPA_BERRY) - 1, + ITEM_TO_BERRY(ITEM_TAMATO_BERRY) - 1, + ITEM_TO_BERRY(ITEM_CORNN_BERRY) - 1, + ITEM_TO_BERRY(ITEM_MAGOST_BERRY) - 1, + ITEM_TO_BERRY(ITEM_RABUTA_BERRY) - 1, + ITEM_TO_BERRY(ITEM_NOMEL_BERRY) - 1 + }, + { // Possible prizes with 5 players + ITEM_TO_BERRY(ITEM_SPELON_BERRY) - 1, + ITEM_TO_BERRY(ITEM_PAMTRE_BERRY) - 1, + ITEM_TO_BERRY(ITEM_WATMEL_BERRY) - 1, + ITEM_TO_BERRY(ITEM_DURIN_BERRY) - 1, + ITEM_TO_BERRY(ITEM_BELUE_BERRY) - 1, + ITEM_TO_BERRY(ITEM_BELUE_BERRY) - 1, + ITEM_TO_BERRY(ITEM_DURIN_BERRY) - 1, + ITEM_TO_BERRY(ITEM_WATMEL_BERRY) - 1, + ITEM_TO_BERRY(ITEM_PAMTRE_BERRY) - 1, + ITEM_TO_BERRY(ITEM_SPELON_BERRY) - 1 + }, +}; + +static void (*const sLeaderFuncs[])(void) = +{ + [FUNC_INTRO] = DoGameIntro, + [FUNC_INIT_COUNTDOWN] = InitCountdown, + [FUNC_COUNTDOWN] = DoCountdown, + [FUNC_WAIT_START] = WaitGameStart, + [FUNC_PLAY_GAME] = PlayGame_Leader, + [FUNC_INIT_RESULTS] = InitResults_Leader, + [FUNC_RESULTS] = DoResults, + [FUNC_ASK_PLAY_AGAIN] = AskPlayAgain, + [FUNC_END_LINK] = EndLink, + [FUNC_EXIT] = ExitGame, + [FUNC_RESET_GAME] = ResetGame, + [FUNC_WAIT_END_GAME] = WaitEndGame_Leader +}; + +static void (*const sMemberFuncs[])(void) = +{ + [FUNC_INTRO] = DoGameIntro, + [FUNC_INIT_COUNTDOWN] = InitCountdown, + [FUNC_COUNTDOWN] = DoCountdown, + [FUNC_WAIT_START] = WaitGameStart, + [FUNC_PLAY_GAME] = PlayGame_Member, + [FUNC_INIT_RESULTS] = InitResults_Member, + [FUNC_RESULTS] = DoResults, + [FUNC_ASK_PLAY_AGAIN] = AskPlayAgain, + [FUNC_END_LINK] = EndLink, + [FUNC_EXIT] = ExitGame, + [FUNC_RESET_GAME] = ResetGame, + [FUNC_WAIT_END_GAME] = WaitEndGame_Member +}; + +void StartDodrioBerryPicking(u16 partyId, MainCallback exitCallback) +{ + sExitingGame = FALSE; + + if (gReceivedRemoteLinkPlayers && (sGame = AllocZeroed(sizeof(*sGame)))) + { + ResetTasksAndSprites(); + InitDodrioGame(sGame); + sGame->exitCallback = exitCallback; + sGame->multiplayerId = GetMultiplayerId(); + sGame->player = sGame->players[sGame->multiplayerId]; + InitMonInfo(&sGame->monInfo[sGame->multiplayerId], &gPlayerParty[partyId]); + CreateTask(Task_StartDodrioGame, 1); + SetMainCallback2(CB2_DodrioGame); + SetRandomPrize(); + GetActiveBerryColumns(sGame->numPlayers, &sGame->berryColStart, &sGame->berryColEnd); StopMapMusic(); PlayNewMapMusic(MUS_BERRY_PICK); } else { - SetMainCallback2(callback); + // Exit - Alloc failed, or players not connected + SetMainCallback2(exitCallback); return; } } -static void sub_81508D8(void) +static void ResetTasksAndSprites(void) { ResetTasks(); ResetSpriteData(); FreeAllSpritePalettes(); } -static void sub_81508EC(struct DodrioStruct * data) +static void InitDodrioGame(struct DodrioGame * game) { u8 i; - data->unk0C = 0; - data->unk10 = 0; - data->unk14 = 0; - data->unk18 = 0; - data->unk1C = 0; - data->unk11C = 0; - data->unk120 = 0; - data->unk30 = 0; - data->unk40 = 0; - data->unk3C = 0; - data->unk12C = 0; + game->startState = 0; + game->state = 0; + game->timer = 0; + game->funcId = FUNC_INTRO; + game->prevFuncId = FUNC_INTRO; + game->startGame = FALSE; + game->berriesFalling = FALSE; + game->countdownEndDelay = 0; + game->numGraySquares = 0; + game->unused2 = 0; + game->allReadyToEnd = FALSE; - for (i = 0; i < 4; i++) + for (i = 0; i < ARRAY_COUNT(game->pickStateQueue); i++) + game->pickStateQueue[i] = PICK_NONE; + + for (i = 0; i < MAX_RFU_PLAYERS; i++) { - data->unk98[i] = 0; + game->inputState[i] = INPUTSTATE_NONE; + game->inputDelay[i] = 0; + game->berryResults[i][BERRY_BLUE] = 0; + game->berryResults[i][BERRY_GREEN] = 0; + game->berryResults[i][BERRY_GOLD] = 0; + game->berryResults[i][BERRY_MISSED] = 0; + game->berryResults[i][BERRY_IN_ROW] = 0; + game->playAgainStates[i] = PLAY_AGAIN_NONE; + game->readyToEnd[i] = FALSE; } - for (i = 0; i < 5; i++) + for (i = 0; i < NUM_BERRY_COLUMNS; i++) { - data->unkA8[i] = 0; - data->unkB0[i] = 0; - data->unk4A[i][0] = 0; - data->unk4A[i][1] = 0; - data->unk4A[i][2] = 0; - data->unk4A[i][3] = 0; - data->unk4A[i][5] = 0; - data->unk10C[i] = 0; - data->unk130[i] = 0; + game->fallTimer[i] = 0; + game->newBerryTimer[i] = 0; + game->berryState[i] = BERRYSTATE_NONE; + game->playersAttemptingPick[i][0] = PLAYER_NONE; + game->playersAttemptingPick[i][1] = PLAYER_NONE; } - for (i = 0; i < 11; i++) + game->isLeader = GetMultiplayerId() == 0 ? TRUE : FALSE; + game->numPlayers = GetLinkPlayerCount(); + game->posToPlayerId[0] = GetMultiplayerId(); + for (i = 1; i < game->numPlayers; i++) { - data->unkD0[i] = 0; - data->unkDC[i] = 0; - data->unkC4[i] = 0; - data->unkF4[i][0] = 0xFF; - data->unkF4[i][1] = 0xFF; - } - - data->unk20 = GetMultiplayerId() == 0 ? 1 : 0; - data->unk24 = GetLinkPlayerCount(); - data->unk34[0] = GetMultiplayerId(); - for (i = 1; i < data->unk24; i++) - { - data->unk34[i] = data->unk34[i - 1] + 1; - if (data->unk34[i] > data->unk24 - 1) - data->unk34[i] %= data->unk24; + game->posToPlayerId[i] = game->posToPlayerId[i - 1] + 1; + if (game->posToPlayerId[i] > game->numPlayers - 1) + game->posToPlayerId[i] %= game->numPlayers; } } -static void sub_8150A84(u8 taskId) +static void Task_StartDodrioGame(u8 taskId) { - u8 r4, r5; + u8 i, numPlayers; - switch (gUnknown_203F3E0->unk0C) + switch (sGame->startState) { case 0: SetVBlankCallback(NULL); - sub_815205C(sub_8151750, 4); - gUnknown_203F3E0->unk0C++; + CreateTask_(Task_CommunicateMonInfo, 4); + sGame->startState++; break; case 1: - if (!FuncIsActiveTask(sub_8151750)) + if (!FuncIsActiveTask(Task_CommunicateMonInfo)) { - sub_8154968(&gUnknown_203F3E0->unk160); - gUnknown_203F3E0->unk0C++; + InitGameGfx(&sGame->gfx); + sGame->startState++; } break; case 2: - if (!sub_8155E68()) + if (!IsGfxFuncActive()) { Rfu_SetLinkStandbyCallback(); - gUnknown_203F3E0->unk0C++; + sGame->startState++; } break; case 3: @@ -311,963 +839,972 @@ static void sub_8150A84(u8 taskId) LoadWirelessStatusIndicatorSpriteGfx(); CreateWirelessStatusIndicatorSprite(0, 0); } - gUnknown_203F3E0->unk0C++; + sGame->startState++; } break; case 4: - r5 = gUnknown_203F3E0->unk24; - sub_8153A9C(); - for (r4 = 0; r4 < r5; r4++) - { - sub_8153AFC(&gUnknown_203F3E0->unk318C[gUnknown_203F3E0->unk34[r4]], r4, gUnknown_203F3E0->unk34[r4], gUnknown_203F3E0->unk24); - } - sub_8153D80(FALSE, gUnknown_203F3E0->unk24); - gUnknown_203F3E0->unk0C++; + numPlayers = sGame->numPlayers; + LoadDodrioGfx(); + for (i = 0; i < numPlayers; i++) + CreateDodrioSprite(&sGame->monInfo[sGame->posToPlayerId[i]], i, sGame->posToPlayerId[i], sGame->numPlayers); + SetAllDodrioInvisibility(FALSE, sGame->numPlayers); + sGame->startState++; break; case 5: - sub_8154128(); - sub_815417C(); - sub_8154438(); - sub_8153E28(); - gUnknown_203F3E0->unk0C++; + LoadBerryGfx(); + CreateBerrySprites(); + CreateCloudSprites(); + CreateStatusBarSprites(); + sGame->startState++; break; case 6: - BlendPalettes(PALETTES_ALL, 0x10, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); - SetVBlankCallback(sub_8152034); - gUnknown_203F3E0->unk0C++; + SetVBlankCallback(VBlankCB_DodrioGame); + sGame->startState++; break; case 7: UpdatePaletteFade(); if (!gPaletteFade.active) - { - gUnknown_203F3E0->unk0C++; - } + sGame->startState++; break; default: DestroyTask(taskId); - sub_815206C(sub_81516DC); + CreateDodrioGameTask(Task_NewGameIntro); break; } } -static void sub_8150C08(u8 taskId) +static void Task_DodrioGame_Leader(u8 taskId) { - sub_8151B54(); - sUnknown_8475578[gUnknown_203F3E0->unk18](); - if (!gUnknown_3002044) - { - sub_815293C(); - } - sub_8151BA0(); + RecvLinkData_Leader(); + sLeaderFuncs[sGame->funcId](); + if (!sExitingGame) + UpdateGame_Leader(); + SendLinkData_Leader(); } -static void sub_8150C40(u8 taskId) +static void Task_DodrioGame_Member(u8 taskId) { - sub_8151C5C(); - sUnknown_84755A8[gUnknown_203F3E0->unk18](); - if (!gUnknown_3002044) - { - sub_8152970(); - } - sub_8151D28(); + RecvLinkData_Member(); + sMemberFuncs[sGame->funcId](); + if (!sExitingGame) + UpdateGame_Member(); + SendLinkData_Member(); } -static void sub_8150C78(void) +static void DoGameIntro(void) { - switch (gUnknown_203F3E0->unk10) + switch (sGame->state) { case 0: - sub_8153BF8(1); - sub_81549D4(1); - gUnknown_203F3E0->unk10++; + StartDodrioIntroAnim(1); + SetGfxFuncById(GFXFUNC_SHOW_NAMES); + sGame->state++; break; case 1: - if (!sub_8155E68()) - sub_8152090(1); + if (!IsGfxFuncActive()) + SetGameFunc(FUNC_INIT_COUNTDOWN); break; } } -static void sub_8150CBC(void) +static void InitCountdown(void) { - if (gUnknown_203F3E0->unk10 == 0) + switch (sGame->state) { - sub_8152110(); - gUnknown_203F3E0->unk10++; - } - else - { - gUnknown_203F3E0->unk118 = 1; - sub_8152090(2); + case 0: + InitFirstWaveOfBerries(); + sGame->state++; + break; + default: + sGame->startCountdown = TRUE; + SetGameFunc(FUNC_COUNTDOWN); + break; } } -static void sub_8150CF4(void) +static void DoCountdown(void) { - switch (gUnknown_203F3E0->unk10) + switch (sGame->state) { case 0: - StartMinigameCountdown(7, 8, 120, 80, 0); - gUnknown_203F3E0->unk10++; + StartMinigameCountdown(GFXTAG_COUNTDOWN, PALTAG_COUNTDOWN, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, 0); + sGame->state++; break; case 1: Rfu_SetLinkStandbyCallback(); - gUnknown_203F3E0->unk10++; + sGame->state++; break; case 2: if (IsLinkTaskFinished()) - { - gUnknown_203F3E0->unk10++; - } + sGame->state++; break; case 3: if (!IsMinigameCountdownRunning()) { Rfu_SetLinkStandbyCallback(); - gUnknown_203F3E0->unk10++; + sGame->state++; } break; case 4: if (IsLinkTaskFinished()) - { - sub_8152090(3); - } + SetGameFunc(FUNC_WAIT_START); break; } } -static void sub_8150D7C(void) +static void WaitGameStart(void) { - if (gUnknown_203F3E0->unk10 == 0) + switch (sGame->state) { - if (gUnknown_203F3E0->unk11C != 0) - { - sub_8152090(4); - } + case 0: + if (sGame->startGame) + SetGameFunc(FUNC_PLAY_GAME); + break; } } -static void sub_8150DA4(void) +static void PlayGame_Leader(void) { - if (gUnknown_203F3E0->unk10 == 0) + switch (sGame->state) { - if (gUnknown_203F3E0->unk40 < 10) + case 0: + if (sGame->numGraySquares < NUM_STATUS_SQUARES) { - if (gUnknown_203F3E0->unkA8[0] == 0) + if (sGame->inputState[0] == INPUTSTATE_NONE) { if (JOY_NEW(DPAD_UP)) { - if (gUnknown_203F3E0->unk31A0[0].unk2C.unk0 == 0) + if (sGame->players[0].comm.pickState == PICK_NONE) { - gUnknown_203F3E0->unk31A0[0].unk2C.unk4 = 0; - gUnknown_203F3E0->unk31A0[0].unk2C.unk0 = sub_815327C(2); + sGame->players[0].comm.ateBerry = FALSE; + sGame->players[0].comm.pickState = UpdatePickStateQueue(PICK_MIDDLE); } } else if (JOY_NEW(DPAD_RIGHT)) { - if (gUnknown_203F3E0->unk31A0[0].unk2C.unk0 == 0) + if (sGame->players[0].comm.pickState == PICK_NONE) { - gUnknown_203F3E0->unk31A0[0].unk2C.unk4 = 0; - gUnknown_203F3E0->unk31A0[0].unk2C.unk0 = sub_815327C(1); + sGame->players[0].comm.ateBerry = FALSE; + sGame->players[0].comm.pickState = UpdatePickStateQueue(PICK_RIGHT); } } else if (JOY_NEW(DPAD_LEFT)) { - if (gUnknown_203F3E0->unk31A0[0].unk2C.unk0 == 0) + if (sGame->players[0].comm.pickState == PICK_NONE) { - gUnknown_203F3E0->unk31A0[0].unk2C.unk4 = 0; - gUnknown_203F3E0->unk31A0[0].unk2C.unk0 = sub_815327C(3); + sGame->players[0].comm.ateBerry = FALSE; + sGame->players[0].comm.pickState = UpdatePickStateQueue(PICK_LEFT); } } else { - gUnknown_203F3E0->unk31A0[0].unk2C.unk0 = sub_815327C(0); + sGame->players[0].comm.pickState = UpdatePickStateQueue(PICK_NONE); } } } else { - sub_8152090(11); + SetGameFunc(FUNC_WAIT_END_GAME); } - sub_815256C(); - sub_8151D98(); + UpdateFallingBerries(); + HandleSound_Leader(); + break; } } -static void sub_8150E68(void) +static void PlayGame_Member(void) { - if (gUnknown_203F3E0->unk40 < 10) + if (sGame->numGraySquares < NUM_STATUS_SQUARES) { if (JOY_NEW(DPAD_UP)) { - if (gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk0 == 0) - { - gUnknown_203F3E0->unk32CC.unk2C.unk0 = 2; - } + if (sGame->players[sGame->multiplayerId].comm.pickState == PICK_NONE) + sGame->player.comm.pickState = PICK_MIDDLE; } else if (JOY_NEW(DPAD_RIGHT)) { - if (gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk0 == 0) - { - gUnknown_203F3E0->unk32CC.unk2C.unk0 = 1; - } + if (sGame->players[sGame->multiplayerId].comm.pickState == PICK_NONE) + sGame->player.comm.pickState = PICK_RIGHT; } else if (JOY_NEW(DPAD_LEFT)) { - if (gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk0 == 0) - { - gUnknown_203F3E0->unk32CC.unk2C.unk0 = 3; - } + if (sGame->players[sGame->multiplayerId].comm.pickState == PICK_NONE) + sGame->player.comm.pickState = PICK_LEFT; } else { - gUnknown_203F3E0->unk32CC.unk2C.unk0 = 0; + sGame->player.comm.pickState = PICK_NONE; } } else { - sub_8152090(11); + SetGameFunc(FUNC_WAIT_END_GAME); } - sub_8151E94(); + HandleSound_Member(); } -static void sub_8150F40(void) +static void WaitEndGame_Leader(void) { u8 i; - sub_815256C(); - sub_8151D98(); - if (sub_8152A98() == 1) + UpdateFallingBerries(); + HandleSound_Leader(); + if (ReadyToEndGame_Leader() == TRUE) { - sub_8153004(); - sub_8152090(5); + SetMaxBerriesPickedInRow(); + SetGameFunc(FUNC_INIT_RESULTS); } else { - gUnknown_203F3E0->unk12C = 1; - for (i = 1; i < gUnknown_203F3E0->unk24; i++) + sGame->allReadyToEnd = TRUE; + for (i = 1; i < sGame->numPlayers; i++) { - if (gUnknown_203F3E0->unk130[i] != 1) + if (sGame->readyToEnd[i] != TRUE) { - gUnknown_203F3E0->unk12C = 0; + sGame->allReadyToEnd = FALSE; break; } } } } -static void sub_8150FC4(void) +static void WaitEndGame_Member(void) { - sub_8151E94(); - if (sub_8152AD8() == 1) - sub_8152090(5); + HandleSound_Member(); + if (ReadyToEndGame_Member() == TRUE) + SetGameFunc(FUNC_INIT_RESULTS); } -static void sub_8150FDC(void) +static void InitResults_Leader(void) { u8 blockReceivedStatus; u8 i; - switch (gUnknown_203F3E0->unk10) + switch (sGame->state) { case 0: - SendBlock(0, gUnknown_203F3E0->unk4A, sizeof(gUnknown_203F3E0->unk4A)); - gUnknown_203F3E0->unk08 = 0; - gUnknown_203F3E0->unk10++; + SendBlock(0, sGame->berryResults, sizeof(sGame->berryResults)); + sGame->playersReceived = 0; + sGame->state++; break; case 1: if (IsLinkTaskFinished()) - { - gUnknown_203F3E0->unk10++; - } + sGame->state++; break; case 2: blockReceivedStatus = GetBlockReceivedStatus(); - for (i = 0; i < gUnknown_203F3E0->unk24; blockReceivedStatus >>= 1, i++) + for (i = 0; i < sGame->numPlayers; blockReceivedStatus >>= 1, i++) { if (blockReceivedStatus & 1) { ResetBlockReceivedFlag(i); - gUnknown_203F3E0->unk08++; + sGame->playersReceived++; } } - if (gUnknown_203F3E0->unk08 >= gUnknown_203F3E0->unk24) + if (sGame->playersReceived >= sGame->numPlayers) { - gUnknown_203F3E0->unk14++; - gUnknown_203F3E0->unk10++; + sGame->timer++; + sGame->state++; } break; default: if (WaitFanfare(TRUE)) { - sub_8152090(6); + SetGameFunc(FUNC_RESULTS); FadeOutAndPlayNewMapMusic(MUS_VICTORY_WILD, 4); } break; } } -static void sub_815109C(void) +static void InitResults_Member(void) { u8 i; u8 blockReceivedStatus; - switch (gUnknown_203F3E0->unk10) { + switch (sGame->state) { case 0: - SendBlock(0, gUnknown_203F3E0->unk4A[gUnknown_203F3E0->unk14], sizeof(gUnknown_203F3E0->unk4A)); - gUnknown_203F3E0->unk08 = 0; - gUnknown_203F3E0->unk10++; + SendBlock(0, sGame->berryResults[sGame->timer], sizeof(sGame->berryResults)); + sGame->playersReceived = 0; + sGame->state++; break; case 1: - if (IsLinkTaskFinished()) { - gUnknown_203F3E0->unk10++; - } + if (IsLinkTaskFinished()) + sGame->state++; break; case 2: blockReceivedStatus = GetBlockReceivedStatus(); - for (i = 0; i < gUnknown_203F3E0->unk24; blockReceivedStatus >>= 1, i++) + for (i = 0; i < sGame->numPlayers; blockReceivedStatus >>= 1, i++) { if (blockReceivedStatus & 1) { - memcpy(gUnknown_203F3E0->unk4A, gBlockRecvBuffer, sizeof(gUnknown_203F3E0->unk4A)); + memcpy(sGame->berryResults, gBlockRecvBuffer, sizeof(sGame->berryResults)); ResetBlockReceivedFlag(i); - gUnknown_203F3E0->unk08++; + sGame->playersReceived++; } } - if (gUnknown_203F3E0->unk08 >= gUnknown_203F3E0->unk24) { - gUnknown_203F3E0->unk14++; - gUnknown_203F3E0->unk10++; + if (sGame->playersReceived >= sGame->numPlayers) + { + sGame->timer++; + sGame->state++; } break; default: - if (WaitFanfare(TRUE)) { - gUnknown_203F3E0->unk114 = gUnknown_203F3E0->unk4A[gUnknown_203F3E0->multiplayerId][5]; - sub_8152090(6); + if (WaitFanfare(TRUE)) + { + sGame->maxBerriesPickedInRow = sGame->berryResults[sGame->multiplayerId][BERRY_IN_ROW]; + SetGameFunc(FUNC_RESULTS); FadeOutAndPlayNewMapMusic(MUS_VICTORY_WILD, 4); } break; } } -static void sub_8151198(void) +static void DoResults(void) { - u8 sp00; + u8 playAgainState; u8 i; u8 blockReceivedStatus; - switch (gUnknown_203F3E0->unk10) + switch (sGame->state) { case 0: - sub_81531FC(); - sub_81540DC(TRUE); - sub_81544F0(); - sub_81545BC(TRUE); - sub_81549D4(2); - gUnknown_203F3E0->unk10++; + TryUpdateRecords(); + SetStatusBarInvisibility(TRUE); + ResetCloudPos(); + SetCloudInvisibility(TRUE); + SetGfxFuncById(2); + sGame->state++; break; case 1: - if (!sub_8155E68()) + if (!IsGfxFuncActive()) { - sp00 = 1; - sub_81549D4(5); - sp00 = sub_8155E8C(); - SendBlock(0, &sp00, sizeof(sp00)); - gUnknown_203F3E0->unk10++; + playAgainState = PLAY_AGAIN_YES; + SetGfxFuncById(GFXFUNC_MSG_COMM_STANDBY); + playAgainState = GetPlayAgainState(); + SendBlock(0, &playAgainState, sizeof(playAgainState)); + sGame->state++; } break; case 2: if (IsLinkTaskFinished()) { - gUnknown_203F3E0->unk10++; - gUnknown_203F3E0->unk08 = 0; + sGame->state++; + sGame->playersReceived = 0; } break; case 3: blockReceivedStatus = GetBlockReceivedStatus(); - for (i = 0; i < gUnknown_203F3E0->unk24; blockReceivedStatus >>= 1, i++) + for (i = 0; i < sGame->numPlayers; blockReceivedStatus >>= 1, i++) { if (blockReceivedStatus & 1) { - *(gUnknown_203F3E0->unk10C + i) = *(u8 *)gBlockRecvBuffer[i]; + *(sGame->playAgainStates + i) = *(u8 *)gBlockRecvBuffer[i]; ResetBlockReceivedFlag(i); - gUnknown_203F3E0->unk08++; + sGame->playersReceived++; } } - if (gUnknown_203F3E0->unk08 >= gUnknown_203F3E0->unk24) { - if (++gUnknown_203F3E0->unk14 >= 120) + if (sGame->playersReceived >= sGame->numPlayers) + { + if (++sGame->timer >= 120) { - sub_81549D4(6); - gUnknown_203F3E0->unk10++; + SetGfxFuncById(GFXFUNC_ERASE_MSG); + sGame->state++; } } break; default: - if (!sub_8155E68()) - { - sub_8152090(7); - } + if (!IsGfxFuncActive()) + SetGameFunc(FUNC_ASK_PLAY_AGAIN); break; } } -static void sub_81512B4(void) +static void AskPlayAgain(void) { - u8 sp0; + u8 playAgainState; u8 i; u8 blockReceivedStatus; - switch (gUnknown_203F3E0->unk10) + switch (sGame->state) { case 0: - if (sub_81534AC() >= 3000) - { - sub_81549D4(4); - } - gUnknown_203F3E0->unk10++; + if (GetHighestScore() >= PRIZE_SCORE) + SetGfxFuncById(GFXFUNC_MSG_SAVING); + sGame->state++; break; case 1: - if (!sub_8155E68()) + if (!IsGfxFuncActive()) { - sub_81549D4(3); - gUnknown_203F3E0->unk10++; + SetGfxFuncById(GFXFUNC_MSG_PLAY_AGAIN); + sGame->state++; } break; case 2: - sub_81546C0(); - sub_8153048(); - gUnknown_203F3E0->unk10++; + ResetBerryAndStatusBarSprites(); + ResetForPlayAgainPrompt(); + sGame->state++; break; case 3: - if ((sp0 = sub_8155E8C()) != 0) - { - gUnknown_203F3E0->unk10++; - } + if ((playAgainState = GetPlayAgainState()) != PLAY_AGAIN_NONE) + sGame->state++; break; case 4: - if (!sub_8155E68()) + if (!IsGfxFuncActive()) { - sub_81549D4(5); - sp0 = sub_8155E8C(); - SendBlock(0, &sp0, sizeof(sp0)); - gUnknown_203F3E0->unk10++; + SetGfxFuncById(GFXFUNC_MSG_COMM_STANDBY); + playAgainState = GetPlayAgainState(); + SendBlock(0, &playAgainState, sizeof(playAgainState)); + sGame->state++; } break; case 5: if (IsLinkTaskFinished()) { - gUnknown_203F3E0->unk10++; - gUnknown_203F3E0->unk08 = 0; + sGame->state++; + sGame->playersReceived = 0; } break; case 6: blockReceivedStatus = GetBlockReceivedStatus(); - for (i = 0; i < gUnknown_203F3E0->unk24; blockReceivedStatus >>= 1, i++) + for (i = 0; i < sGame->numPlayers; blockReceivedStatus >>= 1, i++) { if (blockReceivedStatus & 1) { - *(gUnknown_203F3E0->unk10C + i) = *(u8 *)gBlockRecvBuffer[i]; + *(sGame->playAgainStates + i) = *(u8 *)gBlockRecvBuffer[i]; ResetBlockReceivedFlag(i); - gUnknown_203F3E0->unk08++; + sGame->playersReceived++; } } - if (gUnknown_203F3E0->unk08 >= gUnknown_203F3E0->unk24) { - if (++gUnknown_203F3E0->unk14 >= 120) + if (sGame->playersReceived >= sGame->numPlayers) + { + if (++sGame->timer >= 120) { - sub_815336C(); - sub_81549D4(6); - gUnknown_203F3E0->unk10++; + ResetPickState(); + SetGfxFuncById(GFXFUNC_ERASE_MSG); + sGame->state++; } } else { - sub_81532B8(); + HandleWaitPlayAgainInput(); } break; default: - if (!sub_8155E68()) + if (!IsGfxFuncActive()) { - for (i = 0; i < gUnknown_203F3E0->unk24; i++) + for (i = 0; i < sGame->numPlayers; i++) { - if (gUnknown_203F3E0->unk10C[i] == 2) + if (sGame->playAgainStates[i] == PLAY_AGAIN_NO) { - sub_8152090(8); + SetGameFunc(FUNC_END_LINK); return; } } - sub_8152090(10); + SetGameFunc(FUNC_RESET_GAME); } break; } } -static void sub_8151488(void) +static void EndLink(void) { - switch (gUnknown_203F3E0->unk10) + switch (sGame->state) { case 0: SetCloseLinkCallback(); - sub_81549D4(7); - gUnknown_203F3E0->unk10++; + SetGfxFuncById(GFXFUNC_MSG_PLAYER_DROPPED); + sGame->state++; break; case 1: - if (!sub_8155E68()) - { - gUnknown_203F3E0->unk10++; - } + if (!IsGfxFuncActive()) + sGame->state++; break; case 2: - if (sub_8155E8C() == 5) - { - gUnknown_203F3E0->unk10++; - } + if (GetPlayAgainState() == PLAY_AGAIN_DROPPED) + sGame->state++; break; default: if (!gReceivedRemoteLinkPlayers) - { - sub_8152090(9); - } + SetGameFunc(FUNC_EXIT); break; } } -static void sub_81514F0(void) +static void ExitGame(void) { - switch (gUnknown_203F3E0->unk10) + switch (sGame->state) { case 0: BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); - gUnknown_203F3E0->unk10++; + sGame->state++; break; case 1: UpdatePaletteFade(); if (!gPaletteFade.active) - { - gUnknown_203F3E0->unk10++; - } + sGame->state++; break; case 2: - sub_8154274(); - sub_8153ED8(); - sub_8153D08(gUnknown_203F3E0->unk24); - sub_8154578(); - gUnknown_3002044 = TRUE; - sub_81549D4(8); - gUnknown_203F3E0->unk10++; + FreeBerrySprites(); + FreeStatusBar(); + FreeDodrioSprites(sGame->numPlayers); + FreeCloudSprites(); + sExitingGame = TRUE; + SetGfxFuncById(GFXFUNC_STOP); + sGame->state++; break; default: - if (!sub_8155E68()) + if (!IsGfxFuncActive()) { - SetMainCallback2(gUnknown_203F3E0->savedCallback); - DestroyTask(gUnknown_203F3E0->unk04); - Free(gUnknown_203F3E0); + SetMainCallback2(sGame->exitCallback); + DestroyTask(sGame->taskId); + Free(sGame); FreeAllWindowBuffers(); } break; } } -static void sub_815159C(void) +static void ResetGame(void) { - switch (gUnknown_203F3E0->unk10) + switch (sGame->state) { case 0: - sub_81549D4(9); + SetGfxFuncById(GFXFUNC_IDLE); BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); - gUnknown_203F3E0->unk10++; + sGame->state++; break; case 1: UpdatePaletteFade(); if (!gPaletteFade.active) - { - gUnknown_203F3E0->unk10++; - } + sGame->state++; break; case 2: - ChangeBgX(0, 0, 0); - ChangeBgY(0, 0, 0); - ChangeBgX(1, 0, 0); - ChangeBgY(1, 0, 0); - ChangeBgX(2, 0, 0); - ChangeBgY(2, 0, 0); - ChangeBgX(3, 0, 0); - ChangeBgY(3, 0, 0); - gUnknown_203F3E0->unk10++; + ChangeBgX(0, 0, BG_COORD_SET); + ChangeBgY(0, 0, BG_COORD_SET); + ChangeBgX(1, 0, BG_COORD_SET); + ChangeBgY(1, 0, BG_COORD_SET); + ChangeBgX(2, 0, BG_COORD_SET); + ChangeBgY(2, 0, BG_COORD_SET); + ChangeBgX(3, 0, BG_COORD_SET); + ChangeBgY(3, 0, BG_COORD_SET); + sGame->state++; break; case 3: StopMapMusic(); - gUnknown_203F3E0->unk10++; + sGame->state++; break; case 4: PlayNewMapMusic(MUS_BERRY_PICK); - sub_8154540(); - gUnknown_203F3E0->unk10++; + StartCloudMovement(); + sGame->state++; break; case 5: BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); - gUnknown_203F3E0->unk10++; + sGame->state++; break; case 6: UpdatePaletteFade(); if (!gPaletteFade.active) - { - gUnknown_203F3E0->unk10++; - } + sGame->state++; break; default: - DestroyTask(gUnknown_203F3E0->unk04); - sub_815206C(sub_81516DC); - sub_8154730(); - sub_81508EC(gUnknown_203F3E0); + DestroyTask(sGame->taskId); + CreateDodrioGameTask(Task_NewGameIntro); + ResetGfxState(); + InitDodrioGame(sGame); if (!gReceivedRemoteLinkPlayers) - { - gUnknown_203F3E0->unk24 = 1; - } - sub_8153150(); - sub_81545BC(FALSE); + sGame->numPlayers = 1; + SetRandomPrize(); + SetCloudInvisibility(FALSE); break; } } -static void sub_81516DC(u8 taskId) +static void Task_NewGameIntro(u8 taskId) { - switch (gUnknown_203F3E0->unk10) + switch (sGame->state) { case 0: - if (sub_81520B4() == 1) - { - gUnknown_203F3E0->unk10++; - } + if (SlideTreeBordersOut() == TRUE) + sGame->state++; break; case 1: - sub_8153DD8(); - gUnknown_203F3E0->unk10++; + InitStatusBarPos(); + sGame->state++; break; case 2: - if (sub_8153F1C() == TRUE) - { - gUnknown_203F3E0->unk10++; - } + if (DoStatusBarIntro() == TRUE) + sGame->state++; break; default: - if (gUnknown_203F3E0->unk20 != 0) - { - sub_815206C(sub_8150C08); - } + if (sGame->isLeader) + CreateDodrioGameTask(Task_DodrioGame_Leader); else - { - sub_815206C(sub_8150C40); - } + CreateDodrioGameTask(Task_DodrioGame_Member); DestroyTask(taskId); break; } } -static void sub_8151750(u8 taskId) +#define tState data[0] + +static void Task_CommunicateMonInfo(u8 taskId) { s16 * data = gTasks[taskId].data; u8 i; u8 blockReceivedStatus; - switch (data[0]) + switch (tState) { case 0: - SendBlock(0, &gUnknown_203F3E0->unk318C[gUnknown_203F3E0->multiplayerId].isShiny, sizeof(gUnknown_203F3E0->unk318C[gUnknown_203F3E0->multiplayerId].isShiny)); - gUnknown_203F3E0->unk08 = 0; - data[0]++; + SendBlock(0, &sGame->monInfo[sGame->multiplayerId].isShiny, sizeof(sGame->monInfo[sGame->multiplayerId].isShiny)); + sGame->playersReceived = 0; + tState++; break; case 1: if (IsLinkTaskFinished()) - { - data[0]++; - } + tState++; break; case 2: blockReceivedStatus = GetBlockReceivedStatus(); - for (i = 0; i < gUnknown_203F3E0->unk24; blockReceivedStatus >>= 1, i++) + for (i = 0; i < sGame->numPlayers; blockReceivedStatus >>= 1, i++) { if (blockReceivedStatus & 1) { - *(u8 *)&gUnknown_203F3E0->unk318C[i] = *(u8 *)gBlockRecvBuffer[i]; + *(u8 *)&sGame->monInfo[i] = *(u8 *)gBlockRecvBuffer[i]; ResetBlockReceivedFlag(i); - gUnknown_203F3E0->unk08++; + sGame->playersReceived++; } } - if (gUnknown_203F3E0->unk08 >= gUnknown_203F3E0->unk24) + if (sGame->playersReceived >= sGame->numPlayers) { DestroyTask(taskId); - sub_81549D4(6); - gUnknown_203F3E0->unk10++; + SetGfxFuncById(GFXFUNC_ERASE_MSG); + sGame->state++; } break; } } -static void sub_815184C(void) +#undef tState + +static void RecvLinkData_Gameplay(void) { u8 i; - u8 r7 = gUnknown_203F3E0->unk24; + u8 numPlayers = sGame->numPlayers; - gUnknown_203F3E0->unk31A0[0].unk10 = sub_815A950(0, &gUnknown_203F3E0->unk31A0[0], &gUnknown_203F3E0->unk31A0[0].unk2C, &gUnknown_203F3E0->unk31A0[1].unk2C, &gUnknown_203F3E0->unk31A0[2].unk2C, &gUnknown_203F3E0->unk31A0[3].unk2C, &gUnknown_203F3E0->unk31A0[4].unk2C, &gUnknown_203F3E0->unk40, &gUnknown_203F3E0->unk120, &gUnknown_203F3E0->unk12C); - gUnknown_203F3E0->unk128 = 1; + sGame->players[0].receivedGameStatePacket = RecvPacket_GameState(0, + &sGame->players[0], + &sGame->players[0].comm, + &sGame->players[1].comm, + &sGame->players[2].comm, + &sGame->players[3].comm, + &sGame->players[4].comm, + &sGame->numGraySquares, + &sGame->berriesFalling, + &sGame->allReadyToEnd); + sGame->clearRecvCmds = TRUE; - for (i = 1; i < r7; i++) + for (i = 1; i < numPlayers; i++) { - if ( gUnknown_203F3E0->unkA8[i] == 0 - && sub_815AB04(i, &gUnknown_203F3E0->unk31A0[i].unk2C.unk0) == 0) + if (sGame->inputState[i] == INPUTSTATE_NONE && !RecvPacket_PickState(i, &sGame->players[i].comm.pickState)) { - gUnknown_203F3E0->unk31A0[i].unk2C.unk0 = 0; - gUnknown_203F3E0->unk128 = 0; + sGame->players[i].comm.pickState = PICK_NONE; + sGame->clearRecvCmds = FALSE; } } - if (++gUnknown_203F3E0->unk124 >= 60) + if (++sGame->clearRecvCmdTimer >= 60) { - if (gUnknown_203F3E0->unk128 != 0) + if (sGame->clearRecvCmds) { ClearRecvCommands(); - gUnknown_203F3E0->unk124 = 0; + sGame->clearRecvCmdTimer = 0; } - else if (gUnknown_203F3E0->unk124 > 70) + else if (sGame->clearRecvCmdTimer > 70) { ClearRecvCommands(); - gUnknown_203F3E0->unk124 = 0; + sGame->clearRecvCmdTimer = 0; } } - for (i = 0; i < r7; i++) + for (i = 0; i < numPlayers; i++) { - if ( gUnknown_203F3E0->unk31A0[i].unk2C.unk0 != 0 - && gUnknown_203F3E0->unkA8[i] == 0) + if (sGame->players[i].comm.pickState != PICK_NONE && sGame->inputState[i] == INPUTSTATE_NONE) + sGame->inputState[i] = INPUTSTATE_TRY_PICK; + + switch (sGame->inputState[i]) { - gUnknown_203F3E0->unkA8[i] = 1; - } - switch (gUnknown_203F3E0->unkA8[i]) - { - case 0: + case INPUTSTATE_NONE: default: break; - case 1 ... 3: - if (++gUnknown_203F3E0->unkB0[i] >= 6) + case INPUTSTATE_TRY_PICK: + case INPUTSTATE_PICKED: + case INPUTSTATE_ATE_BERRY: + if (++sGame->inputDelay[i] >= 6) { - gUnknown_203F3E0->unkB0[i] = 0; - gUnknown_203F3E0->unkA8[i] = 0; - gUnknown_203F3E0->unk31A0[i].unk2C.unk0 = 0; - gUnknown_203F3E0->unk31A0[i].unk2C.unk4 = 0; - gUnknown_203F3E0->unk31A0[i].unk2C.unk8 = 0; + sGame->inputDelay[i] = 0; + sGame->inputState[i] = INPUTSTATE_NONE; + sGame->players[i].comm.pickState = PICK_NONE; + sGame->players[i].comm.ateBerry = FALSE; + sGame->players[i].comm.missedBerry = FALSE; } break; - case 4: - if (++gUnknown_203F3E0->unkB0[i] >= 40) + case INPUTSTATE_BAD_MISS: + // Tried to pick with no berry in range, long delay until next input + if (++sGame->inputDelay[i] >= 40) { - gUnknown_203F3E0->unkB0[i] = 0; - gUnknown_203F3E0->unkA8[i] = 0; - gUnknown_203F3E0->unk31A0[i].unk2C.unk0 = 0; - gUnknown_203F3E0->unk31A0[i].unk2C.unk4 = 0; - gUnknown_203F3E0->unk31A0[i].unk2C.unk8 = 0; + sGame->inputDelay[i] = 0; + sGame->inputState[i] = INPUTSTATE_NONE; + sGame->players[i].comm.pickState = PICK_NONE; + sGame->players[i].comm.ateBerry = FALSE; + sGame->players[i].comm.missedBerry = FALSE; } break; } } } -static void sub_8151A5C(void) +static void RecvLinkData_ReadyToEnd(void) { u8 i; - u8 r6 = gUnknown_203F3E0->unk24; + u8 numPlayers = sGame->numPlayers; - gUnknown_203F3E0->unk31A0[0].unk10 = sub_815A950(0, &gUnknown_203F3E0->unk31A0[0], &gUnknown_203F3E0->unk31A0[0].unk2C, &gUnknown_203F3E0->unk31A0[1].unk2C, &gUnknown_203F3E0->unk31A0[2].unk2C, &gUnknown_203F3E0->unk31A0[3].unk2C, &gUnknown_203F3E0->unk31A0[4].unk2C, &gUnknown_203F3E0->unk40, &gUnknown_203F3E0->unk120, &gUnknown_203F3E0->unk12C); - gUnknown_203F3E0->unk128 = 1; + sGame->players[0].receivedGameStatePacket = RecvPacket_GameState(0, + &sGame->players[0], + &sGame->players[0].comm, + &sGame->players[1].comm, + &sGame->players[2].comm, + &sGame->players[3].comm, + &sGame->players[4].comm, + &sGame->numGraySquares, + &sGame->berriesFalling, + &sGame->allReadyToEnd); + sGame->clearRecvCmds = TRUE; - for (i = 1; i < r6; i++) + for (i = 1; i < numPlayers; i++) { - if (sub_815AB60(i) != 0) + if (RecvPacket_ReadyToEnd(i)) { - gUnknown_203F3E0->unk130[i] = 1; - gUnknown_203F3E0->unk128 = 0; + sGame->readyToEnd[i] = TRUE; + sGame->clearRecvCmds = FALSE; } } - if (++gUnknown_203F3E0->unk124 >= 60) + if (++sGame->clearRecvCmdTimer >= 60) { - if (gUnknown_203F3E0->unk128 != 0) + if (sGame->clearRecvCmds) { ClearRecvCommands(); - gUnknown_203F3E0->unk124 = 0; + sGame->clearRecvCmdTimer = 0; } - else if (gUnknown_203F3E0->unk124 > 70) + else if (sGame->clearRecvCmdTimer > 70) { ClearRecvCommands(); - gUnknown_203F3E0->unk124 = 0; + sGame->clearRecvCmdTimer = 0; } } } -static void sub_8151B54(void) +static void RecvLinkData_Leader(void) { - switch (gUnknown_203F3E0->unk18) + switch (sGame->funcId) { - case 3: - if (sub_8152A00() == TRUE) + case FUNC_WAIT_START: + if (AllPlayersReadyToStart() == TRUE) { - sub_8152A70(); - gUnknown_203F3E0->unk11C = 1; + ResetReadyToStart(); + sGame->startGame = TRUE; } break; - case 4: - sub_815184C(); + case FUNC_PLAY_GAME: + RecvLinkData_Gameplay(); break; - case 11: - sub_8151A5C(); + case FUNC_WAIT_END_GAME: + RecvLinkData_ReadyToEnd(); break; } } -static void sub_8151BA0(void) +static void SendLinkData_Leader(void) { - switch (gUnknown_203F3E0->unk18) + switch (sGame->funcId) { - case 4: - sub_815A61C(&gUnknown_203F3E0->unk32CC, &gUnknown_203F3E0->unk31A0[0].unk2C, &gUnknown_203F3E0->unk31A0[1].unk2C, &gUnknown_203F3E0->unk31A0[2].unk2C, &gUnknown_203F3E0->unk31A0[3].unk2C, &gUnknown_203F3E0->unk31A0[4].unk2C, gUnknown_203F3E0->unk40, gUnknown_203F3E0->unk120, gUnknown_203F3E0->unk12C); + case FUNC_PLAY_GAME: + SendPacket_GameState(&sGame->player, + &sGame->players[0].comm, + &sGame->players[1].comm, + &sGame->players[2].comm, + &sGame->players[3].comm, + &sGame->players[4].comm, + sGame->numGraySquares, + sGame->berriesFalling, + sGame->allReadyToEnd); break; - case 11: - sub_815A61C(&gUnknown_203F3E0->unk32CC, &gUnknown_203F3E0->unk31A0[0].unk2C, &gUnknown_203F3E0->unk31A0[1].unk2C, &gUnknown_203F3E0->unk31A0[2].unk2C, &gUnknown_203F3E0->unk31A0[3].unk2C, &gUnknown_203F3E0->unk31A0[4].unk2C, gUnknown_203F3E0->unk40, gUnknown_203F3E0->unk120, gUnknown_203F3E0->unk12C); + case FUNC_WAIT_END_GAME: + SendPacket_GameState(&sGame->player, + &sGame->players[0].comm, + &sGame->players[1].comm, + &sGame->players[2].comm, + &sGame->players[3].comm, + &sGame->players[4].comm, + sGame->numGraySquares, + sGame->berriesFalling, + sGame->allReadyToEnd); break; } } -static void sub_8151C5C(void) +static void RecvLinkData_Member(void) { - switch (gUnknown_203F3E0->unk18) + switch (sGame->funcId) { - case 4: - sub_815A950(gUnknown_203F3E0->multiplayerId, &gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId], &gUnknown_203F3E0->unk31A0[0].unk2C, &gUnknown_203F3E0->unk31A0[1].unk2C, &gUnknown_203F3E0->unk31A0[2].unk2C, &gUnknown_203F3E0->unk31A0[3].unk2C, &gUnknown_203F3E0->unk31A0[4].unk2C, &gUnknown_203F3E0->unk40, &gUnknown_203F3E0->unk120, &gUnknown_203F3E0->unk12C); + case FUNC_PLAY_GAME: + RecvPacket_GameState(sGame->multiplayerId, + &sGame->players[sGame->multiplayerId], + &sGame->players[0].comm, + &sGame->players[1].comm, + &sGame->players[2].comm, + &sGame->players[3].comm, + &sGame->players[4].comm, + &sGame->numGraySquares, + &sGame->berriesFalling, + &sGame->allReadyToEnd); break; - case 11: - sub_815A950(gUnknown_203F3E0->multiplayerId, &gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId], &gUnknown_203F3E0->unk31A0[0].unk2C, &gUnknown_203F3E0->unk31A0[1].unk2C, &gUnknown_203F3E0->unk31A0[2].unk2C, &gUnknown_203F3E0->unk31A0[3].unk2C, &gUnknown_203F3E0->unk31A0[4].unk2C, &gUnknown_203F3E0->unk40, &gUnknown_203F3E0->unk120, &gUnknown_203F3E0->unk12C); + case FUNC_WAIT_END_GAME: + RecvPacket_GameState(sGame->multiplayerId, + &sGame->players[sGame->multiplayerId], + &sGame->players[0].comm, + &sGame->players[1].comm, + &sGame->players[2].comm, + &sGame->players[3].comm, + &sGame->players[4].comm, + &sGame->numGraySquares, + &sGame->berriesFalling, + &sGame->allReadyToEnd); break; } } -static void sub_8151D28(void) +static void SendLinkData_Member(void) { - switch (gUnknown_203F3E0->unk18) + switch (sGame->funcId) { - case 3: - sub_815A5BC(1); - gUnknown_203F3E0->unk11C = 1; + case FUNC_WAIT_START: + SendPacket_ReadyToStart(TRUE); + sGame->startGame = TRUE; break; - case 4: - if (gUnknown_203F3E0->unk32CC.unk2C.unk0 != 0) - { - sub_815AAD8(gUnknown_203F3E0->unk32CC.unk2C.unk0); - } + case FUNC_PLAY_GAME: + if (sGame->player.comm.pickState != PICK_NONE) + SendPacket_PickState(sGame->player.comm.pickState); break; - case 11: - if (gUnknown_203F3E0->unk120 == 0 && gUnknown_203F3E0->unk12C == 0) - { - sub_815AB3C(1); - } + case FUNC_WAIT_END_GAME: + if (!sGame->berriesFalling && !sGame->allReadyToEnd) + SendPacket_ReadyToEnd(TRUE); break; } } -static void sub_8151D98(void) +static void HandleSound_Leader(void) { - if (gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk0 == 0) + if (sGame->players[sGame->multiplayerId].comm.pickState == PICK_NONE) { if (!IsSEPlaying()) - { - gUnknown_203F3E0->unk144 = 0; - } + sGame->playingPickSound = FALSE; } - else if (gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk4 == 1) + else if (sGame->players[sGame->multiplayerId].comm.ateBerry == TRUE) { - if (gUnknown_203F3E0->unk144 == 0) + if (!sGame->playingPickSound) { m4aSongNumStop(SE_SUCCESS); PlaySE(SE_SUCCESS); - gUnknown_203F3E0->unk144 = 1; + sGame->playingPickSound = TRUE; } } - else if (gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk8 == 1) + else if (sGame->players[sGame->multiplayerId].comm.missedBerry == TRUE) { - if (gUnknown_203F3E0->unk144 == 0 && !IsSEPlaying()) + if (!sGame->playingPickSound && !IsSEPlaying()) { PlaySE(SE_BOO); - sub_8153BC0(1); - gUnknown_203F3E0->unk144 = 1; + StartDodrioMissedAnim(1); + sGame->playingPickSound = TRUE; } } - if (gUnknown_203F3E0->unk154 == 0 && gUnknown_203F3E0->unk40 >= 10) + if (sGame->endSoundState == 0 && sGame->numGraySquares >= NUM_STATUS_SQUARES) { + // Ready to play game over sound StopMapMusic(); - gUnknown_203F3E0->unk154 = 1; + sGame->endSoundState = 1; } - else if (gUnknown_203F3E0->unk154 == 1) + else if (sGame->endSoundState == 1) { + // Play game over sound PlayFanfareByFanfareNum(FANFARE_TOO_BAD); - gUnknown_203F3E0->unk154 = 2; + sGame->endSoundState = 2; } } -static void sub_8151E94(void) +static void HandleSound_Member(void) { - u8 r8 = gUnknown_203F3E0->unk44; - u8 r7 = gUnknown_203F3E0->unk48; - u8 r4; - if (gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk0 == 0) + u8 berryStart = sGame->berryColStart; + u8 berryEnd = sGame->berryColEnd; + u8 i; + if (sGame->players[sGame->multiplayerId].comm.pickState == PICK_NONE) { - if (gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk4 != 1 && gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk8 != 1) - { - gUnknown_203F3E0->unk144 = 0; - } + if (sGame->players[sGame->multiplayerId].comm.ateBerry != TRUE + && sGame->players[sGame->multiplayerId].comm.missedBerry != TRUE) + sGame->playingPickSound = 0; } - else if (gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk4 == 1) + else if (sGame->players[sGame->multiplayerId].comm.ateBerry == TRUE) { - if (gUnknown_203F3E0->unk144 == 0) + if (!sGame->playingPickSound) { m4aSongNumStop(SE_SUCCESS); PlaySE(SE_SUCCESS); - gUnknown_203F3E0->unk144 = 1; + sGame->playingPickSound = TRUE; } } - else if (gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk8 == 1) + else if (sGame->players[sGame->multiplayerId].comm.missedBerry == TRUE) { - if (gUnknown_203F3E0->unk144 == 0 && !IsSEPlaying()) + if (!sGame->playingPickSound && !IsSEPlaying()) { PlaySE(SE_BOO); - sub_8153BC0(1); - gUnknown_203F3E0->unk144 = 1; + StartDodrioMissedAnim(1); + sGame->playingPickSound = TRUE; } } - for (r4 = r8; r4 < r7; r4++) + for (i = berryStart; i < berryEnd; i++) { - struct DodrioSubstruct_31A0_14 * ptr = &gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk14; - if (ptr->unkB[r4] >= 10) + struct DodrioGame_Berries * berries = &sGame->players[sGame->multiplayerId].berries; + if (berries->fallDist[i] >= MAX_FALL_DIST) { - if (gUnknown_203F3E0->unk148[r4] == 0) + if (sGame->playingSquishSound[i] == 0) { - PlaySE(SE_BALLOON_RED + ptr->unk0[r4]); - gUnknown_203F3E0->unk148[r4] = 1; + PlaySE(SE_BALLOON_RED + berries->ids[i]); + sGame->playingSquishSound[i] = TRUE; } } else { - gUnknown_203F3E0->unk148[r4] = 0; + sGame->playingSquishSound[i] = FALSE; } } - if (gUnknown_203F3E0->unk154 == 0 && gUnknown_203F3E0->unk40 >= 10) + if (sGame->endSoundState == 0 && sGame->numGraySquares >= NUM_STATUS_SQUARES) { + // Ready to play game over sound StopMapMusic(); - gUnknown_203F3E0->unk154 = 1; + sGame->endSoundState = 1; } - else if (gUnknown_203F3E0->unk154 == 1) + else if (sGame->endSoundState == 1) { + // Play game over sound PlayFanfareByFanfareNum(FANFARE_TOO_BAD); - gUnknown_203F3E0->unk154 = 2; + sGame->endSoundState = 2; } } -static void sub_815201C(void) +static void CB2_DodrioGame(void) { RunTasks(); AnimateSprites(); @@ -1275,53 +1812,55 @@ static void sub_815201C(void) UpdatePaletteFade(); } -static void sub_8152034(void) +static void VBlankCB_DodrioGame(void) { TransferPlttBuffer(); LoadOam(); ProcessSpriteCopyRequests(); } -static void sub_8152048(struct DodrioSubstruct_318C * a0, struct Pokemon * a1) +static void InitMonInfo(struct DodrioGame_MonInfo * monInfo, struct Pokemon * mon) { - a0->isShiny = IsMonShiny(a1); + monInfo->isShiny = IsMonShiny(mon); } -static void sub_815205C(TaskFunc func, u8 priority) +static void CreateTask_(TaskFunc func, u8 priority) { CreateTask(func, priority); } -static void sub_815206C(TaskFunc func) +static void CreateDodrioGameTask(TaskFunc func) { - gUnknown_203F3E0->unk04 = CreateTask(func, 1); - gUnknown_203F3E0->unk10 = 0; - gUnknown_203F3E0->unk0C = 0; - gUnknown_203F3E0->unk14 = 0; + sGame->taskId = CreateTask(func, 1); + sGame->state = 0; + sGame->startState = 0; + sGame->timer = 0; } -static void sub_8152090(u8 a0) +static void SetGameFunc(u8 funcId) { - gUnknown_203F3E0->unk1C = gUnknown_203F3E0->unk18; - gUnknown_203F3E0->unk18 = a0; - gUnknown_203F3E0->unk10 = 0; - gUnknown_203F3E0->unk14 = 0; + sGame->prevFuncId = sGame->funcId; + sGame->funcId = funcId; + sGame->state = 0; + sGame->timer = 0; } -static bool32 sub_81520B4(void) +static bool32 SlideTreeBordersOut(void) { - u8 r2 = gUnknown_203F3E0->unk14 / 4; - gUnknown_203F3E0->unk14++; - if (r2 != 0 && gUnknown_203F3E0->unk14 % 4 == 0) + u8 x = sGame->timer / 4; + sGame->timer++; + if (x != 0 && sGame->timer % 4 == 0) { - if (r2 < sUnknown_8475548[gUnknown_203F3E0->unk24 - 1]) + if (x < sTreeBorderXPos[sGame->numPlayers - 1]) { - SetGpuReg(REG_OFFSET_BG1HOFS, (r2 * 8)); - SetGpuReg(REG_OFFSET_BG2HOFS, -(r2 * 8)); + // Update position + SetGpuReg(REG_OFFSET_BG1HOFS, (x * 8)); // BG_TREE_LEFT + SetGpuReg(REG_OFFSET_BG2HOFS, -(x * 8)); // BG_TREE_RIGHT return FALSE; } else { + // Animation finished return TRUE; } } @@ -1331,413 +1870,450 @@ static bool32 sub_81520B4(void) } } -static void sub_8152110(void) +static void InitFirstWaveOfBerries(void) { u8 i; - u8 start = gUnknown_203F3E0->unk44; - u8 finish = gUnknown_203F3E0->unk48; + u8 berryStart = sGame->berryColStart; + u8 berryEnd = sGame->berryColEnd; - for (i = start; i < finish; i++) + for (i = berryStart; i < berryEnd; i++) { - struct DodrioSubstruct_31A0_14 * ptr = &gUnknown_203F3E0->unk32CC.unk14; - ptr->unkB[i] = (i % 2 == 0) ? 1 : 0; - ptr->unk0[i] = 0; + struct DodrioGame_Berries * berries = &sGame->player.berries; + berries->fallDist[i] = (i % 2 == 0) ? 1 : 0; + berries->ids[i] = BERRY_BLUE; } } -static void sub_8152174(void) +// This function checks every berry and resolves if it should be eaten or not. +// It's run in a loop that handles moving each individual berry, which means +// that every time any berry moves, every single berry is checked. +static void HandlePickBerries(void) { - u8 sp0 = gUnknown_203F3E0->unk44; - u8 sp4 = gUnknown_203F3E0->unk48; - u8 sp8 = gUnknown_203F3E0->unk24; - u8 i, j, k, r5; + u8 berryStart = sGame->berryColStart; + u8 berryEnd = sGame->berryColEnd; + u8 numPlayers = sGame->numPlayers; + u8 i, j, k, column; - if (gUnknown_203F3E0->unk40 >= 10) + // Game is already over + if (sGame->numGraySquares >= NUM_STATUS_SQUARES) return; - for (i = 0; i < sp8; i++) + for (i = 0; i < numPlayers; i++) { - u8 *ptr = &gUnknown_203F3E0->unk31A0[i].unk2C.unk0; - if (*ptr != 0 && gUnknown_203F3E0->unkA8[i] == 1) + u8 *pickState = &sGame->players[i].comm.pickState; + if (*pickState != PICK_NONE && sGame->inputState[i] == INPUTSTATE_TRY_PICK) { - for (j = sp0; j < sp4; j++) + // Player is attempting to pick a berry + for (j = berryStart; j < berryEnd; j++) { - r5 = sUnknown_8471F50[0][0][j]; - if (gUnknown_203F3E0->unkF4[r5][0] == i || gUnknown_203F3E0->unkF4[r5][1] == i) + column = sActiveColumnMap[0][0][j]; + + // Attempt has already been checked + if (sGame->playersAttemptingPick[column][0] == i + || sGame->playersAttemptingPick[column][1] == i) break; - if (sub_8152484(i, *ptr, r5) == TRUE) + + // Check berry pick attempt + if (TryPickBerry(i, *pickState, column) == TRUE) { - for (k = 0; k < 2; k++) + for (k = 0; k < ARRAY_COUNT(sGame->playersAttemptingPick[0]); k++) { - if (gUnknown_203F3E0->unkF4[r5][k] == 0xFF) + if (sGame->playersAttemptingPick[column][k] == PLAYER_NONE) { - gUnknown_203F3E0->unkF4[r5][k] = i; - gUnknown_203F3E0->unkA8[i] = 2; - gUnknown_203F3E0->unkC4[r5] = 1; + sGame->playersAttemptingPick[column][k] = i; + sGame->inputState[i] = INPUTSTATE_PICKED; + sGame->berryState[column] = BERRYSTATE_PICKED; break; } } break; } - if (gUnknown_203F3E0->unk31A0[i].unk2C.unk8 == 1) + if (sGame->players[i].comm.missedBerry == 1) break; } } } - for (j = sp0; j < sp4; j++) + for (j = berryStart; j < berryEnd; j++) { - u8 id = 0xFF; - r5 = sUnknown_8471F50[0][0][j]; - if (gUnknown_203F3E0->unkC4[r5] == 1) + u8 playerIdMissed = PLAYER_NONE; + column = sActiveColumnMap[0][0][j]; + if (sGame->berryState[column] == BERRYSTATE_PICKED) { - s32 r2; - u8 r4, r3 = gUnknown_203F3E0->unk90[sub_8152BD4(r5)] / 7; - if (r3 >= NELEMS(sUnknown_847553C) - 1) - r3 = NELEMS(sUnknown_847553C) - 1; + s32 delayRemaining; + u8 playerIdPicked, delayStage = sGame->difficulty[GetPlayerIdAtColumn(column)] / 7; + if (delayStage >= ARRAY_COUNT(sBerryFallDelays) - 1) + delayStage = ARRAY_COUNT(sBerryFallDelays) - 1; - r2 = sUnknown_847553C[r3][gUnknown_203F3E0->unk31A0[0].unk14.unk0[r5]] - gUnknown_203F3E0->unkD0[r5]; - if (r2 < 6) - gUnknown_203F3E0->unk9C[r5] += r2; + delayRemaining = sBerryFallDelays[delayStage][sGame->players[0].berries.ids[column]] - sGame->fallTimer[column]; + if (delayRemaining < 6) + sGame->eatTimer[column] += delayRemaining; - if (++gUnknown_203F3E0->unk9C[r5] >= 6) + if (++sGame->eatTimer[column] >= 6) { - gUnknown_203F3E0->unk9C[r5] = 0; - if (gUnknown_203F3E0->unkF4[r5][0] == 0xFF && gUnknown_203F3E0->unkF4[r5][1] == 0xFF) + sGame->eatTimer[column] = 0; + if (sGame->playersAttemptingPick[column][0] == PLAYER_NONE + && sGame->playersAttemptingPick[column][1] == PLAYER_NONE) { + // No players attempting to pick this berry continue; } - else if (gUnknown_203F3E0->unkF4[r5][0] != 0xFF && gUnknown_203F3E0->unkF4[r5][1] == 0xFF) + else if (sGame->playersAttemptingPick[column][0] != PLAYER_NONE + && sGame->playersAttemptingPick[column][1] == PLAYER_NONE) { - r4 = gUnknown_203F3E0->unkF4[r5][0]; + // One player attempting to pick this berry + playerIdPicked = sGame->playersAttemptingPick[column][0]; } else { - u8 unk0 = gUnknown_203F3E0->unkF4[r5][0]; - i = gUnknown_203F3E0->unkF4[r5][1]; // Have to re-use the variable to match. + // Two players attempting to pick this berry + // Randomly give it to one of them + u8 playerId1 = sGame->playersAttemptingPick[column][0]; + i = sGame->playersAttemptingPick[column][1]; // playerId2. Have to re-use the variable to match. if (!(Random() & 1)) { - r4 = unk0; - id = i; + playerIdPicked = playerId1; + playerIdMissed = i; } else { - r4 = i; - id = unk0; + playerIdPicked = i; + playerIdMissed = playerId1; } } - gUnknown_203F3E0->unk32CC.unk14.unkB[r5] = 7; - gUnknown_203F3E0->unkC4[r5] = 2; - gUnknown_203F3E0->unkA8[r4] = 3; - gUnknown_203F3E0->unkB8[r5] = r4; - gUnknown_203F3E0->unk31A0[r4].unk2C.unk4 = 1; - gUnknown_203F3E0->unk31A0[id].unk2C.unk8 = 1; - gUnknown_203F3E0->unk86[r4]++; - sub_8152D34(0, r5, r4); - sub_8152F94(TRUE); - sub_8152B64(r4); - gUnknown_203F3E0->unkE8[r5] = gUnknown_203F3E0->unk32CC.unk14.unk0[r5]; - gUnknown_203F3E0->unk32CC.unk14.unk0[r5] = 3; - gUnknown_203F3E0->unkF4[r5][0] = 0xFF; - gUnknown_203F3E0->unkF4[r5][1] = 0xFF; + + // Eat berry + sGame->player.berries.fallDist[column] = EAT_FALL_DIST; + sGame->berryState[column] = BERRYSTATE_EATEN; + sGame->inputState[playerIdPicked] = INPUTSTATE_ATE_BERRY; + sGame->berryEatenBy[column] = playerIdPicked; + sGame->players[playerIdPicked].comm.ateBerry = TRUE; + + +#ifdef UBFIX + if (playerIdMissed != PLAYER_NONE) +#endif + sGame->players[playerIdMissed].comm.missedBerry = TRUE; // UB: playerIdMissed can be PLAYER_NONE here, which is out of bounds + + sGame->berriesEaten[playerIdPicked]++; + IncrementBerryResult(0, column, playerIdPicked); + UpdateBerriesPickedInRow(TRUE); + TryIncrementDifficulty(playerIdPicked); + sGame->prevBerryIds[column] = sGame->player.berries.ids[column]; + sGame->player.berries.ids[column] = BERRY_MISSED; // Just to clear berry id, wasn't actually missed + sGame->playersAttemptingPick[column][0] = PLAYER_NONE; + sGame->playersAttemptingPick[column][1] = PLAYER_NONE; } } } } -static bool32 sub_8152484(u8 a0, u8 a1, u8 a2) +static bool32 TryPickBerry(u8 playerId, u8 pickState, u8 column) { - s32 r7 = 0; - u8 r5 = gUnknown_203F3E0->unk24 - 1; - struct DodrioSubstruct_31A0_14 * ptr = &gUnknown_203F3E0->unk32CC.unk14; + s32 pick = 0; + u8 numPlayersIdx = sGame->numPlayers - 1; + struct DodrioGame_Berries * berries = &sGame->player.berries; - switch (a1) + switch (pickState) { - case 3: + case PICK_LEFT: default: - r7 = 0; + pick = 0; break; - case 2: - r7 = 1; + case PICK_MIDDLE: + pick = 1; break; - case 1: - r7 = 2; + case PICK_RIGHT: + pick = 2; break; } - if (ptr->unkB[a2] == 6 || ptr->unkB[a2] == 7) + + // Check if berry is within range to be picked + if (berries->fallDist[column] == EAT_FALL_DIST - 1 || berries->fallDist[column] == EAT_FALL_DIST) { - if (a2 == sUnknown_8472063[r5][a0][r7]) + // Check if this berry is the one the player is trying to pick + if (column == sDodrioHeadToColumnMap[numPlayersIdx][playerId][pick]) { - if (gUnknown_203F3E0->unkC4[a2] == 1 || gUnknown_203F3E0->unkC4[a2] == 2) + // Check if berry has been picked/eaten by another player + if (sGame->berryState[column] == BERRYSTATE_PICKED || sGame->berryState[column] == BERRYSTATE_EATEN) { - gUnknown_203F3E0->unk31A0[a0].unk2C.unk8 = 1; + // Missed berry, picked by someone else + sGame->players[playerId].comm.missedBerry = TRUE; return FALSE; } else { + // Successfully picked berry return TRUE; } } } else { - if (a2 == sUnknown_8472063[r5][a0][r7]) + // Check if this berry is the one the player is trying to pick + if (column == sDodrioHeadToColumnMap[numPlayersIdx][playerId][pick]) { - gUnknown_203F3E0->unkA8[a0] = 4; - gUnknown_203F3E0->unk31A0[a0].unk2C.unk8 = 1; + // Missed berry, out of range + sGame->inputState[playerId] = INPUTSTATE_BAD_MISS; + sGame->players[playerId].comm.missedBerry = TRUE; } } return FALSE; } -static void sub_815256C(void) +static void UpdateFallingBerries(void) { - u8 r1 = gUnknown_203F3E0->unk44; - u8 r9 = gUnknown_203F3E0->unk48; - u8 r3 = 0; - u8 r10 = 0; + u8 berryStart = sGame->berryColStart; + u8 berryEnd = sGame->berryColEnd; + u8 delayStage = 0; + u8 otherBerryMissed = 0; u8 i; - u8 r2; - struct DodrioStruct * ptr; - gUnknown_203F3E0->unk120 = 0; + sGame->berriesFalling = FALSE; - for (i = r1; i < r9 - 1; i++) + for (i = berryStart; i < berryEnd - 1; i++) { - ptr = gUnknown_203F3E0; + struct DodrioGame * game = sGame; - if (gUnknown_203F3E0->unkC4[i] == 0 || gUnknown_203F3E0->unkC4[i] == 1) + if (sGame->berryState[i] == BERRYSTATE_NONE || sGame->berryState[i] == BERRYSTATE_PICKED) { - gUnknown_203F3E0->unk120 = 1; - if (ptr->unk32CC.unk14.unkB[i] >= 10) + sGame->berriesFalling = TRUE; + + if (game->player.berries.fallDist[i] >= MAX_FALL_DIST) { - ptr->unk32CC.unk14.unkB[i] = 10; - gUnknown_203F3E0->unkC4[i] = 3; - if (gUnknown_203F3E0->unk148[i] == 0) + // Berry hit the ground + game->player.berries.fallDist[i] = MAX_FALL_DIST; + sGame->berryState[i] = BERRYSTATE_SQUISHED; + if (!sGame->playingSquishSound[i]) { - gUnknown_203F3E0->unk148[i] = 1; - PlaySE(SE_BALLOON_RED + ptr->unk32CC.unk14.unk0[i]); + sGame->playingSquishSound[i] = TRUE; + PlaySE(SE_BALLOON_RED + game->player.berries.ids[i]); } - if (gUnknown_203F3E0->unk40 < 10 || r10 == 1) + if (sGame->numGraySquares < NUM_STATUS_SQUARES || otherBerryMissed == TRUE) { - r10 = 1; - gUnknown_203F3E0->unk148[i] = 0; - if (gUnknown_203F3E0->unk40 < 10) - { - gUnknown_203F3E0->unk40++; - } - sub_8152D34(3, i, 0); - sub_8152F94(FALSE); + otherBerryMissed = TRUE; + sGame->playingSquishSound[i] = FALSE; + if (sGame->numGraySquares < NUM_STATUS_SQUARES) + sGame->numGraySquares++; + IncrementBerryResult(BERRY_MISSED, i, 0); + UpdateBerriesPickedInRow(FALSE); } } else { - r3 = gUnknown_203F3E0->unk90[sub_8152BD4(i)] / 7; - if (r3 >= NELEMS(sUnknown_847553C) - 1) + // Berry is still falling + u8 delay; + delayStage = sGame->difficulty[GetPlayerIdAtColumn(i)] / NUM_DIFFICULTIES; + if (delayStage >= ARRAY_COUNT(sBerryFallDelays) - 1) + delayStage = ARRAY_COUNT(sBerryFallDelays) - 1; + + delay = sBerryFallDelays[delayStage][game->player.berries.ids[i]]; + if (++sGame->fallTimer[i] >= delay) { - r3 = NELEMS(sUnknown_847553C) - 1; + game->player.berries.fallDist[i]++; + sGame->fallTimer[i] = 0; } - r2 = sUnknown_847553C[r3][ptr->unk32CC.unk14.unk0[i]]; - if (++gUnknown_203F3E0->unkD0[i] >= r2) - { - ptr->unk32CC.unk14.unkB[i]++; - gUnknown_203F3E0->unkD0[i] = 0; - } - sub_8152174(); + HandlePickBerries(); } } - else if (gUnknown_203F3E0->unkC4[i] == 2) + else if (sGame->berryState[i] == BERRYSTATE_EATEN) { - // gUnknown_203F3E0->unk120 = 1; - if (++gUnknown_203F3E0->unkDC[i] >= 20) + // Berry has been eaten, wait and create a new berry + if (++sGame->newBerryTimer[i] >= 20) { - gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->unkB8[i]].unk2C.unk4 = 0; - gUnknown_203F3E0->unkDC[i] = 0; - gUnknown_203F3E0->unkD0[i] = 0; - gUnknown_203F3E0->unkC4[i] = 0; - ptr->unk32CC.unk14.unkB[i] = 1; - ptr->unk32CC.unk14.unk0[i] = sub_8152BF8(sub_8152BD4(i), i); + sGame->players[sGame->berryEatenBy[i]].comm.ateBerry = FALSE; + sGame->newBerryTimer[i] = 0; + sGame->fallTimer[i] = 0; + sGame->berryState[i] = BERRYSTATE_NONE; + game->player.berries.fallDist[i] = 1; + game->player.berries.ids[i] = GetNewBerryId(GetPlayerIdAtColumn(i), i); } } - else if (gUnknown_203F3E0->unkC4[i] == 3) + else if (sGame->berryState[i] == BERRYSTATE_SQUISHED) { - if (++gUnknown_203F3E0->unkDC[i] >= 20) + // Berry has already hit the ground, wait and create a new berry + if (++sGame->newBerryTimer[i] >= 20) { - if (gUnknown_203F3E0->unk40 < 10) + if (sGame->numGraySquares < NUM_STATUS_SQUARES) { - gUnknown_203F3E0->unkDC[i] = 0; - gUnknown_203F3E0->unkD0[i] = 0; - gUnknown_203F3E0->unkC4[i] = 0; - ptr->unk32CC.unk14.unkB[i] = 1; - gUnknown_203F3E0->unkE8[i] = ptr->unk32CC.unk14.unk0[i]; - ptr->unk32CC.unk14.unk0[i] = sub_8152BF8(sub_8152BD4(i), i); + sGame->newBerryTimer[i] = 0; + sGame->fallTimer[i] = 0; + sGame->berryState[i] = BERRYSTATE_NONE; + game->player.berries.fallDist[i] = 1; + sGame->prevBerryIds[i] = game->player.berries.ids[i]; + game->player.berries.ids[i] = GetNewBerryId(GetPlayerIdAtColumn(i), i); } } } } } -static void sub_81527D0(void) +static void UpdateBerrySprites(void) { - u8 i, first, count; + u8 i; + u8 berryStart = sGame->berryColStart; + u8 berryEnd = sGame->berryColEnd; - first = gUnknown_203F3E0->unk44; - count = gUnknown_203F3E0->unk48; - for (i = first; i < count; i++) + for (i = berryStart; i < berryEnd; i++) { - struct DodrioSubstruct_31A0 * ptr = &gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId]; - u8 var = sUnknown_8471F50[gUnknown_203F3E0->unk24 - 1][gUnknown_203F3E0->multiplayerId][i]; + struct DodrioGame_Player * player = &sGame->players[sGame->multiplayerId]; + u8 column = sActiveColumnMap[sGame->numPlayers - 1][sGame->multiplayerId][i]; - if (ptr->unk14.unkB[var] != 0) - sub_81542EC(i, FALSE); + if (player->berries.fallDist[column] != 0) + SetBerryInvisibility(i, FALSE); else - sub_81542EC(i, TRUE); + SetBerryInvisibility(i, TRUE); - if (ptr->unk14.unkB[var] > 9) + if (player->berries.fallDist[column] >= MAX_FALL_DIST) { - sub_8154398(i, ptr->unk14.unk0[var] + 3); - sub_8154370(i, ptr->unk14.unkB[var] * 2 - 1); + // Berry was missed, set squished anim + SetBerryAnim(i, player->berries.ids[column] + BERRY_MISSED); + SetBerryYPos(i, player->berries.fallDist[column] * 2 - 1); } - else if (ptr->unk14.unk0[var] == 3) + else if (player->berries.ids[column] == 3) { - ptr->unk14.unkB[var] = 7; - sub_8154398(i, 6); - sub_8154370(i, ptr->unk14.unkB[var] * 2 - 1); + // Berry was picked, set eaten anim + player->berries.fallDist[column] = EAT_FALL_DIST; + SetBerryAnim(i, ANIM_EATEN); + SetBerryYPos(i, player->berries.fallDist[column] * 2 - 1); } else { - sub_8154398(i, ptr->unk14.unk0[var]); - sub_8154370(i, ptr->unk14.unkB[var] * 2); + // Berry is still falling + SetBerryAnim(i, player->berries.ids[column]); + SetBerryYPos(i, player->berries.fallDist[column] * 2); } } } -static void sub_81528D0(void) +static void UpdateAllDodrioAnims(void) { - u8 i, count; + u8 i; + u8 numPlayers = sGame->numPlayers; - count = gUnknown_203F3E0->unk24; - for (i = 0; i < count; i++) + for (i = 0; i < numPlayers; i++) { - struct DodrioSubstruct_31A0 * ptr = &gUnknown_203F3E0->unk31A0[i]; - sub_8153DA8(i, ptr->unk2C.unk0); + struct DodrioGame_Player * player = &sGame->players[i]; + SetDodrioAnim(i, player->comm.pickState); } } -static void sub_8152910(void) +static void SetAllDodrioDisabled(void) { - u8 i, count; + u8 i; + u8 numPlayers = sGame->numPlayers; - count = gUnknown_203F3E0->unk24; - for (i = 0; i < count; i++) - sub_8153DA8(i, 4); + for (i = 0; i < numPlayers; i++) + SetDodrioAnim(i, PICK_DISABLED); } -static void sub_815293C(void) +static void UpdateGame_Leader(void) { - sub_81527D0(); - if (gUnknown_203F3E0->unk40 > 9) - sub_8152910(); + UpdateBerrySprites(); + if (sGame->numGraySquares >= NUM_STATUS_SQUARES) + SetAllDodrioDisabled(); else - sub_81528D0(); + UpdateAllDodrioAnims(); - sub_8153FC8(gUnknown_203F3E0->unk40); + UpdateStatusBarAnim(sGame->numGraySquares); } -// This function is literally the same as the one above...Why? -static void sub_8152970(void) +// Identical to UpdateGame_Leader +static void UpdateGame_Member(void) { - sub_81527D0(); - if (gUnknown_203F3E0->unk40 > 9) - sub_8152910(); + UpdateBerrySprites(); + if (sGame->numGraySquares >= NUM_STATUS_SQUARES) + SetAllDodrioDisabled(); else - sub_81528D0(); + UpdateAllDodrioAnims(); - sub_8153FC8(gUnknown_203F3E0->unk40); + UpdateStatusBarAnim(sGame->numGraySquares); } -static void sub_81529A4(u8 arg0, u8 *arg1, u8 *arg2) +static void GetActiveBerryColumns(u8 numPlayers, u8 *start, u8 *end) { - switch (arg0) + switch (numPlayers) { case 1: - *arg1 = 4, *arg2 = 7; + *start = 4, *end = 7; break; case 2: - *arg1 = 3, *arg2 = 8; + *start = 3, *end = 8; break; case 3: - *arg1 = 2, *arg2 = 9; + *start = 2, *end = 9; break; case 4: - *arg1 = 1, *arg2 = 10; + *start = 1, *end = 10; break; case 5: - *arg1 = 0, *arg2 = 11; + *start = 0, *end = 11; break; } } -static bool32 sub_8152A00(void) +static bool32 AllPlayersReadyToStart(void) { - u8 i, count; + u8 i; + u8 numPlayers = sGame->numPlayers; - count = gUnknown_203F3E0->unk24; - for (i = 1; i < count; i++) + for (i = 1; i < numPlayers; i++) { - if (gUnknown_203F3E0->unk158[i] == 0) - gUnknown_203F3E0->unk158[i] = sub_815A5E8(i); + if (sGame->readyToStart[i] == FALSE) + sGame->readyToStart[i] = RecvPacket_ReadyToStart(i); } - // This loop won't ever run, the seemingly pointless assingment below is to make the compiler - // generate code for it. - count = count; - for (; i < count; i++) + numPlayers = numPlayers; // Needed to force compiler to keep loop below + +#ifdef BUGFIX + i = 1; // i isn't reset, loop below never runs. As a result, game can begin before all players ready +#endif + for (; i < numPlayers; i++) { - if (gUnknown_203F3E0->unk158[i] == 0) + if (!sGame->readyToStart[i]) return FALSE; } return TRUE; } -static void sub_8152A70(void) +static void ResetReadyToStart(void) { u8 i; - for (i = 0; i < 5; i++) - gUnknown_203F3E0->unk158[i] = 0; + for (i = 0; i < MAX_RFU_PLAYERS; i++) + sGame->readyToStart[i] = FALSE; } -static bool32 sub_8152A98(void) +static bool32 ReadyToEndGame_Leader(void) { - if (gUnknown_203F3E0->unk40 > 9 && gUnknown_203F3E0->unk120 == 0) + if (sGame->numGraySquares >= NUM_STATUS_SQUARES && !sGame->berriesFalling) { - gUnknown_203F3E0->unk40 = 10; - if (gUnknown_203F3E0->unk12C != 0) + sGame->numGraySquares = NUM_STATUS_SQUARES; + if (sGame->allReadyToEnd != 0) return TRUE; } return FALSE; } -static bool32 sub_8152AD8(void) +static bool32 ReadyToEndGame_Member(void) { - u8 i, first, count; + u8 i, berryStart, berryEnd; - if (gUnknown_203F3E0->unk40 > 9) + if (sGame->numGraySquares >= NUM_STATUS_SQUARES) { - first = gUnknown_203F3E0->unk44; - count = gUnknown_203F3E0->unk48; - gUnknown_203F3E0->unk40 = 10; - if (gUnknown_203F3E0->unk12C != 0) + berryStart = sGame->berryColStart; + berryEnd = sGame->berryColEnd; + sGame->numGraySquares = NUM_STATUS_SQUARES; + if (sGame->allReadyToEnd) { - for (i = first; i < count; i++) + for (i = berryStart; i < berryEnd; i++) { - struct DodrioSubstruct_31A0 * ptr = &gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId]; - u8 var = sUnknown_8471F50[gUnknown_203F3E0->unk24 - 1][gUnknown_203F3E0->multiplayerId][i]; + struct DodrioGame_Player * player = &sGame->players[sGame->multiplayerId]; + u8 column = sActiveColumnMap[sGame->numPlayers - 1][sGame->multiplayerId][i]; - if (ptr->unk14.unkB[var] != 10) + if (player->berries.fallDist[column] != MAX_FALL_DIST) return FALSE; } return TRUE; @@ -1747,208 +2323,216 @@ static bool32 sub_8152AD8(void) return FALSE; } -static void sub_8152B64(u8 arg0) +static void TryIncrementDifficulty(u8 playerId) { - u8 var = sUnknown_8475550[gUnknown_203F3E0->unk90[arg0] % 7] + (gUnknown_203F3E0->unk90[arg0] / 7) * 100; - if (gUnknown_203F3E0->unk86[arg0] >= var) - gUnknown_203F3E0->unk90[arg0]++; + u8 threshold = sDifficultyThresholds[sGame->difficulty[playerId] % NUM_DIFFICULTIES] + (sGame->difficulty[playerId] / NUM_DIFFICULTIES) * 100; + if (sGame->berriesEaten[playerId] >= threshold) + sGame->difficulty[playerId]++; } -static u8 sub_8152BD4(u8 arg0) +static u8 GetPlayerIdAtColumn(u8 column) { - return sUnknown_84720FC[gUnknown_203F3E0->unk24 - 1][arg0]; + return sPlayerIdAtColumn[sGame->numPlayers - 1][column]; } -static u8 sub_8152BF8(u8 arg0, u8 arg1) +// Get a berry id for when a new falling berry is created. +// What type of berry it is depends on the current difficulty +// level of players who can pick berries from that column. +static u8 GetNewBerryId(u8 playerId, u8 column) { - u8 i, var3; - u8 count = gUnknown_203F3E0->unk24 - 1; - u8 var0 = sUnknown_84720AE[count][arg0][0]; - u8 var1 = sUnknown_84720AE[count][arg0][1]; - u8 var2 = sUnknown_84720AE[count][arg0][2]; + u8 i, highestDifficulty; + u8 numPlayersIdx = sGame->numPlayers - 1; + u8 leftPlayer = sDodrioNeighborMap[numPlayersIdx][playerId][0]; + u8 middlePlayer = sDodrioNeighborMap[numPlayersIdx][playerId][1]; + u8 rightPlayer = sDodrioNeighborMap[numPlayersIdx][playerId][2]; - for (i = 0; sUnknown_8472133[count][i] != 0; i++) + for (i = 0; sUnsharedColumns[numPlayersIdx][i] != 0; i++) { - if (arg1 == sUnknown_8472133[count][i]) - return sub_8152CB8(gUnknown_203F3E0->unk90[var1], arg1); + // If only one player can use this column, just use their difficulty + if (column == sUnsharedColumns[numPlayersIdx][i]) + return GetNewBerryIdByDifficulty(sGame->difficulty[middlePlayer], column); } - // Gets the highest of the three. - if (gUnknown_203F3E0->unk90[var0] > gUnknown_203F3E0->unk90[var1]) - var3 = gUnknown_203F3E0->unk90[var0]; + // This column is shared, get the highest difficulty of adjacent players + if (sGame->difficulty[leftPlayer] > sGame->difficulty[middlePlayer]) + highestDifficulty = sGame->difficulty[leftPlayer]; else - var3 = gUnknown_203F3E0->unk90[var1]; + highestDifficulty = sGame->difficulty[middlePlayer]; - if (gUnknown_203F3E0->unk90[var2] > var3) - var3 = gUnknown_203F3E0->unk90[var2]; + if (sGame->difficulty[rightPlayer] > highestDifficulty) + highestDifficulty = sGame->difficulty[rightPlayer]; - return sub_8152CB8(var3, arg1); + return GetNewBerryIdByDifficulty(highestDifficulty, column); } -static u8 sub_8152CB8(u8 arg0, u8 arg1) +// The berry types cycle through different distributions depending on the difficulty +static u8 GetNewBerryIdByDifficulty(u8 difficulty, u8 column) { - u8 var = gUnknown_203F3E0->unkE8[arg1]; - switch (arg0 % 7) + u8 prevBerryId = sGame->prevBerryIds[column]; + switch (difficulty % NUM_DIFFICULTIES) { - default: return 0; - case 0: return 0; - case 1: return 1; - case 2: return 2; + default: return BERRY_BLUE; + case 0: return BERRY_BLUE; + case 1: return BERRY_GREEN; + case 2: return BERRY_GOLD; case 3: - if (var == 0) - return 1; + if (prevBerryId == BERRY_BLUE) + return BERRY_GREEN; else - return 0; + return BERRY_BLUE; case 4: - if (var == 0) - return 2; + if (prevBerryId == BERRY_BLUE) + return BERRY_GOLD; else - return 0; + return BERRY_BLUE; case 5: - if (var == 2) - return 1; + if (prevBerryId == BERRY_GOLD) + return BERRY_GREEN; else - return 2; + return BERRY_GOLD; case 6: - if (var == 0) - return 1; - else if (var == 1) - return 2; + if (prevBerryId == BERRY_BLUE) + return BERRY_GREEN; + else if (prevBerryId == BERRY_GREEN) + return BERRY_GOLD; else - return 0; + return BERRY_BLUE; } } -static void sub_8152D34(u8 arg0, u8 arg1, u8 arg2) +// Despite being set up to take a berry id as an argument, this +// function is only ever given BERRY_BLUE or BERRY_MISSED. +// It reads the actual berry id (if necessary) from ids +static void IncrementBerryResult(u8 berryIdArg, u8 column, u8 playerId) { - u8 var; - u8 count = gUnknown_203F3E0->unk24; - switch (arg0) + u8 berryId; + u8 numPlayers = sGame->numPlayers; + switch (berryIdArg) { - case 0: - case 1: - case 2: - var = gUnknown_203F3E0->unk31A0[0].unk14.unk0[arg1]; - gUnknown_203F3E0->unk4A[arg2][var] = IncrementWithLimit(gUnknown_203F3E0->unk4A[arg2][var], 20000); + case BERRY_BLUE: + case BERRY_GREEN: + case BERRY_GOLD: + berryId = sGame->players[0].berries.ids[column]; + sGame->berryResults[playerId][berryId] = IncrementWithLimit(sGame->berryResults[playerId][berryId], 20000); break; - case 3: - switch (count) + case BERRY_MISSED: + switch (numPlayers) { case 5: - switch (arg1) + switch (column) { case 0: - gUnknown_203F3E0->unk4A[2][3]++; - gUnknown_203F3E0->unk4A[3][3]++; + sGame->berryResults[2][BERRY_MISSED]++; + sGame->berryResults[3][BERRY_MISSED]++; break; case 1: - gUnknown_203F3E0->unk4A[3][3]++; + sGame->berryResults[3][BERRY_MISSED]++; break; case 2: - gUnknown_203F3E0->unk4A[3][3]++; - gUnknown_203F3E0->unk4A[4][3]++; + sGame->berryResults[3][BERRY_MISSED]++; + sGame->berryResults[4][BERRY_MISSED]++; break; case 3: - gUnknown_203F3E0->unk4A[4][3]++; + sGame->berryResults[4][BERRY_MISSED]++; break; case 4: - gUnknown_203F3E0->unk4A[4][3]++; - gUnknown_203F3E0->unk4A[0][3]++; + sGame->berryResults[4][BERRY_MISSED]++; + sGame->berryResults[0][BERRY_MISSED]++; break; case 5: - gUnknown_203F3E0->unk4A[0][3]++; + sGame->berryResults[0][BERRY_MISSED]++; break; case 6: - gUnknown_203F3E0->unk4A[0][3]++; - gUnknown_203F3E0->unk4A[1][3]++; + sGame->berryResults[0][BERRY_MISSED]++; + sGame->berryResults[1][BERRY_MISSED]++; break; case 7: - gUnknown_203F3E0->unk4A[1][3]++; + sGame->berryResults[1][BERRY_MISSED]++; break; case 8: - gUnknown_203F3E0->unk4A[1][3]++; - gUnknown_203F3E0->unk4A[2][3]++; + sGame->berryResults[1][BERRY_MISSED]++; + sGame->berryResults[2][BERRY_MISSED]++; break; case 9: - gUnknown_203F3E0->unk4A[2][3]++; + sGame->berryResults[2][BERRY_MISSED]++; break; } break; case 4: - switch (arg1) + switch (column) { case 1: - gUnknown_203F3E0->unk4A[2][3]++; - gUnknown_203F3E0->unk4A[3][3]++; + sGame->berryResults[2][BERRY_MISSED]++; + sGame->berryResults[3][BERRY_MISSED]++; break; case 2: - gUnknown_203F3E0->unk4A[3][3]++; + sGame->berryResults[3][BERRY_MISSED]++; break; case 3: - gUnknown_203F3E0->unk4A[3][3]++; - gUnknown_203F3E0->unk4A[0][3]++; + sGame->berryResults[3][BERRY_MISSED]++; + sGame->berryResults[0][BERRY_MISSED]++; break; case 4: - gUnknown_203F3E0->unk4A[0][3]++; + sGame->berryResults[0][BERRY_MISSED]++; break; case 5: - gUnknown_203F3E0->unk4A[0][3]++; - gUnknown_203F3E0->unk4A[1][3]++; + sGame->berryResults[0][BERRY_MISSED]++; + sGame->berryResults[1][BERRY_MISSED]++; break; case 6: - gUnknown_203F3E0->unk4A[1][3]++; + sGame->berryResults[1][BERRY_MISSED]++; break; case 7: - gUnknown_203F3E0->unk4A[1][3]++; - gUnknown_203F3E0->unk4A[2][3]++; + sGame->berryResults[1][BERRY_MISSED]++; + sGame->berryResults[2][BERRY_MISSED]++; break; case 8: - gUnknown_203F3E0->unk4A[2][3]++; + sGame->berryResults[2][BERRY_MISSED]++; break; } break; case 3: - switch (arg1) + switch (column) { case 2: - gUnknown_203F3E0->unk4A[1][3]++; - gUnknown_203F3E0->unk4A[2][3]++; + sGame->berryResults[1][BERRY_MISSED]++; + sGame->berryResults[2][BERRY_MISSED]++; break; case 3: - gUnknown_203F3E0->unk4A[2][3]++; + sGame->berryResults[2][BERRY_MISSED]++; break; case 4: - gUnknown_203F3E0->unk4A[2][3]++; - gUnknown_203F3E0->unk4A[0][3]++; + sGame->berryResults[2][BERRY_MISSED]++; + sGame->berryResults[0][BERRY_MISSED]++; break; case 5: - gUnknown_203F3E0->unk4A[0][3]++; + sGame->berryResults[0][BERRY_MISSED]++; break; case 6: - gUnknown_203F3E0->unk4A[0][3]++; - gUnknown_203F3E0->unk4A[1][3]++; + sGame->berryResults[0][BERRY_MISSED]++; + sGame->berryResults[1][BERRY_MISSED]++; break; case 7: - gUnknown_203F3E0->unk4A[1][3]++; + sGame->berryResults[1][BERRY_MISSED]++; break; } break; case 2: - switch (arg1) + switch (column) { case 3: - gUnknown_203F3E0->unk4A[0][3]++; - gUnknown_203F3E0->unk4A[1][3]++; + sGame->berryResults[0][BERRY_MISSED]++; + sGame->berryResults[1][BERRY_MISSED]++; break; case 4: - gUnknown_203F3E0->unk4A[0][3]++; + sGame->berryResults[0][BERRY_MISSED]++; break; case 5: - gUnknown_203F3E0->unk4A[0][3]++; - gUnknown_203F3E0->unk4A[1][3]++; + sGame->berryResults[0][BERRY_MISSED]++; + sGame->berryResults[1][BERRY_MISSED]++; break; case 6: - gUnknown_203F3E0->unk4A[1][3]++; + sGame->berryResults[1][BERRY_MISSED]++; break; } break; @@ -1957,326 +2541,361 @@ static void sub_8152D34(u8 arg0, u8 arg1, u8 arg2) } } -static void sub_8152F94(bool32 arg0) +static void UpdateBerriesPickedInRow(bool32 picked) { - if (gUnknown_203F3E0->unk24 != 5) + // The 'berries picked in row' stat is only + // counted for games with all 5 players + if (sGame->numPlayers != MAX_RFU_PLAYERS) return; - if (arg0 == TRUE) + if (picked == TRUE) { - if (++gUnknown_203F3E0->unk112 > gUnknown_203F3E0->unk114) - gUnknown_203F3E0->unk114 = gUnknown_203F3E0->unk112; - if (gUnknown_203F3E0->unk112 > 9999) - gUnknown_203F3E0->unk112 = 9999; + if (++sGame->berriesPickedInRow > sGame->maxBerriesPickedInRow) + sGame->maxBerriesPickedInRow = sGame->berriesPickedInRow; + if (sGame->berriesPickedInRow > MAX_BERRIES) + sGame->berriesPickedInRow = MAX_BERRIES; } - else + else // missed { - if (gUnknown_203F3E0->unk112 > gUnknown_203F3E0->unk114) - gUnknown_203F3E0->unk114 = gUnknown_203F3E0->unk112; - gUnknown_203F3E0->unk112 = 0; + if (sGame->berriesPickedInRow > sGame->maxBerriesPickedInRow) + sGame->maxBerriesPickedInRow = sGame->berriesPickedInRow; + sGame->berriesPickedInRow = 0; } } -static void sub_8153004(void) +static void SetMaxBerriesPickedInRow(void) { u8 i; - for (i = 0; i < gUnknown_203F3E0->unk24; i++) - gUnknown_203F3E0->unk4A[i][5] = gUnknown_203F3E0->unk114; + for (i = 0; i < sGame->numPlayers; i++) + sGame->berryResults[i][BERRY_IN_ROW] = sGame->maxBerriesPickedInRow; } -static void sub_8153048(void) +static void ResetForPlayAgainPrompt(void) { u8 i, j; - for (i = 0; i < 5; i++) + for (i = 0; i < MAX_RFU_PLAYERS; i++) { - for (j = 0; j < 11; j++) - gUnknown_203F3E0->unk31A0[i].unk14.unkB[j] = 0; - gUnknown_203F3E0->unk31A0[i].unk2C.unk0 = 0; - gUnknown_203F3E0->unk31A0[i].unk2C.unk4 = 0; - gUnknown_203F3E0->unk90[i] = 0; - gUnknown_203F3E0->unk86[i] = 0; - gUnknown_203F3E0->unk3308[i].unk0 = 0; - gUnknown_203F3E0->unk3308[i].unk4 = 0; - gUnknown_203F3E0->unk4A[i][0] = 0; - gUnknown_203F3E0->unk4A[i][1] = 0; - gUnknown_203F3E0->unk4A[i][2] = 0; - gUnknown_203F3E0->unk4A[i][3] = 0; - gUnknown_203F3E0->unk4A[i][4] = 0; - gUnknown_203F3E0->unk4A[i][5] = 0; + for (j = 0; j < NUM_BERRY_COLUMNS; j++) + sGame->players[i].berries.fallDist[j] = 0; + sGame->players[i].comm.pickState = PICK_NONE; + sGame->players[i].comm.ateBerry = FALSE; + sGame->difficulty[i] = 0; + sGame->berriesEaten[i] = 0; + sGame->scoreResults[i].ranking = 0; + sGame->scoreResults[i].score = 0; + sGame->berryResults[i][BERRY_BLUE] = 0; + sGame->berryResults[i][BERRY_GREEN] = 0; + sGame->berryResults[i][BERRY_GOLD] = 0; + sGame->berryResults[i][BERRY_MISSED] = 0; + sGame->berryResults[i][BERRY_PRIZE] = 0; + sGame->berryResults[i][BERRY_IN_ROW] = 0; } - gUnknown_203F3E0->unk154 = 0; - gUnknown_203F3E0->unk112 = 0; - gUnknown_203F3E0->unk40 = 0; - sub_81528D0(); - sub_81527D0(); + sGame->endSoundState = 0; + sGame->berriesPickedInRow = 0; + sGame->numGraySquares = 0; + UpdateAllDodrioAnims(); + UpdateBerrySprites(); } -static const s16 sUnknown_84755D8[] = {10, 30, 50, 50}; - -static void sub_8153150(void) +static const s16 sBerryScoreMultipliers[] = { - u8 i, var = 0, var2 = 0; + [BERRY_BLUE] = 10, + [BERRY_GREEN] = 30, + [BERRY_GOLD] = 50, + [BERRY_MISSED] = 50 // Subtracted +}; - switch (gUnknown_203F3E0->unk24) + +static void SetRandomPrize(void) +{ + u8 i, prizeSet = 0, prizeIdx = 0; + + switch (sGame->numPlayers) { - case 4: var = 1; break; - case 5: var = 2; break; + case 4: prizeSet = 1; break; + case 5: prizeSet = 2; break; } - var2 = Random() % 10; - for (i = 0; i < 5; i++) - gUnknown_203F3E0->unk4A[i][4] = sUnknown_8475558[var][var2]; + prizeIdx = Random() % ARRAY_COUNT(sPrizeBerryIds[0]);; + for (i = 0; i < MAX_RFU_PLAYERS; i++) + sGame->berryResults[i][BERRY_PRIZE] = sPrizeBerryIds[prizeSet][prizeIdx]; } -static u32 sub_81531BC(u8 arg0) +static u32 GetBerriesPicked(u8 playerId) { - u32 sum = gUnknown_203F3E0->unk4A[arg0][0] - + gUnknown_203F3E0->unk4A[arg0][1] - + gUnknown_203F3E0->unk4A[arg0][2]; - return min(sum, 9999); + u32 sum = sGame->berryResults[playerId][BERRY_BLUE] + + sGame->berryResults[playerId][BERRY_GREEN] + + sGame->berryResults[playerId][BERRY_GOLD]; + return min(sum, MAX_BERRIES); } -static void sub_81531FC(void) +static void TryUpdateRecords(void) { - u32 berriesPicked = Min(sub_81531BC(gUnknown_203F3E0->multiplayerId), 9999); - u32 score = Min(sub_8153424(gUnknown_203F3E0->multiplayerId), 999990); + u32 berriesPicked = Min(GetBerriesPicked(sGame->multiplayerId), MAX_BERRIES); // Min here is redundant + u32 score = Min(GetScore(sGame->multiplayerId), MAX_SCORE); if (gSaveBlock2Ptr->berryPick.bestScore < score) gSaveBlock2Ptr->berryPick.bestScore = score; if (gSaveBlock2Ptr->berryPick.berriesPicked < berriesPicked) gSaveBlock2Ptr->berryPick.berriesPicked = berriesPicked; - if (gSaveBlock2Ptr->berryPick.berriesPickedInRow < gUnknown_203F3E0->unk114) - gSaveBlock2Ptr->berryPick.berriesPickedInRow = gUnknown_203F3E0->unk114; + if (gSaveBlock2Ptr->berryPick.berriesPickedInRow < sGame->maxBerriesPickedInRow) + gSaveBlock2Ptr->berryPick.berriesPickedInRow = sGame->maxBerriesPickedInRow; } -static u8 sub_815327C(u8 arg0) +// Enqueue the given state, and dequeue and return +// the state that should be used next +static u8 UpdatePickStateQueue(u8 pickState) { - u8 i, saved; + u8 i, nextState; - saved = gUnknown_203F3E0->unk98[3]; - for (i = 3; i != 0; i--) - gUnknown_203F3E0->unk98[i] = gUnknown_203F3E0->unk98[i - 1]; - gUnknown_203F3E0->unk98[0] = arg0; - return saved; + nextState = sGame->pickStateQueue[ARRAY_COUNT(sGame->pickStateQueue) - 1]; + for (i = ARRAY_COUNT(sGame->pickStateQueue) - 1; i != 0; i--) + sGame->pickStateQueue[i] = sGame->pickStateQueue[i - 1]; + sGame->pickStateQueue[0] = pickState; + return nextState; } -static void sub_81532B8(void) +// The player may extend their Dodrio's heads while they wait for +// other players to respond to the "Play again?" prompt +static void HandleWaitPlayAgainInput(void) { - if (gUnknown_203F3E0->unkB0[gUnknown_203F3E0->multiplayerId] == 0) + if (sGame->inputDelay[sGame->multiplayerId] == 0) { if (JOY_NEW(DPAD_UP)) { - gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk0 = 2; - gUnknown_203F3E0->unkB0[gUnknown_203F3E0->multiplayerId] = 6; + sGame->players[sGame->multiplayerId].comm.pickState = PICK_MIDDLE; + sGame->inputDelay[sGame->multiplayerId] = 6; PlaySE(SE_M_CHARM); } else if (JOY_NEW(DPAD_LEFT)) { - gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk0 = 3; - gUnknown_203F3E0->unkB0[gUnknown_203F3E0->multiplayerId] = 6; + sGame->players[sGame->multiplayerId].comm.pickState = PICK_LEFT; + sGame->inputDelay[sGame->multiplayerId] = 6; PlaySE(SE_M_CHARM); } else if (JOY_NEW(DPAD_RIGHT)) { - gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk0 = 1; - gUnknown_203F3E0->unkB0[gUnknown_203F3E0->multiplayerId] = 6; + sGame->players[sGame->multiplayerId].comm.pickState = PICK_RIGHT; + sGame->inputDelay[sGame->multiplayerId] = 6; PlaySE(SE_M_CHARM); } else { - gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk0 = 0; + sGame->players[sGame->multiplayerId].comm.pickState = PICK_NONE; } } else { - gUnknown_203F3E0->unkB0[gUnknown_203F3E0->multiplayerId]--; + sGame->inputDelay[sGame->multiplayerId]--; } } -static void sub_815336C(void) +static void ResetPickState(void) { - gUnknown_203F3E0->unk31A0[gUnknown_203F3E0->multiplayerId].unk2C.unk0 = 0; + sGame->players[sGame->multiplayerId].comm.pickState = PICK_NONE; } -u16 sub_8153390(void) +static u16 GetPrizeItemId(void) { - return gUnknown_203F3E0->unk4A[gUnknown_203F3E0->multiplayerId][4] + FIRST_BERRY_INDEX; + return sGame->berryResults[sGame->multiplayerId][BERRY_PRIZE] + FIRST_BERRY_INDEX; } -u8 sub_81533B4(void) +static u8 GetNumPlayers(void) { - return gUnknown_203F3E0->unk24; + return sGame->numPlayers; } -u8 *sub_81533C4(u8 id) +static u8 *GetPlayerName(u8 id) { if (gReceivedRemoteLinkPlayers) return gLinkPlayers[id].name; else - return gUnknown_203F3E0->unk31A0[id].name; + return sGame->players[id].name; } -u16 sub_8153404(u8 arg0, u8 arg1) +static u16 GetBerryResult(u8 playerId, u8 berryId) { - return gUnknown_203F3E0->unk4A[arg0][arg1]; + return sGame->berryResults[playerId][berryId]; } -static u32 sub_8153424(u8 arg0) +static u32 GetScore(u8 playerId) { u8 i; - u32 var, sum = 0; + u32 scoreLost, score = 0; - for (i = 0; i < 3; i++) - sum += gUnknown_203F3E0->unk4A[arg0][i] * sUnknown_84755D8[i]; + // Sum up points for berries picked + for (i = 0; i < BERRY_MISSED; i++) + score += sGame->berryResults[playerId][i] * sBerryScoreMultipliers[i]; - var = gUnknown_203F3E0->unk4A[arg0][3] * sUnknown_84755D8[3]; - if (sum <= var) + // Get points lost for berries missed + scoreLost = sGame->berryResults[playerId][BERRY_MISSED] * sBerryScoreMultipliers[BERRY_MISSED]; + + if (score <= scoreLost) return 0; else - return sum - var; + return score - scoreLost; } -u32 sub_81534AC(void) +static u32 GetHighestScore(void) { - u8 i, count = gUnknown_203F3E0->unk24; - u32 maxVar = sub_8153424(0); + u8 i, numPlayers = sGame->numPlayers; + u32 highestScore = GetScore(0); - for (i = 1; i < count; i++) + for (i = 1; i < numPlayers; i++) { - u32 var = sub_8153424(i); - if (var > maxVar) - maxVar = var; + u32 score = GetScore(i); + if (score > highestScore) + highestScore = score; } - return Min(maxVar, 999990); + return Min(highestScore, MAX_SCORE); } -u32 sub_81534F0(u8 arg0) +static u32 GetHighestBerryResult(u8 berryId) { - u8 i, count = gUnknown_203F3E0->unk24; - u16 maxVar = gUnknown_203F3E0->unk4A[0][arg0]; + u8 i, numPlayers = sGame->numPlayers; + u16 highestResult = sGame->berryResults[0][berryId]; - for (i = 0; i < count; i++) + for (i = 0; i < numPlayers; i++) { - u16 var = gUnknown_203F3E0->unk4A[i][arg0]; - if (var > maxVar) - maxVar = var; + u16 result = sGame->berryResults[i][berryId]; + if (result > highestResult) + highestResult = result; } - return maxVar; + return highestResult; } -static u32 sub_8153534(u8 arg0) +static u32 GetScoreByRanking(u8 ranking) { - u32 vals[5], temp; - s16 r6 = TRUE; - u8 i, count = gUnknown_203F3E0->unk24; + u32 scores[MAX_RFU_PLAYERS], temp; + s16 unsorted = TRUE; + u8 i, numPlayers = sGame->numPlayers; - for (i = 0; i < count; i++) - vals[i] = temp = sub_8153424(i); + for (i = 0; i < numPlayers; i++) + scores[i] = temp = GetScore(i); - while (r6) + // Sort the scores in the array highest to lowest + while (unsorted) { - r6 = FALSE; - for (i = 0; i < count - 1; i++) + unsorted = FALSE; + for (i = 0; i < numPlayers - 1; i++) { - if (vals[i] < vals[i + 1]) + if (scores[i] < scores[i + 1]) { - SWAP(vals[i], vals[i + 1], temp); - r6 = TRUE; + SWAP(scores[i], scores[i + 1], temp); + unsorted = TRUE; } } } - return vals[arg0]; + return scores[ranking]; } -u32 sub_81535B0(void) +static u32 SetScoreResults(void) { - u8 i, r10 = 0, r8 = 0, r9 = 0, count = gUnknown_203F3E0->unk24; + u8 i, ranking = 0, nextRanking = 0, playersRanked = 0; + u8 numPlayers = sGame->numPlayers; - // Function called two times for some reason. - sub_81534AC(); - if (sub_81534AC() == 0) + GetHighestScore(); // Useless call + + if (GetHighestScore() == 0) { - for (i = 0; i < count; i++) + // No one scored any points, put everyone in last place with a score of 0. + // Presumably this was supposed to then return, as the assignments in this + // loop are then overwritten by the rest of the function + for (i = 0; i < numPlayers; i++) { - gUnknown_203F3E0->unk3308[i].unk0 = 4; - gUnknown_203F3E0->unk3308[i].unk4 = 0; + sGame->scoreResults[i].ranking = MAX_RFU_PLAYERS - 1;; + sGame->scoreResults[i].score = 0; } } - for (i = 0; i < count; i++) - gUnknown_203F3E0->unk3308[i].unk4 = Min(sub_8153424(i), 999990); + // Set scores + for (i = 0; i < numPlayers; i++) + sGame->scoreResults[i].score = Min(GetScore(i), MAX_SCORE); + // Set rankings do { - u32 r6 = sub_8153534(r10); - u8 r3 = r8; - for (i = 0; i < count; i++) + u32 score = GetScoreByRanking(ranking); + u8 curRanking = nextRanking; + + // Find all players with the score for this ranking. + // Increment nextRanking but not curRanking to allow + // for ties + for (i = 0; i < numPlayers; i++) { - if (r6 == gUnknown_203F3E0->unk3308[i].unk4) + if (score == sGame->scoreResults[i].score) { - gUnknown_203F3E0->unk3308[i].unk0 = r3; - r8++; - r9++; + sGame->scoreResults[i].ranking = curRanking; + nextRanking++; + playersRanked++; } } - r10 = r8; - } while (r9 < count); + ranking = nextRanking; + } while (playersRanked < numPlayers); return 0; } -void sub_81536A0(struct DodrioSubstruct_3308 * dst, u8 id) +static void GetScoreResults(struct DodrioGame_ScoreResults * dst, u8 playerId) { - *dst = gUnknown_203F3E0->unk3308[id]; + *dst = sGame->scoreResults[playerId]; } -static u8 sub_81536C0(u8 arg0) +// Unused +// Returns where the specified player's score ranks, 0 being first (highest score) +static u8 GetScoreRanking(u8 playerId) { - u8 i, ret = 0, count = gUnknown_203F3E0->unk24; - u32 var, vars[5] = {0}; + u8 i, ranking = 0; + u8 numPlayers = sGame->numPlayers; + u32 playersScore, scores[MAX_RFU_PLAYERS] = {0}; - for (i = 0; i < count; i++) - vars[i] = sub_8153424(i); + for (i = 0; i < numPlayers; i++) + scores[i] = GetScore(i); - var = vars[arg0]; - for (i = 0; i < 5; i++) + playersScore = scores[playerId]; + for (i = 0; i < MAX_RFU_PLAYERS; i++) { - if (i != arg0 && var < vars[i]) - ret++; + if (i != playerId && playersScore < scores[i]) + ranking++; } - return ret; + return ranking; } -u8 sub_815372C(void) -{ - u8 multiplayerId = gUnknown_203F3E0->multiplayerId; - u16 itemId = sub_8153390(); +enum { + PRIZE_RECEIVED, + PRIZE_FILLED_BAG, + PRIZE_NO_ROOM, + NO_PRIZE, +}; - if (sub_8153424(multiplayerId) != sub_81534AC()) - return 3; +static u8 TryGivePrize(void) +{ + u8 multiplayerId = sGame->multiplayerId; + u16 itemId = GetPrizeItemId(); + + if (GetScore(multiplayerId) != GetHighestScore()) + return NO_PRIZE; if (!CheckBagHasSpace(itemId, 1)) - return 2; + return PRIZE_NO_ROOM; AddBagItem(itemId, 1); if (!CheckBagHasSpace(itemId, 1)) - return 1; - return 0; + return PRIZE_FILLED_BAG; + return PRIZE_RECEIVED; } -// Really? What next, u32 Add(u32 a)return a+1;? -u32 IncrementWithLimit(u32 a, u32 max) +static u32 IncrementWithLimit(u32 num, u32 max) { - if (a < max) - return a + 1; + if (num < max) + return num + 1; else return max; } -// Gamefreak pls, min(a, b) ((a) < (b) ? (a) : (b)) is a well-known macro -u32 Min(u32 a, u32 b) +static u32 Min(u32 a, u32 b) { if (a < b) return a; @@ -2284,9 +2903,9 @@ u32 Min(u32 a, u32 b) return b; } -u8 sub_81537AC(u8 id) +static u8 GetPlayerIdByPos(u8 id) { - return gUnknown_203F3E0->unk34[id]; + return sGame->posToPlayerId[id]; } void IsDodrioInParty(void) @@ -2305,14 +2924,15 @@ void IsDodrioInParty(void) gSpecialVar_Result = FALSE; } +#define NUM_RECORD_TYPES 3 + void ShowDodrioBerryPickingRecords(void) { u8 taskId = CreateTask(Task_ShowDodrioBerryPickingRecords, 0); Task_ShowDodrioBerryPickingRecords(taskId); } -// Data related to printing saved results. -static const struct WindowTemplate sUnknown_84755E0 = +static const struct WindowTemplate sWindowTemplates_Records = { .bg = 0, .tilemapLeft = 1, @@ -2323,12 +2943,15 @@ static const struct WindowTemplate sUnknown_84755E0 = .baseBlock = 1, }; -static const u8 *const sUnknown_84755E8[] = {gText_BerryPickingRecords, gText_BerriesPicked, gText_BestScore, gText_BerriesInRowFivePlayers}; -static const u8 sUnknown_84755F8[] = {4, 7, 4}; +static const u8 *const sRecordsTexts[NUM_RECORD_TYPES + 1] = {gText_BerryPickingRecords, gText_BerriesPicked, gText_BestScore, gText_BerriesInRowFivePlayers}; +static const u8 sRecordNumMaxDigits[NUM_RECORD_TYPES] = {4, 7, 4}; ALIGNED(4) -static const u8 sUnknown_84755FC[][2] = {{24}, {40}, {56}}; -static const u8 sUnknown_8475602[][2] = {{24}, {40}, {70}}; +static const u8 sRecordTextYCoords[NUM_RECORD_TYPES][2] = {{24}, {40}, {56}}; +static const u8 sRecordNumYCoords[NUM_RECORD_TYPES][2] = {{24}, {40}, {70}}; + +#define tState data[0] +#define tWindowId data[1] static void Task_ShowDodrioBerryPickingRecords(u8 taskId) { @@ -2336,30 +2959,30 @@ static void Task_ShowDodrioBerryPickingRecords(u8 taskId) s32 i, width, widthCurr; s16 *data = gTasks[taskId].data; - switch (data[0]) + switch (tState) { case 0: - data[1] = AddWindow(&sUnknown_84755E0); - sub_81538D0(data[1]); - CopyWindowToVram(data[1], COPYWIN_FULL); - data[0]++; + tWindowId = AddWindow(&sWindowTemplates_Records); + PrintRecordsText(tWindowId); + CopyWindowToVram(tWindowId, COPYWIN_FULL); + tState++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) - data[0]++; + tState++; break; case 2: if (JOY_NEW(A_BUTTON | B_BUTTON)) { - rbox_fill_rectangle(data[1]); - CopyWindowToVram(data[1], COPYWIN_MAP); - data[0]++; + rbox_fill_rectangle(tWindowId); + CopyWindowToVram(tWindowId, COPYWIN_MAP); + tState++; } break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) { - RemoveWindow(data[1]); + RemoveWindow(tWindowId); DestroyTask(taskId); EnableBothScriptContexts(); } @@ -2367,69 +2990,1965 @@ static void Task_ShowDodrioBerryPickingRecords(u8 taskId) } } -static void sub_81538D0(u8 windowId) +#undef tState +#undef tWindowId + +static void PrintRecordsText(u8 windowId) { s32 i, x, numWidth; - s32 results[3]; + s32 recordNums[NUM_RECORD_TYPES]; u8 strbuf[20]; - results[0] = gSaveBlock2Ptr->berryPick.berriesPicked; - results[1] = gSaveBlock2Ptr->berryPick.bestScore; - results[2] = gSaveBlock2Ptr->berryPick.berriesPickedInRow; + recordNums[0] = gSaveBlock2Ptr->berryPick.berriesPicked; + recordNums[1] = gSaveBlock2Ptr->berryPick.bestScore; + recordNums[2] = gSaveBlock2Ptr->berryPick.berriesPickedInRow; TextWindow_SetStdFrame0_WithPal(windowId, 0x21D, 0xD0); DrawTextBorderOuter(windowId, 0x21D, 0xD); FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); - AddTextPrinterParameterized(windowId, FONT_2, sUnknown_84755E8[0], 1, 1, TEXT_SKIP_DRAW, NULL); - for (i = 0; i < 3; i++) + AddTextPrinterParameterized(windowId, FONT_2, sRecordsTexts[0], 1, 1, TEXT_SKIP_DRAW, NULL); + for (i = 0; i < NUM_RECORD_TYPES; i++) { - ConvertIntToDecimalStringN(strbuf, results[i], STR_CONV_MODE_LEFT_ALIGN, sUnknown_84755F8[i]); + ConvertIntToDecimalStringN(strbuf, recordNums[i], STR_CONV_MODE_LEFT_ALIGN, sRecordNumMaxDigits[i]); numWidth = GetStringWidth(FONT_2, strbuf, -1); - AddTextPrinterParameterized(windowId, FONT_2, sUnknown_84755E8[i + 1], 1, sUnknown_84755FC[i][0], TEXT_SKIP_DRAW, NULL); - x = 224 - numWidth; - AddTextPrinterParameterized(windowId, FONT_2, strbuf, x, sUnknown_8475602[i][0], TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(windowId, FONT_2, sRecordsTexts[i + 1], 1, sRecordTextYCoords[i][0], TEXT_SKIP_DRAW, NULL); + x = DISPLAY_WIDTH - 16 - numWidth; + AddTextPrinterParameterized(windowId, FONT_2, strbuf, x, sRecordNumYCoords[i][0], TEXT_SKIP_DRAW, NULL); } PutWindowTilemap(windowId); } // Debug functions? -static const u16 sUnknown_8475608[][4] = +static const u16 sDebug_BerryResults[MAX_RFU_PLAYERS][4] = { - {9999, 0, 90, 9999}, - {9999, 9999, 70, 9999}, - {9999, 0, 9999, 0}, - {9999, 9999, 60, 0}, - {9999, 9999, 9999, 0}, + { + [BERRY_BLUE] = MAX_BERRIES, + [BERRY_GREEN] = 0, + [BERRY_GOLD] = 90, + [BERRY_MISSED] = MAX_BERRIES + }, + { + [BERRY_BLUE] = MAX_BERRIES, + [BERRY_GREEN] = MAX_BERRIES, + [BERRY_GOLD] = 70, + [BERRY_MISSED] = MAX_BERRIES + }, + { + [BERRY_BLUE] = MAX_BERRIES, + [BERRY_GREEN] = 0, + [BERRY_GOLD] = MAX_BERRIES, + [BERRY_MISSED] = 0 + }, + { + [BERRY_BLUE] = MAX_BERRIES, + [BERRY_GREEN] = MAX_BERRIES, + [BERRY_GOLD] = 60, + [BERRY_MISSED] = 0 + }, + { + [BERRY_BLUE] = MAX_BERRIES, + [BERRY_GREEN] = MAX_BERRIES, + [BERRY_GOLD] = MAX_BERRIES, + [BERRY_MISSED] = 0 + }, }; -static const u8 sUnknown_8475630[] = _("あいうえおかき"); -static const u8 sUnknown_8475638[] = _("ABCDEFG"); -static const u8 sUnknown_8475640[] = _("0123456"); +static const u8 sJPText_Vowels[] = _("あいうえおかき"); +static const u8 sText_Letters[] = _("ABCDEFG"); +static const u8 sText_Digits[] = _("0123456"); static const u8 *const sPlaceholderPlayerNames[] = { - sUnknown_8475630, - sUnknown_8475630, - sUnknown_8475630, - sUnknown_8475638, - sUnknown_8475640 + sJPText_Vowels, + sJPText_Vowels, + sJPText_Vowels, + sText_Letters, + sText_Digits }; -static void sub_81539EC(void) +static void Debug_UpdateNumPlayers(void) { - gUnknown_203F3E0->unk24 = GetLinkPlayerCount(); + sGame->numPlayers = GetLinkPlayerCount(); } -static void sub_8153A04(void) +static void Debug_SetPlayerNamesAndResults(void) { u8 i, playerId; - for (playerId = gUnknown_203F3E0->unk24; playerId < NELEMS(sPlaceholderPlayerNames); playerId++) + for (playerId = sGame->numPlayers; playerId < ARRAY_COUNT(sPlaceholderPlayerNames); playerId++) StringCopy(gLinkPlayers[playerId].name, sPlaceholderPlayerNames[playerId]); - gUnknown_203F3E0->unk24 = 5; - for (i = 0; i < 4; i++) + sGame->numPlayers = MAX_RFU_PLAYERS; + for (i = 0; i < NUM_BERRY_TYPES; i++) { - for (playerId = 0; playerId < gUnknown_203F3E0->unk24; playerId++) - gUnknown_203F3E0->unk4A[playerId][i] = sUnknown_8475608[playerId][i]; + for (playerId = 0; playerId < sGame->numPlayers; playerId++) + sGame->berryResults[playerId][i] = sDebug_BerryResults[playerId][i]; } } + +static const struct BgTemplate sBgTemplates[] = +{ + { + .bg = BG_INTERFACE, + .charBaseIndex = 0, + .mapBaseIndex = 30, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = BG_TREE_LEFT, + .charBaseIndex = 2, + .mapBaseIndex = 12, + .screenSize = 1, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = BG_TREE_RIGHT, + .charBaseIndex = 2, + .mapBaseIndex = 14, + .screenSize = 1, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = BG_SCENERY, + .charBaseIndex = 3, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, +}; + +static const struct WindowTemplate sWindowTemplate_Dummy = DUMMY_WIN_TEMPLATE; + +static const struct WindowTemplate sWindowTemplates_Results[] = +{ + { + .bg = BG_INTERFACE, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 28, + .height = 3, + .paletteNum = 13, + .baseBlock = 0x13, + }, + { + .bg = BG_INTERFACE, + .tilemapLeft = 1, + .tilemapTop = 6, + .width = 28, + .height = 13, + .paletteNum = 13, + .baseBlock = 0x67, + } +}; + +static const struct WindowTemplate sWindowTemplate_Prize = +{ + .bg = BG_INTERFACE, + .tilemapLeft = 1, + .tilemapTop = 6, + .width = 28, + .height = 7, + .paletteNum = 13, + .baseBlock = 0x67, +}; + +enum { + WIN_PLAY_AGAIN, + WIN_YES_NO, +}; + +static const struct WindowTemplate sWindowTemplates_PlayAgain[] = +{ + [WIN_PLAY_AGAIN] = { + .bg = BG_INTERFACE, + .tilemapLeft = 1, + .tilemapTop = 8, + .width = 19, + .height = 3, + .paletteNum = 13, + .baseBlock = 0x13, + }, + [WIN_YES_NO] = { + .bg = BG_INTERFACE, + .tilemapLeft = 22, + .tilemapTop = 7, + .width = 6, + .height = 4, + .paletteNum = 13, + .baseBlock = 0x4C, + } +}; + +static const struct WindowTemplate sWindowTemplate_DroppedOut = +{ + .bg = BG_INTERFACE, + .tilemapLeft = 4, + .tilemapTop = 6, + .width = 22, + .height = 5, + .paletteNum = 13, + .baseBlock = 0x13, +}; + +static const struct WindowTemplate sWindowTemplate_CommStandby = +{ + .bg = BG_INTERFACE, + .tilemapLeft = 5, + .tilemapTop = 8, + .width = 19, + .height = 3, + .paletteNum = 13, + .baseBlock = 0x13, +}; + +// Unused duplicate of sActiveColumnMap +static const u8 sActiveColumnMap_Duplicate[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS][NUM_BERRY_COLUMNS] = +{ + { + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, + }, + { + {0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 0}, + {0, 1, 2, 5, 6, 3, 4, 5, 8, 9, 0}, + }, + { + {0, 1, 2, 3, 4, 5, 6, 7, 2, 9, 0}, + {0, 1, 4, 5, 6, 7, 2, 3, 4, 9, 0}, + {0, 1, 6, 7, 2, 3, 4, 5, 6, 9, 0}, + }, + { + {0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 0}, + {0, 3, 4, 5, 6, 7, 8, 1, 2, 3, 0}, + {0, 5, 6, 7, 8, 1, 2, 3, 4, 5, 0}, + {0, 7, 8, 1, 2, 3, 4, 5, 6, 7, 0}, + }, + { + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, + {2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}, + {4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4}, + {6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6}, + {8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8}, + }, +}; + +// Unused duplicate of sDodrioHeadToColumnMap +static const u8 sDodrioHeadToColumnMap_Duplicate[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS][3] = +{ + { + {4, 5, 6}, + }, + { + {3, 4, 5}, + {5, 6, 3}, + }, + { + {4, 5, 6}, + {6, 7, 2}, + {2, 3, 4}, + }, + { + {3, 4, 5}, + {5, 6, 7}, + {7, 8, 1}, + {1, 2, 3}, + }, + { + {4, 5, 6}, + {6, 7, 8}, + {8, 9, 0}, + {0, 1, 2}, + {2, 3, 4}, + }, +}; + +// Unused duplicate of sDodrioNeighborMap +static const u8 sDodrioNeighborMap_Duplicate[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS][3] = +{ + { + {1, 0, 1}, + }, + { + {1, 0, 1}, + {0, 1, 0}, + }, + { + {2, 0, 1}, + {0, 1, 2}, + {1, 2, 0}, + }, + { + {3, 0, 1}, + {0, 1, 2}, + {1, 2, 3}, + {2, 3, 0}, + }, + { + {4, 0, 1}, + {0, 1, 2}, + {1, 2, 3}, + {2, 3, 4}, + {3, 4, 0}, + }, +}; + +// Unused duplicate of sPlayerIdAtColumn +ALIGNED(4) +static const u8 sPlayerIdAtColumn_Duplicate[MAX_RFU_PLAYERS][NUM_BERRY_COLUMNS] = +{ + {9, 9, 9, 9, 1, 1, 1, 9, 9, 9, 9}, + {9, 9, 9, 0, 0, 1, 1, 0, 9, 9, 9}, + {9, 9, 2, 2, 0, 0, 1, 1, 1, 9, 9}, + {9, 3, 3, 0, 0, 1, 1, 2, 2, 3, 9}, + {3, 3, 4, 4, 0, 0, 1, 1, 2, 2, 3}, +}; + +// Unused duplicate of sUnsharedColumns +static const u8 sUnsharedColumns_Duplicate[MAX_RFU_PLAYERS][MAX_RFU_PLAYERS] = +{ + {5}, + {4, 6}, + {3, 5, 7}, + {2, 4, 6, 8}, + {1, 3, 5, 6, 9}, +}; + +static const u16 sBg_Pal[] = INCBIN_U16("graphics/dodrio_berry_picking/bg.gbapal", + "graphics/dodrio_berry_picking/tree_border.gbapal"); +static const u16 sDodrioNormal_Pal[] = INCBIN_U16("graphics/dodrio_berry_picking/dodrio.gbapal"); +static const u16 sDodrioShiny_Pal[] = INCBIN_U16("graphics/dodrio_berry_picking/shiny.gbapal"); +static const u16 sStatus_Pal[] = INCBIN_U16("graphics/dodrio_berry_picking/status.gbapal"); +static const u16 sBerries_Pal[] = INCBIN_U16("graphics/dodrio_berry_picking/berries.gbapal"); +static const u32 sBerries_Gfx[] = INCBIN_U32("graphics/dodrio_berry_picking/berries.4bpp.lz"); +static const u16 sCloud_Pal[] = INCBIN_U16("graphics/dodrio_berry_picking/cloud.gbapal"); +static const u32 sBg_Gfx[] = INCBIN_U32("graphics/dodrio_berry_picking/bg.4bpp.lz"); +static const u32 sTreeBorder_Gfx[] = INCBIN_U32("graphics/dodrio_berry_picking/tree_border.4bpp.lz"); +static const u32 sStatus_Gfx[] = INCBIN_U32("graphics/dodrio_berry_picking/status.4bpp.lz"); +static const u32 sCloud_Gfx[] = INCBIN_U32("graphics/dodrio_berry_picking/cloud.4bpp.lz"); +static const u32 sDodrio_Gfx[] = INCBIN_U32("graphics/dodrio_berry_picking/dodrio.4bpp.lz"); +static const u32 sBg_Tilemap[] = INCBIN_U32("graphics/dodrio_berry_picking/bg.bin.lz"); +static const u32 sTreeBorderRight_Tilemap[] = INCBIN_U32("graphics/dodrio_berry_picking/tree_border_right.bin.lz"); +static const u32 sTreeBorderLeft_Tilemap[] = INCBIN_U32("graphics/dodrio_berry_picking/tree_border_left.bin.lz"); + +static const struct OamData sOamData_Dodrio = +{ + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = FALSE, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(64x64), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(64x64), + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0 +}; + +// Used by the status bar and the results screen berry icons +static const struct OamData sOamData_16x16_Priority0 = +{ + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = FALSE, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(16x16), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(16x16), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_Berry = +{ + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = FALSE, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(16x16), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(16x16), + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_Cloud = +{ + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = FALSE, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(64x32), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(64x32), + .tileNum = 0, + .priority = 3, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AnimCmd sAnim_Dodrio_Normal[] = +{ + ANIMCMD_FRAME(0, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnim_Dodrio_PickRight[] = +{ + ANIMCMD_FRAME(64, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnim_Dodrio_PickMiddle[] = +{ + ANIMCMD_FRAME(128, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnim_Dodrio_PickLeft[] = +{ + ANIMCMD_FRAME(192, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnim_Dodrio_Down[] = +{ + ANIMCMD_FRAME(256, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd *const sAnims_Dodrio[] = +{ + [PICK_NONE] = sAnim_Dodrio_Normal, + [PICK_RIGHT] = sAnim_Dodrio_PickRight, + [PICK_MIDDLE] = sAnim_Dodrio_PickMiddle, + [PICK_LEFT] = sAnim_Dodrio_PickLeft, + [PICK_DISABLED] = sAnim_Dodrio_Down, + // There is an unused 6th frame of Dodrio's graphic +}; + +static const union AnimCmd sAnims_StatusBar_Yellow[] = +{ + ANIMCMD_FRAME(0, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnims_StatusBar_Gray[] = +{ + ANIMCMD_FRAME(4, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnims_StatusBar_Red[] = +{ + ANIMCMD_FRAME(8, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd *const sAnims_StatusBar[] = +{ + [STATUS_YELLOW] = sAnims_StatusBar_Yellow, + [STATUS_GRAY] = sAnims_StatusBar_Gray, + [STATUS_RED] = sAnims_StatusBar_Red +}; + +static const union AnimCmd sAnim_Berry_Blue[] = +{ + ANIMCMD_FRAME(0, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnim_Berry_Green[] = +{ + ANIMCMD_FRAME(4, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnim_Berry_Gold[] = +{ + ANIMCMD_FRAME(8, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnim_Berry_BlueSquished[] = +{ + ANIMCMD_FRAME(12, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnim_Berry_GreenSquished[] = +{ + ANIMCMD_FRAME(16, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnim_Berry_GoldSquished[] = +{ + ANIMCMD_FRAME(20, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnim_Berry_Eaten[] = +{ + ANIMCMD_FRAME(24, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnim_Berry_Empty1[] = +{ + ANIMCMD_FRAME(28, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sAnim_Berry_Empty2[] = +{ + ANIMCMD_FRAME(32, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd *const sAnims_Berry[] = +{ + [BERRY_BLUE] = sAnim_Berry_Blue, + [BERRY_GREEN] = sAnim_Berry_Green, + [BERRY_GOLD] = sAnim_Berry_Gold, + + [BERRY_BLUE + BERRY_MISSED] = sAnim_Berry_BlueSquished, + [BERRY_GREEN + BERRY_MISSED] = sAnim_Berry_GreenSquished, + [BERRY_GOLD + BERRY_MISSED] = sAnim_Berry_GoldSquished, + + [ANIM_EATEN] = sAnim_Berry_Eaten, + + sAnim_Berry_Empty1, + sAnim_Berry_Empty2 +}; + +static const union AnimCmd sAnim_Cloud[] = +{ + ANIMCMD_FRAME(0, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd *const sAnims_Cloud[] = +{ + sAnim_Cloud +}; + +static void LoadDodrioGfx(void) +{ + void *ptr = AllocZeroed(0x3000); + struct SpritePalette normal = {sDodrioNormal_Pal, PALTAG_DODRIO_NORMAL}; + struct SpritePalette shiny = {sDodrioShiny_Pal, PALTAG_DODRIO_SHINY}; + + LZ77UnCompWram(sDodrio_Gfx, ptr); + if (ptr) + { + struct SpriteSheet sheet = {ptr, 0x3000, GFXTAG_DODRIO}; + LoadSpriteSheet(&sheet); + Free(ptr); + } + LoadSpritePalette(&normal); + LoadSpritePalette(&shiny); +} + +static void CreateDodrioSprite(struct DodrioGame_MonInfo * monInfo, u8 playerId, u8 id, u8 numPlayers) +{ + struct SpriteTemplate template = + { + .tileTag = GFXTAG_DODRIO, + .paletteTag = monInfo->isShiny, // PALTAG_DODRIO_NORMAL / PALTAG_DODRIO_SHINY + .oam = &sOamData_Dodrio, + .anims = sAnims_Dodrio, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_Dodrio, + }; + + sDodrioSpriteIds[id] = AllocZeroed(4); + *sDodrioSpriteIds[id] = CreateSprite(&template, GetDodrioXPos(playerId, numPlayers), 136, 3); + SetDodrioInvisibility(TRUE, id); +} + +#define sState data[0] +#define sTimer data[1] +#define sUnused1 data[2] +#define sUnused2 data[3] +#define sUnused3 data[4] + +static void SpriteCB_Dodrio(struct Sprite *sprite) +{ + switch (sprite->sState) + { + case 0: + break; + case 1: + DoDodrioMissedAnim(sprite); + break; + case 2: + DoDodrioIntroAnim(sprite); + break; + } +} + +static void StartDodrioMissedAnim(u8 unused) +{ + struct Sprite *sprite = &gSprites[*sDodrioSpriteIds[GetMultiplayerId()]]; + sprite->sState = 1; + sprite->sTimer = 0; + sprite->sUnused1 = 0; + sprite->sUnused2 = 0; + sprite->sUnused3 = 0; +} + +static void StartDodrioIntroAnim(u8 unused) +{ + struct Sprite *sprite = &gSprites[*sDodrioSpriteIds[GetMultiplayerId()]]; + sprite->sState = 2; + sprite->sTimer = 0; + sprite->sUnused1 = 0; + sprite->sUnused2 = 0; + sprite->sUnused3 = 0; +} + +// Do animation where Dodrio shakes horizontally after reaching for a berry and missing +static u32 DoDodrioMissedAnim(struct Sprite *sprite) +{ + s8 x; + u8 state = (++sprite->sTimer / 2) % 4; + + if (sprite->sTimer >= 3) + { + switch (state) + { + default: + x = 1; + break; + case 1: + case 2: + x = -1; + break; + } + + sprite->x += x; + if (++sprite->sTimer >= 40) + { + sprite->sState = 0; + sprite->x = GetDodrioXPos(0, GetNumPlayers()); + } + } + + return 0; +} + +// Does the intro animation where the player's Dodrio +// cycles through extending each head twice +#define FRAMES_PER_STATE 13 +#define NUM_INTRO_PICK_STATES PICK_DISABLED // Cycle through 'Normal' and each head, but exclude the Disabled state + +static u32 DoDodrioIntroAnim(struct Sprite *sprite) +{ + u8 pickState = (++sprite->sTimer / FRAMES_PER_STATE) % NUM_INTRO_PICK_STATES; + + // Play a sound effect at the start of each head extension + if (sprite->sTimer % FRAMES_PER_STATE == 0 && pickState != PICK_NONE) + PlaySE(SE_M_CHARM); + + if (sprite->sTimer >= FRAMES_PER_STATE * NUM_INTRO_PICK_STATES * 2) + { + // End animation + sprite->sState = 0; + pickState = PICK_NONE; + } + SetDodrioAnim(GetMultiplayerId(), pickState); + return 0; +} + +#undef sState +#undef sTimer +#undef sUnused1 +#undef sUnused2 +#undef sUnused3 + +static void FreeDodrioSprites(u8 numPlayers) +{ + u8 i; + for (i = 0; i < numPlayers; i++) + { + struct Sprite *sprite = &gSprites[*sDodrioSpriteIds[i]]; + if (sprite) + DestroySpriteAndFreeResources(sprite); +#ifdef BUGFIX + FREE_AND_SET_NULL(sDodrioSpriteIds[i]); // Memory should be freed here but is not. +#endif + } +} + +static void SetDodrioInvisibility(bool8 invisible, u8 id) +{ + gSprites[*sDodrioSpriteIds[id]].invisible = invisible; +} + +static void SetAllDodrioInvisibility(bool8 invisible, u8 numPlayers) +{ + u8 i; + for (i = 0; i < numPlayers; i++) + SetDodrioInvisibility(invisible, i); +} + +static void SetDodrioAnim(u8 id, u8 pickState) +{ + StartSpriteAnim(&gSprites[*sDodrioSpriteIds[id]], pickState); +} + +static void SpriteCB_Status(struct Sprite *sprite) +{ + +} + +static void InitStatusBarPos(void) +{ + u8 i; + for (i = 0; i < NUM_STATUS_SQUARES; i++) + { + struct Sprite *sprite = &gSprites[sStatusBar->spriteIds[i]]; + sprite->x = (i * 16) + 48; + sprite->y = -8 - (i * 8); + sStatusBar->entered[i] = FALSE; + } +} + +static void CreateStatusBarSprites(void) +{ + u8 i; + void *ptr = AllocZeroed(0x180); + struct SpritePalette pal = {sStatus_Pal, PALTAG_STATUS}; + + LZ77UnCompWram(sStatus_Gfx, ptr); + // This check should be one line up. + if (ptr) + { + struct SpriteSheet sheet = {ptr, 0x180, GFXTAG_STATUS}; + struct SpriteTemplate template = + { + .tileTag = GFXTAG_STATUS, + .paletteTag = PALTAG_STATUS, + .oam = &sOamData_16x16_Priority0, + .anims = sAnims_StatusBar, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_Status, + }; + + sStatusBar = AllocZeroed(sizeof(*sStatusBar)); + LoadSpriteSheet(&sheet); + LoadSpritePalette(&pal); + for (i = 0; i < NUM_STATUS_SQUARES; i++) + sStatusBar->spriteIds[i] = CreateSprite(&template, (i * 16) + 48, -8 - (i * 8), 0); + } + + Free(ptr); +} + +static void FreeStatusBar(void) +{ + u8 i; + for (i = 0; i < NUM_STATUS_SQUARES; i++) + { + struct Sprite *sprite = &gSprites[sStatusBar->spriteIds[i]]; + if (sprite) + DestroySpriteAndFreeResources(sprite); + } + FREE_AND_SET_NULL(sStatusBar); +} + +// Progress an animation where each square of the +// status bar drops down into view, bounces up, +// then settles into position. +// Returns TRUE if the animation is complete +static bool32 DoStatusBarIntro(void) +{ + u8 i; + bool32 animActive = FALSE; + for (i = 0; i < NUM_STATUS_SQUARES; i++) + { + struct Sprite *sprite = &gSprites[sStatusBar->spriteIds[i]]; + sStatusBar->yChange[i] = 2; + if (sStatusBar->entered[i] != 0 && sprite->y == 8) + continue; + + animActive = TRUE; + if (sprite->y == 8) + { + if (sStatusBar->entered[i]) + continue; + + // Square has entered screen, play click + // sound and reverse direction + sStatusBar->entered[i] = TRUE; + sStatusBar->yChange[i] = -16; + PlaySE(SE_CLICK); + } + sprite->y += sStatusBar->yChange[i]; + } + + if (animActive) + return FALSE; + else + return TRUE; +} + +// The status bar at the top changes color depending on the game performance. +// The squares start out yellow. For every berry missed, a square is colored gray. +// If there are 4 or fewer yellow squares left they also flash red +static void UpdateStatusBarAnim(u8 numEmpty) +{ + u8 i; + + if (numEmpty > NUM_STATUS_SQUARES) + { + // All squares gray + for (i = 0; i < NUM_STATUS_SQUARES; i++) + StartSpriteAnim(&gSprites[sStatusBar->spriteIds[i]], STATUS_GRAY); + } + else + { + // At least 1 square is yellow + for (i = 0; i < NUM_STATUS_SQUARES - numEmpty; i++) + { + if (numEmpty > 6) + { + // Flash the yellow squares red + // The flash cycles faster the fewer yellow squares remain + sStatusBar->flashTimer += numEmpty - 6; + if (sStatusBar->flashTimer > 30) + sStatusBar->flashTimer = 0; + else if (sStatusBar->flashTimer > 10) + StartSpriteAnim(&gSprites[sStatusBar->spriteIds[i]], STATUS_RED); + else + StartSpriteAnim(&gSprites[sStatusBar->spriteIds[i]], STATUS_YELLOW); + } + else + { + StartSpriteAnim(&gSprites[sStatusBar->spriteIds[i]], STATUS_YELLOW); + } + } + + // Set remaining squares gray + for (; i < NUM_STATUS_SQUARES; i++) + StartSpriteAnim(&gSprites[sStatusBar->spriteIds[i]], STATUS_GRAY); + } +} + +static void SetStatusBarInvisibility(bool8 invisible) +{ + u8 i; + for (i = 0; i < NUM_STATUS_SQUARES; i++) + gSprites[sStatusBar->spriteIds[i]].invisible = invisible; +} + +static const u8 sUnusedSounds[] = { + SE_M_CHARM, + SE_NOTE_C, + SE_NOTE_D, + SE_NOTE_E, + SE_NOTE_F, + SE_NOTE_G, + SE_NOTE_A, + SE_NOTE_B, + SE_NOTE_C_HIGH, + SE_CARD_OPEN +}; + +static void LoadBerryGfx(void) +{ + void *ptr = AllocZeroed(0x480); + struct SpritePalette pal = {sBerries_Pal, PALTAG_BERRIES}; + + LZ77UnCompWram(sBerries_Gfx, ptr); + if (ptr) + { + struct SpriteSheet sheet = {ptr, 0x480, GFXTAG_BERRIES}; + LoadSpriteSheet(&sheet); + } + + LoadSpritePalette(&pal); + Free(ptr); +} + +static const s16 sBerryIconXCoords[] = {88, 128, 168, 208}; + +static void CreateBerrySprites(void) +{ + u8 i; + s16 x; + + struct SpriteTemplate berry = + { + .tileTag = GFXTAG_BERRIES, + .paletteTag = PALTAG_BERRIES, + .oam = &sOamData_Berry, + .anims = sAnims_Berry, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }; + struct SpriteTemplate berryIcon = + { + .tileTag = GFXTAG_BERRIES, + .paletteTag = PALTAG_BERRIES, + .oam = &sOamData_16x16_Priority0, + .anims = sAnims_Berry, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }; + + // Create berry sprites that fall during gameplay + for (i = 0; i < NUM_BERRY_COLUMNS; i++) + { + sBerrySpriteIds[i] = AllocZeroed(4); + x = i * 16; + *sBerrySpriteIds[i] = CreateSprite(&berry, x + (i * 8), 8, 1); + SetBerryInvisibility(i, TRUE); + } + + // Create berry icon sprites for results screen + for (i = 0; i < NUM_BERRY_TYPES; i++) + { + sBerryIconSpriteIds[i] = AllocZeroed(4); + if (i == BERRY_MISSED) + *sBerryIconSpriteIds[i] = CreateSprite(&berryIcon, sBerryIconXCoords[i], 57, 0); + else + *sBerryIconSpriteIds[i] = CreateSprite(&berryIcon, sBerryIconXCoords[i], 60, 0); + StartSpriteAnim(&gSprites[*sBerryIconSpriteIds[i]], i); + } + SetBerryIconsInvisibility(TRUE); +} + +static void FreeBerrySprites(void) +{ + struct Sprite *sprite; + u8 i; + + for (i = 0; i < NUM_BERRY_COLUMNS; i++) + { + sprite = &gSprites[*sBerrySpriteIds[i]]; + if (sprite) + DestroySprite(sprite); + FREE_AND_SET_NULL(sBerrySpriteIds[i]); + } + for (i = 0; i < NUM_BERRY_TYPES; i++) + { + sprite = &gSprites[*sBerryIconSpriteIds[i]]; + if (sprite) + DestroySprite(sprite); + FREE_AND_SET_NULL(sBerryIconSpriteIds[i]); + } +} + +static void SetBerryInvisibility(u8 id, bool8 invisible) +{ + gSprites[*sBerrySpriteIds[id]].invisible = invisible; +} + +static void SetBerryIconsInvisibility(bool8 invisible) +{ + u8 i; + for (i = 0; i < NUM_BERRY_TYPES; i++) + gSprites[*sBerryIconSpriteIds[i]].invisible = invisible; +} + +static void SetBerryYPos(u8 id, u8 y) +{ + gSprites[*sBerrySpriteIds[id]].y = y * 8; +} + +static void SetBerryAnim(u16 id, u8 animNum) +{ + StartSpriteAnim(&gSprites[*sBerrySpriteIds[id]], animNum); +} + +// Unused +static void UnusedSetSpritePos(u8 spriteId) +{ + gSprites[spriteId].x = 20 * spriteId + 50; + gSprites[spriteId].y = 50; +} + +// Gamefreak made a mistake there and goes out of bounds for the data array as it holds 8 elements +// in turn overwriting sprite's subpriority and subsprites fields. +#ifdef UBFIX +#define sFrozen data[1] +#else +#define sFrozen data[10] +#endif // BUGFIX + +static void SpriteCB_Cloud(struct Sprite *sprite) +{ + u8 i; + static const u8 moveDelays[] = {30, 20}; + + if (sprite->sFrozen != TRUE) + { + for (i = 0; i < NUM_CLOUDS; i++) + { + if (++sCloudSpriteIds[i][1] > moveDelays[i]) + { + sprite->x--; + sCloudSpriteIds[i][1] = 0; + } + } + } +} + +static const s16 sCloudStartCoords[NUM_CLOUDS][2] = +{ + {230, 55}, + { 30, 74} +}; + +static void CreateCloudSprites(void) +{ + u8 i; + void *ptr = AllocZeroed(0x400); + struct SpritePalette pal = {sCloud_Pal, PALTAG_CLOUD}; + + LZ77UnCompWram(sCloud_Gfx, ptr); + if (ptr) + { + struct SpriteSheet sheet = {ptr, 0x400, GFXTAG_CLOUD}; + struct SpriteTemplate template = + { + .tileTag = GFXTAG_CLOUD, + .paletteTag = PALTAG_CLOUD, + .oam = &sOamData_Cloud, + .anims = sAnims_Cloud, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCB_Cloud, + }; + + LoadSpriteSheet(&sheet); + LoadSpritePalette(&pal); + for (i = 0; i < NUM_CLOUDS; i++) + { + sCloudSpriteIds[i] = AllocZeroed(4); + *sCloudSpriteIds[i] = CreateSprite(&template, sCloudStartCoords[i][0], sCloudStartCoords[i][1], 4); + } + } + Free(ptr); +} + +static void ResetCloudPos(void) +{ + u8 i; + for (i = 0; i < NUM_CLOUDS; i++) + { + struct Sprite *sprite = &gSprites[*sCloudSpriteIds[i]]; + sprite->sFrozen = TRUE; + sprite->x = sCloudStartCoords[i][0]; + sprite->y = sCloudStartCoords[i][1]; + } +} + +static void StartCloudMovement(void) +{ + u8 i; + for (i = 0; i < NUM_CLOUDS; i++) + { + struct Sprite *sprite = &gSprites[*sCloudSpriteIds[i]]; + sprite->sFrozen = FALSE; + } +} + +static void FreeCloudSprites(void) +{ + u8 i; + for (i = 0; i < NUM_CLOUDS; i++) + { + struct Sprite *sprite = &gSprites[*sCloudSpriteIds[i]]; + if (sprite) + DestroySprite(sprite); + FREE_AND_SET_NULL(sCloudSpriteIds[i]); + } +} + +static void SetCloudInvisibility(bool8 invisible) +{ + u8 i; + for (i = 0; i < NUM_CLOUDS; i++) + gSprites[*sCloudSpriteIds[i]].invisible = invisible; +} + +#undef sFrozen + +static s16 GetDodrioXPos(u8 playerId, u8 numPlayers) +{ + s16 x = 0; + switch (numPlayers) + { + case 1: + x = 15; + break; + case 2: + switch (playerId) + { + case 0: x = 12; break; + case 1: x = 18; break; + } + break; + case 3: + switch (playerId) + { + case 0: x = 15; break; + case 1: x = 21; break; + case 2: x = 9; break; + } + break; + case 4: + switch (playerId) + { + case 0: x = 12; break; + case 1: x = 18; break; + case 2: x = 24; break; + case 3: x = 6; break; + } + break; + case 5: + switch (playerId) + { + case 0: x = 15; break; + case 1: x = 21; break; + case 2: x = 27; break; + case 3: x = 3; break; + case 4: x = 9; break; + } + break; + } + + return x * 8; +} + +static void ResetBerryAndStatusBarSprites(void) +{ + u8 i; + for (i = 0; i < NUM_BERRY_COLUMNS; i++) + { + SetBerryInvisibility(i, TRUE); + SetBerryYPos(i, 1); + } + SetStatusBarInvisibility(FALSE); +} + +static void LoadWindowFrameGfx(u8 frameId) +{ + LoadBgTiles(BG_INTERFACE, GetWindowFrameTilesPal(frameId)->tiles, 0x120, 1); + LoadPalette(GetWindowFrameTilesPal(frameId)->palette, 0xA0, 0x20); +} + +static void LoadUserWindowFrameGfx(void) +{ + TextWindow_SetStdFrame0_WithPal(0, 0xA, 0xB0); +} + +static void ResetGfxState(void) +{ + sGfx->finished = FALSE; + sGfx->state = 0; + sGfx->loadState = 0; + sGfx->cursorSelection = 0; + sGfx->playAgainState = PLAY_AGAIN_NONE; +} + +static void DrawYesNoMessageWindow(const struct WindowTemplate * template) +{ + u8 pal = 10; + + FillBgTilemapBufferRect(BG_INTERFACE, 1, template->tilemapLeft - 1, template->tilemapTop - 1, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 2, template->tilemapLeft, template->tilemapTop - 1, template->width, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 3, template->tilemapLeft + template->width, template->tilemapTop - 1, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 4, template->tilemapLeft - 1, template->tilemapTop, 1, template->height, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 6, template->tilemapLeft + template->width, template->tilemapTop, 1, template->height, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 7, template->tilemapLeft - 1, template->tilemapTop + template->height, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 8, template->tilemapLeft, template->tilemapTop + template->height, template->width, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 9, template->tilemapLeft + template->width, template->tilemapTop + template->height, 1, 1, pal); +} + +static void DrawMessageWindow(const struct WindowTemplate * template) +{ + u8 pal = 11; + + FillBgTilemapBufferRect(BG_INTERFACE, 10, template->tilemapLeft - 1, template->tilemapTop - 1, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 11, template->tilemapLeft, template->tilemapTop - 1, template->width, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 12, template->tilemapLeft + template->width, template->tilemapTop - 1, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 13, template->tilemapLeft - 1, template->tilemapTop, 1, template->height, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 15, template->tilemapLeft + template->width, template->tilemapTop, 1, template->height, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 16, template->tilemapLeft - 1, template->tilemapTop + template->height, 1, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 17, template->tilemapLeft, template->tilemapTop + template->height, template->width, 1, pal); + FillBgTilemapBufferRect(BG_INTERFACE, 18, template->tilemapLeft + template->width, template->tilemapTop + template->height, 1, 1, pal); +} + +static void InitGameGfx(struct DodrioGame_Gfx * ptr) +{ + sGfx = ptr; + sGfx->finished = FALSE; + sGfx->state = 0; + sGfx->loadState = 0; + sGfx->cursorSelection = 0; + sGfx->playAgainState = PLAY_AGAIN_NONE; + sGfx->taskId = CreateTask(Task_TryRunGfxFunc, 3); + SetGfxFunc(LoadGfx); +} + +// Unused +static void FreeAllWindowBuffers_(void) +{ + FreeAllWindowBuffers(); +} + +struct WinCoords +{ + u8 left; + u8 top; +}; + +enum { + COLORID_GRAY, + COLORID_RED, + COLORID_BLUE, + COLORID_GREEN, // Unused +}; + +static const u8 sTextColorTable[][3] = +{ + [COLORID_GRAY] = {TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY}, + [COLORID_RED] = {TEXT_COLOR_WHITE, TEXT_COLOR_RED, TEXT_COLOR_LIGHT_RED}, + [COLORID_BLUE] = {TEXT_COLOR_WHITE, TEXT_COLOR_BLUE, TEXT_COLOR_LIGHT_BLUE}, + [COLORID_GREEN] = {TEXT_COLOR_WHITE, TEXT_COLOR_GREEN, TEXT_COLOR_LIGHT_GREEN}, +}; + +static const struct WinCoords sNameWindowCoords_1Player[] = {{12, 6}}; +static const struct WinCoords sNameWindowCoords_2Players[] = {{9, 10}, {15, 6}}; +static const struct WinCoords sNameWindowCoords_3Players[] = {{12, 6}, {18, 10}, {6, 10}}; +static const struct WinCoords sNameWindowCoords_4Players[] = {{9, 10}, {15, 6}, {21, 10}, {3, 6}}; +static const struct WinCoords sNameWindowCoords_5Players[] = {{12, 6}, {18, 10}, {23, 6}, {1, 6}, {6, 10}}; + +static const struct WinCoords * const sNameWindowCoords[MAX_RFU_PLAYERS] = +{ + sNameWindowCoords_1Player, + sNameWindowCoords_2Players, + sNameWindowCoords_3Players, + sNameWindowCoords_4Players, + sNameWindowCoords_5Players, +}; + +static const u8 *const sRankingTexts[MAX_RFU_PLAYERS] = +{ + gText_1Colon, + gText_2Colon, + gText_3Colon, + gText_4Colon, + gText_5Colon, +}; + +static const u16 sResultsXCoords[] = {92, 132, 172, 212}; +static const u16 sResultsYCoords[] = {30, 45, 60, 75, 90}; +static const u16 sRankingYCoords[] = {12, 28, 44, 60, 76}; + +struct +{ + u8 id; + void (*func)(void); +} const sGfxFuncs[] = +{ + {GFXFUNC_LOAD, LoadGfx}, // Element not used, LoadGfx is passed directly to SetGfxFunc + {GFXFUNC_SHOW_NAMES, ShowNames}, + {GFXFUNC_SHOW_RESULTS, ShowResults}, + {GFXFUNC_MSG_PLAY_AGAIN, Msg_WantToPlayAgain}, + {GFXFUNC_MSG_SAVING, Msg_SavingDontTurnOff}, + {GFXFUNC_MSG_COMM_STANDBY, Msg_CommunicationStandby}, + {GFXFUNC_ERASE_MSG, EraseMessage}, + {GFXFUNC_MSG_PLAYER_DROPPED, Msg_SomeoneDroppedOut}, + {GFXFUNC_STOP, StopGfxFuncs}, + {GFXFUNC_IDLE, GfxIdle}, +}; + +static void SetGfxFuncById(u8 funcId) +{ + u8 i; + for (i = 0; i < ARRAY_COUNT(sGfxFuncs); i++) + { + if (sGfxFuncs[i].id == funcId) + SetGfxFunc(sGfxFuncs[i].func); + } +} + +static void Task_TryRunGfxFunc(u8 taskId) +{ + // Continue calling function until it + // has reached its finished state. + // Another will not be called until + // readied by SetGfxFunc + if (!sGfx->finished) + GetGfxFunc()(); +} + +static void LoadGfx(void) +{ + switch (sGfx->state) + { + case 0: + InitBgs(); + sGfx->state++; + break; + case 1: + if (LoadBgGfx() == TRUE) + sGfx->state++; + break; + case 2: + CopyToBgTilemapBuffer(BG_SCENERY, sBg_Tilemap, 0, 0); + CopyToBgTilemapBuffer(BG_TREE_LEFT, sTreeBorderLeft_Tilemap, 0, 0); + CopyToBgTilemapBuffer(BG_TREE_RIGHT, sTreeBorderRight_Tilemap, 0, 0); + CopyBgTilemapBufferToVram(BG_SCENERY); + CopyBgTilemapBufferToVram(BG_TREE_LEFT); + CopyBgTilemapBufferToVram(BG_TREE_RIGHT); + sGfx->state++; + break; + case 3: + ShowBg(BG_INTERFACE); + ShowBg(BG_SCENERY); + ShowBg(BG_TREE_LEFT); + ShowBg(BG_TREE_RIGHT); + sGfx->state++; + break; + case 4: + LoadWindowFrameGfx(gSaveBlock2Ptr->optionsWindowFrameType); + LoadUserWindowFrameGfx(); + sGfx->state++; + break; + default: + sGfx->finished = TRUE; + break; + } +} + +static void ShowNames(void) +{ + u8 i, numPlayers, playerId, colorsId, *name; + u32 left; + struct WindowTemplate window; + const struct WinCoords * coords; + + switch (sGfx->state) + { + case 0: + numPlayers = GetNumPlayers(); + coords = sNameWindowCoords[numPlayers - 1]; + window.bg = BG_INTERFACE; + window.width = 7; + window.height = 2; + window.paletteNum = 13; + window.baseBlock = 0x13; + for (i = 0; i < numPlayers; coords++, i++) + { + colorsId = 0; + playerId = GetPlayerIdByPos(i); + left = (56 - GetStringWidth(FONT_0, GetPlayerName(playerId), -1)) / 2u; + window.tilemapLeft = coords->left; + window.tilemapTop = coords->top; + sGfx->windowIds[i] = AddWindow(&window); + ClearWindowTilemap(sGfx->windowIds[i]); + FillWindowPixelBuffer(sGfx->windowIds[i], PIXEL_FILL(1)); + if (playerId == GetMultiplayerId()) + colorsId = COLORID_BLUE; + name = GetPlayerName(playerId); + AddTextPrinterParameterized3(sGfx->windowIds[i], FONT_0, left, 1, sTextColorTable[colorsId], TEXT_SKIP_DRAW, name); + CopyWindowToVram(sGfx->windowIds[i], COPYWIN_GFX); + window.baseBlock += 0xE; + DrawMessageWindow(&window); + } + sGfx->state++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + numPlayers = GetNumPlayers(); + for (i = 0; i < numPlayers; i++) + PutWindowTilemap(sGfx->windowIds[i]); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->state++; + } + break; + default: + if (++sGfx->state > 180) + { + numPlayers = GetNumPlayers(); + for (i = 0; i < numPlayers; i++) + { + ClearWindowTilemap(sGfx->windowIds[i]); + RemoveWindow(sGfx->windowIds[i]); + } + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->finished = TRUE; + } + break; + } +} + +static void PrintRankedScores(u8 numPlayers_) +{ + u8 i, ranking = 0, rankedPlayers = 0; + u8 numPlayers = numPlayers_; // Needed to match + u8 *name; + u32 x, numWidth; + u8 numString[32]; + u8 playersByRanking[MAX_RFU_PLAYERS] = {0, 1, 2, 3, 4}; + struct DodrioGame_ScoreResults temp, scoreResults[MAX_RFU_PLAYERS]; + + // Get all players scores and rankings + for (i = 0; i < numPlayers; i++) + { + playersByRanking[i] = i; + GetScoreResults(&temp, i); + scoreResults[i] = temp; + } + + // Sort player ids by ranking + if (GetHighestScore() != 0) + { + do + { + for (i = 0; i < numPlayers; i++) + { + if (scoreResults[i].ranking == ranking) + { + playersByRanking[rankedPlayers] = i; + rankedPlayers++; + } + } + ranking = rankedPlayers; + } while (rankedPlayers < numPlayers); + } + + // Put any player with a score of 0 at lowest ranking + for (i = 0; i < numPlayers; i++) + { + if (scoreResults[i].score == 0) + scoreResults[i].ranking = numPlayers - 1; + } + + // Print text + x = 216 - GetStringWidth(FONT_0, gText_SpacePoints, 0); + for (i = 0; i < numPlayers; i++) + { + u8 colorsId = COLORID_GRAY; + u8 playerId = playersByRanking[i]; + u32 points = scoreResults[playerId].score; + + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_0, sRankingTexts[scoreResults[playerId].ranking], 8, sRankingYCoords[i], TEXT_SKIP_DRAW, NULL); + if (playerId == GetMultiplayerId()) + colorsId =COLORID_BLUE; + name = GetPlayerName(playerId); + AddTextPrinterParameterized3(sGfx->windowIds[1], FONT_0, 28, sRankingYCoords[i], sTextColorTable[colorsId], TEXT_SKIP_DRAW, name); + ConvertIntToDecimalStringN(numString, points, STR_CONV_MODE_RIGHT_ALIGN, 7); + numWidth = GetStringWidth(FONT_0, numString, -1); + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_0, numString, x - 35, sRankingYCoords[i], TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_0, gText_SpacePoints, x, sRankingYCoords[i], TEXT_SKIP_DRAW, NULL); + } +} + +static void ShowResults(void) +{ + u8 i, j, prizeState, numPlayers = GetNumPlayers(); + u8 *name; + u32 strWidth, x; + u8 strBuff_Large[100]; + u8 strBuff_Small[20]; + + switch (sGfx->state) + { + case 0: + SetScoreResults(); + sGfx->timer = 0; + sGfx->state++; + break; + case 1: + sGfx->windowIds[0] = AddWindow(&sWindowTemplates_Results[0]); + sGfx->windowIds[1] = AddWindow(&sWindowTemplates_Results[1]); + ClearWindowTilemap(sGfx->windowIds[0]); + ClearWindowTilemap(sGfx->windowIds[1]); + DrawMessageWindow(&sWindowTemplates_Results[0]); + DrawMessageWindow(&sWindowTemplates_Results[1]); + sGfx->state++; + break; + case 2: + FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(sGfx->windowIds[1], PIXEL_FILL(1)); + strWidth = GetStringWidth(FONT_0, gText_BerryPickingResults, -1); + x = (DISPLAY_WIDTH - 16 - strWidth) / 2; + AddTextPrinterParameterized(sGfx->windowIds[0], FONT_0, gText_BerryPickingResults, x, 2, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_0, gText_10P30P50P50P, 68, 16, TEXT_SKIP_DRAW, NULL); + for (i = 0; i < numPlayers; i++) + { + u8 colorsId = COLORID_GRAY; + if (i == GetMultiplayerId()) + colorsId = COLORID_BLUE; + + name = GetPlayerName(i); + AddTextPrinterParameterized3(sGfx->windowIds[1], FONT_0, 2, sResultsYCoords[i], sTextColorTable[colorsId], TEXT_SKIP_DRAW, name); + for (j = 0; j < 4; j++) + { + u32 width; + u16 berriesPicked = Min(GetBerryResult(i, j), MAX_BERRIES); + u16 maxBerriesPicked = Min(GetHighestBerryResult(j), MAX_BERRIES); + + ConvertIntToDecimalStringN(strBuff_Large, berriesPicked, STR_CONV_MODE_LEFT_ALIGN, 4); + width = GetStringWidth(FONT_0, strBuff_Large, -1); + + // If player got the most of a berry type, highlight their number in red + if (maxBerriesPicked == berriesPicked && maxBerriesPicked != 0) + AddTextPrinterParameterized3(sGfx->windowIds[1], FONT_0, sResultsXCoords[j] - width, sResultsYCoords[i], sTextColorTable[1], TEXT_SKIP_DRAW, strBuff_Large); + else + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_0, strBuff_Large, sResultsXCoords[j] - width, sResultsYCoords[i], TEXT_SKIP_DRAW, NULL); + } + } + CopyWindowToVram(sGfx->windowIds[0], COPYWIN_GFX); + CopyWindowToVram(sGfx->windowIds[1], COPYWIN_GFX); + sGfx->state++; + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(sGfx->windowIds[0]); + PutWindowTilemap(sGfx->windowIds[1]); + } + CopyBgTilemapBufferToVram(BG_INTERFACE); + SetBerryIconsInvisibility(FALSE); + sGfx->state++; + break; + case 4: + if (++sGfx->timer >= 30 && JOY_NEW(A_BUTTON)) + { + sGfx->timer = 0; + PlaySE(SE_SELECT); + SetBerryIconsInvisibility(TRUE); + sGfx->state++; + } + break; + case 5: + FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(sGfx->windowIds[1], PIXEL_FILL(1)); + strWidth = GetStringWidth(FONT_0, gText_AnnouncingRankings, -1); + x = (DISPLAY_WIDTH - 16 - strWidth) / 2; + AddTextPrinterParameterized(sGfx->windowIds[0], FONT_0, gText_AnnouncingRankings, x, 2, TEXT_SKIP_DRAW, NULL); + sGfx->state++; + break; + case 6: + PrintRankedScores(numPlayers); + CopyWindowToVram(sGfx->windowIds[0], COPYWIN_GFX); + CopyWindowToVram(sGfx->windowIds[1], COPYWIN_GFX); + sGfx->state++; + break; + case 7: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(sGfx->windowIds[0]); + PutWindowTilemap(sGfx->windowIds[1]); + } + CopyBgTilemapBufferToVram(0); + sGfx->state++; + break; + case 8: + if (++sGfx->timer >= 30 && JOY_NEW(A_BUTTON)) + { + sGfx->timer = 0; + PlaySE(SE_SELECT); + if (GetHighestScore() < 3000) + { + sGfx->state = 127; // Skip to end, past giving prize + } + else + { + StopMapMusic(); + sGfx->state++; + } + + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 5, 30, 15); + RemoveWindow(sGfx->windowIds[1]); + sGfx->windowIds[1] = AddWindow(&sWindowTemplate_Prize); + ClearWindowTilemap(sGfx->windowIds[1]); + DrawMessageWindow(&sWindowTemplate_Prize); + } + break; + case 9: + PlayNewMapMusic(MUS_LEVEL_UP); + FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(sGfx->windowIds[1], PIXEL_FILL(1)); + strWidth = GetStringWidth(FONT_0, gText_AnnouncingPrizes, -1); + x = (DISPLAY_WIDTH - 16 - strWidth) / 2; + AddTextPrinterParameterized(sGfx->windowIds[0], FONT_0, gText_AnnouncingPrizes, x, 2, TEXT_SKIP_DRAW, NULL); + DynamicPlaceholderTextUtil_Reset(); + CopyItemName(GetPrizeItemId(), strBuff_Small); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, strBuff_Small); + DynamicPlaceholderTextUtil_ExpandPlaceholders(strBuff_Large, gText_FirstPlacePrize); + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_0, strBuff_Large, 8, 2, TEXT_SKIP_DRAW, NULL); + prizeState = TryGivePrize(); + if (prizeState != PRIZE_RECEIVED && prizeState != NO_PRIZE) + { + DynamicPlaceholderTextUtil_Reset(); + CopyItemName(GetPrizeItemId(), strBuff_Small); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, strBuff_Small); + if (prizeState == PRIZE_NO_ROOM) + DynamicPlaceholderTextUtil_ExpandPlaceholders(strBuff_Large, gText_CantHoldAnyMore); + else if (prizeState == PRIZE_FILLED_BAG) + DynamicPlaceholderTextUtil_ExpandPlaceholders(strBuff_Large, gText_FilledStorageSpace); + AddTextPrinterParameterized(sGfx->windowIds[1], FONT_0, strBuff_Large, 8, 40, TEXT_SKIP_DRAW, NULL); + } + CopyWindowToVram(sGfx->windowIds[0], COPYWIN_GFX); + CopyWindowToVram(sGfx->windowIds[1], COPYWIN_GFX); + sGfx->state++; + break; + case 10: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(sGfx->windowIds[0]); + PutWindowTilemap(sGfx->windowIds[1]); + } + CopyBgTilemapBufferToVram(BG_INTERFACE); + FadeOutAndFadeInNewMapMusic(MUS_VICTORY_WILD, 20, 10); + sGfx->state++; + break; + case 11: + if (++sGfx->timer >= 30 && JOY_NEW(A_BUTTON)) + { + sGfx->timer = 0; + PlaySE(SE_SELECT); + sGfx->state++; + } + break; + default: + ClearWindowTilemap(sGfx->windowIds[0]); + ClearWindowTilemap(sGfx->windowIds[1]); + RemoveWindow(sGfx->windowIds[0]); + RemoveWindow(sGfx->windowIds[1]); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->finished = TRUE; + break; + } +} + +static void Msg_WantToPlayAgain(void) +{ + u8 y; + + switch (sGfx->state) + { + case 0: + // Create windows + sGfx->windowIds[WIN_PLAY_AGAIN] = AddWindow(&sWindowTemplates_PlayAgain[0]); + sGfx->windowIds[WIN_YES_NO] = AddWindow(&sWindowTemplates_PlayAgain[1]); + ClearWindowTilemap(sGfx->windowIds[WIN_PLAY_AGAIN]); + ClearWindowTilemap(sGfx->windowIds[WIN_YES_NO]); + DrawMessageWindow(&sWindowTemplates_PlayAgain[WIN_PLAY_AGAIN]); + DrawYesNoMessageWindow(&sWindowTemplates_PlayAgain[WIN_YES_NO]); + sGfx->state++; + sGfx->cursorSelection = PLAY_AGAIN_NONE; + sGfx->playAgainState = PLAY_AGAIN_NONE; + break; + case 1: + // Print text + FillWindowPixelBuffer(sGfx->windowIds[WIN_PLAY_AGAIN], PIXEL_FILL(1)); + FillWindowPixelBuffer(sGfx->windowIds[WIN_YES_NO], PIXEL_FILL(1)); + AddTextPrinterParameterized(sGfx->windowIds[WIN_PLAY_AGAIN], FONT_2, gText_WantToPlayAgain, 0, 6, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], FONT_2, gText_Yes, 8, 2, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], FONT_2, gText_No, 8, 16, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], FONT_2, gText_SelectorArrow2, 0, 2, TEXT_SKIP_DRAW, NULL); + CopyWindowToVram(sGfx->windowIds[WIN_PLAY_AGAIN], COPYWIN_GFX); + CopyWindowToVram(sGfx->windowIds[WIN_YES_NO], COPYWIN_GFX); + sGfx->state++; + break; + case 2: + // Draw windows + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(sGfx->windowIds[WIN_PLAY_AGAIN]); + PutWindowTilemap(sGfx->windowIds[WIN_YES_NO]); + } + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->state++; + break; + case 3: + // Handle input + y = sGfx->cursorSelection; + if (y == PLAY_AGAIN_NONE) + y = PLAY_AGAIN_YES; + FillWindowPixelBuffer(sGfx->windowIds[WIN_YES_NO], PIXEL_FILL(1)); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], FONT_2, gText_Yes, 8, 2, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], FONT_2, gText_No, 8, 16, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(sGfx->windowIds[WIN_YES_NO], FONT_2, gText_SelectorArrow2, 0, y == 1 ? 2 : 16, TEXT_SKIP_DRAW, NULL); + CopyWindowToVram(sGfx->windowIds[WIN_YES_NO], COPYWIN_FULL); + + // Increment state only if A or B button have been pressed. + if (JOY_NEW(A_BUTTON)) + { + PlaySE(SE_SELECT); + if (sGfx->cursorSelection == PLAY_AGAIN_NONE) + sGfx->cursorSelection = PLAY_AGAIN_YES; + sGfx->state++; + } + else if (JOY_NEW(DPAD_UP | DPAD_DOWN)) + { + PlaySE(SE_SELECT); + switch (sGfx->cursorSelection) + { + case PLAY_AGAIN_NONE: + sGfx->cursorSelection = PLAY_AGAIN_NO; + break; + case PLAY_AGAIN_YES: + sGfx->cursorSelection = PLAY_AGAIN_NO; + break; + case PLAY_AGAIN_NO: + sGfx->cursorSelection = PLAY_AGAIN_YES; + break; + } + } + else if (JOY_NEW(B_BUTTON)) + { + PlaySE(SE_SELECT); + sGfx->cursorSelection = PLAY_AGAIN_NO; + sGfx->state++; + } + break; + default: + sGfx->playAgainState = sGfx->cursorSelection; + ClearWindowTilemap(sGfx->windowIds[WIN_PLAY_AGAIN]); + ClearWindowTilemap(sGfx->windowIds[WIN_YES_NO]); + RemoveWindow(sGfx->windowIds[WIN_PLAY_AGAIN]); + RemoveWindow(sGfx->windowIds[WIN_YES_NO]); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->finished = TRUE; + break; + } +} + +static void Msg_SavingDontTurnOff(void) +{ + switch (sGfx->state) + { + case 0: + DrawDialogueFrame(0, FALSE); + AddTextPrinterParameterized2(0, FONT_2, gText_SavingDontTurnOffThePower2, 0, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY); + sGfx->state++; + break; + case 1: + CopyWindowToVram(0, COPYWIN_FULL); + sGfx->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + { + CreateTask(Task_LinkFullSave, 0); + sGfx->state++; + } + break; + case 3: + if (!FuncIsActiveTask(Task_LinkFullSave)) + sGfx->state++; + break; + default: + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->finished = TRUE; + break; + } +} + +static void Msg_CommunicationStandby(void) +{ + switch (sGfx->state) + { + case 0: + sGfx->windowIds[0] = AddWindow(&sWindowTemplate_CommStandby); + ClearWindowTilemap(sGfx->windowIds[0]); + DrawMessageWindow(&sWindowTemplate_CommStandby); + sGfx->state++; + break; + case 1: + FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); + AddTextPrinterParameterized(sGfx->windowIds[0], FONT_2, gText_CommunicationStandby3, 0, 6, TEXT_SKIP_DRAW, NULL); + CopyWindowToVram(sGfx->windowIds[0], COPYWIN_GFX); + sGfx->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + PutWindowTilemap(sGfx->windowIds[0]); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->state++; + break; + default: + sGfx->finished = TRUE; + break; + } +} + +static void EraseMessage(void) +{ + ClearWindowTilemap(sGfx->windowIds[0]); + RemoveWindow(sGfx->windowIds[0]); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->finished = TRUE; +} + +static void Msg_SomeoneDroppedOut(void) +{ + switch (sGfx->state) + { + case 0: + sGfx->windowIds[0] = AddWindow(&sWindowTemplate_DroppedOut); + ClearWindowTilemap(sGfx->windowIds[0]); + DrawMessageWindow(&sWindowTemplate_DroppedOut); + sGfx->state++; + sGfx->timer = 0; + sGfx->cursorSelection = 0; + sGfx->playAgainState = PLAY_AGAIN_NONE; + break; + case 1: + FillWindowPixelBuffer(sGfx->windowIds[0], PIXEL_FILL(1)); + AddTextPrinterParameterized(sGfx->windowIds[0], FONT_2, gText_SomeoneDroppedOut, 0, 6, TEXT_SKIP_DRAW, NULL); + CopyWindowToVram(sGfx->windowIds[0], COPYWIN_GFX); + sGfx->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + PutWindowTilemap(sGfx->windowIds[0]); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->state++; + break; + case 3: + if (++sGfx->timer >= 120) + sGfx->state++; + break; + default: + sGfx->playAgainState = PLAY_AGAIN_DROPPED; + ClearWindowTilemap(sGfx->windowIds[0]); + RemoveWindow(sGfx->windowIds[0]); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(BG_INTERFACE); + sGfx->finished = TRUE; + break; + } +} + +static void StopGfxFuncs(void) +{ + DestroyTask(sGfx->taskId); + sGfx->finished = TRUE; +} + +static void GfxIdle(void) +{ + +} + +static void SetGfxFunc(void (*func)(void)) +{ + sGfx->state = 0; + sGfx->finished = FALSE; + sGfx->func = func; +} + +static void (*GetGfxFunc(void))(void) +{ + return sGfx->func; +} + +static bool32 IsGfxFuncActive(void) +{ + if (sGfx->finished == TRUE) + return FALSE; + else + return TRUE; +} + +static u8 GetPlayAgainState(void) +{ + return sGfx->playAgainState; +} + +static void InitBgs(void) +{ + DmaClearLarge16(3, (void *)VRAM, VRAM_SIZE, 0x1000); + DmaClear32(3,(void *)OAM, OAM_SIZE); + DmaClear16(3, (void *)PLTT, PLTT_SIZE); + SetGpuReg(REG_OFFSET_DISPCNT, 0); + ResetBgsAndClearDma3BusyFlags(FALSE); + InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates)); + ChangeBgX(BG_INTERFACE, 0, BG_COORD_SET); + ChangeBgY(BG_INTERFACE, 0, BG_COORD_SET); + ChangeBgX(BG_TREE_LEFT, 0, BG_COORD_SET); + ChangeBgY(BG_TREE_LEFT, 0, BG_COORD_SET); + ChangeBgX(BG_TREE_RIGHT, 0, BG_COORD_SET); + ChangeBgY(BG_TREE_RIGHT, 0, BG_COORD_SET); + ChangeBgX(BG_SCENERY, 0, BG_COORD_SET); + ChangeBgY(BG_SCENERY, 0, BG_COORD_SET); + InitStandardTextBoxWindows(); + InitTextBoxGfxAndPrinters(); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + SetBgTilemapBuffer(BG_SCENERY, sGfx->tilemapBuffers[0]); + SetBgTilemapBuffer(BG_TREE_LEFT, sGfx->tilemapBuffers[1]); + SetBgTilemapBuffer(BG_TREE_RIGHT, sGfx->tilemapBuffers[2]); +} + +static bool32 LoadBgGfx(void) +{ + switch (sGfx->loadState) + { + case 0: + LoadPalette(sBg_Pal, 0, sizeof(sBg_Pal)); + break; + case 1: + ResetTempTileDataBuffers(); + break; + case 2: + DecompressAndCopyTileDataToVram(BG_SCENERY, sBg_Gfx, 0, 0, 0); + break; + case 3: + DecompressAndCopyTileDataToVram(BG_TREE_LEFT, sTreeBorder_Gfx, 0, 0, 0); + break; + case 4: + if (FreeTempTileDataBuffersIfPossible() == TRUE) + return FALSE; + break; + case 5: + LoadPalette(stdpal_get(3), 0xD0, 0x20); + break; + default: + sGfx->loadState = 0; + return TRUE; + } + + sGfx->loadState++; + return FALSE; +} diff --git a/src/dodrio_berry_picking_2.c b/src/dodrio_berry_picking_2.c deleted file mode 100644 index 74d5fcacd..000000000 --- a/src/dodrio_berry_picking_2.c +++ /dev/null @@ -1,1617 +0,0 @@ -#include "global.h" -#include "gflib.h" -#include "dodrio_berry_picking.h" -#include "dynamic_placeholder_text_util.h" -#include "item.h" -#include "link.h" -#include "menu.h" -#include "new_menu_helpers.h" -#include "save.h" -#include "strings.h" -#include "task.h" -#include "text_window.h" -#include "text_window_graphics.h" -#include "constants/songs.h" - -struct DodrioStruct_2022CF4 -{ - u8 filler_00[0xc]; - u8 unkC[10]; - s16 unk16[10]; - u16 unk2A[10]; - u16 unk3E; -}; // size = 0x40 - -static EWRAM_DATA u16 *gUnknown_203F3E4[5] = {NULL}; -static EWRAM_DATA u16 *gUnknown_203F3F8[2] = {NULL}; -static EWRAM_DATA u16 *gUnknown_203F400[11] = {NULL}; -static EWRAM_DATA u16 *gUnknown_203F42C[4] = {NULL}; -static EWRAM_DATA struct DodrioStruct_2022CF4 * gUnknown_203F43C = NULL; -static EWRAM_DATA struct DodrioSubstruct_0160 * gUnknown_203F440 = NULL; - -static void sub_8153B9C(struct Sprite *sprite); -static u32 sub_8153C30(struct Sprite *sprite); -static u32 sub_8153CA0(struct Sprite *sprite); -static void sub_8153D48(bool8 a0, u8 a1); -static void nullsub_97(struct Sprite *sprite); -static void sub_8154324(bool8 a0); -static void sub_81543E8(struct Sprite *sprite); -static s16 sub_8154608(u8 a0, u8 a1); -static void sub_8154A08(u8 taskId); -static void sub_8154A2C(void); -static void sub_8154B34(void); -static void sub_8154F80(void); -static void sub_81556E0(void); -static void sub_8155A78(void); -static void sub_8155B4C(void); -static void sub_8155C2C(void); -static void sub_8155C80(void); -static void unused_0(void); -static void nullsub_98(void); -static void sub_8155E24(MainCallback cb); -MainCallback sub_8155E54(void); -static void sub_8155EA0(void); -static bool32 sub_8155FE0(void); - -// Assets in this header are duplicated -#include "data/dodrio_berry_picking.h" - -static const struct OamData sOamData_8478C98 = -{ - .y = 0, - .affineMode = ST_OAM_AFFINE_OFF, - .objMode = ST_OAM_OBJ_NORMAL, - .mosaic = FALSE, - .bpp = ST_OAM_4BPP, - .shape = SPRITE_SHAPE(64x64), - .x = 0, - .matrixNum = 0, - .size = SPRITE_SIZE(64x64), - .tileNum = 0, - .priority = 2, - .paletteNum = 0, - .affineParam = 0 -}; - -static const struct OamData sOamData_8478CA0 = -{ - .y = 0, - .affineMode = ST_OAM_AFFINE_OFF, - .objMode = ST_OAM_OBJ_NORMAL, - .mosaic = FALSE, - .bpp = ST_OAM_4BPP, - .shape = SPRITE_SHAPE(16x16), - .x = 0, - .matrixNum = 0, - .size = SPRITE_SIZE(16x16), - .tileNum = 0, - .priority = 0, - .paletteNum = 0, - .affineParam = 0 -}; - -static const struct OamData sOamData_8478CA8 = -{ - .y = 0, - .affineMode = ST_OAM_AFFINE_OFF, - .objMode = ST_OAM_OBJ_NORMAL, - .mosaic = FALSE, - .bpp = ST_OAM_4BPP, - .shape = SPRITE_SHAPE(16x16), - .x = 0, - .matrixNum = 0, - .size = SPRITE_SIZE(16x16), - .tileNum = 0, - .priority = 2, - .paletteNum = 0, - .affineParam = 0 -}; - -static const struct OamData sOamData_8478CB0 = -{ - .y = 0, - .affineMode = ST_OAM_AFFINE_OFF, - .objMode = ST_OAM_OBJ_NORMAL, - .mosaic = FALSE, - .bpp = ST_OAM_4BPP, - .shape = SPRITE_SHAPE(64x32), - .x = 0, - .matrixNum = 0, - .size = SPRITE_SIZE(64x32), - .tileNum = 0, - .priority = 3, - .paletteNum = 0, - .affineParam = 0 -}; - -static const union AnimCmd sSpriteAnim_8478CB8[] = -{ - ANIMCMD_FRAME(0, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478CC0[] = -{ - ANIMCMD_FRAME(64, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478CC8[] = -{ - ANIMCMD_FRAME(128, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478CD0[] = -{ - ANIMCMD_FRAME(192, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478CD8[] = -{ - ANIMCMD_FRAME(256, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd *const sSpriteAnimTable_8478CE0[] = -{ - sSpriteAnim_8478CB8, - sSpriteAnim_8478CC0, - sSpriteAnim_8478CC8, - sSpriteAnim_8478CD0, - sSpriteAnim_8478CD8 -}; - -static const union AnimCmd sSpriteAnim_8478CF4[] = -{ - ANIMCMD_FRAME(0, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478CFC[] = -{ - ANIMCMD_FRAME(4, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478D04[] = -{ - ANIMCMD_FRAME(8, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd *const sSpriteAnimTable_8478D0C[] = -{ - sSpriteAnim_8478CF4, - sSpriteAnim_8478CFC, - sSpriteAnim_8478D04 -}; - -static const union AnimCmd sSpriteAnim_8478D18[] = -{ - ANIMCMD_FRAME(0, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478D20[] = -{ - ANIMCMD_FRAME(4, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478D28[] = -{ - ANIMCMD_FRAME(8, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478D30[] = -{ - ANIMCMD_FRAME(12, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478D38[] = -{ - ANIMCMD_FRAME(16, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478D40[] = -{ - ANIMCMD_FRAME(20, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478D48[] = -{ - ANIMCMD_FRAME(24, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478D50[] = -{ - ANIMCMD_FRAME(28, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd sSpriteAnim_8478D58[] = -{ - ANIMCMD_FRAME(32, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd *const sSpriteAnimTable_8478D60[] = -{ - sSpriteAnim_8478D18, - sSpriteAnim_8478D20, - sSpriteAnim_8478D28, - sSpriteAnim_8478D30, - sSpriteAnim_8478D38, - sSpriteAnim_8478D40, - sSpriteAnim_8478D48, - sSpriteAnim_8478D50, - sSpriteAnim_8478D58 -}; - -static const union AnimCmd sSpriteAnim_8478D84[] = -{ - ANIMCMD_FRAME(0, 20), - ANIMCMD_JUMP(0) -}; - -static const union AnimCmd *const sSpriteAnimTable_8478D8C[] = -{ - sSpriteAnim_8478D84 -}; - -// Code - -void sub_8153A9C(void) -{ - void *ptr = AllocZeroed(0x3000); - struct SpritePalette pal1 = {sDodrioBerryPkmnPal, 0}; - struct SpritePalette pal2 = {sDodrioBerryShinyPal, 1}; - - LZ77UnCompWram(sDodrioBerryPkmnGfx, ptr); - // This check should be one line up. - if (ptr != NULL) - { - struct SpriteSheet sheet = {ptr, 0x3000, 0}; - LoadSpriteSheet(&sheet); - Free(ptr); - } - LoadSpritePalette(&pal1); - LoadSpritePalette(&pal2); -} - -void sub_8153AFC(struct DodrioSubstruct_318C * arg0, u8 arg1, u8 id, u8 arg3) -{ - struct SpriteTemplate sprTemplate = - { - .tileTag = 0, - .paletteTag = arg0->isShiny, - .oam = &sOamData_8478C98, - .anims = sSpriteAnimTable_8478CE0, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_8153B9C, - }; - - gUnknown_203F3E4[id] = AllocZeroed(4); - *gUnknown_203F3E4[id] = CreateSprite(&sprTemplate, sub_8154608(arg1, arg3), 136, 3); - sub_8153D48(TRUE, id); -} - -static void sub_8153B9C(struct Sprite *sprite) -{ - switch (sprite->data[0]) - { - case 0: - break; - case 1: - sub_8153C30(sprite); - break; - case 2: - sub_8153CA0(sprite); - break; - } -} - -void sub_8153BC0(u8 unused) -{ - struct Sprite *sprite = &gSprites[*gUnknown_203F3E4[GetMultiplayerId()]]; - sprite->data[0] = 1; - sprite->data[1] = 0; - sprite->data[2] = 0; - sprite->data[3] = 0; - sprite->data[4] = 0; -} - -void sub_8153BF8(u8 unused) -{ - struct Sprite *sprite = &gSprites[*gUnknown_203F3E4[GetMultiplayerId()]]; - sprite->data[0] = 2; - sprite->data[1] = 0; - sprite->data[2] = 0; - sprite->data[3] = 0; - sprite->data[4] = 0; -} - -static u32 sub_8153C30(struct Sprite *sprite) -{ - s8 var; - u8 mod = (++sprite->data[1] / 2) % 4; - - if (sprite->data[1] >= 3) - { - switch (mod) - { - default: - var = 1; - break; - case 1: - case 2: - var = -1; - break; - } - - sprite->x += var; - if (++sprite->data[1] >= 40) - { - sprite->data[0] = 0; - sprite->x = sub_8154608(0, sub_81533B4()); - } - } - - return 0; -} - -static u32 sub_8153CA0(struct Sprite *sprite) -{ - u8 mod = (++sprite->data[1] / 13) % 4; - - if (sprite->data[1] % 13 == 0 && mod != 0) - PlaySE(SE_M_CHARM); - if (sprite->data[1] >= 104) - { - sprite->data[0] = 0; - mod = 0; - } - sub_8153DA8(GetMultiplayerId(), mod); - return 0; -} - -void sub_8153D08(u8 count) -{ - u8 i; - for (i = 0; i < count; i++) - { - struct Sprite *sprite = &gSprites[*gUnknown_203F3E4[i]]; - if (sprite != NULL) - DestroySpriteAndFreeResources(sprite); - // Memory should be freed here but is not. - } -} - -static void sub_8153D48(bool8 invisible, u8 id) -{ - gSprites[*gUnknown_203F3E4[id]].invisible = invisible; -} - -void sub_8153D80(bool8 invisible, u8 count) -{ - u8 i; - for (i = 0; i < count; i++) - sub_8153D48(invisible, i); -} - -void sub_8153DA8(u8 id, u8 frameNum) -{ - StartSpriteAnim(&gSprites[*gUnknown_203F3E4[id]], frameNum); -} - -static void nullsub_97(struct Sprite *sprite) -{ - -} - -void sub_8153DD8(void) -{ - u8 i; - for (i = 0; i < 10; i++) - { - struct Sprite *sprite = &gSprites[gUnknown_203F43C->unk2A[i]]; - sprite->x = (i * 16) + 48; - sprite->y = -8 - (i * 8); - gUnknown_203F43C->unkC[i] = 0; - } -} - -void sub_8153E28(void) -{ - u8 i; - void *ptr = AllocZeroed(0x180); - struct SpritePalette spPal = {sDodrioBerryStatusPal, 2}; - - LZ77UnCompWram(sDodrioBerryStatusGfx, ptr); - // This check should be one line up. - if (ptr != NULL) - { - struct SpriteSheet spSheet = {ptr, 0x180, 1}; - struct SpriteTemplate spTemplate = - { - .tileTag = 1, - .paletteTag = 2, - .oam = &sOamData_8478CA0, - .anims = sSpriteAnimTable_8478D0C, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = nullsub_97, - }; - - gUnknown_203F43C = AllocZeroed(sizeof(*gUnknown_203F43C)); - LoadSpriteSheet(&spSheet); - LoadSpritePalette(&spPal); - for (i = 0; i < 10; i++) - gUnknown_203F43C->unk2A[i] = CreateSprite(&spTemplate, (i * 16) + 48, -8 - (i * 8), 0); - } - - Free(ptr); -} - -void sub_8153ED8(void) -{ - u8 i; - for (i = 0; i < 10; i++) - { - struct Sprite *sprite = &gSprites[gUnknown_203F43C->unk2A[i]]; - if (sprite != NULL) - DestroySpriteAndFreeResources(sprite); - } - FREE_AND_SET_NULL(gUnknown_203F43C); -} - -bool32 sub_8153F1C(void) -{ - u8 i; - bool32 r3 = FALSE; - for (i = 0; i < 10; i++) - { - struct Sprite *sprite = &gSprites[gUnknown_203F43C->unk2A[i]]; - gUnknown_203F43C->unk16[i] = 2; - if (gUnknown_203F43C->unkC[i] != 0 && sprite->y == 8) - continue; - r3 = TRUE; - if (sprite->y == 8) - { - if (gUnknown_203F43C->unkC[i] != 0) - continue; - gUnknown_203F43C->unkC[i] = 1; - gUnknown_203F43C->unk16[i] = -16; - PlaySE(SE_CLICK); - } - sprite->y += gUnknown_203F43C->unk16[i]; - } - - if (r3) - return FALSE; - else - return TRUE; -} - -void sub_8153FC8(u8 arg0) -{ - u8 i; - - if (arg0 > 10) - { - for (i = 0; i < 10; i++) - StartSpriteAnim(&gSprites[gUnknown_203F43C->unk2A[i]], 1); - } - else - { - for (i = 0; i < 10 - arg0; i++) - { - if (arg0 > 6) - { - gUnknown_203F43C->unk3E += arg0 - 6; - if (gUnknown_203F43C->unk3E > 30) - gUnknown_203F43C->unk3E = 0; - else if (gUnknown_203F43C->unk3E > 10) - StartSpriteAnim(&gSprites[gUnknown_203F43C->unk2A[i]], 2); - else - StartSpriteAnim(&gSprites[gUnknown_203F43C->unk2A[i]], 0); - } - else - { - StartSpriteAnim(&gSprites[gUnknown_203F43C->unk2A[i]], 0); - } - } - for (; i < 10; i++) - StartSpriteAnim(&gSprites[gUnknown_203F43C->unk2A[i]], 1); - } -} - -void sub_81540DC(bool8 invisible) -{ - u8 i; - for (i = 0; i < 10; i++) - gSprites[gUnknown_203F43C->unk2A[i]].invisible = invisible; -} - -// Unknown unused data, feel free to remove. -static const u8 sUnused2[] = { - SE_M_CHARM, - SE_NOTE_C, - SE_NOTE_D, - SE_NOTE_E, - SE_NOTE_F, - SE_NOTE_G, - SE_NOTE_A, - SE_NOTE_B, - SE_NOTE_C_HIGH, - SE_CARD_OPEN -}; - -void sub_8154128(void) -{ - void *ptr = AllocZeroed(0x480); - struct SpritePalette sprPal = {sDodrioBerrySpritesPal, 3}; - - LZ77UnCompWram(sDodrioBerrySpritesGfx, ptr); - if (ptr != NULL) // This should be one line up - { - struct SpriteSheet sprSheet = {ptr, 0x480, 2}; - LoadSpriteSheet(&sprSheet); - } - - LoadSpritePalette(&sprPal); - Free(ptr); -} - -static const s16 sUnknown_8478DD4[] = {88, 128, 168, 208}; - -void sub_815417C(void) -{ - u8 i; - s16 x; - - struct SpriteTemplate sprTemplate1 = - { - .tileTag = 2, - .paletteTag = 3, - .oam = &sOamData_8478CA8, - .anims = sSpriteAnimTable_8478D60, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = SpriteCallbackDummy, - }; - struct SpriteTemplate sprTemplate2 = - { - .tileTag = 2, - .paletteTag = 3, - .oam = &sOamData_8478CA0, - .anims = sSpriteAnimTable_8478D60, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = SpriteCallbackDummy, - }; - - for (i = 0; i < 11; i++) - { - gUnknown_203F400[i] = AllocZeroed(4); - x = i * 16; - *gUnknown_203F400[i] = CreateSprite(&sprTemplate1, x + (i * 8), 8, 1); - sub_81542EC(i, TRUE); - } - for (i = 0; i < 4; i++) - { - gUnknown_203F42C[i] = AllocZeroed(4); - if (i == 3) - *gUnknown_203F42C[i] = CreateSprite(&sprTemplate2, sUnknown_8478DD4[i], 57, 0); - else - *gUnknown_203F42C[i] = CreateSprite(&sprTemplate2, sUnknown_8478DD4[i], 60, 0); - StartSpriteAnim(&gSprites[*gUnknown_203F42C[i]], i); - } - - sub_8154324(TRUE); -} - -void sub_8154274(void) -{ - struct Sprite *sprite; - u8 i; - - for (i = 0; i < 11; i++) - { - sprite = &gSprites[*gUnknown_203F400[i]]; - if (sprite != NULL) - DestroySprite(sprite); - FREE_AND_SET_NULL(gUnknown_203F400[i]); - } - for (i = 0; i < 4; i++) - { - sprite = &gSprites[*gUnknown_203F42C[i]]; - if (sprite != NULL) - DestroySprite(sprite); - FREE_AND_SET_NULL(gUnknown_203F42C[i]); - } -} - -void sub_81542EC(u8 id, bool8 invisible) -{ - gSprites[*gUnknown_203F400[id]].invisible = invisible; -} - -static void sub_8154324(bool8 invisible) -{ - u8 i; - for (i = 0; i < 4; i++) - gSprites[*gUnknown_203F42C[i]].invisible = invisible; -} - -void sub_8154370(u8 id, u8 y) -{ - gSprites[*gUnknown_203F400[id]].y = y * 8; -} - -void sub_8154398(u16 id, u8 frameNum) -{ - StartSpriteAnim(&gSprites[*gUnknown_203F400[id]], frameNum); -} - -// Unused -static void sub_81543C4(u8 spriteId) -{ - gSprites[spriteId].x = 20 * spriteId + 50; - gSprites[spriteId].y = 50; -} - -// Gamefreak made a mistake there and goes out of bounds for the data array as it holds 8 elements -// in turn overwriting sprite's subpriority and subsprites fields. -#if defined(BUGFIX) -#define sKeepPosX data[1] -#else -#define sKeepPosX data[10] -#endif // BUGFIX - -static void sub_81543E8(struct Sprite *sprite) -{ - u8 i; - static const u8 array[] = {30, 20}; - - if (sprite->sKeepPosX != TRUE) - { - for (i = 0; i < 2; i++) - { - if (++gUnknown_203F3F8[i][1] > array[i]) - { - sprite->x--; - gUnknown_203F3F8[i][1] = 0; - } - } - } -} - -static const s16 gUnknown_8478E0E[][2] = {{230, 55}, {30, 74}}; - -void sub_8154438(void) -{ - u8 i; - void *ptr = AllocZeroed(0x400); - struct SpritePalette sprPal = {sDodrioBerryPlatformPal, 6}; - - LZ77UnCompWram(sDodrioBerryPlatformGfx, ptr); - if (ptr != NULL) // This should be one line up - { - struct SpriteSheet sprSheet = {ptr, 0x400, 5}; - struct SpriteTemplate sprTemplate = - { - .tileTag = 5, - .paletteTag = 6, - .oam = &sOamData_8478CB0, - .anims = sSpriteAnimTable_8478D8C, - .images = NULL, - .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_81543E8, - }; - - LoadSpriteSheet(&sprSheet); - LoadSpritePalette(&sprPal); - for (i = 0; i < 2; i++) - { - gUnknown_203F3F8[i] = AllocZeroed(4); - *gUnknown_203F3F8[i] = CreateSprite(&sprTemplate, gUnknown_8478E0E[i][0], gUnknown_8478E0E[i][1], 4); - } - } - - Free(ptr); -} - -void sub_81544F0(void) -{ - u8 i; - for (i = 0; i < 2; i++) - { - struct Sprite *sprite = &gSprites[*gUnknown_203F3F8[i]]; - sprite->sKeepPosX = TRUE; - sprite->x = gUnknown_8478E0E[i][0]; - sprite->y = gUnknown_8478E0E[i][1]; - } -} - -void sub_8154540(void) -{ - u8 i; - for (i = 0; i < 2; i++) - { - struct Sprite *sprite = &gSprites[*gUnknown_203F3F8[i]]; - sprite->sKeepPosX = FALSE; - } -} - -void sub_8154578(void) -{ - u8 i; - for (i = 0; i < 2; i++) - { - struct Sprite *sprite = &gSprites[*gUnknown_203F3F8[i]]; - if (sprite) - DestroySprite(sprite); - FREE_AND_SET_NULL(gUnknown_203F3F8[i]); - } -} - -void sub_81545BC(bool8 invisible) -{ - u8 i; - for (i = 0; i < 2; i++) - gSprites[*gUnknown_203F3F8[i]].invisible = invisible; -} - -#undef sKeepPosX - -static s16 sub_8154608(u8 arg0, u8 arg1) -{ - s16 x = 0; - switch (arg1) - { - case 1: - x = 15; - break; - case 2: - switch (arg0) - { - case 0: x = 12; break; - case 1: x = 18; break; - } - break; - case 3: - switch (arg0) - { - case 0: x = 15; break; - case 1: x = 21; break; - case 2: x = 9; break; - } - break; - case 4: - switch (arg0) - { - case 0: x = 12; break; - case 1: x = 18; break; - case 2: x = 24; break; - case 3: x = 6; break; - } - break; - case 5: - switch (arg0) - { - case 0: x = 15; break; - case 1: x = 21; break; - case 2: x = 27; break; - case 3: x = 3; break; - case 4: x = 9; break; - } - break; - } - - return x * 8; -} - -void sub_81546C0(void) -{ - u8 i; - for (i = 0; i < 11; i++) - { - sub_81542EC(i, TRUE); - sub_8154370(i, 1); - } - sub_81540DC(FALSE); -} - -static void sub_81546EC(u8 frameId) -{ - LoadBgTiles(0, GetWindowFrameTilesPal(frameId)->tiles, 0x120, 1); - LoadPalette(GetWindowFrameTilesPal(frameId)->palette, 0xA0, 0x20); -} - -static void sub_8154720(void) -{ - TextWindow_SetStdFrame0_WithPal(0, 0xA, 0xB0); -} - -void sub_8154730(void) -{ - gUnknown_203F440->finished = FALSE; - gUnknown_203F440->state = 0; - gUnknown_203F440->unk3018 = 0; - gUnknown_203F440->unk3020 = 0; - gUnknown_203F440->unk3024 = 0; -} - -static void sub_8154768(const struct WindowTemplate * winTempl) -{ - u8 pal = 0xA; - - FillBgTilemapBufferRect(0, 1, winTempl->tilemapLeft - 1, winTempl->tilemapTop - 1, 1, 1, pal); - FillBgTilemapBufferRect(0, 2, winTempl->tilemapLeft, winTempl->tilemapTop - 1, winTempl->width, 1, pal); - FillBgTilemapBufferRect(0, 3, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop - 1, 1, 1, pal); - FillBgTilemapBufferRect(0, 4, winTempl->tilemapLeft - 1, winTempl->tilemapTop, 1, winTempl->height, pal); - FillBgTilemapBufferRect(0, 6, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop, 1, winTempl->height, pal); - FillBgTilemapBufferRect(0, 7, winTempl->tilemapLeft - 1, winTempl->tilemapTop + winTempl->height, 1, 1, pal); - FillBgTilemapBufferRect(0, 8, winTempl->tilemapLeft, winTempl->tilemapTop + winTempl->height, winTempl->width, 1, pal); - FillBgTilemapBufferRect(0, 9, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop + winTempl->height, 1, 1, pal); -} - -static void sub_8154868(const struct WindowTemplate * winTempl) -{ - u8 pal = 0xB; - - FillBgTilemapBufferRect(0, 10, winTempl->tilemapLeft - 1, winTempl->tilemapTop - 1, 1, 1, pal); - FillBgTilemapBufferRect(0, 11, winTempl->tilemapLeft, winTempl->tilemapTop - 1, winTempl->width, 1, pal); - FillBgTilemapBufferRect(0, 12, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop - 1, 1, 1, pal); - FillBgTilemapBufferRect(0, 13, winTempl->tilemapLeft - 1, winTempl->tilemapTop, 1, winTempl->height, pal); - FillBgTilemapBufferRect(0, 15, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop, 1, winTempl->height, pal); - FillBgTilemapBufferRect(0, 16, winTempl->tilemapLeft - 1, winTempl->tilemapTop + winTempl->height, 1, 1, pal); - FillBgTilemapBufferRect(0, 17, winTempl->tilemapLeft, winTempl->tilemapTop + winTempl->height, winTempl->width, 1, pal); - FillBgTilemapBufferRect(0, 18, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop + winTempl->height, 1, 1, pal); -} - -void sub_8154968(struct DodrioSubstruct_0160 * ptr) -{ - gUnknown_203F440 = ptr; - gUnknown_203F440->finished = FALSE; - gUnknown_203F440->state = 0; - gUnknown_203F440->unk3018 = 0; - gUnknown_203F440->unk3020 = 0; - gUnknown_203F440->unk3024 = 0; - gUnknown_203F440->unk3004 = CreateTask(sub_8154A08, 3); - sub_8155E24(sub_8154A2C); -} - -static void sub_81549C8(void) -{ - FreeAllWindowBuffers(); -} - -struct WinCoords -{ - u8 left; - u8 top; -}; - -static const u8 sTextColorTable[][3] = -{ - { - TEXT_COLOR_WHITE, - TEXT_COLOR_DARK_GRAY, - TEXT_COLOR_LIGHT_GRAY - }, { - TEXT_COLOR_WHITE, - TEXT_COLOR_RED, - TEXT_COLOR_LIGHT_RED - }, { - TEXT_COLOR_WHITE, - TEXT_COLOR_BLUE, - TEXT_COLOR_LIGHT_BLUE - }, { - TEXT_COLOR_WHITE, - TEXT_COLOR_GREEN, - TEXT_COLOR_LIGHT_GREEN - } -}; - -static const struct WinCoords sUnknown_8478E44[] = {{12, 6}}; -static const struct WinCoords sUnknown_8478E48[] = {{9, 10}, {15, 6}}; -static const struct WinCoords sUnknown_8478E50[] = {{12, 6}, {18, 10}, {6, 10}}; -static const struct WinCoords sUnknown_8478E5C[] = {{9, 10}, {15, 6}, {21, 10}, {3, 6}}; -static const struct WinCoords sUnknown_8478E6C[] = {{12, 6}, {18, 10}, {23, 6}, {1, 6}, {6, 10}}; - -static const struct WinCoords * const sUnknown_8478E80[] = -{ - sUnknown_8478E44, - sUnknown_8478E48, - sUnknown_8478E50, - sUnknown_8478E5C, - sUnknown_8478E6C, -}; - -static const u8 *const sUnknown_8478E94[] = -{ - gText_1Colon, - gText_2Colon, - gText_3Colon, - gText_4Colon, - gText_5Colon, -}; - -static const u16 sUnknown_8478EA8[] = {92, 132, 172, 212}; -static const u16 sUnknown_8478EB0[] = {30, 45, 60, 75, 90}; -static const u16 sUnknown_8478EBA[] = {12, 28, 44, 60, 76}; - -struct -{ - u8 id; - void (*func)(void); -} const gUnknown_8478EC4[] = -{ - {0, sub_8154A2C}, - {1, sub_8154B34}, - {2, sub_8154F80}, - {3, sub_81556E0}, - {4, sub_8155A78}, - {5, sub_8155B4C}, - {6, sub_8155C2C}, - {7, sub_8155C80}, - {8, unused_0}, - {9, nullsub_98}, -}; - -void sub_81549D4(u8 arg0) -{ - u8 i; - for (i = 0; i < 10; i++) - { - if (gUnknown_8478EC4[i].id == arg0) - sub_8155E24(gUnknown_8478EC4[i].func); - } -} - -static void sub_8154A08(u8 taskId) -{ - if (!gUnknown_203F440->finished) - sub_8155E54()(); -} - -static void sub_8154A2C(void) -{ - switch (gUnknown_203F440->state) - { - case 0: - sub_8155EA0(); - gUnknown_203F440->state++; - break; - case 1: - if (sub_8155FE0() == TRUE) - gUnknown_203F440->state++; - break; - case 2: - CopyToBgTilemapBuffer(3, sDodrioBerryBgTilemap1, 0, 0); - CopyToBgTilemapBuffer(1, sDodrioBerryBgTilemap2Left, 0, 0); - CopyToBgTilemapBuffer(2, sDodrioBerryBgTilemap2Right, 0, 0); - CopyBgTilemapBufferToVram(3); - CopyBgTilemapBufferToVram(1); - CopyBgTilemapBufferToVram(2); - gUnknown_203F440->state++; - break; - case 3: - ShowBg(0); - ShowBg(3); - ShowBg(1); - ShowBg(2); - gUnknown_203F440->state++; - break; - case 4: - sub_81546EC(gSaveBlock2Ptr->optionsWindowFrameType); - sub_8154720(); - gUnknown_203F440->state++; - break; - default: - gUnknown_203F440->finished = TRUE; - break; - } -} - -static void sub_8154B34(void) -{ - u8 i, playersCount, id, colorsId, *name; - u32 left; - struct WindowTemplate window; - const struct WinCoords * ptr; - - switch (gUnknown_203F440->state) - { - case 0: - playersCount = sub_81533B4(); - ptr = sUnknown_8478E80[playersCount - 1]; - window.bg = 0; - window.width = 7; - window.height = 2; - window.paletteNum = 0xD; - window.baseBlock = 0x13; - for (i = 0; i < playersCount; ptr++, i++) - { - colorsId = 0; - id = sub_81537AC(i); - left = (56 - GetStringWidth(FONT_0, sub_81533C4(id), -1)) / 2u; - window.tilemapLeft = ptr->left; - window.tilemapTop = ptr->top; - gUnknown_203F440->unk3008[i] = AddWindow(&window); - ClearWindowTilemap(gUnknown_203F440->unk3008[i]); - FillWindowPixelBuffer(gUnknown_203F440->unk3008[i], PIXEL_FILL(1)); - if (id == GetMultiplayerId()) - colorsId = 2; - name = sub_81533C4(id); - AddTextPrinterParameterized3(gUnknown_203F440->unk3008[i], FONT_0, left, 1, sTextColorTable[colorsId], -1, name); - CopyWindowToVram(gUnknown_203F440->unk3008[i], COPYWIN_GFX); - window.baseBlock += 0xE; - sub_8154868(&window); - } - gUnknown_203F440->state++; - break; - case 1: - if (!IsDma3ManagerBusyWithBgCopy()) - { - playersCount = sub_81533B4(); - for (i = 0; i < playersCount; i++) - PutWindowTilemap(gUnknown_203F440->unk3008[i]); - CopyBgTilemapBufferToVram(0); - gUnknown_203F440->state++; - } - break; - default: - if (++gUnknown_203F440->state > 180) - { - playersCount = sub_81533B4(); - for (i = 0; i < playersCount; i++) - { - ClearWindowTilemap(gUnknown_203F440->unk3008[i]); - RemoveWindow(gUnknown_203F440->unk3008[i]); - } - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - CopyBgTilemapBufferToVram(0); - gUnknown_203F440->finished = TRUE; - } - break; - } -} - -static void sub_8154D9C(u8 playersCount_) -{ - u8 i, r8 = 0, r6 = 0; - u8 playersCount = playersCount_; // Pointless variable, I know, but it's needed to match. - u8 *name; - u32 x, numWidth; - u8 numString[32]; - u8 array[5] = {0, 1, 2, 3, 4}; - struct DodrioSubstruct_3308 temp, structArray[5]; - - for (i = 0; i < playersCount; i++) - { - array[i] = i; - sub_81536A0(&temp, i); - structArray[i] = temp; - } - - if (sub_81534AC() != 0) - { - do - { - for (i = 0; i < playersCount; i++) - { - if (structArray[i].unk0 == r8) - { - array[r6] = i; - r6++; - } - } - r8 = r6; - } while (r6 < playersCount); - } - - for (i = 0; i < playersCount; i++) - { - if (structArray[i].unk4 == 0) - structArray[i].unk0 = playersCount - 1; - } - - x = 216 - GetStringWidth(FONT_0, gText_SpacePoints, 0); - for (i = 0; i < playersCount; i++) - { - u8 colorsId = 0; - u8 id = array[i]; - u32 points = structArray[id].unk4; - - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_0, sUnknown_8478E94[structArray[id].unk0], 8, sUnknown_8478EBA[i], -1, NULL); - if (id == GetMultiplayerId()) - colorsId = 2; - name = sub_81533C4(id); - AddTextPrinterParameterized3(gUnknown_203F440->unk3008[1], FONT_0, 28, sUnknown_8478EBA[i], sTextColorTable[colorsId], -1, name); - ConvertIntToDecimalStringN(numString, points, STR_CONV_MODE_RIGHT_ALIGN, 7); - numWidth = GetStringWidth(FONT_0, numString, -1); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_0, numString, x - 35, sUnknown_8478EBA[i], -1, NULL); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_0, gText_SpacePoints, x, sUnknown_8478EBA[i], -1, NULL); - } -} - -static void sub_8154F80(void) -{ - u8 i, j, itemGiveRet, playersCount = sub_81533B4(); - u8 *name; - u32 strWidth, x; - u8 sp0C[100]; - u8 sp70[20]; - - switch (gUnknown_203F440->state) - { - case 0: - sub_81535B0(); - gUnknown_203F440->unk301C = 0; - gUnknown_203F440->state++; - break; - case 1: - gUnknown_203F440->unk3008[0] = AddWindow(&sUnknown_8475674[0]); - gUnknown_203F440->unk3008[1] = AddWindow(&sUnknown_8475674[1]); - ClearWindowTilemap(gUnknown_203F440->unk3008[0]); - ClearWindowTilemap(gUnknown_203F440->unk3008[1]); - sub_8154868(&sUnknown_8475674[0]); - sub_8154868(&sUnknown_8475674[1]); - gUnknown_203F440->state++; - break; - case 2: - FillWindowPixelBuffer(gUnknown_203F440->unk3008[0], PIXEL_FILL(1)); - FillWindowPixelBuffer(gUnknown_203F440->unk3008[1], PIXEL_FILL(1)); - strWidth = GetStringWidth(FONT_0, gText_BerryPickingResults, -1); - x = (224 - strWidth) / 2; - AddTextPrinterParameterized(gUnknown_203F440->unk3008[0], FONT_0, gText_BerryPickingResults, x, 2, -1, NULL); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_0, gText_10P30P50P50P, 68, 16, -1, NULL); - for (i = 0; i < playersCount; i++) - { - u8 colorsId = 0; - if (i == GetMultiplayerId()) - colorsId = 2; - - name = sub_81533C4(i); - AddTextPrinterParameterized3(gUnknown_203F440->unk3008[1], FONT_0, 2, sUnknown_8478EB0[i], sTextColorTable[colorsId], -1, name); - for (j = 0; j < 4; j++) - { - u32 width; - u16 result1 = Min(sub_8153404(i, j), 9999); - u16 result2 = Min(sub_81534F0(j), 9999); - - ConvertIntToDecimalStringN(sp0C, result1, STR_CONV_MODE_LEFT_ALIGN, 4); - width = GetStringWidth(FONT_0, sp0C, -1); - if (result2 == result1 && result2 != 0) - AddTextPrinterParameterized3(gUnknown_203F440->unk3008[1], FONT_0, sUnknown_8478EA8[j] - width, sUnknown_8478EB0[i], sTextColorTable[1], -1, sp0C); - else - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_0, sp0C, sUnknown_8478EA8[j] - width, sUnknown_8478EB0[i], -1, NULL); - } - } - CopyWindowToVram(gUnknown_203F440->unk3008[0], COPYWIN_GFX); - CopyWindowToVram(gUnknown_203F440->unk3008[1], COPYWIN_GFX); - gUnknown_203F440->state++; - break; - case 3: - if (!IsDma3ManagerBusyWithBgCopy()) - { - PutWindowTilemap(gUnknown_203F440->unk3008[0]); - PutWindowTilemap(gUnknown_203F440->unk3008[1]); - } - CopyBgTilemapBufferToVram(0); - sub_8154324(FALSE); - gUnknown_203F440->state++; - break; - case 4: - if (++gUnknown_203F440->unk301C >= 30 && JOY_NEW(A_BUTTON)) - { - gUnknown_203F440->unk301C = 0; - PlaySE(SE_SELECT); - sub_8154324(TRUE); - gUnknown_203F440->state++; - } - break; - case 5: - FillWindowPixelBuffer(gUnknown_203F440->unk3008[0], PIXEL_FILL(1)); - FillWindowPixelBuffer(gUnknown_203F440->unk3008[1], PIXEL_FILL(1)); - strWidth = GetStringWidth(FONT_0, gText_AnnouncingRankings, -1); - x = (224 - strWidth) / 2; - AddTextPrinterParameterized(gUnknown_203F440->unk3008[0], FONT_0, gText_AnnouncingRankings, x, 2, -1, NULL); - gUnknown_203F440->state++; - break; - case 6: - sub_8154D9C(playersCount); - CopyWindowToVram(gUnknown_203F440->unk3008[0], COPYWIN_GFX); - CopyWindowToVram(gUnknown_203F440->unk3008[1], COPYWIN_GFX); - gUnknown_203F440->state++; - break; - case 7: - if (!IsDma3ManagerBusyWithBgCopy()) - { - PutWindowTilemap(gUnknown_203F440->unk3008[0]); - PutWindowTilemap(gUnknown_203F440->unk3008[1]); - } - CopyBgTilemapBufferToVram(0); - gUnknown_203F440->state++; - break; - case 8: - if (++gUnknown_203F440->unk301C >= 30 && JOY_NEW(A_BUTTON)) - { - gUnknown_203F440->unk301C = 0; - PlaySE(SE_SELECT); - if (sub_81534AC() < 3000) - { - gUnknown_203F440->state = 127; - } - else - { - StopMapMusic(); - gUnknown_203F440->state++; - } - - FillBgTilemapBufferRect_Palette0(0, 0, 0, 5, 30, 15); - RemoveWindow(gUnknown_203F440->unk3008[1]); - gUnknown_203F440->unk3008[1] = AddWindow(&sUnknown_8475684); - ClearWindowTilemap(gUnknown_203F440->unk3008[1]); - sub_8154868(&sUnknown_8475684); - } - break; - case 9: - PlayNewMapMusic(MUS_LEVEL_UP); - FillWindowPixelBuffer(gUnknown_203F440->unk3008[0], PIXEL_FILL(1)); - FillWindowPixelBuffer(gUnknown_203F440->unk3008[1], PIXEL_FILL(1)); - strWidth = GetStringWidth(FONT_0, gText_AnnouncingPrizes, -1); - x = (224 - strWidth) / 2; - AddTextPrinterParameterized(gUnknown_203F440->unk3008[0], FONT_0, gText_AnnouncingPrizes, x, 2, -1, NULL); - DynamicPlaceholderTextUtil_Reset(); - CopyItemName(sub_8153390(), sp70); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sp70); - DynamicPlaceholderTextUtil_ExpandPlaceholders(sp0C, gText_FirstPlacePrize); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_0, sp0C, 8, 2, -1, NULL); - itemGiveRet = sub_815372C(); - if (itemGiveRet != 0 && itemGiveRet != 3) - { - DynamicPlaceholderTextUtil_Reset(); - CopyItemName(sub_8153390(), sp70); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sp70); - if (itemGiveRet == 2) - DynamicPlaceholderTextUtil_ExpandPlaceholders(sp0C, gText_CantHoldAnyMore); - else if (itemGiveRet == 1) - DynamicPlaceholderTextUtil_ExpandPlaceholders(sp0C, gText_FilledStorageSpace); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_0, sp0C, 8, 40, -1, NULL); - } - CopyWindowToVram(gUnknown_203F440->unk3008[0], COPYWIN_GFX); - CopyWindowToVram(gUnknown_203F440->unk3008[1], COPYWIN_GFX); - gUnknown_203F440->state++; - break; - case 10: - if (!IsDma3ManagerBusyWithBgCopy()) - { - PutWindowTilemap(gUnknown_203F440->unk3008[0]); - PutWindowTilemap(gUnknown_203F440->unk3008[1]); - } - CopyBgTilemapBufferToVram(0); - FadeOutAndFadeInNewMapMusic(MUS_VICTORY_WILD, 20, 10); - gUnknown_203F440->state++; - break; - case 11: - if (++gUnknown_203F440->unk301C >= 30 && JOY_NEW(A_BUTTON)) - { - gUnknown_203F440->unk301C = 0; - PlaySE(SE_SELECT); - gUnknown_203F440->state++; - } - break; - default: - ClearWindowTilemap(gUnknown_203F440->unk3008[0]); - ClearWindowTilemap(gUnknown_203F440->unk3008[1]); - RemoveWindow(gUnknown_203F440->unk3008[0]); - RemoveWindow(gUnknown_203F440->unk3008[1]); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - CopyBgTilemapBufferToVram(0); - gUnknown_203F440->finished = TRUE; - break; - } -} - -static void sub_81556E0(void) -{ - u8 y; - - switch (gUnknown_203F440->state) - { - case 0: - gUnknown_203F440->unk3008[0] = AddWindow(&sUnknown_847568C[0]); - gUnknown_203F440->unk3008[1] = AddWindow(&sUnknown_847568C[1]); - ClearWindowTilemap(gUnknown_203F440->unk3008[0]); - ClearWindowTilemap(gUnknown_203F440->unk3008[1]); - sub_8154868(&sUnknown_847568C[0]); - sub_8154768(&sUnknown_847568C[1]); - gUnknown_203F440->state++; - gUnknown_203F440->unk3020 = 0; - gUnknown_203F440->unk3024 = 0; - break; - case 1: - FillWindowPixelBuffer(gUnknown_203F440->unk3008[0], PIXEL_FILL(1)); - FillWindowPixelBuffer(gUnknown_203F440->unk3008[1], PIXEL_FILL(1)); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[0], FONT_2, gText_WantToPlayAgain, 0, 6, -1, NULL); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_2, gText_Yes, 8, 2, -1, NULL); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_2, gText_No, 8, 16, -1, NULL); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_2, gText_SelectorArrow2, 0, 2, -1, NULL); - CopyWindowToVram(gUnknown_203F440->unk3008[0], COPYWIN_GFX); - CopyWindowToVram(gUnknown_203F440->unk3008[1], COPYWIN_GFX); - gUnknown_203F440->state++; - break; - case 2: - if (!IsDma3ManagerBusyWithBgCopy()) - { - PutWindowTilemap(gUnknown_203F440->unk3008[0]); - PutWindowTilemap(gUnknown_203F440->unk3008[1]); - } - CopyBgTilemapBufferToVram(0); - gUnknown_203F440->state++; - break; - case 3: - y = gUnknown_203F440->unk3020; - if (y == 0) - y = 1; - FillWindowPixelBuffer(gUnknown_203F440->unk3008[1], PIXEL_FILL(1)); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_2, gText_Yes, 8, 2, -1, NULL); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_2, gText_No, 8, 16, -1, NULL); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[1], FONT_2, gText_SelectorArrow2, 0, y == 1 ? 2 : 16, -1, NULL); - CopyWindowToVram(gUnknown_203F440->unk3008[1], COPYWIN_FULL); - // Increment state only if A or B button have been pressed. - if (JOY_NEW(A_BUTTON)) - { - PlaySE(SE_SELECT); - if (gUnknown_203F440->unk3020 == 0) - gUnknown_203F440->unk3020 = 1; - gUnknown_203F440->state++; - } - else if (JOY_NEW(DPAD_UP | DPAD_DOWN)) - { - PlaySE(SE_SELECT); - switch (gUnknown_203F440->unk3020) - { - case 0: - gUnknown_203F440->unk3020 = 2; - break; - case 1: - gUnknown_203F440->unk3020 = 2; - break; - case 2: - gUnknown_203F440->unk3020 = 1; - break; - } - } - else if (JOY_NEW(B_BUTTON)) - { - PlaySE(SE_SELECT); - gUnknown_203F440->unk3020 = 2; - gUnknown_203F440->state++; - } - break; - default: - gUnknown_203F440->unk3024 = gUnknown_203F440->unk3020; - ClearWindowTilemap(gUnknown_203F440->unk3008[0]); - ClearWindowTilemap(gUnknown_203F440->unk3008[1]); - RemoveWindow(gUnknown_203F440->unk3008[0]); - RemoveWindow(gUnknown_203F440->unk3008[1]); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - CopyBgTilemapBufferToVram(0); - gUnknown_203F440->finished = TRUE; - break; - } -} - -static void sub_8155A78(void) -{ - switch (gUnknown_203F440->state) - { - case 0: - DrawDialogueFrame(0, FALSE); - AddTextPrinterParameterized2(0, FONT_2, gText_SavingDontTurnOffThePower2, 0, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY); - gUnknown_203F440->state++; - break; - case 1: - CopyWindowToVram(0, COPYWIN_FULL); - gUnknown_203F440->state++; - break; - case 2: - if (!IsDma3ManagerBusyWithBgCopy()) - { - CreateTask(Task_LinkFullSave, 0); - gUnknown_203F440->state++; - } - break; - case 3: - if (!FuncIsActiveTask(Task_LinkFullSave)) - gUnknown_203F440->state++; - break; - default: - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - CopyBgTilemapBufferToVram(0); - gUnknown_203F440->finished = TRUE; - break; - } -} - -static void sub_8155B4C(void) -{ - switch (gUnknown_203F440->state) - { - case 0: - gUnknown_203F440->unk3008[0] = AddWindow(&sUnknown_84756A4); - ClearWindowTilemap(gUnknown_203F440->unk3008[0]); - sub_8154868(&sUnknown_84756A4); - gUnknown_203F440->state++; - break; - case 1: - FillWindowPixelBuffer(gUnknown_203F440->unk3008[0], PIXEL_FILL(1)); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[0], FONT_2, gText_CommunicationStandby3, 0, 6, -1, NULL); - CopyWindowToVram(gUnknown_203F440->unk3008[0], COPYWIN_GFX); - gUnknown_203F440->state++; - break; - case 2: - if (!IsDma3ManagerBusyWithBgCopy()) - PutWindowTilemap(gUnknown_203F440->unk3008[0]); - CopyBgTilemapBufferToVram(0); - gUnknown_203F440->state++; - break; - default: - gUnknown_203F440->finished = TRUE; - break; - } -} - -static void sub_8155C2C(void) -{ - ClearWindowTilemap(gUnknown_203F440->unk3008[0]); - RemoveWindow(gUnknown_203F440->unk3008[0]); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - CopyBgTilemapBufferToVram(0); - gUnknown_203F440->finished = TRUE; -} - -static void sub_8155C80(void) -{ - switch (gUnknown_203F440->state) - { - case 0: - gUnknown_203F440->unk3008[0] = AddWindow(&sUnknown_847569C); - ClearWindowTilemap(gUnknown_203F440->unk3008[0]); - sub_8154868(&sUnknown_847569C); - gUnknown_203F440->state++; - gUnknown_203F440->unk301C = 0; - gUnknown_203F440->unk3020 = 0; - gUnknown_203F440->unk3024 = 0; - break; - case 1: - FillWindowPixelBuffer(gUnknown_203F440->unk3008[0], PIXEL_FILL(1)); - AddTextPrinterParameterized(gUnknown_203F440->unk3008[0], FONT_2, gText_SomeoneDroppedOut, 0, 6, TEXT_SKIP_DRAW, NULL); - CopyWindowToVram(gUnknown_203F440->unk3008[0], COPYWIN_GFX); - gUnknown_203F440->state++; - break; - case 2: - if (!IsDma3ManagerBusyWithBgCopy()) - PutWindowTilemap(gUnknown_203F440->unk3008[0]); - CopyBgTilemapBufferToVram(0); - gUnknown_203F440->state++; - break; - case 3: - if (++gUnknown_203F440->unk301C >= 120) - gUnknown_203F440->state++; - break; - default: - gUnknown_203F440->unk3024 = 5; - ClearWindowTilemap(gUnknown_203F440->unk3008[0]); - RemoveWindow(gUnknown_203F440->unk3008[0]); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - CopyBgTilemapBufferToVram(0); - gUnknown_203F440->finished = TRUE; - break; - } -} - -static void unused_0(void) -{ - DestroyTask(gUnknown_203F440->unk3004); - gUnknown_203F440->finished = TRUE; -} - -static void nullsub_98(void) -{ - -} - -static void sub_8155E24(void (*func)(void)) -{ - gUnknown_203F440->state = 0; - gUnknown_203F440->finished = FALSE; - gUnknown_203F440->unk3028 = func; -} - -void (*sub_8155E54(void))(void) -{ - return gUnknown_203F440->unk3028; -} - -bool32 sub_8155E68(void) -{ - if (gUnknown_203F440->finished == TRUE) - return FALSE; - else - return TRUE; -} - -u8 sub_8155E8C(void) -{ - return gUnknown_203F440->unk3024; -} - -static void sub_8155EA0(void) -{ - DmaClearLarge16(3, (void *)VRAM, VRAM_SIZE, 0x1000); - DmaClear32(3,(void *)OAM, OAM_SIZE); - DmaClear16(3, (void *)PLTT, PLTT_SIZE); - SetGpuReg(REG_OFFSET_DISPCNT, 0); - ResetBgsAndClearDma3BusyFlags(FALSE); - InitBgsFromTemplates(0, sUnknown_847565C, NELEMS(sUnknown_847565C)); - ChangeBgX(0, 0, 0); - ChangeBgY(0, 0, 0); - ChangeBgX(1, 0, 0); - ChangeBgY(1, 0, 0); - ChangeBgX(2, 0, 0); - ChangeBgY(2, 0, 0); - ChangeBgX(3, 0, 0); - ChangeBgY(3, 0, 0); - InitStandardTextBoxWindows(); - InitTextBoxGfxAndPrinters(); - SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); - SetBgTilemapBuffer(3, gUnknown_203F440->tilemapBuffers[0]); - SetBgTilemapBuffer(1, gUnknown_203F440->tilemapBuffers[1]); - SetBgTilemapBuffer(2, gUnknown_203F440->tilemapBuffers[2]); -} - -static bool32 sub_8155FE0(void) -{ - switch (gUnknown_203F440->unk3018) - { - case 0: - LoadPalette(sDodrioBerryBgPal1, 0, sizeof(sDodrioBerryBgPal1)); - break; - case 1: - ResetTempTileDataBuffers(); - break; - case 2: - DecompressAndCopyTileDataToVram(3, sDodrioBerryBgGfx1, 0, 0, 0); - break; - case 3: - DecompressAndCopyTileDataToVram(1, sDodrioBerryBgGfx2, 0, 0, 0); - break; - case 4: - if (FreeTempTileDataBuffersIfPossible() == TRUE) - return FALSE; - break; - case 5: - LoadPalette(stdpal_get(3), 0xD0, 0x20); - break; - default: - gUnknown_203F440->unk3018 = 0; - return TRUE; - } - - gUnknown_203F440->unk3018++; - return FALSE; -} diff --git a/src/dodrio_berry_picking_3.c b/src/dodrio_berry_picking_3.c deleted file mode 100644 index 3bd538f94..000000000 --- a/src/dodrio_berry_picking_3.c +++ /dev/null @@ -1,241 +0,0 @@ -#include "global.h" -#include "dodrio_berry_picking.h" -#include "link.h" -#include "link_rfu.h" - -void sub_815A5BC(s32 a0) -{ - struct Padded_U8 data[2]; - data[0].value = 1; - data[1].value = a0; - Rfu_SendPacket(data); -} - -u8 sub_815A5E8(s32 a0) -{ - u8 * r1; - if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00) - return 0; - r1 = (u8 *)&gRecvCmds[a0][1]; - if (r1[0] == 1) - return r1[4]; - return 0; -} - -struct UnkPacket2 -{ - u8 id; - u8 unk1_0:4; - u8 unk1_1:4; - u16 unk2_0:4; - u16 unk2_1:4; - u16 unk3_0:4; - u16 unk3_1:4; - u16 unk4_0:4; - u16 unk4_1:4; - u16 unk5_0:4; - u16 unk5_1:4; - u16 unk6_0:2; - u16 unk6_1:2; - u16 unk6_2:2; - u16 unk6_3:2; - u16 unk7_0:2; - u16 unk7_1:2; - u16 unk7_2:2; - u16 unk7_3:2; - u8 unk8_0:2; - u8 unk8_1:2; - u8 unk8_2:2; - u8 unk8_3:2; - u8 unk9_0:2; - u8 unk9_1:2; - u8 unk9_2:2; - u8 unk9_3:1; - u8 unk9_4:1; - u8 unkA_0:1; - u8 unkA_1:1; - u8 unkA_2:1; - u8 unkA_3:5; - u8 unkB_0:1; - u8 unkB_1:1; - u8 unkB_2:1; - u8 unkB_3:1; - u8 unkB_4:1; - u8 unkB_5:1; - u8 unkB_6:1; -}; - -void sub_815A61C(struct DodrioSubstruct_31A0 * arg0, struct DodrioSubstruct_31A0_2C * arg1, struct DodrioSubstruct_31A0_2C * arg2, struct DodrioSubstruct_31A0_2C * arg3, struct DodrioSubstruct_31A0_2C * arg4, struct DodrioSubstruct_31A0_2C * arg5, u8 arg6, u32 arg7, u32 arg8) -{ - struct UnkPacket2 packet; - struct DodrioSubstruct_31A0_14 * ptr = &arg0->unk14; - - packet.id = 2; - packet.unk1_0 = ptr->unkB[0]; - packet.unk1_1 = ptr->unkB[1]; - packet.unk2_0 = ptr->unkB[2]; - packet.unk2_1 = ptr->unkB[3]; - packet.unk3_0 = ptr->unkB[4]; - packet.unk3_1 = ptr->unkB[5]; - packet.unk4_0 = ptr->unkB[6]; - packet.unk4_1 = ptr->unkB[7]; - packet.unk5_0 = ptr->unkB[8]; - packet.unk5_1 = ptr->unkB[9]; - - packet.unk6_0 = ptr->unk0[0]; - packet.unk6_1 = ptr->unk0[1]; - packet.unk6_2 = ptr->unk0[2]; - packet.unk6_3 = ptr->unk0[3]; - packet.unk7_0 = ptr->unk0[4]; - packet.unk7_1 = ptr->unk0[5]; - packet.unk7_2 = ptr->unk0[6]; - packet.unk7_3 = ptr->unk0[7]; - packet.unk8_0 = ptr->unk0[8]; - packet.unk8_1 = ptr->unk0[9]; - - packet.unk8_2 = arg1->unk0; - packet.unk8_3 = arg2->unk0; - packet.unk9_0 = arg3->unk0; - packet.unk9_1 = arg4->unk0; - packet.unk9_2 = arg5->unk0; - - packet.unk9_3 = arg1->unk4; - packet.unk9_4 = arg2->unk4; - packet.unkA_0 = arg3->unk4; - packet.unkA_1 = arg4->unk4; - packet.unkA_2 = arg5->unk4; - - packet.unkB_2 = arg1->unk8; - packet.unkB_3 = arg2->unk8; - packet.unkB_4 = arg3->unk8; - packet.unkB_5 = arg4->unk8; - packet.unkB_6 = arg5->unk8; - - packet.unkA_3 = arg6; - packet.unkB_1 = arg7; - packet.unkB_0 = arg8; - Rfu_SendPacket(&packet); -} - -u32 sub_815A950(u32 unused, struct DodrioSubstruct_31A0 * arg0, struct DodrioSubstruct_31A0_2C * arg1, struct DodrioSubstruct_31A0_2C * arg2, struct DodrioSubstruct_31A0_2C * arg3, struct DodrioSubstruct_31A0_2C * arg4, struct DodrioSubstruct_31A0_2C * arg5, u8 *arg6, u32 *arg7, u32 *arg8) -{ - struct UnkPacket2 * packet; - struct DodrioSubstruct_31A0_14 * ptr = &arg0->unk14; - - if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00) - return 0; - - packet = (void *)&gRecvCmds[0][1]; - if (packet->id == 2) - { - ptr->unkB[0] = packet->unk1_0; - ptr->unkB[1] = packet->unk1_1; - ptr->unkB[2] = packet->unk2_0; - ptr->unkB[3] = packet->unk2_1; - ptr->unkB[4] = packet->unk3_0; - ptr->unkB[5] = packet->unk3_1; - ptr->unkB[6] = packet->unk4_0; - ptr->unkB[7] = packet->unk4_1; - ptr->unkB[8] = packet->unk5_0; - ptr->unkB[9] = packet->unk5_1; - ptr->unkB[10] = packet->unk1_0; - - ptr->unk0[0] = packet->unk6_0; - ptr->unk0[1] = packet->unk6_1; - ptr->unk0[2] = packet->unk6_2; - ptr->unk0[3] = packet->unk6_3; - ptr->unk0[4] = packet->unk7_0; - ptr->unk0[5] = packet->unk7_1; - ptr->unk0[6] = packet->unk7_2; - ptr->unk0[7] = packet->unk7_3; - ptr->unk0[8] = packet->unk8_0; - ptr->unk0[9] = packet->unk8_1; - ptr->unk0[10] = packet->unk6_0; - - arg1->unk0 = packet->unk8_2; - arg1->unk4 = packet->unk9_3; - arg1->unk8 = packet->unkB_2; - - arg2->unk0 = packet->unk8_3; - arg2->unk4 = packet->unk9_4; - arg2->unk8 = packet->unkB_3; - - arg3->unk0 = packet->unk9_0; - arg3->unk4 = packet->unkA_0; - arg3->unk8 = packet->unkB_4; - - arg4->unk0 = packet->unk9_1; - arg4->unk4 = packet->unkA_1; - arg4->unk8 = packet->unkB_5; - - arg5->unk0 = packet->unk9_2; - arg5->unk4 = packet->unkA_2; - arg5->unk8 = packet->unkB_6; - - *arg6 = packet->unkA_3; - *arg7 = packet->unkB_1; - *arg8 = packet->unkB_0; - return 1; - } - - return 0; -} - -struct UnkPacket3 -{ - u8 id; - u8 ALIGNED(4) unk4; -}; - -void sub_815AAD8(u8 arg0) -{ - struct UnkPacket3 packet; - packet.id = 3; - packet.unk4 = arg0; - Rfu_SendPacket(&packet); -} - -u32 sub_815AB04(u32 arg0, u8 *arg1) -{ - struct UnkPacket3 * packet; - - if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00) - return 0; - - packet = (void *)&gRecvCmds[arg0][1]; - if (packet->id == 3) - { - *arg1 = packet->unk4; - return 1; - } - - return 0; -} - -struct UnkPacket4 -{ - u8 id; - u32 unk4; -}; - -void sub_815AB3C(u32 arg0) -{ - struct UnkPacket4 packet; - packet.id = 4; - packet.unk4 = arg0; - Rfu_SendPacket(&packet); -} - -u32 sub_815AB60(u32 arg0) -{ - struct UnkPacket4 * packet; - - if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00) - return 0; - - packet = (void *)&gRecvCmds[arg0][1]; - if (packet->id == 4) - return packet->unk4; - - return 0; -} diff --git a/src/dodrio_berry_picking_comm.c b/src/dodrio_berry_picking_comm.c new file mode 100644 index 000000000..2f1b12d0d --- /dev/null +++ b/src/dodrio_berry_picking_comm.c @@ -0,0 +1,274 @@ +#include "global.h" +#include "dodrio_berry_picking.h" +#include "link.h" +#include "link_rfu.h" + +enum { + PACKET_READY_START = 1, + PACKET_GAME_STATE, + PACKET_PICK_STATE, + PACKET_READY_END, +}; + +struct ReadyToStartPacket +{ + u8 id; + bool8 ALIGNED(4) ready; +}; + +struct GameStatePacket +{ + u8 id; + u8 fallDist_Col0:4; + u8 fallDist_Col1:4; + u16 fallDist_Col2:4; + u16 fallDist_Col3:4; + u16 fallDist_Col4:4; + u16 fallDist_Col5:4; + u16 fallDist_Col6:4; + u16 fallDist_Col7:4; + u16 fallDist_Col8:4; + u16 fallDist_Col9:4; + u16 berryId_Col0:2; + u16 berryId_Col1:2; + u16 berryId_Col2:2; + u16 berryId_Col3:2; + u16 berryId_Col4:2; + u16 berryId_Col5:2; + u16 berryId_Col6:2; + u16 berryId_Col7:2; + u8 berryId_Col8:2; + u8 berryId_Col9:2; + u8 pickState_Player1:2; + u8 pickState_Player2:2; + u8 pickState_Player3:2; + u8 pickState_Player4:2; + u8 pickState_Player5:2; + bool8 ateBerry_Player1:1; + bool8 ateBerry_Player2:1; + bool8 ateBerry_Player3:1; + bool8 ateBerry_Player4:1; + bool8 ateBerry_Player5:1; + u8 numGraySquares:5; + bool8 allReadyToEnd:1; + bool8 berriesFalling:1; + bool8 missedBerry_Player1:1; + bool8 missedBerry_Player2:1; + bool8 missedBerry_Player3:1; + bool8 missedBerry_Player4:1; + bool8 missedBerry_Player5:1; +}; + +struct PickStatePacket +{ + u8 id; + u8 ALIGNED(4) pickState; +}; + +struct ReadyToEndPacket +{ + u8 id; + bool32 ready; +}; + +void SendPacket_ReadyToStart(bool32 ready) +{ + struct ReadyToStartPacket packet; + packet.id = PACKET_READY_START; + packet.ready = ready; + Rfu_SendPacket(&packet); +} + +bool8 RecvPacket_ReadyToStart(s32 playerId) +{ + struct ReadyToStartPacket *packet; + + if ((gRecvCmds[0][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET) + return FALSE; + + packet = (void *)&gRecvCmds[playerId][1]; + if (packet->id == PACKET_READY_START) + return packet->ready; + + return FALSE; +} + +void SendPacket_GameState(struct DodrioGame_Player *player, + struct DodrioGame_PlayerCommData *player1, + struct DodrioGame_PlayerCommData *player2, + struct DodrioGame_PlayerCommData *player3, + struct DodrioGame_PlayerCommData *player4, + struct DodrioGame_PlayerCommData *player5, + u8 numGraySquares, + bool32 berriesFalling, + bool32 allReadyToEnd) +{ + struct GameStatePacket packet; + struct DodrioGame_Berries *berries = &player->berries; + + packet.id = PACKET_GAME_STATE; + packet.fallDist_Col0 = berries->fallDist[0]; + packet.fallDist_Col1 = berries->fallDist[1]; + packet.fallDist_Col2 = berries->fallDist[2]; + packet.fallDist_Col3 = berries->fallDist[3]; + packet.fallDist_Col4 = berries->fallDist[4]; + packet.fallDist_Col5 = berries->fallDist[5]; + packet.fallDist_Col6 = berries->fallDist[6]; + packet.fallDist_Col7 = berries->fallDist[7]; + packet.fallDist_Col8 = berries->fallDist[8]; + packet.fallDist_Col9 = berries->fallDist[9]; + + packet.berryId_Col0 = berries->ids[0]; + packet.berryId_Col1 = berries->ids[1]; + packet.berryId_Col2 = berries->ids[2]; + packet.berryId_Col3 = berries->ids[3]; + packet.berryId_Col4 = berries->ids[4]; + packet.berryId_Col5 = berries->ids[5]; + packet.berryId_Col6 = berries->ids[6]; + packet.berryId_Col7 = berries->ids[7]; + packet.berryId_Col8 = berries->ids[8]; + packet.berryId_Col9 = berries->ids[9]; + + packet.pickState_Player1 = player1->pickState; + packet.pickState_Player2 = player2->pickState; + packet.pickState_Player3 = player3->pickState; + packet.pickState_Player4 = player4->pickState; + packet.pickState_Player5 = player5->pickState; + + packet.ateBerry_Player1 = player1->ateBerry; + packet.ateBerry_Player2 = player2->ateBerry; + packet.ateBerry_Player3 = player3->ateBerry; + packet.ateBerry_Player4 = player4->ateBerry; + packet.ateBerry_Player5 = player5->ateBerry; + + packet.missedBerry_Player1 = player1->missedBerry; + packet.missedBerry_Player2 = player2->missedBerry; + packet.missedBerry_Player3 = player3->missedBerry; + packet.missedBerry_Player4 = player4->missedBerry; + packet.missedBerry_Player5 = player5->missedBerry; + + packet.numGraySquares = numGraySquares; + packet.berriesFalling = berriesFalling; + packet.allReadyToEnd = allReadyToEnd; + Rfu_SendPacket(&packet); +} + +bool32 RecvPacket_GameState(u32 playerId, + struct DodrioGame_Player *player, + struct DodrioGame_PlayerCommData *player1, + struct DodrioGame_PlayerCommData *player2, + struct DodrioGame_PlayerCommData *player3, + struct DodrioGame_PlayerCommData *player4, + struct DodrioGame_PlayerCommData *player5, + u8 *numGraySquares, + bool32 *berriesFalling, + bool32 *allReadyToEnd) +{ + struct GameStatePacket *packet; + struct DodrioGame_Berries *berries = &player->berries; + + if ((gRecvCmds[0][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET) + return FALSE; + + packet = (void *)&gRecvCmds[0][1]; + if (packet->id == PACKET_GAME_STATE) + { + berries->fallDist[0] = packet->fallDist_Col0; + berries->fallDist[1] = packet->fallDist_Col1; + berries->fallDist[2] = packet->fallDist_Col2; + berries->fallDist[3] = packet->fallDist_Col3; + berries->fallDist[4] = packet->fallDist_Col4; + berries->fallDist[5] = packet->fallDist_Col5; + berries->fallDist[6] = packet->fallDist_Col6; + berries->fallDist[7] = packet->fallDist_Col7; + berries->fallDist[8] = packet->fallDist_Col8; + berries->fallDist[9] = packet->fallDist_Col9; + berries->fallDist[10] = packet->fallDist_Col0; + + berries->ids[0] = packet->berryId_Col0; + berries->ids[1] = packet->berryId_Col1; + berries->ids[2] = packet->berryId_Col2; + berries->ids[3] = packet->berryId_Col3; + berries->ids[4] = packet->berryId_Col4; + berries->ids[5] = packet->berryId_Col5; + berries->ids[6] = packet->berryId_Col6; + berries->ids[7] = packet->berryId_Col7; + berries->ids[8] = packet->berryId_Col8; + berries->ids[9] = packet->berryId_Col9; + berries->ids[10] = packet->berryId_Col0; + + player1->pickState = packet->pickState_Player1; + player1->ateBerry = packet->ateBerry_Player1; + player1->missedBerry = packet->missedBerry_Player1; + + player2->pickState = packet->pickState_Player2; + player2->ateBerry = packet->ateBerry_Player2; + player2->missedBerry = packet->missedBerry_Player2; + + player3->pickState = packet->pickState_Player3; + player3->ateBerry = packet->ateBerry_Player3; + player3->missedBerry = packet->missedBerry_Player3; + + player4->pickState = packet->pickState_Player4; + player4->ateBerry = packet->ateBerry_Player4; + player4->missedBerry = packet->missedBerry_Player4; + + player5->pickState = packet->pickState_Player5; + player5->ateBerry = packet->ateBerry_Player5; + player5->missedBerry = packet->missedBerry_Player5; + + *numGraySquares = packet->numGraySquares; + *berriesFalling = packet->berriesFalling; + *allReadyToEnd = packet->allReadyToEnd; + return TRUE; + } + + return FALSE; +} + +void SendPacket_PickState(u8 pickState) +{ + struct PickStatePacket packet; + packet.id = PACKET_PICK_STATE; + packet.pickState = pickState; + Rfu_SendPacket(&packet); +} + +bool32 RecvPacket_PickState(u32 playerId, u8 *pickState) +{ + struct PickStatePacket * packet; + + if ((gRecvCmds[0][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET) + return FALSE; + + packet = (void *)&gRecvCmds[playerId][1]; + if (packet->id == PACKET_PICK_STATE) + { + *pickState = packet->pickState; + return TRUE; + } + + return FALSE; +} + +void SendPacket_ReadyToEnd(bool32 ready) +{ + struct ReadyToEndPacket packet; + packet.id = PACKET_READY_END; + packet.ready = ready; + Rfu_SendPacket(&packet); +} + +bool32 RecvPacket_ReadyToEnd(u32 playerId) +{ + struct ReadyToEndPacket * packet; + + if ((gRecvCmds[0][0] & RFUCMD_MASK) != RFUCMD_SEND_PACKET) + return FALSE; + + packet = (void *)&gRecvCmds[playerId][1]; + if (packet->id == PACKET_READY_END) + return packet->ready; + + return FALSE; +} diff --git a/src/dynamic_placeholder_text_util.c b/src/dynamic_placeholder_text_util.c index 8167c0d2b..3eaf8db8d 100644 --- a/src/dynamic_placeholder_text_util.c +++ b/src/dynamic_placeholder_text_util.c @@ -4,85 +4,87 @@ static EWRAM_DATA const u8 *sStringPointers[8] = {0}; +#define COLORS(a, b)((a) | (b << 4)) + static const u8 sTextColorTable[] = { // [LOW_NYBBLE / 2] = 0xXY, // HIGH_NYBBLE - [OBJ_EVENT_GFX_RED_NORMAL / 2] = 0x00, // OBJ_EVENT_GFX_RED_BIKE - [OBJ_EVENT_GFX_RED_SURF / 2] = 0x00, // OBJ_EVENT_GFX_RED_FIELD_MOVE - [OBJ_EVENT_GFX_RED_FISH / 2] = 0x00, // OBJ_EVENT_GFX_RED_VS_SEEKER - [OBJ_EVENT_GFX_RED_VS_SEEKER_BIKE / 2] = 0x10, // OBJ_EVENT_GFX_GREEN_NORMAL - [OBJ_EVENT_GFX_GREEN_BIKE / 2] = 0x11, // OBJ_EVENT_GFX_GREEN_SURF - [OBJ_EVENT_GFX_GREEN_FIELD_MOVE / 2] = 0x11, // OBJ_EVENT_GFX_GREEN_FISH - [OBJ_EVENT_GFX_GREEN_VS_SEEKER / 2] = 0x11, // OBJ_EVENT_GFX_GREEN_VS_SEEKER_BIKE - [OBJ_EVENT_GFX_RS_BRENDAN / 2] = 0x10, // OBJ_EVENT_GFX_RS_MAY - [OBJ_EVENT_GFX_LITTLE_BOY / 2] = 0x10, // OBJ_EVENT_GFX_LITTLE_GIRL - [OBJ_EVENT_GFX_YOUNGSTER / 2] = 0x00, // OBJ_EVENT_GFX_BOY - [OBJ_EVENT_GFX_BUG_CATCHER / 2] = 0x00, // OBJ_EVENT_GFX_SITTING_BOY - [OBJ_EVENT_GFX_LASS / 2] = 0x11, // OBJ_EVENT_GFX_WOMAN_1 - [OBJ_EVENT_GFX_BATTLE_GIRL / 2] = 0x01, // OBJ_EVENT_GFX_MAN - [OBJ_EVENT_GFX_ROCKER / 2] = 0x00, // OBJ_EVENT_GFX_FAT_MAN - [OBJ_EVENT_GFX_WOMAN_2 / 2] = 0x11, // OBJ_EVENT_GFX_BEAUTY - [OBJ_EVENT_GFX_BALDING_MAN / 2] = 0x10, // OBJ_EVENT_GFX_WOMAN_3 - [OBJ_EVENT_GFX_OLD_MAN_1 / 2] = 0x00, // OBJ_EVENT_GFX_OLD_MAN_2 - [OBJ_EVENT_GFX_OLD_MAN_LYING_DOWN / 2] = 0x10, // OBJ_EVENT_GFX_OLD_WOMAN - [OBJ_EVENT_GFX_TUBER_M_WATER / 2] = 0x10, // OBJ_EVENT_GFX_TUBER_F - [OBJ_EVENT_GFX_TUBER_M_LAND / 2] = 0x00, // OBJ_EVENT_GFX_CAMPER - [OBJ_EVENT_GFX_PICNICKER / 2] = 0x01, // OBJ_EVENT_GFX_COOLTRAINER_M - [OBJ_EVENT_GFX_COOLTRAINER_F / 2] = 0x01, // OBJ_EVENT_GFX_SWIMMER_M_WATER - [OBJ_EVENT_GFX_SWIMMER_F_WATER / 2] = 0x01, // OBJ_EVENT_GFX_SWIMMER_M_LAND - [OBJ_EVENT_GFX_SWIMMER_F_LAND / 2] = 0x01, // OBJ_EVENT_GFX_WORKER_M - [OBJ_EVENT_GFX_WORKER_F / 2] = 0x01, // OBJ_EVENT_GFX_ROCKET_M - [OBJ_EVENT_GFX_ROCKET_F / 2] = 0x01, // OBJ_EVENT_GFX_GBA_KID - [OBJ_EVENT_GFX_SUPER_NERD / 2] = 0x00, // OBJ_EVENT_GFX_BIKER - [OBJ_EVENT_GFX_BLACKBELT / 2] = 0x00, // OBJ_EVENT_GFX_SCIENTIST - [OBJ_EVENT_GFX_HIKER / 2] = 0x00, // OBJ_EVENT_GFX_FISHER - [OBJ_EVENT_GFX_CHANNELER / 2] = 0x01, // OBJ_EVENT_GFX_CHEF - [OBJ_EVENT_GFX_POLICEMAN / 2] = 0x00, // OBJ_EVENT_GFX_GENTLEMAN - [OBJ_EVENT_GFX_SAILOR / 2] = 0x00, // OBJ_EVENT_GFX_CAPTAIN - [OBJ_EVENT_GFX_NURSE / 2] = 0x11, // OBJ_EVENT_GFX_CABLE_CLUB_RECEPTIONIST - [OBJ_EVENT_GFX_UNION_ROOM_RECEPTIONIST / 2] = 0x01, // OBJ_EVENT_GFX_UNUSED_MALE_RECEPTIONIST - [OBJ_EVENT_GFX_CLERK / 2] = 0x00, // OBJ_EVENT_GFX_MG_DELIVERYMAN - [OBJ_EVENT_GFX_TRAINER_TOWER_DUDE / 2] = 0x00, // OBJ_EVENT_GFX_PROF_OAK - [OBJ_EVENT_GFX_BLUE / 2] = 0x00, // OBJ_EVENT_GFX_BILL - [OBJ_EVENT_GFX_LANCE / 2] = 0x10, // OBJ_EVENT_GFX_AGATHA - [OBJ_EVENT_GFX_DAISY / 2] = 0x11, // OBJ_EVENT_GFX_LORELEI - [OBJ_EVENT_GFX_MR_FUJI / 2] = 0x00, // OBJ_EVENT_GFX_BRUNO - [OBJ_EVENT_GFX_BROCK / 2] = 0x10, // OBJ_EVENT_GFX_MISTY - [OBJ_EVENT_GFX_LT_SURGE / 2] = 0x10, // OBJ_EVENT_GFX_ERIKA - [OBJ_EVENT_GFX_KOGA / 2] = 0x10, // OBJ_EVENT_GFX_SABRINA - [OBJ_EVENT_GFX_BLAINE / 2] = 0x00, // OBJ_EVENT_GFX_GIOVANNI - [OBJ_EVENT_GFX_MOM / 2] = 0x01, // OBJ_EVENT_GFX_CELIO - [OBJ_EVENT_GFX_TEACHY_TV_HOST / 2] = 0x00, // OBJ_EVENT_GFX_GYM_GUY - [OBJ_EVENT_GFX_ITEM_BALL / 2] = 0x33, // OBJ_EVENT_GFX_TOWN_MAP - [OBJ_EVENT_GFX_POKEDEX / 2] = 0x33, // OBJ_EVENT_GFX_CUT_TREE - [OBJ_EVENT_GFX_ROCK_SMASH_ROCK / 2] = 0x33, // OBJ_EVENT_GFX_PUSHABLE_BOULDER - [OBJ_EVENT_GFX_FOSSIL / 2] = 0x33, // OBJ_EVENT_GFX_RUBY - [OBJ_EVENT_GFX_SAPPHIRE / 2] = 0x33, // OBJ_EVENT_GFX_OLD_AMBER - [OBJ_EVENT_GFX_GYM_SIGN / 2] = 0x33, // OBJ_EVENT_GFX_SIGN - [OBJ_EVENT_GFX_TRAINER_TIPS / 2] = 0x33, // OBJ_EVENT_GFX_CLIPBOARD - [OBJ_EVENT_GFX_METEORITE / 2] = 0x33, // OBJ_EVENT_GFX_LAPRAS_DOLL - [OBJ_EVENT_GFX_SEAGALLOP / 2] = 0x23, // OBJ_EVENT_GFX_SNORLAX - [OBJ_EVENT_GFX_SPEAROW / 2] = 0x22, // OBJ_EVENT_GFX_CUBONE - [OBJ_EVENT_GFX_POLIWRATH / 2] = 0x22, // OBJ_EVENT_GFX_CLEFAIRY - [OBJ_EVENT_GFX_PIDGEOT / 2] = 0x22, // OBJ_EVENT_GFX_JIGGLYPUFF - [OBJ_EVENT_GFX_PIDGEY / 2] = 0x22, // OBJ_EVENT_GFX_CHANSEY - [OBJ_EVENT_GFX_OMANYTE / 2] = 0x22, // OBJ_EVENT_GFX_KANGASKHAN - [OBJ_EVENT_GFX_PIKACHU / 2] = 0x22, // OBJ_EVENT_GFX_PSYDUCK - [OBJ_EVENT_GFX_NIDORAN_F / 2] = 0x22, // OBJ_EVENT_GFX_NIDORAN_M - [OBJ_EVENT_GFX_NIDORINO / 2] = 0x22, // OBJ_EVENT_GFX_MEOWTH - [OBJ_EVENT_GFX_SEEL / 2] = 0x22, // OBJ_EVENT_GFX_VOLTORB - [OBJ_EVENT_GFX_SLOWPOKE / 2] = 0x22, // OBJ_EVENT_GFX_SLOWBRO - [OBJ_EVENT_GFX_MACHOP / 2] = 0x22, // OBJ_EVENT_GFX_WIGGLYTUFF - [OBJ_EVENT_GFX_DODUO / 2] = 0x22, // OBJ_EVENT_GFX_FEAROW - [OBJ_EVENT_GFX_MACHOKE / 2] = 0x22, // OBJ_EVENT_GFX_LAPRAS - [OBJ_EVENT_GFX_ZAPDOS / 2] = 0x22, // OBJ_EVENT_GFX_MOLTRES - [OBJ_EVENT_GFX_ARTICUNO / 2] = 0x22, // OBJ_EVENT_GFX_MEWTWO - [OBJ_EVENT_GFX_MEW / 2] = 0x22, // OBJ_EVENT_GFX_ENTEI - [OBJ_EVENT_GFX_SUICUNE / 2] = 0x22, // OBJ_EVENT_GFX_RAIKOU - [OBJ_EVENT_GFX_LUGIA / 2] = 0x22, // OBJ_EVENT_GFX_HO_OH - [OBJ_EVENT_GFX_CELEBI / 2] = 0x22, // OBJ_EVENT_GFX_KABUTO - [OBJ_EVENT_GFX_DEOXYS_D / 2] = 0x22, // OBJ_EVENT_GFX_DEOXYS_A - [OBJ_EVENT_GFX_DEOXYS_N / 2] = 0x32, // OBJ_EVENT_GFX_SS_ANNE + [OBJ_EVENT_GFX_RED_NORMAL / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_RED_BIKE + [OBJ_EVENT_GFX_RED_SURF / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_RED_FIELD_MOVE + [OBJ_EVENT_GFX_RED_FISH / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_RED_VS_SEEKER + [OBJ_EVENT_GFX_RED_VS_SEEKER_BIKE / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_GREEN_NORMAL + [OBJ_EVENT_GFX_GREEN_BIKE / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_GREEN_SURF + [OBJ_EVENT_GFX_GREEN_FIELD_MOVE / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_GREEN_FISH + [OBJ_EVENT_GFX_GREEN_VS_SEEKER / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_GREEN_VS_SEEKER_BIKE + [OBJ_EVENT_GFX_RS_BRENDAN / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_RS_MAY + [OBJ_EVENT_GFX_LITTLE_BOY / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_LITTLE_GIRL + [OBJ_EVENT_GFX_YOUNGSTER / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_BOY + [OBJ_EVENT_GFX_BUG_CATCHER / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_SITTING_BOY + [OBJ_EVENT_GFX_LASS / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_WOMAN_1 + [OBJ_EVENT_GFX_BATTLE_GIRL / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_MAN + [OBJ_EVENT_GFX_ROCKER / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_FAT_MAN + [OBJ_EVENT_GFX_WOMAN_2 / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_BEAUTY + [OBJ_EVENT_GFX_BALDING_MAN / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_WOMAN_3 + [OBJ_EVENT_GFX_OLD_MAN_1 / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_OLD_MAN_2 + [OBJ_EVENT_GFX_OLD_MAN_LYING_DOWN / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_OLD_WOMAN + [OBJ_EVENT_GFX_TUBER_M_WATER / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_TUBER_F + [OBJ_EVENT_GFX_TUBER_M_LAND / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_CAMPER + [OBJ_EVENT_GFX_PICNICKER / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_COOLTRAINER_M + [OBJ_EVENT_GFX_COOLTRAINER_F / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_SWIMMER_M_WATER + [OBJ_EVENT_GFX_SWIMMER_F_WATER / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_SWIMMER_M_LAND + [OBJ_EVENT_GFX_SWIMMER_F_LAND / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_WORKER_M + [OBJ_EVENT_GFX_WORKER_F / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_ROCKET_M + [OBJ_EVENT_GFX_ROCKET_F / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_GBA_KID + [OBJ_EVENT_GFX_SUPER_NERD / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_BIKER + [OBJ_EVENT_GFX_BLACKBELT / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_SCIENTIST + [OBJ_EVENT_GFX_HIKER / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_FISHER + [OBJ_EVENT_GFX_CHANNELER / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_CHEF + [OBJ_EVENT_GFX_POLICEMAN / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_GENTLEMAN + [OBJ_EVENT_GFX_SAILOR / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_CAPTAIN + [OBJ_EVENT_GFX_NURSE / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_CABLE_CLUB_RECEPTIONIST + [OBJ_EVENT_GFX_UNION_ROOM_RECEPTIONIST / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_UNUSED_MALE_RECEPTIONIST + [OBJ_EVENT_GFX_CLERK / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_MG_DELIVERYMAN + [OBJ_EVENT_GFX_TRAINER_TOWER_DUDE / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_PROF_OAK + [OBJ_EVENT_GFX_BLUE / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_BILL + [OBJ_EVENT_GFX_LANCE / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_AGATHA + [OBJ_EVENT_GFX_DAISY / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_LORELEI + [OBJ_EVENT_GFX_MR_FUJI / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_BRUNO + [OBJ_EVENT_GFX_BROCK / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_MISTY + [OBJ_EVENT_GFX_LT_SURGE / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_ERIKA + [OBJ_EVENT_GFX_KOGA / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_FEMALE), // OBJ_EVENT_GFX_SABRINA + [OBJ_EVENT_GFX_BLAINE / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_GIOVANNI + [OBJ_EVENT_GFX_MOM / 2] = COLORS(NPC_TEXT_COLOR_FEMALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_CELIO + [OBJ_EVENT_GFX_TEACHY_TV_HOST / 2] = COLORS(NPC_TEXT_COLOR_MALE, NPC_TEXT_COLOR_MALE), // OBJ_EVENT_GFX_GYM_GUY + [OBJ_EVENT_GFX_ITEM_BALL / 2] = COLORS(NPC_TEXT_COLOR_NEUTRAL, NPC_TEXT_COLOR_NEUTRAL), // OBJ_EVENT_GFX_TOWN_MAP + [OBJ_EVENT_GFX_POKEDEX / 2] = COLORS(NPC_TEXT_COLOR_NEUTRAL, NPC_TEXT_COLOR_NEUTRAL), // OBJ_EVENT_GFX_CUT_TREE + [OBJ_EVENT_GFX_ROCK_SMASH_ROCK / 2] = COLORS(NPC_TEXT_COLOR_NEUTRAL, NPC_TEXT_COLOR_NEUTRAL), // OBJ_EVENT_GFX_PUSHABLE_BOULDER + [OBJ_EVENT_GFX_FOSSIL / 2] = COLORS(NPC_TEXT_COLOR_NEUTRAL, NPC_TEXT_COLOR_NEUTRAL), // OBJ_EVENT_GFX_RUBY + [OBJ_EVENT_GFX_SAPPHIRE / 2] = COLORS(NPC_TEXT_COLOR_NEUTRAL, NPC_TEXT_COLOR_NEUTRAL), // OBJ_EVENT_GFX_OLD_AMBER + [OBJ_EVENT_GFX_GYM_SIGN / 2] = COLORS(NPC_TEXT_COLOR_NEUTRAL, NPC_TEXT_COLOR_NEUTRAL), // OBJ_EVENT_GFX_SIGN + [OBJ_EVENT_GFX_TRAINER_TIPS / 2] = COLORS(NPC_TEXT_COLOR_NEUTRAL, NPC_TEXT_COLOR_NEUTRAL), // OBJ_EVENT_GFX_CLIPBOARD + [OBJ_EVENT_GFX_METEORITE / 2] = COLORS(NPC_TEXT_COLOR_NEUTRAL, NPC_TEXT_COLOR_NEUTRAL), // OBJ_EVENT_GFX_LAPRAS_DOLL + [OBJ_EVENT_GFX_SEAGALLOP / 2] = COLORS(NPC_TEXT_COLOR_NEUTRAL, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_SNORLAX + [OBJ_EVENT_GFX_SPEAROW / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_CUBONE + [OBJ_EVENT_GFX_POLIWRATH / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_CLEFAIRY + [OBJ_EVENT_GFX_PIDGEOT / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_JIGGLYPUFF + [OBJ_EVENT_GFX_PIDGEY / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_CHANSEY + [OBJ_EVENT_GFX_OMANYTE / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_KANGASKHAN + [OBJ_EVENT_GFX_PIKACHU / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_PSYDUCK + [OBJ_EVENT_GFX_NIDORAN_F / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_NIDORAN_M + [OBJ_EVENT_GFX_NIDORINO / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_MEOWTH + [OBJ_EVENT_GFX_SEEL / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_VOLTORB + [OBJ_EVENT_GFX_SLOWPOKE / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_SLOWBRO + [OBJ_EVENT_GFX_MACHOP / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_WIGGLYTUFF + [OBJ_EVENT_GFX_DODUO / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_FEAROW + [OBJ_EVENT_GFX_MACHOKE / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_LAPRAS + [OBJ_EVENT_GFX_ZAPDOS / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_MOLTRES + [OBJ_EVENT_GFX_ARTICUNO / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_MEWTWO + [OBJ_EVENT_GFX_MEW / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_ENTEI + [OBJ_EVENT_GFX_SUICUNE / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_RAIKOU + [OBJ_EVENT_GFX_LUGIA / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_HO_OH + [OBJ_EVENT_GFX_CELEBI / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_KABUTO + [OBJ_EVENT_GFX_DEOXYS_D / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_MON), // OBJ_EVENT_GFX_DEOXYS_A + [OBJ_EVENT_GFX_DEOXYS_N / 2] = COLORS(NPC_TEXT_COLOR_MON, NPC_TEXT_COLOR_NEUTRAL), // OBJ_EVENT_GFX_SS_ANNE }; void DynamicPlaceholderTextUtil_Reset(void) 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 2b18c1f7c..1949961c2 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -90,9 +90,9 @@ static bool8 sub_805E2E8(struct ObjectEventTemplate *, s16, s16); static void sub_805E384(struct ObjectEventTemplate *); static bool8 MovementType_Disguise_Callback(struct ObjectEvent *, struct Sprite *); static bool8 MovementType_Buried_Callback(struct ObjectEvent *, struct Sprite *); -static u8 MovementType_VsSeeker4D_Callback(struct ObjectEvent *, struct Sprite *); -static u8 MovementType_VsSeeker4E_Callback(struct ObjectEvent *, struct Sprite *); -static u8 MovementType_VsSeeker4F_Callback(struct ObjectEvent *, struct Sprite *); +static u8 MovementType_RaiseHandAndStop_Callback(struct ObjectEvent *, struct Sprite *); +static u8 MovementType_RaiseHandAndJump_Callback(struct ObjectEvent *, struct Sprite *); +static u8 MovementType_RaiseHandAndSwim_Callback(struct ObjectEvent *, struct Sprite *); static void sub_8064544(struct ObjectEvent *, struct Sprite *); static void DoObjectUnionRoomWarpYDisplacement(struct Sprite *sprite); static void MovementType_None(struct Sprite *); @@ -147,11 +147,25 @@ static void MovementType_WalkInPlace(struct Sprite *); static void MovementType_WalkSlowlyInPlace(struct Sprite *); static void MovementType_JogInPlace(struct Sprite *); static void MovementType_Invisible(struct Sprite *); -static void MovementType_VsSeeker4D(struct Sprite *); -static void MovementType_VsSeeker4E(struct Sprite *); -static void MovementType_VsSeeker4F(struct Sprite *); +static void MovementType_RaiseHandAndStop(struct Sprite *); +static void MovementType_RaiseHandAndJump(struct Sprite *); +static void MovementType_RaiseHandAndSwim(struct Sprite *); static void MovementType_WanderAroundSlower(struct Sprite *); +enum { + MOVE_SPEED_NORMAL, // walking + MOVE_SPEED_FAST_1, // running / surfing / sliding (ice tile) + MOVE_SPEED_FAST_2, // water current / bicycle + MOVE_SPEED_FASTER, // going down cycling road on bicycle + MOVE_SPEED_FASTEST, +}; + +enum { + JUMP_DISTANCE_IN_PLACE, + JUMP_DISTANCE_NORMAL, + JUMP_DISTANCE_FAR, +}; + #define movement_type_def(setup, table) \ static u8 setup##_callback(struct ObjectEvent *, struct Sprite *); \ void setup(struct Sprite *sprite) \ @@ -275,9 +289,9 @@ static void (*const sMovementTypeCallbacks[MOVEMENT_TYPES_COUNT])(struct Sprite [MOVEMENT_TYPE_JOG_IN_PLACE_LEFT] = MovementType_JogInPlace, [MOVEMENT_TYPE_JOG_IN_PLACE_RIGHT] = MovementType_JogInPlace, [MOVEMENT_TYPE_INVISIBLE] = MovementType_Invisible, - [MOVEMENT_TYPE_VS_SEEKER_4D] = MovementType_VsSeeker4D, - [MOVEMENT_TYPE_VS_SEEKER_4E] = MovementType_VsSeeker4E, - [MOVEMENT_TYPE_VS_SEEKER_4F] = MovementType_VsSeeker4F, + [MOVEMENT_TYPE_RAISE_HAND_AND_STOP] = MovementType_RaiseHandAndStop, + [MOVEMENT_TYPE_RAISE_HAND_AND_JUMP] = MovementType_RaiseHandAndJump, + [MOVEMENT_TYPE_RAISE_HAND_AND_SWIM] = MovementType_RaiseHandAndSwim, [MOVEMENT_TYPE_WANDER_AROUND_SLOWER] = MovementType_WanderAroundSlower, }; @@ -404,9 +418,9 @@ static const u8 gInitialMovementTypeFacingDirections[MOVEMENT_TYPES_COUNT] = { [MOVEMENT_TYPE_JOG_IN_PLACE_LEFT] = DIR_WEST, [MOVEMENT_TYPE_JOG_IN_PLACE_RIGHT] = DIR_EAST, [MOVEMENT_TYPE_INVISIBLE] = DIR_SOUTH, - [MOVEMENT_TYPE_VS_SEEKER_4D] = DIR_SOUTH, - [MOVEMENT_TYPE_VS_SEEKER_4E] = DIR_SOUTH, - [MOVEMENT_TYPE_VS_SEEKER_4F] = DIR_SOUTH, + [MOVEMENT_TYPE_RAISE_HAND_AND_STOP] = DIR_SOUTH, + [MOVEMENT_TYPE_RAISE_HAND_AND_JUMP] = DIR_SOUTH, + [MOVEMENT_TYPE_RAISE_HAND_AND_SWIM] = DIR_SOUTH, [MOVEMENT_TYPE_WANDER_AROUND_SLOWER] = DIR_SOUTH, }; @@ -939,11 +953,11 @@ static const u8 gUnknown_83A650A[] = { }; static const u8 gUnknown_83A650F[] = { - [DIR_NONE] = MOVEMENT_ACTION_0xA0, - [DIR_SOUTH] = MOVEMENT_ACTION_0xA0, - [DIR_NORTH] = MOVEMENT_ACTION_0xA1, - [DIR_WEST] = MOVEMENT_ACTION_0xA2, - [DIR_EAST] = MOVEMENT_ACTION_0xA3, + [DIR_NONE] = MOVEMENT_ACTION_GLIDE_DOWN, + [DIR_SOUTH] = MOVEMENT_ACTION_GLIDE_DOWN, + [DIR_NORTH] = MOVEMENT_ACTION_GLIDE_UP, + [DIR_WEST] = MOVEMENT_ACTION_GLIDE_LEFT, + [DIR_EAST] = MOVEMENT_ACTION_GLIDE_RIGHT, }; static const u8 gUnknown_83A6514[] = { @@ -955,11 +969,11 @@ static const u8 gUnknown_83A6514[] = { }; static const u8 gUnknown_83A6519[] = { - [DIR_NONE] = MOVEMENT_ACTION_WALK_FASTEST_DOWN, - [DIR_SOUTH] = MOVEMENT_ACTION_WALK_FASTEST_DOWN, - [DIR_NORTH] = MOVEMENT_ACTION_WALK_FASTEST_UP, - [DIR_WEST] = MOVEMENT_ACTION_WALK_FASTEST_LEFT, - [DIR_EAST] = MOVEMENT_ACTION_WALK_FASTEST_RIGHT, + [DIR_NONE] = MOVEMENT_ACTION_WALK_FASTER_DOWN, + [DIR_SOUTH] = MOVEMENT_ACTION_WALK_FASTER_DOWN, + [DIR_NORTH] = MOVEMENT_ACTION_WALK_FASTER_UP, + [DIR_WEST] = MOVEMENT_ACTION_WALK_FASTER_LEFT, + [DIR_EAST] = MOVEMENT_ACTION_WALK_FASTER_RIGHT, }; static const u8 gUnknown_83A651E[] = { @@ -1067,11 +1081,11 @@ static const u8 gUnknown_83A655A[] = { }; static const u8 gUnknown_83A655F[] = { - [DIR_NONE] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_DOWN, - [DIR_SOUTH] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_DOWN, - [DIR_NORTH] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_UP, - [DIR_WEST] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_LEFT, - [DIR_EAST] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_RIGHT, + [DIR_NONE] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_DOWN, + [DIR_SOUTH] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_DOWN, + [DIR_NORTH] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_UP, + [DIR_WEST] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_LEFT, + [DIR_EAST] = MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_RIGHT, }; static const u8 gUnknown_83A6564[] = { @@ -1715,7 +1729,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 +2083,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 +2113,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 +2128,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; @@ -4573,45 +4587,45 @@ static bool8 MovementType_Invisible_Step2(struct ObjectEvent *objectEvent, struc return FALSE; } -void MovementType_VsSeeker4D(struct Sprite *sprite) +void MovementType_RaiseHandAndStop(struct Sprite *sprite) { - UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, MovementType_VsSeeker4D_Callback); + UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, MovementType_RaiseHandAndStop_Callback); } -void MovementType_VsSeeker4E(struct Sprite *sprite) +void MovementType_RaiseHandAndJump(struct Sprite *sprite) { - UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, MovementType_VsSeeker4E_Callback); + UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, MovementType_RaiseHandAndJump_Callback); } -void MovementType_VsSeeker4F(struct Sprite *sprite) +void MovementType_RaiseHandAndSwim(struct Sprite *sprite) { - UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, MovementType_VsSeeker4F_Callback); + UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, MovementType_RaiseHandAndSwim_Callback); } -static u8 MovementType_VsSeeker4D_Callback(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static u8 MovementType_RaiseHandAndStop_Callback(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - return gMovementTypeFuncs_VsSeeker4D[sprite->data[1]](objectEvent, sprite); + return gMovementTypeFuncs_RaiseHandAndStop[sprite->data[1]](objectEvent, sprite); } -static u8 MovementType_VsSeeker4E_Callback(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static u8 MovementType_RaiseHandAndJump_Callback(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - return gMovementTypeFuncs_VsSeeker4E[sprite->data[1]](objectEvent, sprite); + return gMovementTypeFuncs_RaiseHandAndJump[sprite->data[1]](objectEvent, sprite); } -static u8 MovementType_VsSeeker4F_Callback(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static u8 MovementType_RaiseHandAndSwim_Callback(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - return gMovementTypeFuncs_VsSeeker4F[sprite->data[1]](objectEvent, sprite); + return gMovementTypeFuncs_RaiseHandAndSwim[sprite->data[1]](objectEvent, sprite); } -static bool8 MovementType_VsSeeker4D_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementType_RaiseHandAndStop_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { ClearObjectEventMovement(objectEvent, sprite); - ObjectEventSetSingleMovement(objectEvent, sprite, MOVEMENT_ACTION_0x98); + ObjectEventSetSingleMovement(objectEvent, sprite, MOVEMENT_ACTION_RAISE_HAND_AND_STOP); sprite->data[1] = 1; return TRUE; } -static bool8 MovementType_VsSeeker4D_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementType_RaiseHandAndStop_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { @@ -4621,29 +4635,29 @@ static bool8 MovementType_VsSeeker4D_Step1(struct ObjectEvent *objectEvent, stru return FALSE; } -static bool8 MovementType_VsSeeker4D_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementType_RaiseHandAndStop_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite) { objectEvent->singleMovementActive = FALSE; return FALSE; } -static bool8 MovementType_VsSeeker4E_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementType_RaiseHandAndJump_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { ClearObjectEventMovement(objectEvent, sprite); - ObjectEventSetSingleMovement(objectEvent, sprite, MOVEMENT_ACTION_0x99); + ObjectEventSetSingleMovement(objectEvent, sprite, MOVEMENT_ACTION_RAISE_HAND_AND_JUMP); sprite->data[1] = 1; return FALSE; } -static bool8 MovementType_VsSeeker4F_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementType_RaiseHandAndSwim_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { ClearObjectEventMovement(objectEvent, sprite); - ObjectEventSetSingleMovement(objectEvent, sprite, MOVEMENT_ACTION_0x9A); + ObjectEventSetSingleMovement(objectEvent, sprite, MOVEMENT_ACTION_RAISE_HAND_AND_SWIM); sprite->data[1] = 1; return FALSE; } -static bool8 MovementType_VsSeeker4E_VsSeeker4F_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementType_RaiseHandAndMove_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { @@ -5251,7 +5265,7 @@ static u32 GetCopyDirection(u8 copyInitDir, u32 playerInitDir, u32 playerMoveDir static void ObjectEventExecHeldMovementAction(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - if (gMovementActionFuncs[objectEvent->movementActionId][sprite->data[2]](objectEvent, sprite)) + if (sMovementActionFuncs[objectEvent->movementActionId][sprite->data[2]](objectEvent, sprite)) { objectEvent->heldMovementFinished = TRUE; } @@ -5259,7 +5273,7 @@ static void ObjectEventExecHeldMovementAction(struct ObjectEvent *objectEvent, s static void sub_8064544(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - if (gMovementActionFuncs[objectEvent->movementActionId][sprite->data[2]](objectEvent, sprite)) + if (sMovementActionFuncs[objectEvent->movementActionId][sprite->data[2]](objectEvent, sprite)) { objectEvent->heldMovementFinished = TRUE; if (objectEvent->graphicsId == OBJ_EVENT_GFX_PUSHABLE_BOULDER) @@ -5269,7 +5283,7 @@ static void sub_8064544(struct ObjectEvent *objectEvent, struct Sprite *sprite) static bool8 ObjectEventExecSingleMovementAction(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - if (gMovementActionFuncs[objectEvent->movementActionId][sprite->data[2]](objectEvent, sprite)) + if (sMovementActionFuncs[objectEvent->movementActionId][sprite->data[2]](objectEvent, sprite)) { objectEvent->movementActionId = 0xFF; sprite->data[2] = 0; @@ -5340,16 +5354,15 @@ void InitNpcForMovement(struct ObjectEvent *objectEvent, struct Sprite *sprite, void InitMovementNormal(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 speed) { - u8 (*functions[NELEMS(gUnknown_83A6884)])(u8); - - memcpy(functions, gUnknown_83A6884, sizeof gUnknown_83A6884); + u8 (*functions[NELEMS(sDirectionAnimFuncsBySpeed)])(u8); + memcpy(functions, sDirectionAnimFuncsBySpeed, sizeof sDirectionAnimFuncsBySpeed); InitNpcForMovement(objectEvent, sprite, direction, speed); SetStepAnimHandleAlternation(objectEvent, sprite, functions[speed](objectEvent->facingDirection)); } void StartRunningAnim(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction) { - InitNpcForMovement(objectEvent, sprite, direction, 1); + InitNpcForMovement(objectEvent, sprite, direction, MOVE_SPEED_FAST_1); SetStepAnimHandleAlternation(objectEvent, sprite, GetRunningDirectionAnimNum(objectEvent->facingDirection)); } @@ -5433,13 +5446,13 @@ bool8 UpdateWalkSlowest(struct ObjectEvent *objectEvent, struct Sprite *sprite) return FALSE; } -static bool8 MovementActionFunc_x9B_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowestDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitWalkSlowest(objectEvent, sprite, DIR_SOUTH); - return MovementActionFunc_x9B_1(objectEvent, sprite); + return MovementAction_WalkSlowestDown_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x9B_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowestDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateWalkSlowest(objectEvent, sprite)) { @@ -5449,13 +5462,13 @@ static bool8 MovementActionFunc_x9B_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x9C_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowestUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitWalkSlowest(objectEvent, sprite, DIR_NORTH); - return MovementActionFunc_x9C_1(objectEvent, sprite); + return MovementAction_WalkSlowestUp_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x9C_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowestUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateWalkSlowest(objectEvent, sprite)) { @@ -5465,13 +5478,13 @@ static bool8 MovementActionFunc_x9C_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x9D_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowestLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitWalkSlowest(objectEvent, sprite, DIR_WEST); - return MovementActionFunc_x9D_1(objectEvent, sprite); + return MovementAction_WalkSlowestLeft_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x9D_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowestLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateWalkSlowest(objectEvent, sprite)) { @@ -5481,13 +5494,13 @@ static bool8 MovementActionFunc_x9D_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x9E_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowestRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitWalkSlowest(objectEvent, sprite, DIR_EAST); - return MovementActionFunc_x9E_1(objectEvent, sprite); + return MovementAction_WalkSlowestRight_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x9E_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowestRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateWalkSlowest(objectEvent, sprite)) { @@ -5497,13 +5510,13 @@ static bool8 MovementActionFunc_x9E_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x08_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowerDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitWalkSlower(objectEvent, sprite, DIR_SOUTH); - return MovementActionFunc_x08_1(objectEvent, sprite); + return MovementAction_WalkSlowerDown_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x08_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowerDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateWalkSlower(objectEvent, sprite)) { @@ -5513,13 +5526,13 @@ static bool8 MovementActionFunc_x08_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x09_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowerUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitWalkSlower(objectEvent, sprite, DIR_NORTH); - return MovementActionFunc_x09_1(objectEvent, sprite); + return MovementAction_WalkSlowerUp_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x09_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowerUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateWalkSlower(objectEvent, sprite)) { @@ -5529,13 +5542,13 @@ static bool8 MovementActionFunc_x09_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x0A_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowerLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitWalkSlower(objectEvent, sprite, DIR_WEST); - return MovementActionFunc_x0A_1(objectEvent, sprite); + return MovementAction_WalkSlowerLeft_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x0A_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowerLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateWalkSlower(objectEvent, sprite)) { @@ -5545,13 +5558,13 @@ static bool8 MovementActionFunc_x0A_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x0B_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowerRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitWalkSlower(objectEvent, sprite, DIR_EAST); - return MovementActionFunc_x0B_1(objectEvent, sprite); + return MovementAction_WalkSlowerRight_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x0B_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowerRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateWalkSlower(objectEvent, sprite)) { @@ -5599,13 +5612,13 @@ bool8 UpdateWalkSlow(struct ObjectEvent *objectEvent, struct Sprite *sprite) return FALSE; } -static bool8 MovementActionFunc_x0D_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitWalkSlow(objectEvent, sprite, DIR_NORTH); - return MovementActionFunc_x0D_1(objectEvent, sprite); + return MovementAction_WalkSlowUp_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x0D_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateWalkSlow(objectEvent, sprite)) { @@ -5615,13 +5628,13 @@ static bool8 MovementActionFunc_x0D_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x0C_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitWalkSlow(objectEvent, sprite, DIR_SOUTH); - return MovementActionFunc_x0C_1(objectEvent, sprite); + return MovementAction_WalkSlowDown_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x0C_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateWalkSlow(objectEvent, sprite)) { @@ -5631,13 +5644,13 @@ static bool8 MovementActionFunc_x0C_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x0E_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitWalkSlow(objectEvent, sprite, DIR_WEST); - return MovementActionFunc_x0E_1(objectEvent, sprite); + return MovementAction_WalkSlowLeft_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x0E_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateWalkSlow(objectEvent, sprite)) { @@ -5647,13 +5660,13 @@ static bool8 MovementActionFunc_x0E_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x0F_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitWalkSlow(objectEvent, sprite, DIR_EAST); - return MovementActionFunc_x0F_1(objectEvent, sprite); + return MovementAction_WalkSlowRight_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x0F_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkSlowRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateWalkSlow(objectEvent, sprite)) { @@ -5665,7 +5678,7 @@ static bool8 MovementActionFunc_x0F_1(struct ObjectEvent *objectEvent, struct Sp static bool8 MovementAction_WalkNormalDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_SOUTH, 0); + InitMovementNormal(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_NORMAL); return MovementAction_WalkNormalDown_Step1(objectEvent, sprite); } @@ -5681,7 +5694,7 @@ static bool8 MovementAction_WalkNormalDown_Step1(struct ObjectEvent *objectEvent static bool8 MovementAction_WalkNormalUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_NORTH, 0); + InitMovementNormal(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_NORMAL); return MovementAction_WalkNormalUp_Step1(objectEvent, sprite); } @@ -5697,7 +5710,7 @@ static bool8 MovementAction_WalkNormalUp_Step1(struct ObjectEvent *objectEvent, static bool8 MovementAction_WalkNormalLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_WEST, 0); + InitMovementNormal(objectEvent, sprite, DIR_WEST, MOVE_SPEED_NORMAL); return MovementAction_WalkNormalLeft_Step1(objectEvent, sprite); } @@ -5713,7 +5726,7 @@ static bool8 MovementAction_WalkNormalLeft_Step1(struct ObjectEvent *objectEvent static bool8 MovementAction_WalkNormalRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_EAST, 0); + InitMovementNormal(objectEvent, sprite, DIR_EAST, MOVE_SPEED_NORMAL); return MovementAction_WalkNormalRight_Step1(objectEvent, sprite); } @@ -5727,42 +5740,51 @@ static bool8 MovementAction_WalkNormalRight_Step1(struct ObjectEvent *objectEven return FALSE; } -void InitJump(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 speed, u8 a5) +#define JUMP_HALFWAY 1 +#define JUMP_FINISHED ((u8)-1) + +enum { + JUMP_TYPE_HIGH, + JUMP_TYPE_LOW, + JUMP_TYPE_NORMAL, +}; + +void InitJump(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 distance, u8 type) { - s16 displacements[NELEMS(gUnknown_83A6958)]; + s16 displacements[NELEMS(sJumpInitDisplacements)]; s16 x; s16 y; - memcpy(displacements, gUnknown_83A6958, sizeof gUnknown_83A6958); + memcpy(displacements, sJumpInitDisplacements, sizeof sJumpInitDisplacements); x = 0; y = 0; SetObjectEventDirection(objectEvent, direction); - MoveCoordsInDirection(direction, &x, &y, displacements[speed], displacements[speed]); + MoveCoordsInDirection(direction, &x, &y, displacements[distance], displacements[distance]); ShiftObjectEventCoords(objectEvent, objectEvent->currentCoords.x + x, objectEvent->currentCoords.y + y); - SetJumpSpriteData(sprite, direction, speed, a5); + SetJumpSpriteData(sprite, direction, distance, type); sprite->data[2] = 1; sprite->animPaused = 0; objectEvent->triggerGroundEffectsOnMove = 1; objectEvent->disableCoveringGroundEffects = 1; } -void InitJumpRegular(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 speed, u8 a4) +void InitJumpRegular(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 distance, u8 type) { - InitJump(objectEvent, sprite, direction, speed, a4); + InitJump(objectEvent, sprite, direction, distance, type); SetStepAnimHandleAlternation(objectEvent, sprite, GetMoveDirectionAnimNum(objectEvent->facingDirection)); DoShadowFieldEffect(objectEvent); } u8 UpdateJumpAnim(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 callback(struct Sprite *)) { - s16 displacements[NELEMS(gUnknown_83A695E)]; + s16 displacements[NELEMS(sJumpDisplacements)]; s16 x; s16 y; u8 result; - memcpy(displacements, gUnknown_83A695E, sizeof gUnknown_83A695E); + memcpy(displacements, sJumpDisplacements, sizeof sJumpDisplacements); result = callback(sprite); - if (result == 1 && displacements[sprite->data[4]] != 0) + if (result == JUMP_HALFWAY && displacements[sprite->data[4]] != 0) { x = 0; y = 0; @@ -5771,7 +5793,7 @@ u8 UpdateJumpAnim(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 cal objectEvent->triggerGroundEffectsOnMove = TRUE; objectEvent->disableCoveringGroundEffects = TRUE; } - else if (result == 0xFF) + else if (result == JUMP_FINISHED) { ShiftStillObjectEventCoords(objectEvent); objectEvent->triggerGroundEffectsOnStop = TRUE; @@ -5793,7 +5815,7 @@ u8 DoJumpSpecialAnimStep(struct ObjectEvent *objectEvent, struct Sprite *sprite) bool8 DoJumpAnim(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - if (DoJumpAnimStep(objectEvent, sprite) == 0xFF) + if (DoJumpAnimStep(objectEvent, sprite) == JUMP_FINISHED) return TRUE; return FALSE; @@ -5801,7 +5823,7 @@ bool8 DoJumpAnim(struct ObjectEvent *objectEvent, struct Sprite *sprite) bool8 DoJumpSpecialAnim(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - if (DoJumpSpecialAnimStep(objectEvent, sprite) == 0xFF) + if (DoJumpSpecialAnimStep(objectEvent, sprite) == JUMP_FINISHED) return TRUE; return FALSE; @@ -5811,9 +5833,9 @@ bool8 DoJumpInPlaceAnim(struct ObjectEvent *objectEvent, struct Sprite *sprite) { switch (DoJumpAnimStep(objectEvent, sprite)) { - case 0xFF: + case JUMP_FINISHED: return TRUE; - case 1: + case JUMP_HALFWAY: SetObjectEventDirection(objectEvent, GetOppositeDirection(objectEvent->movementDirection)); SetStepAnim(objectEvent, sprite, GetMoveDirectionAnimNum(objectEvent->facingDirection)); default: @@ -5823,7 +5845,7 @@ bool8 DoJumpInPlaceAnim(struct ObjectEvent *objectEvent, struct Sprite *sprite) static bool8 MovementAction_Jump2Down_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_SOUTH, 2, 0); + InitJumpRegular(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH); return MovementAction_Jump2Down_Step1(objectEvent, sprite); } @@ -5840,7 +5862,7 @@ static bool8 MovementAction_Jump2Down_Step1(struct ObjectEvent *objectEvent, str static bool8 MovementAction_Jump2Up_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_NORTH, 2, 0); + InitJumpRegular(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH); return MovementAction_Jump2Up_Step1(objectEvent, sprite); } @@ -5857,7 +5879,7 @@ static bool8 MovementAction_Jump2Up_Step1(struct ObjectEvent *objectEvent, struc static bool8 MovementAction_Jump2Left_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_WEST, 2, 0); + InitJumpRegular(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH); return MovementAction_Jump2Left_Step1(objectEvent, sprite); } @@ -5874,7 +5896,7 @@ static bool8 MovementAction_Jump2Left_Step1(struct ObjectEvent *objectEvent, str static bool8 MovementAction_Jump2Right_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_EAST, 2, 0); + InitJumpRegular(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH); return MovementAction_Jump2Right_Step1(objectEvent, sprite); } @@ -5937,7 +5959,7 @@ static bool8 MovementAction_Delay16_Step0(struct ObjectEvent *objectEvent, struc static bool8 MovementAction_WalkFastDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_SOUTH, 1); + InitMovementNormal(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_FAST_1); return MovementAction_WalkFastDown_Step1(objectEvent, sprite); } @@ -5953,7 +5975,7 @@ static bool8 MovementAction_WalkFastDown_Step1(struct ObjectEvent *objectEvent, static bool8 MovementAction_WalkFastUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_NORTH, 1); + InitMovementNormal(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_FAST_1); return MovementAction_WalkFastUp_Step1(objectEvent, sprite); } @@ -5969,7 +5991,7 @@ static bool8 MovementAction_WalkFastUp_Step1(struct ObjectEvent *objectEvent, st static bool8 MovementAction_WalkFastLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_WEST, 1); + InitMovementNormal(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FAST_1); return MovementAction_WalkFastLeft_Step1(objectEvent, sprite); } @@ -5985,7 +6007,7 @@ static bool8 MovementAction_WalkFastLeft_Step1(struct ObjectEvent *objectEvent, static bool8 MovementAction_WalkFastRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_EAST, 1); + InitMovementNormal(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FAST_1); return MovementAction_WalkFastRight_Step1(objectEvent, sprite); } @@ -5999,7 +6021,7 @@ static bool8 MovementAction_WalkFastRight_Step1(struct ObjectEvent *objectEvent, return FALSE; } -bool8 sub_80653CC(struct ObjectEvent *objectEvent, struct Sprite *sprite) +bool8 UpdateMovementGlide(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (NpcTakeStep(sprite)) { @@ -6010,19 +6032,19 @@ bool8 sub_80653CC(struct ObjectEvent *objectEvent, struct Sprite *sprite) return FALSE; } -u8 MovementActionFunc_xA0_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +u8 MovementAction_GlideDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if(objectEvent->facingDirection != DIR_SOUTH) StartSpriteAnim(sprite, GetFaceDirectionAnimNum(DIR_SOUTH)); - InitNpcForMovement(objectEvent, sprite, DIR_SOUTH, 1); - return MovementActionFunc_xA0_1(objectEvent, sprite); + InitNpcForMovement(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_FAST_1); + return MovementAction_GlideDown_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_xA0_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_GlideDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { AnimateSprite(sprite); - if (sub_80653CC(objectEvent, sprite)) + if (UpdateMovementGlide(objectEvent, sprite)) { sprite->data[2] = 2; return TRUE; @@ -6030,19 +6052,19 @@ static bool8 MovementActionFunc_xA0_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -u8 MovementActionFunc_xA1_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +u8 MovementAction_GlideUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if(objectEvent->facingDirection != DIR_NORTH) StartSpriteAnim(sprite, GetFaceDirectionAnimNum(DIR_NORTH)); - InitNpcForMovement(objectEvent, sprite, DIR_NORTH, 1); - return MovementActionFunc_xA1_1(objectEvent, sprite); + InitNpcForMovement(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_FAST_1); + return MovementAction_GlideUp_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_xA1_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_GlideUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { AnimateSprite(sprite); - if (sub_80653CC(objectEvent, sprite)) + if (UpdateMovementGlide(objectEvent, sprite)) { sprite->data[2] = 2; return TRUE; @@ -6050,19 +6072,19 @@ static bool8 MovementActionFunc_xA1_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -u8 MovementActionFunc_xA2_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +u8 MovementAction_GlideLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if(objectEvent->facingDirection != DIR_WEST) StartSpriteAnim(sprite, GetFaceDirectionAnimNum(DIR_WEST)); - InitNpcForMovement(objectEvent, sprite, DIR_WEST, 1); - return MovementActionFunc_xA2_1(objectEvent, sprite); + InitNpcForMovement(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FAST_1); + return MovementAction_GlideLeft_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_xA2_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_GlideLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { AnimateSprite(sprite); - if (sub_80653CC(objectEvent, sprite)) + if (UpdateMovementGlide(objectEvent, sprite)) { sprite->data[2] = 2; return TRUE; @@ -6070,19 +6092,19 @@ static bool8 MovementActionFunc_xA2_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -u8 MovementActionFunc_xA3_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +u8 MovementAction_GlideRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if(objectEvent->facingDirection != DIR_EAST) StartSpriteAnim(sprite, GetFaceDirectionAnimNum(DIR_EAST)); - InitNpcForMovement(objectEvent, sprite, DIR_EAST, 1); - return MovementActionFunc_xA3_1(objectEvent, sprite); + InitNpcForMovement(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FAST_1); + return MovementAction_GlideRight_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_xA3_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_GlideRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { AnimateSprite(sprite); - if (sub_80653CC(objectEvent, sprite)) + if (UpdateMovementGlide(objectEvent, sprite)) { sprite->data[2] = 2; return TRUE; @@ -6098,7 +6120,7 @@ void sub_80655A8(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 dire sprite->data[2] = 1; } -u8 MovementActionFunc_x04_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +u8 MovementAction_FaceDownFast_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if(objectEvent->facingDirection != DIR_SOUTH) StartSpriteAnim(sprite, GetFaceDirectionAnimNum(DIR_SOUTH)); @@ -6108,7 +6130,7 @@ u8 MovementActionFunc_x04_0(struct ObjectEvent *objectEvent, struct Sprite *spri return TRUE; } -u8 MovementActionFunc_x05_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +u8 MovementAction_FaceUpFast_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if(objectEvent->facingDirection != DIR_NORTH) StartSpriteAnim(sprite, GetFaceDirectionAnimNum(DIR_NORTH)); @@ -6118,7 +6140,7 @@ u8 MovementActionFunc_x05_0(struct ObjectEvent *objectEvent, struct Sprite *spri return TRUE; } -u8 MovementActionFunc_x06_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +u8 MovementAction_FaceLeftFast_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if(objectEvent->facingDirection != DIR_WEST) StartSpriteAnim(sprite, GetFaceDirectionAnimNum(DIR_WEST)); @@ -6128,7 +6150,7 @@ u8 MovementActionFunc_x06_0(struct ObjectEvent *objectEvent, struct Sprite *spri return TRUE; } -u8 MovementActionFunc_x07_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +u8 MovementAction_FaceRightFast_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if(objectEvent->facingDirection != DIR_EAST) StartSpriteAnim(sprite, GetFaceDirectionAnimNum(DIR_EAST)); @@ -6238,25 +6260,25 @@ static bool8 MovementAction_WalkInPlaceFastRight_Step0(struct ObjectEvent *objec return MovementAction_WalkInPlace_Step1(objectEvent, sprite); } -static bool8 MovementAction_WalkInPlaceFastestDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkInPlaceFasterDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitMoveInPlace(objectEvent, sprite, DIR_SOUTH, GetMoveDirectionFasterAnimNum(DIR_SOUTH), 4); return MovementAction_WalkInPlace_Step1(objectEvent, sprite); } -static bool8 MovementAction_WalkInPlaceFastestUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkInPlaceFasterUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitMoveInPlace(objectEvent, sprite, DIR_NORTH, GetMoveDirectionFasterAnimNum(DIR_NORTH), 4); return MovementAction_WalkInPlace_Step1(objectEvent, sprite); } -static bool8 MovementAction_WalkInPlaceFastestLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkInPlaceFasterLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitMoveInPlace(objectEvent, sprite, DIR_WEST, GetMoveDirectionFasterAnimNum(DIR_WEST), 4); return MovementAction_WalkInPlace_Step1(objectEvent, sprite); } -static bool8 MovementAction_WalkInPlaceFastestRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkInPlaceFasterRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitMoveInPlace(objectEvent, sprite, DIR_EAST, GetMoveDirectionFasterAnimNum(DIR_EAST), 4); return MovementAction_WalkInPlace_Step1(objectEvent, sprite); @@ -6264,7 +6286,7 @@ static bool8 MovementAction_WalkInPlaceFastestRight_Step0(struct ObjectEvent *ob static bool8 MovementAction_RideWaterCurrentDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_SOUTH, 2); + InitMovementNormal(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_FAST_2); return MovementAction_RideWaterCurrentDown_Step1(objectEvent, sprite); } @@ -6280,7 +6302,7 @@ static bool8 MovementAction_RideWaterCurrentDown_Step1(struct ObjectEvent *objec static bool8 MovementAction_RideWaterCurrentUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_NORTH, 2); + InitMovementNormal(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_FAST_2); return MovementAction_RideWaterCurrentUp_Step1(objectEvent, sprite); } @@ -6296,7 +6318,7 @@ static bool8 MovementAction_RideWaterCurrentUp_Step1(struct ObjectEvent *objectE static bool8 MovementAction_RideWaterCurrentLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_WEST, 2); + InitMovementNormal(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FAST_2); return MovementAction_RideWaterCurrentLeft_Step1(objectEvent, sprite); } @@ -6312,7 +6334,7 @@ static bool8 MovementAction_RideWaterCurrentLeft_Step1(struct ObjectEvent *objec static bool8 MovementAction_RideWaterCurrentRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_EAST, 2); + InitMovementNormal(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FAST_2); return MovementAction_RideWaterCurrentRight_Step1(objectEvent, sprite); } @@ -6326,13 +6348,13 @@ static bool8 MovementAction_RideWaterCurrentRight_Step1(struct ObjectEvent *obje return FALSE; } -static bool8 MovementAction_WalkFastestDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkFasterDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_SOUTH, 3); - return MovementAction_WalkFastestDown_Step1(objectEvent, sprite); + InitMovementNormal(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_FASTER); + return MovementAction_WalkFasterDown_Step1(objectEvent, sprite); } -static bool8 MovementAction_WalkFastestDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkFasterDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateMovementNormal(objectEvent, sprite)) { @@ -6342,13 +6364,13 @@ static bool8 MovementAction_WalkFastestDown_Step1(struct ObjectEvent *objectEven return FALSE; } -static bool8 MovementAction_WalkFastestUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkFasterUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_NORTH, 3); - return MovementAction_WalkFastestUp_Step1(objectEvent, sprite); + InitMovementNormal(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_FASTER); + return MovementAction_WalkFasterUp_Step1(objectEvent, sprite); } -static bool8 MovementAction_WalkFastestUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkFasterUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateMovementNormal(objectEvent, sprite)) { @@ -6358,13 +6380,13 @@ static bool8 MovementAction_WalkFastestUp_Step1(struct ObjectEvent *objectEvent, return FALSE; } -static bool8 MovementAction_WalkFastestLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkFasterLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_WEST, 3); - return MovementAction_WalkFastestLeft_Step1(objectEvent, sprite); + InitMovementNormal(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FASTER); + return MovementAction_WalkFasterLeft_Step1(objectEvent, sprite); } -static bool8 MovementAction_WalkFastestLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkFasterLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateMovementNormal(objectEvent, sprite)) { @@ -6374,13 +6396,13 @@ static bool8 MovementAction_WalkFastestLeft_Step1(struct ObjectEvent *objectEven return FALSE; } -static bool8 MovementAction_WalkFastestRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkFasterRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_EAST, 3); - return MovementAction_WalkFastestRight_Step1(objectEvent, sprite); + InitMovementNormal(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FASTER); + return MovementAction_WalkFasterRight_Step1(objectEvent, sprite); } -static bool8 MovementAction_WalkFastestRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_WalkFasterRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateMovementNormal(objectEvent, sprite)) { @@ -6392,7 +6414,7 @@ static bool8 MovementAction_WalkFastestRight_Step1(struct ObjectEvent *objectEve static bool8 MovementAction_SlideDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_SOUTH, 4); + InitMovementNormal(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_FASTEST); return MovementAction_SlideDown_Step1(objectEvent, sprite); } @@ -6408,7 +6430,7 @@ static bool8 MovementAction_SlideDown_Step1(struct ObjectEvent *objectEvent, str static bool8 MovementAction_SlideUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_NORTH, 4); + InitMovementNormal(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_FASTEST); return MovementAction_SlideUp_Step1(objectEvent, sprite); } @@ -6424,7 +6446,7 @@ static bool8 MovementAction_SlideUp_Step1(struct ObjectEvent *objectEvent, struc static bool8 MovementAction_SlideLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_WEST, 4); + InitMovementNormal(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FASTEST); return MovementAction_SlideLeft_Step1(objectEvent, sprite); } @@ -6440,7 +6462,7 @@ static bool8 MovementAction_SlideLeft_Step1(struct ObjectEvent *objectEvent, str static bool8 MovementAction_SlideRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_EAST, 4); + InitMovementNormal(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FASTEST); return MovementAction_SlideRight_Step1(objectEvent, sprite); } @@ -6552,13 +6574,13 @@ bool8 UpdateRunSlow(struct ObjectEvent *objectEvent, struct Sprite *sprite) return FALSE; } -static bool8 MovementActionFunc_x41_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_RunDownSlow_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitRunSlow(objectEvent, sprite, DIR_SOUTH); - return MovementActionFunc_x41_1(objectEvent, sprite); + return MovementAction_RunDownSlow_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x41_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_RunDownSlow_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateRunSlow(objectEvent, sprite)) { @@ -6568,13 +6590,13 @@ static bool8 MovementActionFunc_x41_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x42_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_RunUpSlow_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitRunSlow(objectEvent, sprite, DIR_NORTH); - return MovementActionFunc_x42_1(objectEvent, sprite); + return MovementAction_RunUpSlow_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x42_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_RunUpSlow_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateRunSlow(objectEvent, sprite)) { @@ -6584,13 +6606,13 @@ static bool8 MovementActionFunc_x42_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x43_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_RunLeftSlow_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitRunSlow(objectEvent, sprite, DIR_WEST); - return MovementActionFunc_x43_1(objectEvent, sprite); + return MovementAction_RunLeftSlow_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x43_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_RunLeftSlow_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateRunSlow(objectEvent, sprite)) { @@ -6600,13 +6622,13 @@ static bool8 MovementActionFunc_x43_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x44_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_RunRightSlow_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitRunSlow(objectEvent, sprite, DIR_SOUTH); - return MovementActionFunc_x44_1(objectEvent, sprite); + return MovementAction_RunRightSlow_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x44_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_RunRightSlow_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateRunSlow(objectEvent, sprite)) { @@ -6641,7 +6663,7 @@ static bool8 MovementAction_WaitSpriteAnim(struct ObjectEvent *objectEvent, stru void InitJumpSpecial(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction) { - InitJump(objectEvent, sprite, direction, 1, 0); + InitJump(objectEvent, sprite, direction, JUMP_DISTANCE_NORMAL, JUMP_TYPE_HIGH); StartSpriteAnim(sprite, GetJumpSpecialDirectionAnimNum(direction)); } @@ -6713,13 +6735,13 @@ static bool8 MovementAction_JumpSpecialRight_Step1(struct ObjectEvent *objectEve return FALSE; } -static bool8 MovementActionFunc_xA6_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_JumpSpecialWithEffectDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitJumpSpecial(objectEvent, sprite, DIR_SOUTH); - return MovementActionFunc_xA6_1(objectEvent, sprite); + return MovementAction_JumpSpecialWithEffectDown_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_xA6_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_JumpSpecialWithEffectDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (DoJumpSpecialAnim(objectEvent, sprite)) { @@ -6729,13 +6751,13 @@ static bool8 MovementActionFunc_xA6_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_xA7_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_JumpSpecialWithEffectUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitJumpSpecial(objectEvent, sprite, DIR_NORTH); - return MovementActionFunc_xA7_1(objectEvent, sprite); + return MovementAction_JumpSpecialWithEffectUp_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_xA7_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_JumpSpecialWithEffectUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (DoJumpSpecialAnim(objectEvent, sprite)) { @@ -6745,13 +6767,13 @@ static bool8 MovementActionFunc_xA7_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_xA8_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_JumpSpecialWithEffectLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitJumpSpecial(objectEvent, sprite, DIR_WEST); - return MovementActionFunc_xA8_1(objectEvent, sprite); + return MovementAction_JumpSpecialWithEffectLeft_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_xA8_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_JumpSpecialWithEffectLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (DoJumpSpecialAnim(objectEvent, sprite)) { @@ -6761,13 +6783,13 @@ static bool8 MovementActionFunc_xA8_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_xA9_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_JumpSpecialWithEffectRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitJumpSpecial(objectEvent, sprite, DIR_EAST); - return MovementActionFunc_xA9_1(objectEvent, sprite); + return MovementAction_JumpSpecialWithEffectRight_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_xA9_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_JumpSpecialWithEffectRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (DoJumpSpecialAnim(objectEvent, sprite)) { @@ -6817,7 +6839,7 @@ static bool8 MovementAction_UnlockFacingDirection_Step0(struct ObjectEvent *obje static bool8 MovementAction_JumpDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_SOUTH, 1, 2); + InitJumpRegular(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_NORMAL, JUMP_TYPE_NORMAL); return MovementAction_JumpDown_Step1(objectEvent, sprite); } @@ -6834,7 +6856,7 @@ static bool8 MovementAction_JumpDown_Step1(struct ObjectEvent *objectEvent, stru static bool8 MovementAction_JumpUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_NORTH, 1, 2); + InitJumpRegular(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_NORMAL, JUMP_TYPE_NORMAL); return MovementAction_JumpUp_Step1(objectEvent, sprite); } @@ -6851,7 +6873,7 @@ static bool8 MovementAction_JumpUp_Step1(struct ObjectEvent *objectEvent, struct static bool8 MovementAction_JumpLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_WEST, 1, 2); + InitJumpRegular(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_NORMAL, JUMP_TYPE_NORMAL); return MovementAction_JumpLeft_Step1(objectEvent, sprite); } @@ -6868,7 +6890,7 @@ static bool8 MovementAction_JumpLeft_Step1(struct ObjectEvent *objectEvent, stru static bool8 MovementAction_JumpRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_EAST, 1, 2); + InitJumpRegular(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_NORMAL, JUMP_TYPE_NORMAL); return MovementAction_JumpRight_Step1(objectEvent, sprite); } @@ -6885,7 +6907,7 @@ static bool8 MovementAction_JumpRight_Step1(struct ObjectEvent *objectEvent, str static bool8 MovementAction_JumpInPlaceDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_SOUTH, 0, 0); + InitJumpRegular(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_HIGH); return MovementAction_JumpInPlaceDown_Step1(objectEvent, sprite); } @@ -6902,7 +6924,7 @@ static bool8 MovementAction_JumpInPlaceDown_Step1(struct ObjectEvent *objectEven static bool8 MovementAction_JumpInPlaceUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_NORTH, 0, 0); + InitJumpRegular(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_HIGH); return MovementAction_JumpInPlaceUp_Step1(objectEvent, sprite); } @@ -6919,7 +6941,7 @@ static bool8 MovementAction_JumpInPlaceUp_Step1(struct ObjectEvent *objectEvent, static bool8 MovementAction_JumpInPlaceLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_WEST, 0, 0); + InitJumpRegular(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_HIGH); return MovementAction_JumpInPlaceLeft_Step1(objectEvent, sprite); } @@ -6936,7 +6958,7 @@ static bool8 MovementAction_JumpInPlaceLeft_Step1(struct ObjectEvent *objectEven static bool8 MovementAction_JumpInPlaceRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_EAST, 0, 0); + InitJumpRegular(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_HIGH); return MovementAction_JumpInPlaceRight_Step1(objectEvent, sprite); } @@ -6953,7 +6975,7 @@ static bool8 MovementAction_JumpInPlaceRight_Step1(struct ObjectEvent *objectEve static bool8 MovementAction_JumpInPlaceDownUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_SOUTH, 0, 2); + InitJumpRegular(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_NORMAL); return MovementAction_JumpInPlaceDownUp_Step1(objectEvent, sprite); } @@ -6970,7 +6992,7 @@ static bool8 MovementAction_JumpInPlaceDownUp_Step1(struct ObjectEvent *objectEv static bool8 MovementAction_JumpInPlaceUpDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_NORTH, 0, 2); + InitJumpRegular(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_NORMAL); return MovementAction_JumpInPlaceUpDown_Step1(objectEvent, sprite); } @@ -6987,7 +7009,7 @@ static bool8 MovementAction_JumpInPlaceUpDown_Step1(struct ObjectEvent *objectEv static bool8 MovementAction_JumpInPlaceLeftRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_WEST, 0, 2); + InitJumpRegular(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_NORMAL); return MovementAction_JumpInPlaceLeftRight_Step1(objectEvent, sprite); } @@ -7004,7 +7026,7 @@ static bool8 MovementAction_JumpInPlaceLeftRight_Step1(struct ObjectEvent *objec static bool8 MovementAction_JumpInPlaceRightLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitJumpRegular(objectEvent, sprite, DIR_EAST, 0, 2); + InitJumpRegular(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_NORMAL); return MovementAction_JumpInPlaceRightLeft_Step1(objectEvent, sprite); } @@ -7089,7 +7111,7 @@ static bool8 MovementAction_EmoteQuestionMark_Step0(struct ObjectEvent *objectEv return TRUE; } -static bool8 MovementAction_EmoteHeart_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_EmoteX_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { ObjectEventGetLocalIdAndMap(objectEvent, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]); FieldEffectStart(FLDEFF_X_ICON); @@ -7097,7 +7119,7 @@ static bool8 MovementAction_EmoteHeart_Step0(struct ObjectEvent *objectEvent, st return TRUE; } -static bool8 do_double_excl_bubble(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_EmoteDoubleExclamationMark_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { ObjectEventGetLocalIdAndMap(objectEvent, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]); FieldEffectStart(FLDEFF_DOUBLE_EXCL_MARK_ICON); @@ -7105,7 +7127,7 @@ static bool8 do_double_excl_bubble(struct ObjectEvent *objectEvent, struct Sprit return TRUE; } -static bool8 do_smile_bubble(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_EmoteSmile_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { ObjectEventGetLocalIdAndMap(objectEvent, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]); FieldEffectStart(FLDEFF_SMILEY_FACE_ICON); @@ -7274,25 +7296,25 @@ void AcroWheelieFaceDirection(struct ObjectEvent *objectEvent, struct Sprite *sp sprite->data[2] = 1; } -static bool8 MovementActionFunc_x70_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_AcroWheelieFaceDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { AcroWheelieFaceDirection(objectEvent, sprite, DIR_SOUTH); return TRUE; } -static bool8 MovementActionFunc_x71_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_AcroWheelieFaceUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { AcroWheelieFaceDirection(objectEvent, sprite, DIR_NORTH); return TRUE; } -static bool8 MovementActionFunc_x72_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_AcroWheelieFaceLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { AcroWheelieFaceDirection(objectEvent, sprite, DIR_WEST); return TRUE; } -static bool8 MovementActionFunc_x73_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_AcroWheelieFaceRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { AcroWheelieFaceDirection(objectEvent, sprite, DIR_EAST); return TRUE; @@ -7370,16 +7392,16 @@ static bool8 MovementAction_UnusedAcroActionRight_Step0(struct ObjectEvent *obje return FALSE; } -void InitAcroWheelieJump(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 speed, u8 a4) +void InitAcroWheelieJump(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 distance, u8 type) { - InitJump(objectEvent, sprite, direction, speed, a4); + InitJump(objectEvent, sprite, direction, distance, type); StartSpriteAnimIfDifferent(sprite, GetAcroWheelieDirectionAnimNum(direction)); DoShadowFieldEffect(objectEvent); } static bool8 MovementAction_AcroWheelieHopFaceDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieJump(objectEvent, sprite, DIR_SOUTH, 0, 1); + InitAcroWheelieJump(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_LOW); return MovementAction_AcroWheelieHopFaceDown_Step1(objectEvent, sprite); } @@ -7396,7 +7418,7 @@ static bool8 MovementAction_AcroWheelieHopFaceDown_Step1(struct ObjectEvent *obj static bool8 MovementAction_AcroWheelieHopFaceUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieJump(objectEvent, sprite, DIR_NORTH, 0, 1); + InitAcroWheelieJump(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_LOW); return MovementAction_AcroWheelieHopFaceUp_Step1(objectEvent, sprite); } @@ -7413,7 +7435,7 @@ static bool8 MovementAction_AcroWheelieHopFaceUp_Step1(struct ObjectEvent *objec static bool8 MovementAction_AcroWheelieHopFaceLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieJump(objectEvent, sprite, DIR_WEST, 0, 1); + InitAcroWheelieJump(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_LOW); return MovementAction_AcroWheelieHopFaceLeft_Step1(objectEvent, sprite); } @@ -7430,7 +7452,7 @@ static bool8 MovementAction_AcroWheelieHopFaceLeft_Step1(struct ObjectEvent *obj static bool8 MovementAction_AcroWheelieHopFaceRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieJump(objectEvent, sprite, DIR_EAST, 0, 1); + InitAcroWheelieJump(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_LOW); return MovementAction_AcroWheelieHopFaceRight_Step1(objectEvent, sprite); } @@ -7447,7 +7469,7 @@ static bool8 MovementAction_AcroWheelieHopFaceRight_Step1(struct ObjectEvent *ob static bool8 MovementAction_AcroWheelieHopDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieJump(objectEvent, sprite, DIR_SOUTH, 1, 1); + InitAcroWheelieJump(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_NORMAL, JUMP_TYPE_LOW); return MovementAction_AcroWheelieHopDown_Step1(objectEvent, sprite); } @@ -7464,7 +7486,7 @@ static bool8 MovementAction_AcroWheelieHopDown_Step1(struct ObjectEvent *objectE static bool8 MovementAction_AcroWheelieHopUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieJump(objectEvent, sprite, DIR_NORTH, 1, 1); + InitAcroWheelieJump(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_NORMAL, JUMP_TYPE_LOW); return MovementAction_AcroWheelieHopUp_Step1(objectEvent, sprite); } @@ -7481,7 +7503,7 @@ static bool8 MovementAction_AcroWheelieHopUp_Step1(struct ObjectEvent *objectEve static bool8 MovementAction_AcroWheelieHopLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieJump(objectEvent, sprite, DIR_WEST, 1, 1); + InitAcroWheelieJump(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_NORMAL, JUMP_TYPE_LOW); return MovementAction_AcroWheelieHopLeft_Step1(objectEvent, sprite); } @@ -7498,7 +7520,7 @@ static bool8 MovementAction_AcroWheelieHopLeft_Step1(struct ObjectEvent *objectE static bool8 MovementAction_AcroWheelieHopRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieJump(objectEvent, sprite, DIR_EAST, 1, 1); + InitAcroWheelieJump(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_NORMAL, JUMP_TYPE_LOW); return MovementAction_AcroWheelieHopRight_Step1(objectEvent, sprite); } @@ -7515,7 +7537,7 @@ static bool8 MovementAction_AcroWheelieHopRight_Step1(struct ObjectEvent *object static bool8 MovementAction_AcroWheelieJumpDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieJump(objectEvent, sprite, DIR_SOUTH, 2, 0); + InitAcroWheelieJump(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH); return MovementAction_AcroWheelieJumpDown_Step1(objectEvent, sprite); } @@ -7532,7 +7554,7 @@ static bool8 MovementAction_AcroWheelieJumpDown_Step1(struct ObjectEvent *object static bool8 MovementAction_AcroWheelieJumpUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieJump(objectEvent, sprite, DIR_NORTH, 2, 0); + InitAcroWheelieJump(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH); return MovementAction_AcroWheelieJumpUp_Step1(objectEvent, sprite); } @@ -7549,7 +7571,7 @@ static bool8 MovementAction_AcroWheelieJumpUp_Step1(struct ObjectEvent *objectEv static bool8 MovementAction_AcroWheelieJumpLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieJump(objectEvent, sprite, DIR_WEST, 2, 0); + InitAcroWheelieJump(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH); return MovementAction_AcroWheelieJumpLeft_Step1(objectEvent, sprite); } @@ -7566,7 +7588,7 @@ static bool8 MovementAction_AcroWheelieJumpLeft_Step1(struct ObjectEvent *object static bool8 MovementAction_AcroWheelieJumpRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieJump(objectEvent, sprite, DIR_EAST, 2, 0); + InitAcroWheelieJump(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH); return MovementAction_AcroWheelieJumpRight_Step1(objectEvent, sprite); } @@ -7581,25 +7603,25 @@ static bool8 MovementAction_AcroWheelieJumpRight_Step1(struct ObjectEvent *objec return FALSE; } -static bool8 MovementActionFunc_x88_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_AcroWheelieInPlaceDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitMoveInPlace(objectEvent, sprite, DIR_SOUTH, GetAcroWheeliePedalDirectionAnimNum(DIR_SOUTH), 8); return MovementAction_WalkInPlace_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x89_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_AcroWheelieInPlaceUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitMoveInPlace(objectEvent, sprite, DIR_NORTH, GetAcroWheeliePedalDirectionAnimNum(DIR_NORTH), 8); return MovementAction_WalkInPlace_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x8A_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_AcroWheelieInPlaceLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitMoveInPlace(objectEvent, sprite, DIR_WEST, GetAcroWheeliePedalDirectionAnimNum(DIR_WEST), 8); return MovementAction_WalkInPlace_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x8B_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_AcroWheelieInPlaceRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { InitMoveInPlace(objectEvent, sprite, DIR_EAST, GetAcroWheeliePedalDirectionAnimNum(DIR_EAST), 8); return MovementAction_WalkInPlace_Step1(objectEvent, sprite); @@ -7614,7 +7636,7 @@ void InitAcroPopWheelie(struct ObjectEvent *objectEvent, struct Sprite *sprite, static bool8 MovementAction_AcroPopWheelieMoveDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroPopWheelie(objectEvent, sprite, DIR_SOUTH, 1); + InitAcroPopWheelie(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_FAST_1); return MovementAction_AcroPopWheelieMoveDown_Step1(objectEvent, sprite); } @@ -7630,7 +7652,7 @@ static bool8 MovementAction_AcroPopWheelieMoveDown_Step1(struct ObjectEvent *obj static bool8 MovementAction_AcroPopWheelieMoveUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroPopWheelie(objectEvent, sprite, DIR_NORTH, 1); + InitAcroPopWheelie(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_FAST_1); return MovementAction_AcroPopWheelieMoveUp_Step1(objectEvent, sprite); } @@ -7646,7 +7668,7 @@ static bool8 MovementAction_AcroPopWheelieMoveUp_Step1(struct ObjectEvent *objec static bool8 MovementAction_AcroPopWheelieMoveLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroPopWheelie(objectEvent, sprite, DIR_WEST, 1); + InitAcroPopWheelie(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FAST_1); return MovementAction_AcroPopWheelieMoveLeft_Step1(objectEvent, sprite); } @@ -7662,7 +7684,7 @@ static bool8 MovementAction_AcroPopWheelieMoveLeft_Step1(struct ObjectEvent *obj static bool8 MovementAction_AcroPopWheelieMoveRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroPopWheelie(objectEvent, sprite, DIR_EAST, 1); + InitAcroPopWheelie(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FAST_1); return MovementAction_AcroPopWheelieMoveRight_Step1(objectEvent, sprite); } @@ -7684,7 +7706,7 @@ void InitAcroWheelieMove(struct ObjectEvent *objectEvent, struct Sprite *sprite, static bool8 MovementAction_AcroWheelieMoveDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieMove(objectEvent, sprite, DIR_SOUTH, 1); + InitAcroWheelieMove(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_FAST_1); return MovementAction_AcroWheelieMoveDown_Step1(objectEvent, sprite); } @@ -7700,7 +7722,7 @@ static bool8 MovementAction_AcroWheelieMoveDown_Step1(struct ObjectEvent *object static bool8 MovementAction_AcroWheelieMoveUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieMove(objectEvent, sprite, DIR_NORTH, 1); + InitAcroWheelieMove(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_FAST_1); return MovementAction_AcroWheelieMoveUp_Step1(objectEvent, sprite); } @@ -7716,7 +7738,7 @@ static bool8 MovementAction_AcroWheelieMoveUp_Step1(struct ObjectEvent *objectEv static bool8 MovementAction_AcroWheelieMoveLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieMove(objectEvent, sprite, DIR_WEST, 1); + InitAcroWheelieMove(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FAST_1); return MovementAction_AcroWheelieMoveLeft_Step1(objectEvent, sprite); } @@ -7732,7 +7754,7 @@ static bool8 MovementAction_AcroWheelieMoveLeft_Step1(struct ObjectEvent *object static bool8 MovementAction_AcroWheelieMoveRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitAcroWheelieMove(objectEvent, sprite, DIR_EAST, 1); + InitAcroWheelieMove(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FAST_1); return MovementAction_AcroWheelieMoveRight_Step1(objectEvent, sprite); } @@ -7753,13 +7775,13 @@ void InitSpin(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 directi SeekSpriteAnim(sprite, 0); } -static bool8 MovementActionFunc_x94_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_SpinDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitSpin(objectEvent, sprite, DIR_SOUTH, 1); - return MovementActionFunc_x94_1(objectEvent, sprite); + InitSpin(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_FAST_1); + return MovementAction_SpinDown_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x94_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_SpinDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateMovementNormal(objectEvent, sprite)) { @@ -7769,13 +7791,13 @@ static bool8 MovementActionFunc_x94_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x95_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_SpinUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitSpin(objectEvent, sprite, DIR_NORTH, 1); - return MovementActionFunc_x95_1(objectEvent, sprite); + InitSpin(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_FAST_1); + return MovementAction_SpinUp_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x95_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_SpinUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateMovementNormal(objectEvent, sprite)) { @@ -7785,13 +7807,13 @@ static bool8 MovementActionFunc_x95_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x96_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_SpinLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitSpin(objectEvent, sprite, DIR_WEST, 1); - return MovementActionFunc_x96_1(objectEvent, sprite); + InitSpin(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FAST_1); + return MovementAction_SpinLeft_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x96_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_SpinLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateMovementNormal(objectEvent, sprite)) { @@ -7801,13 +7823,13 @@ static bool8 MovementActionFunc_x96_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x97_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_SpinRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitSpin(objectEvent, sprite, DIR_EAST, 1); - return MovementActionFunc_x97_1(objectEvent, sprite); + InitSpin(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FAST_1); + return MovementAction_SpinRight_Step1(objectEvent, sprite); } -static bool8 MovementActionFunc_x97_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_SpinRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateMovementNormal(objectEvent, sprite)) { @@ -7817,7 +7839,7 @@ static bool8 MovementActionFunc_x97_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x98_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_RaiseHand_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { StartSpriteAnim(sprite, ANIM_RAISE_HAND); sprite->animPaused = FALSE; @@ -7830,12 +7852,12 @@ static bool8 MovementActionFunc_x98_0(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x98_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_RaiseHandAndStop_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { return sprite->animEnded; } -static bool8 MovementActionFunc_x99_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_RaiseHandAndJump_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { switch (sprite->data[7]) { @@ -7881,7 +7903,7 @@ static bool8 MovementActionFunc_x99_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x9A_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_RaiseHandAndSwim_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { bool8 ret; sprite->data[7] = (sprite->data[7] + 4) & 0xFF; @@ -7893,7 +7915,7 @@ static bool8 MovementActionFunc_x9A_1(struct ObjectEvent *objectEvent, struct Sp return ret; } -static bool8 MovementActionFunc_x9F_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_ShakeHeadOrWalkInPlace_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { StartSpriteAnim(sprite, ANIM_SHAKE_HEAD_OR_WALK_IN_PLACE); sprite->animPaused = FALSE; @@ -7902,7 +7924,7 @@ static bool8 MovementActionFunc_x9F_0(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_x9F_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_ShakeHeadOrWalkInPlace_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { return sprite->animEnded; } @@ -7918,14 +7940,14 @@ static bool8 MovementAction_PauseSpriteAnim(struct ObjectEvent *objectEvent, str return TRUE; } -static bool8 MovementActionFunc_xA4_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_FlyUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { sprite->y2 = 0; sprite->data[2]++; return FALSE; } -static bool8 MovementActionFunc_xA4_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_FlyUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { sprite->y2 -= 8; if (sprite->y2 == -160) @@ -7933,14 +7955,14 @@ static bool8 MovementActionFunc_xA4_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -static bool8 MovementActionFunc_xA5_0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_FlyDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { sprite->y2 = -160; sprite->data[2]++; return FALSE; } -static bool8 MovementActionFunc_xA5_1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +static bool8 MovementAction_FlyDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { sprite->y2 += 8; if (sprite->y2 == 0) @@ -7948,7 +7970,7 @@ static bool8 MovementActionFunc_xA5_1(struct ObjectEvent *objectEvent, struct Sp return FALSE; } -u8 MovementActionFunc_xA4_2(struct ObjectEvent *objectEvent, struct Sprite *sprite) +u8 MovementAction_FlyUp_Step2(struct ObjectEvent *objectEvent, struct Sprite *sprite) { return TRUE; } @@ -8840,31 +8862,31 @@ void UnfreezeObjectEvents(void) #define tSpeed data[4] #define tStepNo data[5] -static void little_step(struct Sprite *sprite, u8 direction) +static void Step1(struct Sprite *sprite, u8 direction) { sprite->x += sDirectionToVectors[direction].x; sprite->y += sDirectionToVectors[direction].y; } -static void double_little_steps(struct Sprite *sprite, u8 direction) +static void Step2(struct Sprite *sprite, u8 direction) { sprite->x += 2 * (u16)sDirectionToVectors[direction].x; sprite->y += 2 * (u16)sDirectionToVectors[direction].y; } -static void triple_little_steps(struct Sprite *sprite, u8 direction) +static void Step3(struct Sprite *sprite, u8 direction) { sprite->x += 2 * (u16)sDirectionToVectors[direction].x + (u16)sDirectionToVectors[direction].x; sprite->y += 2 * (u16)sDirectionToVectors[direction].y + (u16)sDirectionToVectors[direction].y; } -static void quad_little_steps(struct Sprite *sprite, u8 direction) +static void Step4(struct Sprite *sprite, u8 direction) { sprite->x += 4 * (u16)sDirectionToVectors[direction].x; sprite->y += 4 * (u16)sDirectionToVectors[direction].y; } -static void oct_little_steps(struct Sprite *sprite, u8 direction) +static void Step8(struct Sprite *sprite, u8 direction) { sprite->x += 8 * (u16)sDirectionToVectors[direction].x; sprite->y += 8 * (u16)sDirectionToVectors[direction].y; @@ -8879,83 +8901,83 @@ void SetSpriteDataForNormalStep(struct Sprite *sprite, u8 direction, u8 speed) typedef void (*SpriteStepFunc)(struct Sprite *sprite, u8 direction); -static const SpriteStepFunc sSpeed0[] = { - little_step, - little_step, - little_step, - little_step, - little_step, - little_step, - little_step, - little_step, - little_step, - little_step, - little_step, - little_step, - little_step, - little_step, - little_step, - little_step +static const SpriteStepFunc sSpeedNormalStepFuncs[] = { + Step1, + Step1, + Step1, + Step1, + Step1, + Step1, + Step1, + Step1, + Step1, + Step1, + Step1, + Step1, + Step1, + Step1, + Step1, + Step1 }; -static const SpriteStepFunc sSpeed1[] = { - double_little_steps, - double_little_steps, - double_little_steps, - double_little_steps, - double_little_steps, - double_little_steps, - double_little_steps, - double_little_steps +static const SpriteStepFunc sSpeedFast1StepFuncs[] = { + Step2, + Step2, + Step2, + Step2, + Step2, + Step2, + Step2, + Step2 }; -static const SpriteStepFunc sSpeed2[] = { - double_little_steps, - triple_little_steps, - triple_little_steps, - double_little_steps, - triple_little_steps, - triple_little_steps +static const SpriteStepFunc sSpeedFast2StepFuncs[] = { + Step2, + Step3, + Step3, + Step2, + Step3, + Step3 }; -static const SpriteStepFunc sSpeed3[] = { - quad_little_steps, - quad_little_steps, - quad_little_steps, - quad_little_steps +static const SpriteStepFunc sSpeedFasterStepFuncs[] = { + Step4, + Step4, + Step4, + Step4 }; -static const SpriteStepFunc sSpeed4[] = { - oct_little_steps, - oct_little_steps +static const SpriteStepFunc sSpeedFastestStepFuncs[] = { + Step8, + Step8 }; -static const SpriteStepFunc *const sSpriteStepFuncsBySpeed[] = { - sSpeed0, - sSpeed1, - sSpeed2, - sSpeed3, - sSpeed4 +static const SpriteStepFunc *const sNpcStepFuncTables[] = { + [MOVE_SPEED_NORMAL] = sSpeedNormalStepFuncs, + [MOVE_SPEED_FAST_1] = sSpeedFast1StepFuncs, + [MOVE_SPEED_FAST_2] = sSpeedFast2StepFuncs, + [MOVE_SPEED_FASTER] = sSpeedFasterStepFuncs, + [MOVE_SPEED_FASTEST] = sSpeedFastestStepFuncs, }; -static const s16 sSpriteStepCountsBySpeed[] = { - NELEMS(sSpeed0), - NELEMS(sSpeed1), - NELEMS(sSpeed2), - NELEMS(sSpeed3), - NELEMS(sSpeed4) +static const s16 sStepTimes[] = { + [MOVE_SPEED_NORMAL] = NELEMS(sSpeedNormalStepFuncs), + [MOVE_SPEED_FAST_1] = NELEMS(sSpeedFast1StepFuncs), + [MOVE_SPEED_FAST_2] = NELEMS(sSpeedFast2StepFuncs), + [MOVE_SPEED_FASTER] = NELEMS(sSpeedFasterStepFuncs), + [MOVE_SPEED_FASTEST] = NELEMS(sSpeedFastestStepFuncs), }; bool8 NpcTakeStep(struct Sprite *sprite) { - if (sprite->tStepNo >= sSpriteStepCountsBySpeed[sprite->tSpeed]) + if (sprite->tStepNo >= sStepTimes[sprite->tSpeed]) return FALSE; - sSpriteStepFuncsBySpeed[sprite->tSpeed][sprite->tStepNo](sprite, sprite->tDirection); + sNpcStepFuncTables[sprite->tSpeed][sprite->tStepNo](sprite, sprite->tDirection); sprite->tStepNo++; - if (sprite->tStepNo < sSpriteStepCountsBySpeed[sprite->tSpeed]) + if (sprite->tStepNo < sStepTimes[sprite->tSpeed]) return FALSE; return TRUE; @@ -8976,7 +8998,7 @@ bool8 UpdateWalkSlowerAnim(struct Sprite *sprite) { if (!(sprite->tDelay & 1)) { - little_step(sprite, sprite->tDirection); + Step1(sprite, sprite->tDirection); sprite->tStepNo++; } @@ -9001,7 +9023,7 @@ bool8 UpdateWalkSlowAnim(struct Sprite *sprite) { if (++sprite->tDelay < 3) { - little_step(sprite, sprite->tDirection); + Step1(sprite, sprite->tDirection); sprite->tStepNo++; } else @@ -9025,7 +9047,7 @@ bool8 UpdateWalkSlowestAnim(struct Sprite *sprite) if (++sprite->tDelay > 9) { sprite->tDelay = 0; - little_step(sprite, sprite->tDirection); + Step1(sprite, sprite->tDirection); sprite->tStepNo++; } @@ -9046,12 +9068,12 @@ bool8 UpdateRunSlowAnim(struct Sprite *sprite) { if ((++sprite->tDelay) & 1) { - little_step(sprite, sprite->tDirection); + Step1(sprite, sprite->tDirection); sprite->tStepNo++; } else { - double_little_steps(sprite, sprite->tDirection); + Step2(sprite, sprite->tDirection); sprite->tStepNo += 2; } @@ -9064,61 +9086,72 @@ bool8 UpdateRunSlowAnim(struct Sprite *sprite) #undef tStepNo #undef tDelay -#define tJumpSpeed data[4] -#define tJumpHeight data[5] -#define tStepNo data[6] - -static const s8 sJumpHeight12[] = { - -4, -6, -8, -10, -11, -12, -12, -12, -11, -10, -9, -8, -6, -4, 0, 0 +static const s8 sJumpY_High[] = { + -4, -6, -8, -10, -11, -12, -12, -12, + -11, -10, -9, -8, -6, -4, 0, 0 }; -static const s8 sJumpHeight6[] = { - 0, -2, -3, -4, -5, -6, -6, -6, -5, -5, -4, -3, -2, 0, 0, 0 +static const s8 sJumpY_Low[] = { + 0, -2, -3, -4, -5, -6, -6, -6, + -5, -5, -4, -3, -2, 0, 0, 0 }; -static const s8 sJumpHeight10[] = { - -2, -4, -6, -8, -9, -10, -10, -10, -9, -8, -6, -5, -3, -2, 0, 0 +static const s8 sJumpY_Normal[] = { + -2, -4, -6, -8, -9, -10, -10, -10, + -9, -8, -6, -5, -3, -2, 0, 0 }; -static const s8 *const sYDisplacementPtrs[] = { - sJumpHeight12, - sJumpHeight6, - sJumpHeight10 +#define sJumpDistance data[4] +#define sJumpType data[5] +#define sTimer data[6] + +static const s8 *const sJumpYTable[] = { + [JUMP_TYPE_HIGH] = sJumpY_High, + [JUMP_TYPE_LOW] = sJumpY_Low, + [JUMP_TYPE_NORMAL] = sJumpY_Normal, }; -static s16 GetJumpYDisplacement(s16 stepno, u8 jumpno) +static s16 GetJumpY(s16 i, u8 type) { - return sYDisplacementPtrs[jumpno][stepno]; + return sJumpYTable[type][i]; } -void SetJumpSpriteData(struct Sprite *sprite, u8 direction, u8 speed, u8 height) +void SetJumpSpriteData(struct Sprite *sprite, u8 direction, u8 distance, u8 type) { sprite->tDirection = direction; - sprite->tJumpSpeed = speed; - sprite->tJumpHeight = height; - sprite->tStepNo = 0; + sprite->sJumpDistance = distance; + sprite->sJumpType = type; + sprite->sTimer = 0; } u8 DoJumpSpriteMovement(struct Sprite *sprite) { - s16 duration[3] = {0x10, 0x10, 0x20}; - u8 shifts[3] = {0, 0, 1}; + s16 distanceToTime[] = { + [JUMP_DISTANCE_IN_PLACE] = 16, + [JUMP_DISTANCE_NORMAL] = 16, + [JUMP_DISTANCE_FAR] = 32, + }; + u8 distanceToShift[] = { + [JUMP_DISTANCE_IN_PLACE] = 0, + [JUMP_DISTANCE_NORMAL] = 0, + [JUMP_DISTANCE_FAR] = 1, + }; u8 jumpPhase = 0; - if (sprite->tJumpSpeed != 0) - little_step(sprite, sprite->tDirection); + if (sprite->sJumpDistance != JUMP_DISTANCE_IN_PLACE) + Step1(sprite, sprite->tDirection); - sprite->y2 = GetJumpYDisplacement(sprite->tStepNo >> shifts[sprite->tJumpSpeed], sprite->tJumpHeight); + sprite->y2 = GetJumpY(sprite->sTimer >> distanceToShift[sprite->sJumpDistance], sprite->sJumpType); - sprite->tStepNo++; + sprite->sTimer++; - if (sprite->tStepNo == (duration[sprite->tJumpSpeed] >> 1)) - jumpPhase = 1; + if (sprite->sTimer == (distanceToTime[sprite->sJumpDistance] >> 1)) + jumpPhase = JUMP_HALFWAY; - if (sprite->tStepNo >= duration[sprite->tJumpSpeed]) + if (sprite->sTimer >= distanceToTime[sprite->sJumpDistance]) { sprite->y2 = 0; - jumpPhase = -1; + jumpPhase = JUMP_FINISHED; } return jumpPhase; @@ -9130,28 +9163,28 @@ u8 DoJumpSpecialSpriteMovement(struct Sprite *sprite) u8 shifts[3] = {1, 1, 2}; u8 jumpPhase = 0; - if (sprite->tJumpSpeed != 0 && !(sprite->tStepNo & 1)) - little_step(sprite, sprite->tDirection); + if (sprite->sJumpDistance != JUMP_DISTANCE_IN_PLACE && !(sprite->sTimer & 1)) + Step1(sprite, sprite->tDirection); - sprite->y2 = GetJumpYDisplacement(sprite->tStepNo >> shifts[sprite->tJumpSpeed], sprite->tJumpHeight); + sprite->y2 = GetJumpY(sprite->sTimer >> shifts[sprite->sJumpDistance], sprite->sJumpType); - sprite->tStepNo++; + sprite->sTimer++; - if (sprite->tStepNo == (duration[sprite->tJumpSpeed] >> 1)) - jumpPhase = 1; + if (sprite->sTimer == (duration[sprite->sJumpDistance] >> 1)) + jumpPhase = JUMP_HALFWAY; - if (sprite->tStepNo >= duration[sprite->tJumpSpeed]) + if (sprite->sTimer >= duration[sprite->sJumpDistance]) { sprite->y2 = 0; - jumpPhase = -1; + jumpPhase = JUMP_FINISHED; } return jumpPhase; } -#undef tStepNo -#undef tJumpHeight -#undef tJumpSpeed +#undef sTimer +#undef sJumpType +#undef sJumpDistance #undef tDirection #define tDelay data[3] @@ -9252,7 +9285,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_player_avatar.c b/src/field_player_avatar.c index 7d661b1b6..8731886c4 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -767,7 +767,7 @@ static bool8 PlayerAnimIsMultiFrameStationary(void) if (movementActionId <= MOVEMENT_ACTION_FACE_RIGHT_FAST || (movementActionId >= MOVEMENT_ACTION_DELAY_1 && movementActionId <= MOVEMENT_ACTION_DELAY_16) - || (movementActionId >= MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_DOWN && movementActionId <= MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_RIGHT) + || (movementActionId >= MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_DOWN && movementActionId <= MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_RIGHT) || (movementActionId >= MOVEMENT_ACTION_ACRO_WHEELIE_FACE_DOWN && movementActionId <= MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_RIGHT) || (movementActionId >= MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_DOWN && movementActionId <= MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_RIGHT)) return TRUE; diff --git a/src/field_specials.c b/src/field_specials.c index 0f8093e8e..e9574f429 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1542,18 +1542,26 @@ void SetSeenMon(void) void ResetContextNpcTextColor(void) { gSelectedObjectEvent = 0; - gSpecialVar_TextColor = 0xFF; + gSpecialVar_TextColor = NPC_TEXT_COLOR_DEFAULT; } u8 ContextNpcGetTextColor(void) { u8 gfxId; - if (gSpecialVar_TextColor != 0xFF) + if (gSpecialVar_TextColor != NPC_TEXT_COLOR_DEFAULT) + { + // A text color has been specified, use that return gSpecialVar_TextColor; + } else if (gSelectedObjectEvent == 0) - return 3; + { + // No text color specified and no object selected, use neutral + return NPC_TEXT_COLOR_NEUTRAL; + } else { + // An object is selected and no color has been specified. + // Use the text color normally associated with this object's sprite. gfxId = gObjectEvents[gSelectedObjectEvent].graphicsId; if (gfxId >= OBJ_EVENT_GFX_VAR_0) gfxId = VarGetObjectEventGraphicsId(gfxId - OBJ_EVENT_GFX_VAR_0); @@ -1631,7 +1639,7 @@ void ChangeBoxPokemonNickname(void) species = GetBoxMonData(pokemon, MON_DATA_SPECIES, NULL); gender = GetBoxMonGender(pokemon); personality = GetBoxMonData(pokemon, MON_DATA_PERSONALITY, NULL); - DoNamingScreen(NAMING_SCREEN_NAME_RATER, gStringVar2, species, gender, personality, ChangeBoxPokemonNickname_CB); + DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar2, species, gender, personality, ChangeBoxPokemonNickname_CB); } static void ChangeBoxPokemonNickname_CB(void) @@ -1651,7 +1659,7 @@ void ChangePokemonNickname(void) species = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES, NULL); gender = GetMonGender(&gPlayerParty[gSpecialVar_0x8004]); personality = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_PERSONALITY, NULL); - DoNamingScreen(NAMING_SCREEN_NAME_RATER, gStringVar2, species, gender, personality, ChangePokemonNickname_CB); + DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar2, species, gender, personality, ChangePokemonNickname_CB); } static void ChangePokemonNickname_CB(void) @@ -2419,7 +2427,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/graphics.c b/src/graphics.c index e8c2a96e1..b7694f158 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1181,33 +1181,36 @@ const u16 gUnknown_8E97DDC[] = INCBIN_U16("graphics/interface/learn_move.gbapal" const u32 gUnknown_8E97DFC[] = INCBIN_U32("graphics/interface/learn_move.4bpp.lz"); const u32 gUnknown_8E97EC4[] = INCBIN_U32("graphics/interface/learn_move.bin.lz"); -const u16 gUnknown_8E97FE4[] = INCBIN_U16("graphics/interface/naming_screen_8E97FE4.gbapal"); -const u16 gUnknown_8E98004[] = INCBIN_U16("graphics/interface/naming_screen_8E98004.gbapal"); -const u16 gNamingScreenMenu_Pal[] = INCBIN_U16("graphics/interface/naming_screen_8E98024.gbapal"); -const u16 gUnknown_8E98044[] = INCBIN_U16("graphics/interface/naming_screen_8E98044.gbapal"); -const u16 gUnknown_8E98064[] = INCBIN_U16("graphics/interface/naming_screen_8E98064.gbapal"); -const u16 gUnknown_8E98084[] = INCBIN_U16("graphics/interface/naming_screen_8E98084.gbapal"); -const u16 gUnknown_8E980A4[] = INCBIN_U16("graphics/interface/naming_screen_8E980A4.gbapal"); -const u16 gUnknown_8E980C4[] = INCBIN_U16("graphics/interface/naming_screen_8E980C4.gbapal"); +const u16 gNamingScreenKeyboard_Pal[] = INCBIN_U16("graphics/naming_screen/keyboard.gbapal"); +const u16 gNamingScreenRival_Pal[] = INCBIN_U16("graphics/naming_screen/rival.gbapal"); +const u16 gNamingScreenMenu_Pal[6][16] = +{ + INCBIN_U16("graphics/naming_screen/menu.gbapal"), + INCBIN_U16("graphics/naming_screen/page_swap_upper.gbapal"), + INCBIN_U16("graphics/naming_screen/page_swap_lower.gbapal"), + INCBIN_U16("graphics/naming_screen/page_swap_others.gbapal"), + INCBIN_U16("graphics/naming_screen/buttons.gbapal"), + INCBIN_U16("graphics/naming_screen/cursor.gbapal"), +}; -const u32 gNamingScreenMenu_Gfx[] = INCBIN_U32("graphics/interface/naming_screen_menu.4bpp.lz"); -const u32 gUnknown_8E982BC[] = INCBIN_U32("graphics/interface/naming_screen_menu.bin.lz"); -const u32 gUnknown_8E98398[] = INCBIN_U32("graphics/interface/naming_screen_E98398.bin.lz"); -const u32 gUnknown_8E98458[] = INCBIN_U32("graphics/interface/naming_screen_E98458.bin.lz"); -const u32 gUnknown_8E98518[] = INCBIN_U32("graphics/interface/naming_screen_E98518.bin.lz"); +const u32 gNamingScreenMenu_Gfx[] = INCBIN_U32("graphics/naming_screen/menu.4bpp.lz"); +const u32 gNamingScreenBackground_Tilemap[] = INCBIN_U32("graphics/naming_screen/background.bin.lz"); +const u32 gNamingScreenKeyboardUpper_Tilemap[] = INCBIN_U32("graphics/naming_screen/keyboard_upper.bin.lz"); +const u32 gNamingScreenKeyboardLower_Tilemap[] = INCBIN_U32("graphics/naming_screen/keyboard_lower.bin.lz"); +const u32 gNamingScreenKeyboardSymbols_Tilemap[] = INCBIN_U32("graphics/naming_screen/keyboard_symbols.bin.lz"); -const u32 gUnknown_8E985D8[] = INCBIN_U32("graphics/interface/naming_screen_8E985D8.4bpp"); -const u32 gUnknown_8E98858[] = INCBIN_U32("graphics/interface/naming_screen_8E98858.4bpp"); -const u32 gUnknown_8E98A38[] = INCBIN_U32("graphics/interface/naming_screen_8E98A38.4bpp"); -const u32 gUnknown_8E98C18[] = INCBIN_U32("graphics/interface/naming_screen_8E98C18.4bpp"); -const u32 gUnknown_8E98CB8[] = INCBIN_U32("graphics/interface/naming_screen_8E98CB8.4bpp"); -const u32 gUnknown_8E98D58[] = INCBIN_U32("graphics/interface/naming_screen_8E98D58.4bpp"); -const u32 gUnknown_8E98DF8[] = INCBIN_U32("graphics/interface/naming_screen_8E98DF8.4bpp"); -const u32 gUnknown_8E98E98[] = INCBIN_U32("graphics/interface/naming_screen_8E98E98.4bpp"); -const u32 gUnknown_8E98F38[] = INCBIN_U32("graphics/interface/naming_screen_8E98F38.4bpp"); -const u32 gUnknown_8E98FD8[] = INCBIN_U32("graphics/interface/naming_screen_8E98FD8.4bpp"); -const u32 gUnknown_8E990D8[] = INCBIN_U32("graphics/interface/naming_screen_8E990D8.4bpp"); -const u32 gUnknown_8E990F8[] = INCBIN_U32("graphics/interface/naming_screen_8E990F8.4bpp"); +const u32 gNamingScreenPageSwapFrame_Gfx[] = INCBIN_U32("graphics/naming_screen/page_swap_frame.4bpp"); +const u32 gNamingScreenBackButton_Gfx[] = INCBIN_U32("graphics/naming_screen/back_button.4bpp"); +const u32 gNamingScreenOKButton_Gfx[] = INCBIN_U32("graphics/naming_screen/ok_button.4bpp"); +const u32 gNamingScreenPageSwapUpper_Gfx[] = INCBIN_U32("graphics/naming_screen/page_swap_upper.4bpp"); +const u32 gNamingScreenPageSwapLower_Gfx[] = INCBIN_U32("graphics/naming_screen/page_swap_lower.4bpp"); +const u32 gNamingScreenPageSwapOthers_Gfx[] = INCBIN_U32("graphics/naming_screen/page_swap_others.4bpp"); +const u32 gNamingScreenCursor_Gfx[] = INCBIN_U32("graphics/naming_screen/cursor.4bpp"); +const u32 gNamingScreenCursorSquished_Gfx[] = INCBIN_U32("graphics/naming_screen/cursor_squished.4bpp"); +const u32 gNamingScreenCursorFilled_Gfx[] = INCBIN_U32("graphics/naming_screen/cursor_filled.4bpp"); +const u32 gNamingScreenPageSwapButton_Gfx[] = INCBIN_U32("graphics/naming_screen/page_swap_button.4bpp"); +const u32 gNamingScreenInputArrow_Gfx[] = INCBIN_U32("graphics/naming_screen/input_arrow.4bpp"); +const u32 gNamingScreenUnderscore_Gfx[] = INCBIN_U32("graphics/naming_screen/underscore.4bpp"); const u8 gUnknown_8E99118[] = INCBIN_U8("graphics/tm_case/unk_8E99118.4bpp"); diff --git a/src/mail_data.c b/src/mail_data.c index bb5fa6581..9bff74b6d 100644 --- a/src/mail_data.c +++ b/src/mail_data.c @@ -5,6 +5,8 @@ #include "constants/items.h" #include "pokemon_icon.h" +#define UNOWN_OFFSET 30000 + void ClearMailData(void) { u8 i; @@ -73,7 +75,7 @@ u8 GiveMailToMon(struct Pokemon *mon, u16 itemId) u16 SpeciesToMailSpecies(u16 species, u32 personality) { if (species == SPECIES_UNOWN) { - u32 mailSpecies = GetUnownLetterByPersonality(personality) + 30000; + u32 mailSpecies = GetUnownLetterByPersonality(personality) + UNOWN_OFFSET; return mailSpecies; } return species; @@ -83,10 +85,10 @@ u16 MailSpeciesToSpecies(u16 mailSpecies, u16 *unownLetter) { u16 result; - if (mailSpecies >= 30000 && mailSpecies < (30000 + UNOWN_FORM_COUNT)) + if (mailSpecies >= UNOWN_OFFSET && mailSpecies < (UNOWN_OFFSET + NUM_UNOWN_FORMS)) { result = SPECIES_UNOWN; - *unownLetter = mailSpecies - 30000; + *unownLetter = mailSpecies - UNOWN_OFFSET; } else { diff --git a/src/menu_helpers.c b/src/menu_helpers.c index 9b8bbda21..be092ccf4 100644 --- a/src/menu_helpers.c +++ b/src/menu_helpers.c @@ -241,7 +241,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *quantity_p, u16 qmax) u8 GetDialogBoxFontId(void) { - if (!ContextNpcGetTextColor()) + if (ContextNpcGetTextColor() == NPC_TEXT_COLOR_MALE) return FONT_4; else return FONT_5; 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/naming_screen.c b/src/naming_screen.c index 1749e33e9..57560c3d7 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -20,56 +20,122 @@ #include "task.h" #include "text_window.h" #include "trig.h" +#include "constants/event_object_movement.h" #include "constants/help_system.h" #include "constants/songs.h" #include "constants/event_objects.h" -#define subsprite_table(ptr) {.subsprites = ptr, .subspriteCount = (sizeof ptr) / (sizeof(struct Subsprite))} - -#define KBEVENT_NONE 0 -#define KBEVENT_PRESSED_A 5 -#define KBEVENT_PRESSED_B 6 -#define KBEVENT_PRESSED_SELECT 8 -#define KBEVENT_PRESSED_START 9 +enum { + INPUT_NONE, + INPUT_DPAD_UP, + INPUT_DPAD_DOWN, + INPUT_DPAD_LEFT, + INPUT_DPAD_RIGHT, + INPUT_A_BUTTON, + INPUT_B_BUTTON, + INPUT_LR_BUTTON, + INPUT_SELECT, + INPUT_START, +}; #define KBROW_COUNT 4 +#define KBCOL_COUNT 8 -enum -{ - KBPAGE_LETTERS_LOWER, - KBPAGE_LETTERS_UPPER, +enum { + GFXTAG_BACK_BUTTON, + GFXTAG_OK_BUTTON, + GFXTAG_PAGE_SWAP_FRAME, + GFXTAG_PAGE_SWAP_BUTTON, + GFXTAG_PAGE_SWAP_UPPER, + GFXTAG_PAGE_SWAP_LOWER, + GFXTAG_PAGE_SWAP_OTHERS, + GFXTAG_CURSOR, + GFXTAG_CURSOR_SQUISHED, + GFXTAG_CURSOR_FILLED, + GFXTAG_INPUT_ARROW, + GFXTAG_UNDERSCORE, + GFXTAG_RIVAL = 255, +}; + +enum { + PALTAG_MENU, // Also the PC icon + PALTAG_PAGE_SWAP_UPPER, + PALTAG_PAGE_SWAP_LOWER, + PALTAG_PAGE_SWAP_OTHERS, // Also the input arrow/underscore + PALTAG_PAGE_SWAP, + PALTAG_CURSOR, + PALTAG_BACK_BUTTON, + PALTAG_OK_BUTTON, + PALTAG_RIVAL = 255, +}; + +enum { + WIN_KB_PAGE_1, // Which of these two windows is in front is cycled as the player swaps + WIN_KB_PAGE_2, // Initially WIN_KB_PAGE_1 is in front, with WIN_KB_PAGE_2 on deck + WIN_TEXT_ENTRY, + WIN_TEXT_ENTRY_BOX, + WIN_BANNER, + WIN_COUNT, +}; + +// The constants for the pages are needlessly complicated because GF didn't keep the indexing order consistent +// This set is used for sNamingScreen->currentPage. It uses the order that the pages are cycled in +enum { KBPAGE_SYMBOLS, + KBPAGE_LETTERS_UPPER, + KBPAGE_LETTERS_LOWER, KBPAGE_COUNT, }; -enum -{ - MAIN_STATE_BEGIN_FADE_IN, - MAIN_STATE_WAIT_FADE_IN, - MAIN_STATE_HANDLE_INPUT, - MAIN_STATE_MOVE_TO_OK_BUTTON, - MAIN_STATE_START_PAGE_SWAP, - MAIN_STATE_WAIT_PAGE_SWAP, - MAIN_STATE_6, - MAIN_STATE_UPDATE_SENT_TO_PC_MESSAGE, - MAIN_STATE_BEGIN_FADE_OUT, - MAIN_STATE_WAIT_FADE_OUT_AND_EXIT, +// This set is used for initializing a page's keyboard text and getting its number of columns +enum { + KEYBOARD_LETTERS_LOWER, + KEYBOARD_LETTERS_UPPER, + KEYBOARD_SYMBOLS, }; -enum -{ - INPUT_STATE_DISABLED, - INPUT_STATE_ENABLED, +// This set is used for getting the gfx/pal tags of the page's swap button +enum { + PAGE_SWAP_UPPER, + PAGE_SWAP_OTHERS, + PAGE_SWAP_LOWER, }; -enum -{ +enum { KEY_ROLE_CHAR, KEY_ROLE_PAGE, KEY_ROLE_BACKSPACE, KEY_ROLE_OK, }; +enum { + BUTTON_PAGE, + BUTTON_BACK, + BUTTON_OK, + BUTTON_COUNT, +}; + +// states for Task_NamingScreen +enum { + STATE_FADE_IN, + STATE_WAIT_FADE_IN, + STATE_HANDLE_INPUT, + STATE_MOVE_TO_OK_BUTTON, + STATE_START_PAGE_SWAP, + STATE_WAIT_PAGE_SWAP, + STATE_PRESSED_OK, + STATE_WAIT_SENT_TO_PC_MESSAGE, + STATE_FADE_OUT, + STATE_EXIT, +}; + +// sates for Task_HandleInput +enum +{ + INPUT_STATE_DISABLED, + INPUT_STATE_ENABLED, +}; + struct NamingScreenTemplate { u8 copyExistingString; @@ -88,7 +154,7 @@ struct NamingScreenData /*0x1800*/ u8 textBuffer[0x10]; /*0x1810*/ u8 tileBuffer[0x600]; /*0x1E10*/ u8 state; - /*0x1E11*/ u8 windows[5]; + /*0x1E11*/ u8 windows[WIN_COUNT]; /*0x1E16*/ u16 inputCharBaseXPos; /*0x1E18*/ u16 bg1vOffset; /*0x1E1A*/ u16 bg2vOffset; @@ -98,7 +164,7 @@ struct NamingScreenData /*0x1E21*/ u8 bgToHide; /*0x1E22*/ u8 currentPage; /*0x1E23*/ u8 cursorSpriteId; - /*0x1E24*/ u8 selectBtnFrameSpriteId; + /*0x1E24*/ u8 swapBtnFrameSpriteId; /*0x1E25*/ u8 keyRepeatStartDelayCopy; /*0x1E28*/ const struct NamingScreenTemplate *template; /*0x1E2C*/ u8 templateNum; @@ -109,59 +175,59 @@ struct NamingScreenData /*0x1E3C*/ MainCallback returnCallback; }; -static EWRAM_DATA struct NamingScreenData * sNamingScreenData = NULL; +static EWRAM_DATA struct NamingScreenData * sNamingScreen = NULL; -static void CB2_NamingScreen(void); +static void CB2_LoadNamingScreen(void); static void NamingScreen_Init(void); static void NamingScreen_InitBGs(void); -static void sub_809DD60(void); -static void sub_809DD88(u8 taskId); -static bool8 MainState_BeginFadeIn(void); +static void CreateNamingScreenTask(void); +static void Task_NamingScreen(u8); +static bool8 MainState_FadeIn(void); static bool8 MainState_WaitFadeIn(void); static bool8 MainState_HandleInput(void); static bool8 MainState_MoveToOKButton(void); -static bool8 pokemon_store(void); -static bool8 MainState_BeginFadeInOut(void); -static bool8 MainState_WaitFadeOutAndExit(void); -static void pokemon_transfer_to_pc_with_message(void); -static bool8 sub_809E1D4(void); +static bool8 MainState_PressedOKButton(void); +static bool8 MainState_FadeOut(void); +static bool8 MainState_Exit(void); +static void DisplaySentToPCMessage(void); +static bool8 MainState_WaitSentToPCMessage(void); static bool8 MainState_StartPageSwap(void); static bool8 MainState_WaitPageSwap(void); static void StartPageSwapAnim(void); -static void Task_HandlePageSwapAnim(u8 taskId); +static void Task_HandlePageSwapAnim(u8); static bool8 IsPageSwapAnimNotInProgress(void); -static bool8 PageSwapAnimState_Init(struct Task *task); -static bool8 PageSwapAnimState_1(struct Task *task); -static bool8 PageSwapAnimState_2(struct Task *task); -static bool8 PageSwapAnimState_Done(struct Task *task); -static void sub_809E518(u8 a0, u8 a1, u8 a2); -static void Task_809E58C(u8 taskId); -static u16 sub_809E644(u8 tag); -static void sub_809E6B8(u8 a0); -static void sub_809E6E0(struct Task *task, u8 a1, u8 a2); -static void sub_809E700(struct Sprite *sprite); -static void sub_809E7F0(struct Sprite *sprite); -static void sub_809E83C(struct Sprite *sprite); -static void sub_809E898(void); -static void CursorInit(void); -static void SetCursorPos(s16 x, s16 y); -static void GetCursorPos(s16 *xP, s16 *yP); +static bool8 PageSwapAnimState_Init(struct Task *); +static bool8 PageSwapAnimState_1(struct Task *); +static bool8 PageSwapAnimState_2(struct Task *); +static bool8 PageSwapAnimState_Done(struct Task *); +static void TryStartButtonFlash(u8, u8, u8); +static void Task_UpdateButtonFlash(u8); +static u16 GetButtonPalOffset(u8); +static void RestoreButtonColor(u8); +static void StartButtonFlash(struct Task *, u8, u8); +static void SpriteCB_Cursor(struct Sprite *); +static void SpriteCB_InputArrow(struct Sprite *); +static void SpriteCB_Underscore(struct Sprite *); +static void CreateSprites(void); +static void CreateCursorSprite(void); +static void SetCursorPos(s16, s16); +static void GetCursorPos(s16 *, s16 *); static void MoveCursorToOKButton(void); -static void sub_809EA0C(u8 a0); -static void sub_809EA64(u8 a0); +static void SetCursorInvisibility(u8); +static void SetCursorFlashing(u8); static bool8 IsCursorAnimFinished(void); static u8 GetCurrentPageColumnCount(void); -static void CreatePageSwitcherSprites(void); -static void sub_809EC20(void); -static bool8 PageSwapSpritesCB_Init(struct Sprite *sprite); -static bool8 PageSwapSpritesCB_Idle(struct Sprite *sprite); -static bool8 PageSwapSpritesCB_SwapHide(struct Sprite *sprite); -static bool8 PageSwapSpritesCB_SwapShow(struct Sprite *sprite); -static void sub_809ED88(u8 a0, struct Sprite *spr1, struct Sprite *spr2); +static void CreatePageSwapButtonSprites(void); +static void StartPageSwapButtonAnim(void); +static bool8 PageSwapSprite_Init(struct Sprite *); +static bool8 PageSwapSprite_Idle(struct Sprite *); +static bool8 PageSwapSprite_SlideOff(struct Sprite *); +static bool8 PageSwapSprite_SlideOn(struct Sprite *); +static void SetPageSwapButtonGfx(u8, struct Sprite *, struct Sprite *); static void CreateBackOkSprites(void); -static void CreateUnderscoreSprites(void); +static void CreateTextEntrySprites(void); static void CreateInputTargetIcon(void); -static void NamingScreen_NoCreateIcon(void); +static void NamingScreen_NoIcon(void); static void NamingScreen_CreatePlayerIcon(void); static void NamingScreen_CreatePCIcon(void); static void NamingScreen_CreateMonIcon(void); @@ -171,107 +237,94 @@ static bool8 KeyboardKeyHandler_Character(u8); static bool8 KeyboardKeyHandler_Page(u8); static bool8 KeyboardKeyHandler_Backspace(u8); static bool8 KeyboardKeyHandler_OK(u8); -static bool8 TriggerKeyboardChange(void); +static bool8 SwapKeyboardPage(void); static u8 GetInputEvent(void); -static void SetInputState(u8 state); -static void Task_HandleInput(u8 taskId); -static void InputState_Disabled(struct Task *task); -static void InputState_Enabled(struct Task *task); -static void HandleDpadMovement(struct Task *task); -static void PrintTitle(void); -static void AddGenderIconFunc_No(void); -static void AddGenderIconFunc_Yes(void); +static void SetInputState(u8); +static void Task_HandleInput(u8); +static void Input_Disabled(struct Task *); +static void Input_Enabled(struct Task *); +static void HandleDpadMovement(struct Task *); +static void DrawTextEntryBox(void); +static void DummyGenderIcon(void); +static void DrawGenderIcon(void); static void DeleteTextCharacter(void); -static u8 GetTextCaretPosition(void); -static bool8 AppendCharToBuffer_CheckBufferFull(void); -static void AddTextCharacter(u8 character); -static void CopyStringToDestBuffer(void); -static void choose_name_or_words_screen_load_bg_tile_patterns(void); -static void sub_809F8C0(void); -static void choose_name_or_words_screen_apply_bg_pals(void); -static void DecompressToBgTilemapBuffer(u8 bgId, const u32 * tmap); -static void PrintBufferCharactersOnScreen(void); -static void sub_809F9E8(u8 windowId, u8 kbPage); -static void sub_809FA60(void); -static void sub_809FAE4(void); -static void sub_809FB70(void); -static void NamingScreen_TurnOffScreen(void); -static void NamingScreen_InitDisplayMode(void); +static u8 GetTextEntryPosition(void); +static bool8 AddTextCharacter(void); +static void BufferCharacter(u8 character); +static void SaveInputText(void); +static void LoadGfx(void); +static void CreateHelperTasks(void); +static void LoadPalettes(void); +static void DecompressToBgTilemapBuffer(u8, const u32 *); +static void DrawTextEntry(void); +static void PrintKeyboardKeys(u8, u8); +static void DrawKeyboardPageOnDeck(void); +static void PrintControls(void); +static void CB2_NamingScreen(void); +static void ResetVHBlank(void); +static void SetVBlank(void); static void VBlankCB_NamingScreen(void); -static void ShowAllBgs(void); -static bool8 IsLetter(u8 character); +static void NamingScreen_ShowBgs(void); +static bool8 IsWideLetter(u8); -// Forward declarations - -static const struct SubspriteTable gUnknown_83E2504[]; -static const struct SubspriteTable gUnknown_83E250C[]; -static const struct SubspriteTable gUnknown_83E2524[]; -static const struct SubspriteTable gUnknown_83E252C[]; - -static const struct SpriteTemplate gUnknown_83E2574; -static const struct SpriteTemplate gUnknown_83E258C; -static const struct SpriteTemplate gUnknown_83E25A4; -static const struct SpriteTemplate gUnknown_83E25BC; -static const struct SpriteTemplate gUnknown_83E25D4; -static const struct SpriteTemplate gUnknown_83E25EC; +static const struct SubspriteTable sSubspriteTable_PageSwapFrame[]; +static const struct SubspriteTable sSubspriteTable_PageSwapText[]; +static const struct SubspriteTable sSubspriteTable_Button[]; +static const struct SubspriteTable sSubspriteTable_PCIcon[]; +static const struct SpriteTemplate sSpriteTemplate_PageSwapFrame; +static const struct SpriteTemplate sSpriteTemplate_PageSwapButton; +static const struct SpriteTemplate sSpriteTemplate_PageSwapText; +static const struct SpriteTemplate sSpriteTemplate_BackButton; +static const struct SpriteTemplate sSpriteTemplate_OkButton; +static const struct SpriteTemplate sSpriteTemplate_Cursor; static const struct SpriteTemplate sSpriteTemplate_InputArrow; static const struct SpriteTemplate sSpriteTemplate_Underscore; -static const struct SpriteTemplate gUnknown_83E2634; - +static const struct SpriteTemplate sSpriteTemplate_PCIcon; static const u8 *const sNamingScreenKeyboardText[][KBROW_COUNT]; +static const struct SpriteSheet sSpriteSheets[]; +static const struct SpritePalette sSpritePalettes[]; +static const struct NamingScreenTemplate *const sNamingScreenTemplates[]; -static const struct SpriteSheet gUnknown_83E267C[]; -static const struct SpritePalette gUnknown_83E26E4[]; +static const u16 sPCIconOff_Gfx[] = INCBIN_U16("graphics/naming_screen/pc_icon_off.4bpp"); +static const u16 sPCIconOn_Gfx[] = INCBIN_U16("graphics/naming_screen/pc_icon_on.4bpp"); +static const u16 sRival_Gfx[] = INCBIN_U16("graphics/naming_screen/rival.4bpp"); -static const u16 gUnknown_83E1800[] = INCBIN_U16("graphics/interface/naming_screen_83E1800.4bpp"); -static const u16 gUnknown_83E18C0[] = INCBIN_U16("graphics/interface/naming_screen_83E18C0.4bpp"); -static const u16 gUnknown_83E1980[] = INCBIN_U16("graphics/interface/naming_screen_83E1980.4bpp"); - -static const u8 *const sTransferredToPCMessages[] = { +static const u8 *const sTransferredToPCMessages[] = +{ Text_MonSentToBoxInSomeonesPC, Text_MonSentToBoxInBillsPC, Text_MonSentToBoxSomeonesBoxFull, Text_MonSentToBoxBillsBoxFull }; -static const struct BgTemplate gUnknown_83E2290[4] = { +static const struct BgTemplate sBgTemplates[] = +{ { .bg = 0, .charBaseIndex = 0, .mapBaseIndex = 30, - .screenSize = 0, - .paletteMode = 0, .priority = 0, - .baseTile = 0x000 - }, { + },{ .bg = 1, .charBaseIndex = 2, .mapBaseIndex = 29, - .screenSize = 0, - .paletteMode = 0, .priority = 1, - .baseTile = 0x000 }, { .bg = 2, .charBaseIndex = 2, .mapBaseIndex = 28, - .screenSize = 0, - .paletteMode = 0, .priority = 2, - .baseTile = 0x000 }, { .bg = 3, .charBaseIndex = 3, .mapBaseIndex = 31, - .screenSize = 0, - .paletteMode = 0, .priority = 3, - .baseTile = 0x000 } }; -static const struct WindowTemplate gUnknown_83E22A0[6] = { - { +static const struct WindowTemplate sWindowTemplates[WIN_COUNT + 1] = +{ + [WIN_KB_PAGE_1] = { .bg = 1, .tilemapLeft = 3, .tilemapTop = 10, @@ -279,7 +332,8 @@ static const struct WindowTemplate gUnknown_83E22A0[6] = { .height = 8, .paletteNum = 10, .baseBlock = 0x0030 - }, { + }, + [WIN_KB_PAGE_2] = { .bg = 2, .tilemapLeft = 3, .tilemapTop = 10, @@ -287,7 +341,8 @@ static const struct WindowTemplate gUnknown_83E22A0[6] = { .height = 8, .paletteNum = 10, .baseBlock = 0x00c8 - }, { + }, + [WIN_TEXT_ENTRY] = { .bg = 3, .tilemapLeft = 8, .tilemapTop = 6, @@ -295,7 +350,8 @@ static const struct WindowTemplate gUnknown_83E22A0[6] = { .height = 2, .paletteNum = 10, .baseBlock = 0x0030 - }, { + }, + [WIN_TEXT_ENTRY_BOX] = { .bg = 3, .tilemapLeft = 9, .tilemapTop = 4, @@ -303,7 +359,8 @@ static const struct WindowTemplate gUnknown_83E22A0[6] = { .height = 2, .paletteNum = 10, .baseBlock = 0x004c - }, { + }, + [WIN_BANNER] = { .bg = 0, .tilemapLeft = 0, .tilemapTop = 0, @@ -311,23 +368,26 @@ static const struct WindowTemplate gUnknown_83E22A0[6] = { .height = 2, .paletteNum = 11, .baseBlock = 0x006c - }, DUMMY_WIN_TEMPLATE + }, + DUMMY_WIN_TEMPLATE }; -static const u8 gUnknown_83E22D0[][4][8] = { - [KBPAGE_LETTERS_LOWER] = { +// This handles what characters get inserted when a key is pressed +// The keys shown on the keyboard are handled separately by sNamingScreenKeyboardText +static const u8 sKeyboardChars[KBPAGE_COUNT][KBROW_COUNT][KBCOL_COUNT] = { + [KEYBOARD_LETTERS_LOWER] = { __("abcdef ."), __("ghijkl ,"), __("mnopqrs"), __("tuvwxyz"), }, - [KBPAGE_LETTERS_UPPER] = { + [KEYBOARD_LETTERS_UPPER] = { __("ABCDEF ."), __("GHIJKL ,"), __("MNOPQRS"), __("TUVWXYZ"), }, - [KBPAGE_SYMBOLS] = { + [KEYBOARD_SYMBOLS] = { __("01234"), __("56789"), __("!?♂♀/-"), @@ -335,74 +395,47 @@ static const u8 gUnknown_83E22D0[][4][8] = { } }; -static const u8 gUnknown_83E2330[] = { - [KBPAGE_LETTERS_LOWER] = 8, // lower - [KBPAGE_LETTERS_UPPER] = 8, // upper - [KBPAGE_SYMBOLS] = 6 +static const u8 sPageColumnCounts[] = { + [KEYBOARD_LETTERS_LOWER] = KBCOL_COUNT, + [KEYBOARD_LETTERS_UPPER] = KBCOL_COUNT, + [KEYBOARD_SYMBOLS] = 6 }; -static const u8 gUnknown_83E2333[][8] = { - [KBPAGE_LETTERS_LOWER] = { - 0, - 12, - 24, - 56, - 68, - 80, - 92, - 123 - }, - [KBPAGE_LETTERS_UPPER] = { - 0, - 12, - 24, - 56, - 68, - 80, - 92, - 123 - }, - [KBPAGE_SYMBOLS] = { - 0, - 22, - 44, - 66, - 88, - 110 - } +static const u8 sPageColumnXPos[KBPAGE_COUNT][KBCOL_COUNT] = { + [KEYBOARD_LETTERS_LOWER] = {0, 12, 24, 56, 68, 80, 92, 123}, + [KEYBOARD_LETTERS_UPPER] = {0, 12, 24, 56, 68, 80, 92, 123}, + [KEYBOARD_SYMBOLS] = {0, 22, 44, 66, 88, 110} }; -static const struct NamingScreenTemplate *const sNamingScreenTemplates[]; - void DoNamingScreen(u8 templateNum, u8 *destBuffer, u16 monSpecies, u16 monGender, u32 monPersonality, MainCallback returnCallback) { - sNamingScreenData = Alloc(sizeof(struct NamingScreenData)); - if (!sNamingScreenData) + sNamingScreen = Alloc(sizeof(struct NamingScreenData)); + if (!sNamingScreen) { SetMainCallback2(returnCallback); } else { - sNamingScreenData->templateNum = templateNum; - sNamingScreenData->monSpecies = monSpecies; - sNamingScreenData->monGender = monGender; - sNamingScreenData->monPersonality = monPersonality; - sNamingScreenData->destBuffer = destBuffer; - sNamingScreenData->returnCallback = returnCallback; + sNamingScreen->templateNum = templateNum; + sNamingScreen->monSpecies = monSpecies; + sNamingScreen->monGender = monGender; + sNamingScreen->monPersonality = monPersonality; + sNamingScreen->destBuffer = destBuffer; + sNamingScreen->returnCallback = returnCallback; - if (templateNum == 0) + if (templateNum == NAMING_SCREEN_PLAYER) StartTimer1(); - SetMainCallback2(CB2_NamingScreen); + SetMainCallback2(CB2_LoadNamingScreen); } } -static void CB2_NamingScreen(void) +static void CB2_LoadNamingScreen(void) { switch (gMain.state) { case 0: - NamingScreen_TurnOffScreen(); + ResetVHBlank(); NamingScreen_Init(); gMain.state++; break; @@ -424,46 +457,46 @@ static void CB2_NamingScreen(void) gMain.state++; break; case 5: - choose_name_or_words_screen_apply_bg_pals(); + LoadPalettes(); gMain.state++; break; case 6: - choose_name_or_words_screen_load_bg_tile_patterns(); + LoadGfx(); gMain.state++; break; case 7: - sub_809E898(); + CreateSprites(); UpdatePaletteFade(); - ShowAllBgs(); + NamingScreen_ShowBgs(); gMain.state++; break; default: - sub_809F8C0(); - sub_809DD60(); + CreateHelperTasks(); + CreateNamingScreenTask(); break; } } static void NamingScreen_Init(void) { - sNamingScreenData->state = 0; - sNamingScreenData->bg1vOffset = 0; - sNamingScreenData->bg2vOffset = 0; - sNamingScreenData->bg1Priority = BGCNT_PRIORITY(1); - sNamingScreenData->bg2Priority = BGCNT_PRIORITY(2); - sNamingScreenData->bgToReveal = 0; - sNamingScreenData->bgToHide = 1; - sNamingScreenData->template = sNamingScreenTemplates[sNamingScreenData->templateNum]; - sNamingScreenData->currentPage = sNamingScreenData->template->initialPage; - sNamingScreenData->inputCharBaseXPos = (240 - sNamingScreenData->template->maxChars * 8) / 2 + 6; - sNamingScreenData->keyRepeatStartDelayCopy = gKeyRepeatStartDelay; - memset(sNamingScreenData->textBuffer, 0xFF, sizeof(sNamingScreenData->textBuffer)); - if (sNamingScreenData->template->copyExistingString != 0) - StringCopy(sNamingScreenData->textBuffer, sNamingScreenData->destBuffer); + sNamingScreen->state = STATE_FADE_IN; + sNamingScreen->bg1vOffset = 0; + sNamingScreen->bg2vOffset = 0; + sNamingScreen->bg1Priority = BGCNT_PRIORITY(1); + sNamingScreen->bg2Priority = BGCNT_PRIORITY(2); + sNamingScreen->bgToReveal = 0; + sNamingScreen->bgToHide = 1; + sNamingScreen->template = sNamingScreenTemplates[sNamingScreen->templateNum]; + sNamingScreen->currentPage = sNamingScreen->template->initialPage; + sNamingScreen->inputCharBaseXPos = (DISPLAY_WIDTH - sNamingScreen->template->maxChars * 8) / 2 + 6; + sNamingScreen->keyRepeatStartDelayCopy = gKeyRepeatStartDelay; + memset(sNamingScreen->textBuffer, EOS, sizeof(sNamingScreen->textBuffer)); + if (sNamingScreen->template->copyExistingString) + StringCopy(sNamingScreen->textBuffer, sNamingScreen->destBuffer); gKeyRepeatStartDelay = 16; } -static void sub_809DB70(void) +static void SetSpritesVisible(void) { u8 i; for (i = 0; i < MAX_SPRITES; i++) @@ -471,7 +504,7 @@ static void sub_809DB70(void) if (gSprites[i].inUse) gSprites[i].invisible = FALSE; } - sub_809EA0C(0); + SetCursorInvisibility(0); } static void NamingScreen_InitBGs(void) @@ -484,133 +517,137 @@ static void NamingScreen_InitBGs(void) SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0); ResetBgsAndClearDma3BusyFlags(FALSE); - InitBgsFromTemplates(0, gUnknown_83E2290, NELEMS(gUnknown_83E2290)); + InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates)); - ChangeBgX(0, 0, 0); - ChangeBgY(0, 0, 0); - ChangeBgX(1, 0, 0); - ChangeBgY(1, 0, 0); - ChangeBgX(2, 0, 0); - ChangeBgY(2, 0, 0); - ChangeBgX(3, 0, 0); - ChangeBgY(3, 0, 0); + ChangeBgX(0, 0, BG_COORD_SET); + ChangeBgY(0, 0, BG_COORD_SET); + ChangeBgX(1, 0, BG_COORD_SET); + ChangeBgY(1, 0, BG_COORD_SET); + ChangeBgX(2, 0, BG_COORD_SET); + ChangeBgY(2, 0, BG_COORD_SET); + ChangeBgX(3, 0, BG_COORD_SET); + ChangeBgY(3, 0, BG_COORD_SET); InitStandardTextBoxWindows(); InitTextBoxGfxAndPrinters(); - for (i = 0; i < NELEMS(gUnknown_83E22A0) - 1; i++) - sNamingScreenData->windows[i] = AddWindow(&gUnknown_83E22A0[i]); + for (i = 0; i < WIN_COUNT; i++) + sNamingScreen->windows[i] = AddWindow(&sWindowTemplates[i]); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2); - SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0xC, 0x8)); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(12, 8)); - SetBgTilemapBuffer(1, sNamingScreenData->tilemapBuffer1); - SetBgTilemapBuffer(2, sNamingScreenData->tilemapBuffer2); - SetBgTilemapBuffer(3, sNamingScreenData->tilemapBuffer3); + SetBgTilemapBuffer(1, sNamingScreen->tilemapBuffer1); + SetBgTilemapBuffer(2, sNamingScreen->tilemapBuffer2); + SetBgTilemapBuffer(3, sNamingScreen->tilemapBuffer3); FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 0x20, 0x20); FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 0x20, 0x20); FillBgTilemapBufferRect_Palette0(3, 0, 0, 0, 0x20, 0x20); } -static void sub_809DD60(void) +static void CreateNamingScreenTask(void) { - CreateTask(sub_809DD88, 2); - SetMainCallback2(sub_809FB70); + CreateTask(Task_NamingScreen, 2); + SetMainCallback2(CB2_NamingScreen); BackupHelpContext(); SetHelpContext(HELPCONTEXT_NAMING_SCREEN); } -static void sub_809DD88(u8 taskId) +static void Task_NamingScreen(u8 taskId) { - switch (sNamingScreenData->state) + switch (sNamingScreen->state) { - case MAIN_STATE_BEGIN_FADE_IN: - MainState_BeginFadeIn(); - sub_809DB70(); - NamingScreen_InitDisplayMode(); + case STATE_FADE_IN: + MainState_FadeIn(); + SetSpritesVisible(); + SetVBlank(); break; - case MAIN_STATE_WAIT_FADE_IN: + case STATE_WAIT_FADE_IN: MainState_WaitFadeIn(); break; - case MAIN_STATE_HANDLE_INPUT: + case STATE_HANDLE_INPUT: MainState_HandleInput(); break; - case MAIN_STATE_MOVE_TO_OK_BUTTON: + case STATE_MOVE_TO_OK_BUTTON: MainState_MoveToOKButton(); break; - case MAIN_STATE_START_PAGE_SWAP: + case STATE_START_PAGE_SWAP: MainState_StartPageSwap(); break; - case MAIN_STATE_WAIT_PAGE_SWAP: + case STATE_WAIT_PAGE_SWAP: MainState_WaitPageSwap(); break; - case MAIN_STATE_6: - pokemon_store(); + case STATE_PRESSED_OK: + MainState_PressedOKButton(); break; - case MAIN_STATE_UPDATE_SENT_TO_PC_MESSAGE: - sub_809E1D4(); + case STATE_WAIT_SENT_TO_PC_MESSAGE: + MainState_WaitSentToPCMessage(); break; - case MAIN_STATE_BEGIN_FADE_OUT: - MainState_BeginFadeInOut(); + case STATE_FADE_OUT: + MainState_FadeOut(); break; - case MAIN_STATE_WAIT_FADE_OUT_AND_EXIT: - MainState_WaitFadeOutAndExit(); + case STATE_EXIT: + MainState_Exit(); break; } } -static const u8 sPageOrderLowerFirst[] = { - KBPAGE_LETTERS_LOWER, - KBPAGE_SYMBOLS, - KBPAGE_LETTERS_UPPER +// Which gfx/pal to load for the swap page button +static const u8 sPageToNextGfxId[KBPAGE_COUNT] = +{ + [KBPAGE_SYMBOLS] = PAGE_SWAP_UPPER, + [KBPAGE_LETTERS_UPPER] = PAGE_SWAP_LOWER, + [KBPAGE_LETTERS_LOWER] = PAGE_SWAP_OTHERS }; -static const u8 sPageOrderUpperFirst[] = { - KBPAGE_LETTERS_UPPER, - KBPAGE_LETTERS_LOWER, - KBPAGE_SYMBOLS +static const u8 sPageToNextKeyboardId[KBPAGE_COUNT] = +{ + [KBPAGE_SYMBOLS] = KEYBOARD_LETTERS_UPPER, + [KBPAGE_LETTERS_UPPER] = KEYBOARD_LETTERS_LOWER, + [KBPAGE_LETTERS_LOWER] = KEYBOARD_SYMBOLS }; -static const u8 sPageOrderSymbolsFirst[] = { - KBPAGE_SYMBOLS, - KBPAGE_LETTERS_UPPER, - KBPAGE_LETTERS_LOWER +static const u8 sPageToKeyboardId[KBPAGE_COUNT] = +{ + [KBPAGE_SYMBOLS] = KEYBOARD_SYMBOLS, + [KBPAGE_LETTERS_UPPER] = KEYBOARD_LETTERS_UPPER, + [KBPAGE_LETTERS_LOWER] = KEYBOARD_LETTERS_LOWER }; -static u8 sub_809DE20(u8 a1) +static u8 PageToNextGfxId(u8 page) { - return sPageOrderLowerFirst[a1]; + return sPageToNextGfxId[page]; } -static u8 sub_809DE30(void) +static u8 CurrentPageToNextKeyboardId(void) { - return sPageOrderUpperFirst[sNamingScreenData->currentPage]; + return sPageToNextKeyboardId[sNamingScreen->currentPage]; } -static u8 sub_809DE50(void) +static u8 CurrentPageToKeyboardId(void) { - return sPageOrderSymbolsFirst[sNamingScreenData->currentPage]; + return sPageToKeyboardId[sNamingScreen->currentPage]; } -static bool8 MainState_BeginFadeIn(void) +static bool8 MainState_FadeIn(void) { - DecompressToBgTilemapBuffer(3, gUnknown_8E982BC); - sNamingScreenData->currentPage = KBPAGE_LETTERS_UPPER; - DecompressToBgTilemapBuffer(2, gUnknown_8E98458); - DecompressToBgTilemapBuffer(1, gUnknown_8E98398); - sub_809F9E8(sNamingScreenData->windows[1], KBPAGE_LETTERS_LOWER); - sub_809F9E8(sNamingScreenData->windows[0], KBPAGE_LETTERS_UPPER); - PrintBufferCharactersOnScreen(); - PrintTitle(); - sub_809FAE4(); + DecompressToBgTilemapBuffer(3, gNamingScreenBackground_Tilemap); + sNamingScreen->currentPage = KBPAGE_LETTERS_UPPER; + DecompressToBgTilemapBuffer(2, gNamingScreenKeyboardLower_Tilemap); + DecompressToBgTilemapBuffer(1, gNamingScreenKeyboardUpper_Tilemap); + PrintKeyboardKeys(sNamingScreen->windows[WIN_KB_PAGE_2], KEYBOARD_LETTERS_LOWER); + PrintKeyboardKeys(sNamingScreen->windows[WIN_KB_PAGE_1], KEYBOARD_LETTERS_UPPER); + DrawTextEntry(); + DrawTextEntryBox(); + PrintControls(); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(3); - BlendPalettes(-1, 16, RGB_BLACK); + BlendPalettes(PALETTES_ALL, 16, RGB_BLACK); BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); - sNamingScreenData->state++; + sNamingScreen->state++; return FALSE; } @@ -619,8 +656,8 @@ static bool8 MainState_WaitFadeIn(void) if (!gPaletteFade.active) { SetInputState(INPUT_STATE_ENABLED); - sub_809EA64(1); - sNamingScreenData->state++; + SetCursorFlashing(TRUE); + sNamingScreen->state++; } return FALSE; } @@ -636,66 +673,66 @@ static bool8 MainState_MoveToOKButton(void) { SetInputState(INPUT_STATE_ENABLED); MoveCursorToOKButton(); - sNamingScreenData->state = MAIN_STATE_HANDLE_INPUT; + sNamingScreen->state = STATE_HANDLE_INPUT; } return FALSE; } -static bool8 pokemon_store(void) +static bool8 MainState_PressedOKButton(void) { - CopyStringToDestBuffer(); + SaveInputText(); SetInputState(INPUT_STATE_DISABLED); - sub_809EA64(0); - sub_809E518(3, 0, 1); - if (sNamingScreenData->templateNum == NAMING_SCREEN_CAUGHT_MON && - CalculatePlayerPartyCount() >= 6) + SetCursorFlashing(FALSE); + TryStartButtonFlash(BUTTON_COUNT, FALSE, TRUE); + if (sNamingScreen->templateNum == NAMING_SCREEN_CAUGHT_MON + && CalculatePlayerPartyCount() >= PARTY_SIZE) { - pokemon_transfer_to_pc_with_message(); - sNamingScreenData->state = MAIN_STATE_UPDATE_SENT_TO_PC_MESSAGE; + DisplaySentToPCMessage(); + sNamingScreen->state = STATE_WAIT_SENT_TO_PC_MESSAGE; return FALSE; } else { - sNamingScreenData->state = MAIN_STATE_BEGIN_FADE_OUT; + sNamingScreen->state = STATE_FADE_OUT; return TRUE; //Exit the naming screen } } -static bool8 MainState_BeginFadeInOut(void) +static bool8 MainState_FadeOut(void) { BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK); - sNamingScreenData->state++; + sNamingScreen->state++; return FALSE; } -static bool8 MainState_WaitFadeOutAndExit(void) +static bool8 MainState_Exit(void) { if (!gPaletteFade.active) { - if (sNamingScreenData->templateNum == NAMING_SCREEN_PLAYER) + if (sNamingScreen->templateNum == NAMING_SCREEN_PLAYER) SeedRngAndSetTrainerId(); - SetMainCallback2(sNamingScreenData->returnCallback); - DestroyTask(FindTaskIdByFunc(sub_809DD88)); + SetMainCallback2(sNamingScreen->returnCallback); + DestroyTask(FindTaskIdByFunc(Task_NamingScreen)); FreeAllWindowBuffers(); - FREE_AND_SET_NULL(sNamingScreenData); + FREE_AND_SET_NULL(sNamingScreen); RestoreHelpContext(); } return FALSE; } -static void pokemon_transfer_to_pc_with_message(void) +static void DisplaySentToPCMessage(void) { u8 stringToDisplay = 0; if (!IsDestinationBoxFull()) { StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON))); - StringCopy(gStringVar2, sNamingScreenData->destBuffer); + StringCopy(gStringVar2, sNamingScreen->destBuffer); } else { StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_PC_BOX_TO_SEND_MON))); - StringCopy(gStringVar2, sNamingScreenData->destBuffer); + StringCopy(gStringVar2, sNamingScreen->destBuffer); StringCopy(gStringVar3, GetBoxNamePtr(GetPCBoxToSendMon())); stringToDisplay = 2; } @@ -710,12 +747,11 @@ static void pokemon_transfer_to_pc_with_message(void) CopyWindowToVram(0, COPYWIN_FULL); } -static bool8 sub_809E1D4(void) +static bool8 MainState_WaitSentToPCMessage(void) { RunTextPrinters(); - - if (!IsTextPrinterActive(0) && (JOY_NEW(A_BUTTON))) - sNamingScreenData->state = MAIN_STATE_BEGIN_FADE_OUT; + if (!IsTextPrinterActive(0) && JOY_NEW(A_BUTTON)) + sNamingScreen->state = STATE_FADE_OUT; return FALSE; } @@ -723,12 +759,12 @@ static bool8 sub_809E1D4(void) static bool8 MainState_StartPageSwap(void) { SetInputState(INPUT_STATE_DISABLED); - sub_809EC20(); + StartPageSwapButtonAnim(); StartPageSwapAnim(); - sub_809EA0C(1); - sub_809E518(0, 0, 1); + SetCursorInvisibility(TRUE); + TryStartButtonFlash(BUTTON_PAGE, FALSE, TRUE); PlaySE(SE_WIN_OPEN); - sNamingScreenData->state = MAIN_STATE_WAIT_PAGE_SWAP; + sNamingScreen->state = STATE_WAIT_PAGE_SWAP; return FALSE; } @@ -736,19 +772,19 @@ static bool8 MainState_WaitPageSwap(void) { s16 cursorX; s16 cursorY; - bool32 var3; + bool32 onLastColumn; if (IsPageSwapAnimNotInProgress()) { GetCursorPos(&cursorX, &cursorY); - var3 = (cursorX == GetCurrentPageColumnCount()); + onLastColumn = (cursorX == GetCurrentPageColumnCount()); - sNamingScreenData->state = MAIN_STATE_HANDLE_INPUT; - sNamingScreenData->currentPage++; - sNamingScreenData->currentPage %= 3; + sNamingScreen->state = STATE_HANDLE_INPUT; + sNamingScreen->currentPage++; + sNamingScreen->currentPage %= KBPAGE_COUNT; - if (var3) + if (onLastColumn) { cursorX = GetCurrentPageColumnCount(); } @@ -759,9 +795,9 @@ static bool8 MainState_WaitPageSwap(void) } SetCursorPos(cursorX, cursorY); - sub_809FA60(); + DrawKeyboardPageOnDeck(); SetInputState(INPUT_STATE_ENABLED); - sub_809EA0C(0); + SetCursorInvisibility(FALSE); } return FALSE; } @@ -773,7 +809,8 @@ static bool8 MainState_WaitPageSwap(void) #define tState data[0] #define tFrameCount data[1] -static bool8 (*const sPageSwapAnimStateFuncs[])(struct Task *task) = { +static bool8 (*const sPageSwapAnimStateFuncs[])(struct Task *task) = +{ PageSwapAnimState_Init, PageSwapAnimState_1, PageSwapAnimState_2, @@ -782,9 +819,7 @@ static bool8 (*const sPageSwapAnimStateFuncs[])(struct Task *task) = { static void StartPageSwapAnim(void) { - u8 taskId; - - taskId = CreateTask(Task_HandlePageSwapAnim, 0); + u8 taskId = CreateTask(Task_HandlePageSwapAnim, 0); Task_HandlePageSwapAnim(taskId); } @@ -796,7 +831,7 @@ static void Task_HandlePageSwapAnim(u8 taskId) static bool8 IsPageSwapAnimNotInProgress(void) { - if (FindTaskIdByFunc(Task_HandlePageSwapAnim) == 0xFF) + if (FindTaskIdByFunc(Task_HandlePageSwapAnim) == TASK_NONE) return TRUE; else return FALSE; @@ -804,29 +839,27 @@ static bool8 IsPageSwapAnimNotInProgress(void) static bool8 PageSwapAnimState_Init(struct Task *task) { - sNamingScreenData->bg1vOffset = 0; - sNamingScreenData->bg2vOffset = 0; + sNamingScreen->bg1vOffset = 0; + sNamingScreen->bg2vOffset = 0; task->tState++; return 0; } static bool8 PageSwapAnimState_1(struct Task *task) { - u16 *const arr[] = - { - &sNamingScreenData->bg2vOffset, - &sNamingScreenData->bg1vOffset - }; + u16 *const vOffsets[] = + { + &sNamingScreen->bg2vOffset, + &sNamingScreen->bg1vOffset + }; task->tFrameCount += 4; - *arr[sNamingScreenData->bgToReveal] = Sin(task->tFrameCount, 40); - *arr[sNamingScreenData->bgToHide] = Sin((task->tFrameCount + 128) & 0xFF, 40); + *vOffsets[sNamingScreen->bgToReveal] = Sin(task->tFrameCount, 40); + *vOffsets[sNamingScreen->bgToHide] = Sin((task->tFrameCount + 128) & 0xFF, 40); if (task->tFrameCount >= 64) { - u8 temp = sNamingScreenData->bg1Priority; //Why u8 and not u16? - - sNamingScreenData->bg1Priority = sNamingScreenData->bg2Priority; - sNamingScreenData->bg2Priority = temp; + u8 temp; + SWAP(sNamingScreen->bg1Priority, sNamingScreen->bg2Priority, temp); task->tState++; } return 0; @@ -834,21 +867,19 @@ static bool8 PageSwapAnimState_1(struct Task *task) static bool8 PageSwapAnimState_2(struct Task *task) { - u16 *const arr[] = - { - &sNamingScreenData->bg2vOffset, - &sNamingScreenData->bg1vOffset - }; + u16 *const vOffsets[] = + { + &sNamingScreen->bg2vOffset, + &sNamingScreen->bg1vOffset + }; task->tFrameCount += 4; - *arr[sNamingScreenData->bgToReveal] = Sin(task->tFrameCount, 40); - *arr[sNamingScreenData->bgToHide] = Sin((task->tFrameCount + 128) & 0xFF, 40); + *vOffsets[sNamingScreen->bgToReveal] = Sin(task->tFrameCount, 40); + *vOffsets[sNamingScreen->bgToHide] = Sin((task->tFrameCount + 128) & 0xFF, 40); if (task->tFrameCount >= 128) { - u8 temp = sNamingScreenData->bgToReveal; - - sNamingScreenData->bgToReveal = sNamingScreenData->bgToHide; - sNamingScreenData->bgToHide = temp; + u8 temp; + SWAP(sNamingScreen->bgToReveal, sNamingScreen->bgToHide, temp); task->tState++; } return 0; @@ -867,223 +898,265 @@ static bool8 PageSwapAnimState_Done(struct Task *task) // Cursor blink //-------------------------------------------------- -#define tIdent data[0] +#define tButtonId data[0] +#define tKeepFlashing data[1] +#define tAllowFlash data[2] +#define tColor data[3] +#define tColorIncr data[4] +#define tColorDelay data[5] +#define tColorDelta data[6] -static void sub_809E4F0(void) +static void CreateButtonFlashTask(void) { - u8 taskId; - - taskId = CreateTask(Task_809E58C, 3); - gTasks[taskId].data[0] = 3; + u8 taskId = CreateTask(Task_UpdateButtonFlash, 3); + gTasks[taskId].tButtonId = BUTTON_COUNT; } -static void sub_809E518(u8 a, u8 b, u8 c) +static void TryStartButtonFlash(u8 button, bool8 keepFlashing, bool8 interruptCurFlash) { - struct Task *task = &gTasks[FindTaskIdByFunc(Task_809E58C)]; + struct Task *task = &gTasks[FindTaskIdByFunc(Task_UpdateButtonFlash)]; - if (a == task->data[0] && c == 0) + if (button == task->tButtonId && !interruptCurFlash) { - task->data[1] = b; - task->data[2] = 1; + task->tKeepFlashing = keepFlashing; + task->tAllowFlash = TRUE; return; } - if (a == 3 && task->data[1] == 0 && c == 0) + if (button == BUTTON_COUNT && !task->tKeepFlashing && !interruptCurFlash) return; - if (task->data[0] != 3) - sub_809E6B8(task->data[0]); - sub_809E6E0(task, a, b); + + if (task->tButtonId != BUTTON_COUNT) + RestoreButtonColor(task->tButtonId); + StartButtonFlash(task, button, keepFlashing); } -static void Task_809E58C(u8 taskId) +static void Task_UpdateButtonFlash(u8 taskId) { struct Task *task = &gTasks[taskId]; - if (task->data[0] == 3 || task->data[2] == 0) + if (task->tButtonId == BUTTON_COUNT || !task->tAllowFlash) return; - MultiplyInvertedPaletteRGBComponents(sub_809E644(task->data[0]), task->data[3], task->data[3], task->data[3]); - if (task->data[5] != 0) + + MultiplyInvertedPaletteRGBComponents(GetButtonPalOffset(task->tButtonId), task->tColor, task->tColor, task->tColor); + + if (task->tColorDelay && --task->tColorDelay) + return; + + task->tColorDelay = 2; + if (task->tColorIncr >= 0) { - task->data[5]--; - if (task->data[5] != 0) - return; - } - task->data[5] = 2; - if (task->data[4] >= 0) - { - if (task->data[3] < 14) + if (task->tColor < 14) { - task->data[3] += task->data[4]; - task->data[6] += task->data[4]; + task->tColor += task->tColorIncr; + task->tColorDelta += task->tColorIncr; } else { - task->data[3] = 16; - task->data[6]++; + task->tColor = 16; + task->tColorDelta++; } } else { - task->data[3] += task->data[4]; - task->data[6] += task->data[4]; + task->tColor += task->tColorIncr; + task->tColorDelta += task->tColorIncr; } - if (task->data[3] == 16 && task->data[6] == 22) + if (task->tColor == 16 && task->tColorDelta == 22) { - task->data[4] = -4; + task->tColorIncr = -4; } - else if (task->data[3] == 0) + else if (task->tColor == 0) { - task->data[2] = task->data[1]; - task->data[4] = 2; - task->data[6] = 0; + task->tAllowFlash = task->tKeepFlashing; + task->tColorIncr = 2; + task->tColorDelta = 0; } } -static u16 sub_809E644(u8 a) +static u16 GetButtonPalOffset(u8 button) { - const u16 arr[] = + const u16 palOffsets[BUTTON_COUNT + 1] = { - IndexOfSpritePaletteTag(4) * 16 + 0x10E, // Swap - IndexOfSpritePaletteTag(6) * 16 + 0x10E, // BACK - IndexOfSpritePaletteTag(7) * 16 + 0x10E, // OK - IndexOfSpritePaletteTag(7) * 16 + 0x101, // kbd + [BUTTON_PAGE] = IndexOfSpritePaletteTag(PALTAG_PAGE_SWAP) * 16 + 0x10E, + [BUTTON_BACK] = IndexOfSpritePaletteTag(PALTAG_BACK_BUTTON) * 16 + 0x10E, + [BUTTON_OK] = IndexOfSpritePaletteTag(PALTAG_OK_BUTTON) * 16 + 0x10E, + [BUTTON_COUNT] = IndexOfSpritePaletteTag(PALTAG_OK_BUTTON) * 16 + 0x101, }; - return arr[a]; + return palOffsets[button]; } -static void sub_809E6B8(u8 a) +static void RestoreButtonColor(u8 button) { - u16 index = sub_809E644(a); - + u16 index = GetButtonPalOffset(button); gPlttBufferFaded[index] = gPlttBufferUnfaded[index]; } -static void sub_809E6E0(struct Task *task, u8 b, u8 c) +static void StartButtonFlash(struct Task *task, u8 button, u8 keepFlashing) { - task->data[0] = b; - task->data[1] = c; - task->data[2] = 1; - task->data[3] = 4; - task->data[4] = 2; - task->data[5] = 0; - task->data[6] = 4; + task->tButtonId = button; + task->tKeepFlashing = keepFlashing; + task->tAllowFlash = TRUE; + task->tColor = 4; + task->tColorIncr = 2; + task->tColorDelay = 0; + task->tColorDelta = 4; } +#undef tButtonId +#undef tKeepFlashing +#undef tAllowFlash +#undef tColor +#undef tColorIncr +#undef tColorDelay +#undef tColorDelta + //-------------------------------------------------- // Cursor //-------------------------------------------------- -static void sub_809E700(struct Sprite *sprite) +// Sprite data for the the cursor +#define sX data[0] +#define sY data[1] +#define sPrevX data[2] +#define sPrevY data[3] +#define sInvisible data[4] & 0x00FF +#define sFlashing data[4] & 0xFF00 +#define sColor data[5] +#define sColorIncr data[6] +#define sColorDelay data[7] + +static void SpriteCB_Cursor(struct Sprite *sprite) { if (sprite->animEnded) StartSpriteAnim(sprite, 0); - sprite->invisible = (sprite->data[4] & 0xFF); - if (sprite->data[0] == GetCurrentPageColumnCount()) + + // Hide cursor when on button column + sprite->invisible = sprite->sInvisible; + if (sprite->sX == GetCurrentPageColumnCount()) sprite->invisible = TRUE; - if (sprite->invisible || (sprite->data[4] & 0xFF00) == 0 - || sprite->data[0] != sprite->data[2] || sprite->data[1] != sprite->data[3]) + + if (sprite->invisible + || !(sprite->sFlashing) + || sprite->sX != sprite->sPrevX + || sprite->sY != sprite->sPrevY) { - sprite->data[5] = 0; - sprite->data[6] = 2; - sprite->data[7] = 2; + sprite->sColor = 0; + sprite->sColorIncr = 2; + sprite->sColorDelay = 2; } - sprite->data[7]--; - if (sprite->data[7] == 0) + + sprite->sColorDelay--; + if (sprite->sColorDelay == 0) { - sprite->data[5] += sprite->data[6]; - if (sprite->data[5] == 16 || sprite->data[5] == 0) - sprite->data[6] = -sprite->data[6]; - sprite->data[7] = 2; + sprite->sColor += sprite->sColorIncr; + if (sprite->sColor == 16 || sprite->sColor == 0) + sprite->sColorIncr = -sprite->sColorIncr; + sprite->sColorDelay = 2; } - if ((sprite->data[4] & 0xFF00) != 0) + + if (sprite->sFlashing) { - s8 gb = sprite->data[5]; - s8 r = sprite->data[5] >> 1; - u16 index = IndexOfSpritePaletteTag(5) * 16 + 0x0101; + s8 gb = sprite->sColor; + s8 r = sprite->sColor >> 1; + u16 index = IndexOfSpritePaletteTag(PALTAG_CURSOR) * 16 + 0x0101; MultiplyInvertedPaletteRGBComponents(index, r, gb, gb); } } -static void sub_809E7F0(struct Sprite *sprite) -{ - const s16 arr[] = {0, -4, -2, -1}; +#define sDelay data[0] +#define sXPosId data[1] - if (sprite->data[0] == 0 || --sprite->data[0] == 0) +static void SpriteCB_InputArrow(struct Sprite *sprite) +{ + const s16 x[] = {0, -4, -2, -1}; + + if (sprite->sDelay == 0 || --sprite->sDelay == 0) { - sprite->data[0] = 8; - sprite->data[1] = (sprite->data[1] + 1) & 3; + sprite->sDelay = 8; + sprite->sXPosId = (sprite->sXPosId + 1) & (ARRAY_COUNT(x) - 1); } - sprite->x2 = arr[sprite->data[1]]; + sprite->x2 = x[sprite->sXPosId]; } -static void sub_809E83C(struct Sprite *sprite) -{ - const s16 arr[] = {2, 3, 2, 1}; - u8 var; +#undef sDelay +#undef sXPosId - var = GetTextCaretPosition(); - if (var != (u8)sprite->data[0]) +#define sId data[0] // set in CreateTextEntrySprites +#define sYPosId data[1] +#define sDelay data[2] + +static void SpriteCB_Underscore(struct Sprite *sprite) +{ + const s16 y[] = {2, 3, 2, 1}; + u8 pos = GetTextEntryPosition(); + + if (pos != (u8)sprite->sId) { sprite->y2 = 0; - sprite->data[1] = 0; - sprite->data[2] = 0; + sprite->sYPosId = 0; + sprite->sDelay = 0; } else { - sprite->y2 = arr[sprite->data[1]]; - sprite->data[2]++; - if (sprite->data[2] > 8) + sprite->y2 = y[sprite->sYPosId]; + sprite->sDelay++; + if (sprite->sDelay > 8) { - sprite->data[1] = (sprite->data[1] + 1) & 3; - sprite->data[2] = 0; + sprite->sYPosId = (sprite->sYPosId + 1) & (ARRAY_COUNT(y) - 1); + sprite->sDelay = 0; } } } -static void sub_809E898(void) +#undef sId +#undef sYPosId +#undef sDelay + +static void CreateSprites(void) { - CursorInit(); - CreatePageSwitcherSprites(); + CreateCursorSprite(); + CreatePageSwapButtonSprites(); CreateBackOkSprites(); - CreateUnderscoreSprites(); + CreateTextEntrySprites(); CreateInputTargetIcon(); } -static void CursorInit(void) +static void CreateCursorSprite(void) { - sNamingScreenData->cursorSpriteId = CreateSprite(&gUnknown_83E25EC, 38, 88, 1); - sub_809EA0C(1); - gSprites[sNamingScreenData->cursorSpriteId].oam.priority = 1; - gSprites[sNamingScreenData->cursorSpriteId].oam.objMode = ST_OAM_OBJ_BLEND; - gSprites[sNamingScreenData->cursorSpriteId].data[6] = 1; - gSprites[sNamingScreenData->cursorSpriteId].data[6] = 2; + sNamingScreen->cursorSpriteId = CreateSprite(&sSpriteTemplate_Cursor, 38, 88, 1); + SetCursorInvisibility(TRUE); + gSprites[sNamingScreen->cursorSpriteId].oam.priority = 1; + gSprites[sNamingScreen->cursorSpriteId].oam.objMode = ST_OAM_OBJ_BLEND; + gSprites[sNamingScreen->cursorSpriteId].sColorIncr = 1; // ? immediately overwritten + gSprites[sNamingScreen->cursorSpriteId].sColorIncr = 2; SetCursorPos(0, 0); } static void SetCursorPos(s16 x, s16 y) { - struct Sprite *cursorSprite = &gSprites[sNamingScreenData->cursorSpriteId]; + struct Sprite *cursorSprite = &gSprites[sNamingScreen->cursorSpriteId]; - if (x < gUnknown_83E2330[sub_809DE50()]) - cursorSprite->x = gUnknown_83E2333[sub_809DE50()][x] + 38; + if (x < sPageColumnCounts[CurrentPageToKeyboardId()]) + cursorSprite->x = sPageColumnXPos[CurrentPageToKeyboardId()][x] + 38; else cursorSprite->x = 0; cursorSprite->y = y * 16 + 88; - cursorSprite->data[2] = cursorSprite->data[0]; - cursorSprite->data[3] = cursorSprite->data[1]; - cursorSprite->data[0] = x; - cursorSprite->data[1] = y; + cursorSprite->sPrevX = cursorSprite->sX; + cursorSprite->sPrevY = cursorSprite->sY; + cursorSprite->sX = x; + cursorSprite->sY = y; } static void GetCursorPos(s16 *x, s16 *y) { - struct Sprite *cursorSprite = &gSprites[sNamingScreenData->cursorSpriteId]; + struct Sprite *cursorSprite = &gSprites[sNamingScreen->cursorSpriteId]; - *x = cursorSprite->data[0]; - *y = cursorSprite->data[1]; + *x = cursorSprite->sX; + *y = cursorSprite->sY; } static void MoveCursorToOKButton(void) @@ -1091,30 +1164,30 @@ static void MoveCursorToOKButton(void) SetCursorPos(GetCurrentPageColumnCount(), 2); } -static void sub_809EA0C(u8 a) +static void SetCursorInvisibility(bool8 invisible) { - gSprites[sNamingScreenData->cursorSpriteId].data[4] &= ~0xFF; - gSprites[sNamingScreenData->cursorSpriteId].data[4] |= a; - StartSpriteAnim(&gSprites[sNamingScreenData->cursorSpriteId], 0); + gSprites[sNamingScreen->cursorSpriteId].data[4] &= 0xFF00; + gSprites[sNamingScreen->cursorSpriteId].data[4] |= invisible; // sInvisible + StartSpriteAnim(&gSprites[sNamingScreen->cursorSpriteId], 0); } -static void sub_809EA64(u8 a) +static void SetCursorFlashing(bool8 flashing) { - gSprites[sNamingScreenData->cursorSpriteId].data[4] &= 0xFF; - gSprites[sNamingScreenData->cursorSpriteId].data[4] |= a << 8; + gSprites[sNamingScreen->cursorSpriteId].data[4] &= 0xFF; + gSprites[sNamingScreen->cursorSpriteId].data[4] |= flashing << 8; // sFlashing } -static void sub_809EAA8(void) +static void SquishCursor(void) { - StartSpriteAnim(&gSprites[sNamingScreenData->cursorSpriteId], 1); + StartSpriteAnim(&gSprites[sNamingScreen->cursorSpriteId], 1); } static bool8 IsCursorAnimFinished(void) { - return gSprites[sNamingScreenData->cursorSpriteId].animEnded; + return gSprites[sNamingScreen->cursorSpriteId].animEnded; } -static const u8 sKeyRoles[] = {KEY_ROLE_PAGE, KEY_ROLE_BACKSPACE, KEY_ROLE_OK}; +static const u8 sButtonKeyRoles[] = {KEY_ROLE_PAGE, KEY_ROLE_BACKSPACE, KEY_ROLE_OK}; static u8 GetKeyRoleAtCursorPos(void) { @@ -1125,147 +1198,166 @@ static u8 GetKeyRoleAtCursorPos(void) if (cursorX < GetCurrentPageColumnCount()) return KEY_ROLE_CHAR; else - return sKeyRoles[cursorY]; + return sButtonKeyRoles[cursorY]; } +// If the cursor's x is equal to the column count, cursor is in the button column static u8 GetCurrentPageColumnCount(void) { - return gUnknown_83E2330[sub_809DE50()]; + return sPageColumnCounts[CurrentPageToKeyboardId()]; } -static void CreatePageSwitcherSprites(void) +#undef sX +#undef sY +#undef sPrevX +#undef sPrevY +#undef sInvisible +#undef sFlashing +#undef sColor +#undef sColorIncr +#undef sColorDelay + +#define sState data[0] +#define sPage data[1] +#define sTextSpriteId data[6] +#define sButtonSpriteId data[7] + +static void CreatePageSwapButtonSprites(void) { - u8 spriteId1; - u8 spriteId2; - u8 spriteId3; + u8 frameSpriteId; + u8 textSpriteId; + u8 buttonSpriteId; - spriteId1 = CreateSprite(&gUnknown_83E2574, 0xCC, 0x58, 0); - sNamingScreenData->selectBtnFrameSpriteId = spriteId1; - SetSubspriteTables(&gSprites[spriteId1], gUnknown_83E2504); - gSprites[spriteId1].invisible = TRUE; + frameSpriteId = CreateSprite(&sSpriteTemplate_PageSwapFrame, 204, 88, 0); + sNamingScreen->swapBtnFrameSpriteId = frameSpriteId; + SetSubspriteTables(&gSprites[frameSpriteId], sSubspriteTable_PageSwapFrame); + gSprites[frameSpriteId].invisible = TRUE; - spriteId2 = CreateSprite(&gUnknown_83E25A4, 0xCC, 0x54, 1); - gSprites[spriteId1].data[6] = spriteId2; - SetSubspriteTables(&gSprites[spriteId2], gUnknown_83E250C); - gSprites[spriteId2].invisible = TRUE; + textSpriteId = CreateSprite(&sSpriteTemplate_PageSwapText, 204, 84, 1); + gSprites[frameSpriteId].data[6] = textSpriteId; + SetSubspriteTables(&gSprites[textSpriteId], sSubspriteTable_PageSwapText); + gSprites[textSpriteId].invisible = TRUE; - spriteId3 = CreateSprite(&gUnknown_83E258C, 0xCC, 0x53, 2); - gSprites[spriteId3].oam.priority = 1; - gSprites[spriteId1].data[7] = spriteId3; - gSprites[spriteId3].invisible = TRUE; + buttonSpriteId = CreateSprite(&sSpriteTemplate_PageSwapButton, 204, 83, 2); + gSprites[buttonSpriteId].oam.priority = 1; + gSprites[frameSpriteId].data[7] = buttonSpriteId; + gSprites[buttonSpriteId].invisible = TRUE; } -static void sub_809EC20(void) +static void StartPageSwapButtonAnim(void) { - struct Sprite *sprite = &gSprites[sNamingScreenData->selectBtnFrameSpriteId]; + struct Sprite *sprite = &gSprites[sNamingScreen->swapBtnFrameSpriteId]; - sprite->data[0] = 2; - sprite->data[1] = sNamingScreenData->currentPage; + sprite->sState = 2; // go to PageSwapSprite_SlideOff + sprite->sPage = sNamingScreen->currentPage; } -static bool8 (*const sPageSwapSpritesCBs[])(struct Sprite *sprite) = { - PageSwapSpritesCB_Init, - PageSwapSpritesCB_Idle, - PageSwapSpritesCB_SwapHide, - PageSwapSpritesCB_SwapShow +static bool8 (*const sPageSwapSpriteFuncs[])(struct Sprite *sprite) = +{ + PageSwapSprite_Init, + PageSwapSprite_Idle, + PageSwapSprite_SlideOff, + PageSwapSprite_SlideOn }; static void SpriteCB_PageSwap(struct Sprite *sprite) { - while (sPageSwapSpritesCBs[sprite->data[0]](sprite)) + while (sPageSwapSpriteFuncs[sprite->sState](sprite)) ; } -static bool8 PageSwapSpritesCB_Init(struct Sprite *sprite) +static bool8 PageSwapSprite_Init(struct Sprite *sprite) { - struct Sprite *sprite1 = &gSprites[sprite->data[6]]; - struct Sprite *sprite2 = &gSprites[sprite->data[7]]; + struct Sprite *text = &gSprites[sprite->sTextSpriteId]; + struct Sprite *button = &gSprites[sprite->sButtonSpriteId]; - sub_809ED88(sub_809DE20(sNamingScreenData->currentPage), sprite1, sprite2); - sprite->data[0]++; + SetPageSwapButtonGfx(PageToNextGfxId(sNamingScreen->currentPage), text, button); + sprite->sState++; return FALSE; } -static bool8 PageSwapSpritesCB_Idle(struct Sprite *sprite) +static bool8 PageSwapSprite_Idle(struct Sprite *sprite) { - struct Sprite *sprite1 = &gSprites[sprite->data[6]]; - struct Sprite *sprite2 = &gSprites[sprite->data[7]]; - return FALSE; } -static bool8 PageSwapSpritesCB_SwapHide(struct Sprite *sprite) +static bool8 PageSwapSprite_SlideOff(struct Sprite *sprite) { - struct Sprite *sprite1 = &gSprites[sprite->data[6]]; - struct Sprite *sprite2 = &gSprites[sprite->data[7]]; - u8 page; + struct Sprite *text = &gSprites[sprite->sTextSpriteId]; + struct Sprite *button = &gSprites[sprite->sButtonSpriteId]; - sprite1->y2++; - if (sprite1->y2 > 7) + if (++text->y2 > 7) { - sprite->data[0]++; - sprite1->y2 = -4; - sprite1->invisible = TRUE; - page = sprite->data[1]; - sub_809ED88(sub_809DE20((page + 1) % 3), sprite1, sprite2); + sprite->sState++; + text->y2 = -4; + text->invisible = TRUE; + SetPageSwapButtonGfx(PageToNextGfxId(((u8)sprite->sPage + 1) % KBPAGE_COUNT), text, button); } return FALSE; } -static bool8 PageSwapSpritesCB_SwapShow(struct Sprite *sprite) +static bool8 PageSwapSprite_SlideOn(struct Sprite *sprite) { - struct Sprite *sprite1 = &gSprites[sprite->data[6]]; - struct Sprite *sprite2 = &gSprites[sprite->data[7]]; + struct Sprite *text = &gSprites[sprite->sTextSpriteId]; - sprite1->invisible = FALSE; - sprite1->y2++; - if (sprite1->y2 >= 0) + text->invisible = FALSE; + if (++text->y2 >= 0) { - sprite1->y2 = 0; - sprite->data[0] = 1; + text->y2 = 0; + sprite->sState = 1; // go to PageSwapSprite_Idle } return FALSE; } -static const u16 gUnknown_83E2388[] = {1, 3, 2}; -static const u16 gUnknown_83E238E[] = {4, 6, 5}; +static const u16 sPageSwapPalTags[] = { + [PAGE_SWAP_UPPER] = PALTAG_PAGE_SWAP_UPPER, + [PAGE_SWAP_OTHERS] = PALTAG_PAGE_SWAP_OTHERS, + [PAGE_SWAP_LOWER] = PALTAG_PAGE_SWAP_LOWER +}; -static void sub_809ED88(u8 page, struct Sprite *sprite1, struct Sprite *sprite2) +static const u16 sPageSwapGfxTags[] = { + [PAGE_SWAP_UPPER] = GFXTAG_PAGE_SWAP_UPPER, + [PAGE_SWAP_OTHERS] = GFXTAG_PAGE_SWAP_OTHERS, + [PAGE_SWAP_LOWER] = GFXTAG_PAGE_SWAP_LOWER +}; + +static void SetPageSwapButtonGfx(u8 page, struct Sprite *text, struct Sprite *button) { - sprite2->oam.paletteNum = IndexOfSpritePaletteTag(gUnknown_83E2388[page]); - sprite1->sheetTileStart = GetSpriteTileStartByTag(gUnknown_83E238E[page]); - sprite1->subspriteTableNum = page; + button->oam.paletteNum = IndexOfSpritePaletteTag(sPageSwapPalTags[page]); + text->sheetTileStart = GetSpriteTileStartByTag(sPageSwapGfxTags[page]); + text->subspriteTableNum = page; } -// +#undef sState +#undef sPage +#undef sTextSpriteId +#undef sButtonSpriteId static void CreateBackOkSprites(void) { - u8 spriteId; - - spriteId = CreateSprite(&gUnknown_83E25BC, 0xCC, 0x74, 0); - SetSubspriteTables(&gSprites[spriteId], gUnknown_83E2524); + u8 spriteId = CreateSprite(&sSpriteTemplate_BackButton, 204, 116, 0); + SetSubspriteTables(&gSprites[spriteId], sSubspriteTable_Button); gSprites[spriteId].invisible = TRUE; - spriteId = CreateSprite(&gUnknown_83E25D4, 0xCC, 0x8C, 0); - SetSubspriteTables(&gSprites[spriteId], gUnknown_83E2524); + spriteId = CreateSprite(&sSpriteTemplate_OkButton, 204, 140, 0); + SetSubspriteTables(&gSprites[spriteId], sSubspriteTable_Button); gSprites[spriteId].invisible = TRUE; } -static void CreateUnderscoreSprites(void) +static void CreateTextEntrySprites(void) { u8 spriteId; s16 xPos; u8 i; - xPos = sNamingScreenData->inputCharBaseXPos - 5; - spriteId = CreateSprite(&sSpriteTemplate_InputArrow, xPos, 0x38, 0); + xPos = sNamingScreen->inputCharBaseXPos - 5; + spriteId = CreateSprite(&sSpriteTemplate_InputArrow, xPos, 56, 0); gSprites[spriteId].oam.priority = 3; gSprites[spriteId].invisible = TRUE; - xPos = sNamingScreenData->inputCharBaseXPos; - for (i = 0; i < sNamingScreenData->template->maxChars; i++, xPos += 8) + xPos = sNamingScreen->inputCharBaseXPos; + for (i = 0; i < sNamingScreen->template->maxChars; i++, xPos += 8) { - spriteId = CreateSprite(&sSpriteTemplate_Underscore, xPos + 3, 0x3C, 0); + spriteId = CreateSprite(&sSpriteTemplate_Underscore, xPos + 3, 60, 0); gSprites[spriteId].oam.priority = 3; gSprites[spriteId].data[0] = i; gSprites[spriteId].invisible = TRUE; @@ -1276,8 +1368,9 @@ static void CreateUnderscoreSprites(void) // Icon creation (the thing you're naming or giving input to) //-------------------------------------------------- -static void (*const sIconFunctions[])(void) = { - NamingScreen_NoCreateIcon, +static void (*const sIconFunctions[])(void) = +{ + NamingScreen_NoIcon, NamingScreen_CreatePlayerIcon, NamingScreen_CreatePCIcon, NamingScreen_CreateMonIcon, @@ -1286,10 +1379,10 @@ static void (*const sIconFunctions[])(void) = { static void CreateInputTargetIcon(void) { - sIconFunctions[sNamingScreenData->template->iconFunction](); + sIconFunctions[sNamingScreen->template->iconFunction](); } -static void NamingScreen_NoCreateIcon(void) +static void NamingScreen_NoIcon(void) { } @@ -1299,18 +1392,16 @@ static void NamingScreen_CreatePlayerIcon(void) u8 rivalGfxId; u8 spriteId; - rivalGfxId = GetRivalAvatarGraphicsIdByStateIdAndGender(0, sNamingScreenData->monSpecies); - spriteId = AddPseudoObjectEvent(rivalGfxId, SpriteCallbackDummy, 0x38, 0x25, 0); + rivalGfxId = GetRivalAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, sNamingScreen->monSpecies); + spriteId = AddPseudoObjectEvent(rivalGfxId, SpriteCallbackDummy, 56, 37, 0); gSprites[spriteId].oam.priority = 3; - StartSpriteAnim(&gSprites[spriteId], 4); + StartSpriteAnim(&gSprites[spriteId], ANIM_STD_GO_SOUTH); } static void NamingScreen_CreatePCIcon(void) { - u8 spriteId; - - spriteId = CreateSprite(&gUnknown_83E2634, 0x38, 0x29, 0); - SetSubspriteTables(&gSprites[spriteId], gUnknown_83E252C); + u8 spriteId = CreateSprite(&sSpriteTemplate_PCIcon, 56, 41, 0); + SetSubspriteTables(&gSprites[spriteId], sSubspriteTable_PCIcon); gSprites[spriteId].oam.priority = 3; } @@ -1319,11 +1410,12 @@ static void NamingScreen_CreateMonIcon(void) u8 spriteId; LoadMonIconPalettes(); - spriteId = CreateMonIcon(sNamingScreenData->monSpecies, SpriteCallbackDummy, 0x38, 0x28, 0, sNamingScreenData->monPersonality, 1); + spriteId = CreateMonIcon(sNamingScreen->monSpecies, SpriteCallbackDummy, 56, 40, 0, sNamingScreen->monPersonality, 1); gSprites[spriteId].oam.priority = 3; } -static const union AnimCmd gUnknown_83E23A8[] = { +static const union AnimCmd sAnim_Rival[] = +{ ANIMCMD_FRAME( 0, 10), ANIMCMD_FRAME(24, 10), ANIMCMD_FRAME( 0, 10), @@ -1331,17 +1423,18 @@ static const union AnimCmd gUnknown_83E23A8[] = { ANIMCMD_JUMP(0) }; -static const union AnimCmd *const gUnknown_83E23BC[] = { - gUnknown_83E23A8 +static const union AnimCmd *const sAnims_Rival[] = +{ + sAnim_Rival }; static void NamingScreen_CreateRivalIcon(void) { const struct SpriteSheet sheet = { - gUnknown_83E1980, 0x900, 255 + sRival_Gfx, 0x900, GFXTAG_RIVAL }; const struct SpritePalette palette = { - gUnknown_8E98004, 255 + gNamingScreenRival_Pal, PALTAG_RIVAL }; struct SpriteTemplate template; const struct SubspriteTable * tables_p; @@ -1351,95 +1444,96 @@ static void NamingScreen_CreateRivalIcon(void) template.tileTag = sheet.tag; template.paletteTag = palette.tag; - template.anims = gUnknown_83E23BC; + template.anims = sAnims_Rival; LoadSpriteSheet(&sheet); LoadSpritePalette(&palette); - spriteId = CreateSprite(&template, 0x38, 0x25, 0); + spriteId = CreateSprite(&template, 56, 37, 0); gSprites[spriteId].oam.priority = 3; } -static bool8 (*const sKeyboardKeyHandlers[])(u8) = { - KeyboardKeyHandler_Character, - KeyboardKeyHandler_Page, - KeyboardKeyHandler_Backspace, - KeyboardKeyHandler_OK, +static bool8 (*const sKeyboardKeyHandlers[])(u8) = +{ + [KEY_ROLE_CHAR] = KeyboardKeyHandler_Character, + [KEY_ROLE_PAGE] = KeyboardKeyHandler_Page, + [KEY_ROLE_BACKSPACE] = KeyboardKeyHandler_Backspace, + [KEY_ROLE_OK] = KeyboardKeyHandler_OK, }; static bool8 HandleKeyboardEvent(void) { - u8 event = GetInputEvent(); + u8 input = GetInputEvent(); u8 keyRole = GetKeyRoleAtCursorPos(); - if (event == KBEVENT_PRESSED_SELECT) + if (input == INPUT_SELECT) { - return TriggerKeyboardChange(); + return SwapKeyboardPage(); } - else if (event == KBEVENT_PRESSED_B) + else if (input == INPUT_B_BUTTON) { DeleteTextCharacter(); return FALSE; } - else if (event == KBEVENT_PRESSED_START) + else if (input == INPUT_START) { MoveCursorToOKButton(); return FALSE; } else { - return sKeyboardKeyHandlers[keyRole](event); + return sKeyboardKeyHandlers[keyRole](input); } } -static bool8 KeyboardKeyHandler_Character(u8 event) +static bool8 KeyboardKeyHandler_Character(u8 input) { - sub_809E518(3, 0, 0); - if (event == KBEVENT_PRESSED_A) + TryStartButtonFlash(BUTTON_COUNT, FALSE, FALSE); + if (input == INPUT_A_BUTTON) { - bool8 var = AppendCharToBuffer_CheckBufferFull(); + bool8 textFull = AddTextCharacter(); - sub_809EAA8(); - if (var) + SquishCursor(); + if (textFull) { SetInputState(INPUT_STATE_DISABLED); - sNamingScreenData->state = MAIN_STATE_MOVE_TO_OK_BUTTON; + sNamingScreen->state = STATE_MOVE_TO_OK_BUTTON; } } return FALSE; } -static bool8 KeyboardKeyHandler_Page(u8 event) +static bool8 KeyboardKeyHandler_Page(u8 input) { - sub_809E518(0, 1, 0); - if (event == KBEVENT_PRESSED_A) - return TriggerKeyboardChange(); + TryStartButtonFlash(BUTTON_PAGE, TRUE, FALSE); + if (input == INPUT_A_BUTTON) + return SwapKeyboardPage(); else return FALSE; } -static bool8 KeyboardKeyHandler_Backspace(u8 event) +static bool8 KeyboardKeyHandler_Backspace(u8 input) { - sub_809E518(1, 1, 0); - if (event == KBEVENT_PRESSED_A) + TryStartButtonFlash(BUTTON_BACK, TRUE, FALSE); + if (input == INPUT_A_BUTTON) DeleteTextCharacter(); return FALSE; } -static bool8 KeyboardKeyHandler_OK(u8 event) +static bool8 KeyboardKeyHandler_OK(u8 input) { - sub_809E518(2, 1, 0); - if (event == KBEVENT_PRESSED_A) + TryStartButtonFlash(BUTTON_OK, TRUE, FALSE); + if (input == INPUT_A_BUTTON) { PlaySE(SE_SELECT); - sNamingScreenData->state = MAIN_STATE_6; + sNamingScreen->state = STATE_PRESSED_OK; return TRUE; } else return FALSE; } -static bool8 TriggerKeyboardChange(void) +static bool8 SwapKeyboardPage(void) { - sNamingScreenData->state = MAIN_STATE_START_PAGE_SWAP; + sNamingScreen->state = STATE_START_PAGE_SWAP; return TRUE; } @@ -1447,23 +1541,17 @@ static bool8 TriggerKeyboardChange(void) // Input handling //-------------------------------------------------- -enum -{ - FNKEY_CASE, - FNKEY_BACK, - FNKEY_OK, -}; - #define tState data[0] #define tKeyboardEvent data[1] -#define tKbFunctionKey data[2] +#define tButtonId data[2] -static void (*const sInputStateFuncs[])(struct Task *) = { - InputState_Disabled, - InputState_Enabled +static void (*const sInputFuncs[])(struct Task *) = +{ + [INPUT_STATE_DISABLED] = Input_Disabled, + [INPUT_STATE_ENABLED] = Input_Enabled, }; -static void InputInit(void) +static void CreateInputHandlerTask(void) { CreateTask(Task_HandleInput, 1); } @@ -1484,26 +1572,26 @@ static void SetInputState(u8 state) static void Task_HandleInput(u8 taskId) { - sInputStateFuncs[gTasks[taskId].tState](&gTasks[taskId]); + sInputFuncs[gTasks[taskId].tState](&gTasks[taskId]); } -static void InputState_Disabled(struct Task *task) +static void Input_Disabled(struct Task *task) { - task->tKeyboardEvent = 0; + task->tKeyboardEvent = INPUT_NONE; } -static void InputState_Enabled(struct Task *task) +static void Input_Enabled(struct Task *task) { - task->tKeyboardEvent = 0; + task->tKeyboardEvent = INPUT_NONE; if (JOY_NEW(A_BUTTON)) - task->tKeyboardEvent = KBEVENT_PRESSED_A; + task->tKeyboardEvent = INPUT_A_BUTTON; else if (JOY_NEW(B_BUTTON)) - task->tKeyboardEvent = KBEVENT_PRESSED_B; + task->tKeyboardEvent = INPUT_B_BUTTON; else if (JOY_NEW(SELECT_BUTTON)) - task->tKeyboardEvent = KBEVENT_PRESSED_SELECT; + task->tKeyboardEvent = INPUT_SELECT; else if (JOY_NEW(START_BUTTON)) - task->tKeyboardEvent = KBEVENT_PRESSED_START; + task->tKeyboardEvent = INPUT_START; else HandleDpadMovement(task); } @@ -1511,44 +1599,44 @@ static void InputState_Enabled(struct Task *task) static void HandleDpadMovement(struct Task *task) { const s16 sDpadDeltaX[] = { - 0, //none - 0, //up - 0, //down - -1, //left - 1 //right + [INPUT_NONE] = 0, + [INPUT_DPAD_UP] = 0, + [INPUT_DPAD_DOWN] = 0, + [INPUT_DPAD_LEFT] = -1, + [INPUT_DPAD_RIGHT] = 1 }; const s16 sDpadDeltaY[] = { - 0, //none - -1, //up - 1, //down - 0, //left - 0 //right + [INPUT_NONE] = 0, + [INPUT_DPAD_UP] = -1, + [INPUT_DPAD_DOWN] = 1, + [INPUT_DPAD_LEFT] = 0, + [INPUT_DPAD_RIGHT] = 0 }; - const s16 s4RowTo3RowTableY[] = {0, 1, 1, 2}; - const s16 s3RowTo4RowTableY[] = {0, 0, 3}; + const s16 sKeyRowToButtonRow[KBROW_COUNT] = {0, 1, 1, 2}; + const s16 sButtonRowToKeyRow[BUTTON_COUNT] = {0, 0, 3}; s16 cursorX; s16 cursorY; - u16 dpadDir; + u16 input; s16 prevCursorX; GetCursorPos(&cursorX, &cursorY); - dpadDir = 0; + input = INPUT_NONE; if (JOY_REPT(DPAD_UP)) - dpadDir = 1; + input = INPUT_DPAD_UP; if (JOY_REPT(DPAD_DOWN)) - dpadDir = 2; + input = INPUT_DPAD_DOWN; if (JOY_REPT(DPAD_LEFT)) - dpadDir = 3; + input = INPUT_DPAD_LEFT; if (JOY_REPT(DPAD_RIGHT)) - dpadDir = 4; + input = INPUT_DPAD_RIGHT; - //Get new cursor position + // Get new cursor position prevCursorX = cursorX; - cursorX += sDpadDeltaX[dpadDir]; - cursorY += sDpadDeltaY[dpadDir]; + cursorX += sDpadDeltaX[input]; + cursorY += sDpadDeltaY[input]; //Wrap cursor position in the X direction if (cursorX < 0) @@ -1556,42 +1644,48 @@ static void HandleDpadMovement(struct Task *task) if (cursorX > GetCurrentPageColumnCount()) cursorX = 0; - //Handle cursor movement in X direction - if (sDpadDeltaX[dpadDir] != 0) + // Handle moving on/off the button column + if (sDpadDeltaX[input] != 0) { if (cursorX == GetCurrentPageColumnCount()) { - //We are now on the last column - task->tKbFunctionKey = cursorY; - cursorY = s4RowTo3RowTableY[cursorY]; + // Moved onto button column + // Save cursor pos in tButtonId for moving back onto keys + task->tButtonId = cursorY; + cursorY = sKeyRowToButtonRow[cursorY]; } else if (prevCursorX == GetCurrentPageColumnCount()) { - if (cursorY == 1) - cursorY = task->tKbFunctionKey; + // Moved off button column + // If you're on the middle button, go to the row that + // the cursor was on previously (saved in tButtonId above) + if (cursorY == BUTTON_COUNT / 2) + cursorY = task->tButtonId; else - cursorY = s3RowTo4RowTableY[cursorY]; + cursorY = sButtonRowToKeyRow[cursorY]; } } + // Wrap cursor position in the y direction if (cursorX == GetCurrentPageColumnCount()) { - //There are only 3 keys on the last column, unlike the others, - //so wrap Y accordingly + // There are only 3 keys in the button column + // so wrap Y accordingly if (cursorY < 0) - cursorY = 2; - if (cursorY > 2) + cursorY = BUTTON_COUNT - 1; + if (cursorY >= BUTTON_COUNT) cursorY = 0; + if (cursorY == 0) - task->tKbFunctionKey = FNKEY_BACK; - else if (cursorY == 2) - task->tKbFunctionKey = FNKEY_OK; + task->tButtonId = BUTTON_BACK; + else if (cursorY == BUTTON_COUNT - 1) + task->tButtonId = BUTTON_OK; } else { if (cursorY < 0) - cursorY = 3; - if (cursorY > 3) + cursorY = KBROW_COUNT - 1; + if (cursorY >= KBROW_COUNT) cursorY = 0; } SetCursorPos(cursorX, cursorY); @@ -1599,50 +1693,52 @@ static void HandleDpadMovement(struct Task *task) #undef tState #undef tKeyboardEvent -#undef tKbFunctionKey +#undef tButtonId -static void PrintTitleFunction_NoMon(void) +static void DrawNormalTextEntryBox(void) { - FillWindowPixelBuffer(sNamingScreenData->windows[3], PIXEL_FILL(1)); - AddTextPrinterParameterized(sNamingScreenData->windows[3], FONT_1, sNamingScreenData->template->title, 1, 1, 0, NULL); - PutWindowTilemap(sNamingScreenData->windows[3]); + FillWindowPixelBuffer(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], PIXEL_FILL(1)); + AddTextPrinterParameterized(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], FONT_1, sNamingScreen->template->title, 1, 1, 0, NULL); + PutWindowTilemap(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX]); } -static void PrintTitleFunction_WithMon(void) +static void DrawMonTextEntryBox(void) { - u8 buffer[0x20]; + u8 buffer[32]; - StringCopy(buffer, gSpeciesNames[sNamingScreenData->monSpecies]); - StringAppendN(buffer, sNamingScreenData->template->title, 15); - FillWindowPixelBuffer(sNamingScreenData->windows[3], PIXEL_FILL(1)); - AddTextPrinterParameterized(sNamingScreenData->windows[3], FONT_1, buffer, 1, 1, 0, NULL); - PutWindowTilemap(sNamingScreenData->windows[3]); + StringCopy(buffer, gSpeciesNames[sNamingScreen->monSpecies]); + StringAppendN(buffer, sNamingScreen->template->title, 15); + FillWindowPixelBuffer(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], PIXEL_FILL(1)); + AddTextPrinterParameterized(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX], FONT_1, buffer, 1, 1, 0, NULL); + PutWindowTilemap(sNamingScreen->windows[WIN_TEXT_ENTRY_BOX]); } -static void (*const sPrintTitleFuncs[])(void) = { - [NAMING_SCREEN_PLAYER] = PrintTitleFunction_NoMon, - [NAMING_SCREEN_BOX] = PrintTitleFunction_NoMon, - [NAMING_SCREEN_CAUGHT_MON] = PrintTitleFunction_WithMon, - [NAMING_SCREEN_NAME_RATER] = PrintTitleFunction_WithMon, - [NAMING_SCREEN_RIVAL] = PrintTitleFunction_NoMon +static void (*const sDrawTextEntryBoxFuncs[])(void) = +{ + [NAMING_SCREEN_PLAYER] = DrawNormalTextEntryBox, + [NAMING_SCREEN_BOX] = DrawNormalTextEntryBox, + [NAMING_SCREEN_CAUGHT_MON] = DrawMonTextEntryBox, + [NAMING_SCREEN_NICKNAME] = DrawMonTextEntryBox, + [NAMING_SCREEN_RIVAL] = DrawNormalTextEntryBox }; -static void PrintTitle(void) +static void DrawTextEntryBox(void) { - sPrintTitleFuncs[sNamingScreenData->templateNum](); + sDrawTextEntryBoxFuncs[sNamingScreen->templateNum](); } -static void (*const sAddGenderIconFuncs[])(void) = { - AddGenderIconFunc_No, - AddGenderIconFunc_Yes +static void (*const sDrawGenderIconFuncs[])(void) = +{ + [FALSE] = DummyGenderIcon, + [TRUE] = DrawGenderIcon, }; -static void CallAddGenderIconFunc(void) +static void TryDrawGenderIcon(void) { - sAddGenderIconFuncs[sNamingScreenData->template->addGenderIcon](); + sDrawGenderIconFuncs[sNamingScreen->template->addGenderIcon](); } -static void AddGenderIconFunc_No(void) +static void DummyGenderIcon(void) { } @@ -1652,48 +1748,48 @@ static const u8 sGenderColors[2][3] = { [FEMALE] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_LIGHT_RED, TEXT_COLOR_RED} }; -static void AddGenderIconFunc_Yes(void) +static void DrawGenderIcon(void) { u8 genderSymbol[2]; bool8 gender = MALE; StringCopy(genderSymbol, gText_MaleSymbol); - if (sNamingScreenData->monGender != MON_GENDERLESS) + if (sNamingScreen->monGender != MON_GENDERLESS) { - if (sNamingScreenData->monGender == MON_FEMALE) + if (sNamingScreen->monGender == MON_FEMALE) { StringCopy(genderSymbol, gText_FemaleSymbol); gender = FEMALE; } - AddTextPrinterParameterized3(sNamingScreenData->windows[2], FONT_2, 0x68, 1, sGenderColors[gender], TEXT_SKIP_DRAW, genderSymbol); + AddTextPrinterParameterized3(sNamingScreen->windows[2], FONT_2, 0x68, 1, sGenderColors[gender], TEXT_SKIP_DRAW, genderSymbol); } } static u8 GetCharAtKeyboardPos(s16 x, s16 y) { - return gUnknown_83E22D0[sub_809DE50()][y][x]; + return sKeyboardChars[CurrentPageToKeyboardId()][y][x]; } -static u8 GetTextCaretPosition(void) +static u8 GetTextEntryPosition(void) { u8 i; - for (i = 0; i < sNamingScreenData->template->maxChars; i++) + for (i = 0; i < sNamingScreen->template->maxChars; i++) { - if (sNamingScreenData->textBuffer[i] == EOS) + if (sNamingScreen->textBuffer[i] == EOS) return i; } - return sNamingScreenData->template->maxChars - 1; + return sNamingScreen->template->maxChars - 1; } static u8 GetPreviousTextCaretPosition(void) { s8 i; - for (i = sNamingScreenData->template->maxChars - 1; i > 0; i--) + for (i = sNamingScreen->template->maxChars - 1; i > 0; i--) { - if (sNamingScreenData->textBuffer[i] != EOS) + if (sNamingScreen->textBuffer[i] != EOS) return i; } return 0; @@ -1702,79 +1798,82 @@ static u8 GetPreviousTextCaretPosition(void) static void DeleteTextCharacter(void) { u8 index; - u8 var2; + u8 keyRole; index = GetPreviousTextCaretPosition(); // Temporarily make this a space for redrawing purposes - sNamingScreenData->textBuffer[index] = CHAR_SPACE; - PrintBufferCharactersOnScreen(); + sNamingScreen->textBuffer[index] = CHAR_SPACE; + DrawTextEntry(); CopyBgTilemapBufferToVram(3); - sNamingScreenData->textBuffer[index] = EOS; - var2 = GetKeyRoleAtCursorPos(); - if (var2 == KEY_ROLE_CHAR || var2 == KEY_ROLE_BACKSPACE) - sub_809E518(1, 0, 1); + sNamingScreen->textBuffer[index] = EOS; + keyRole = GetKeyRoleAtCursorPos(); + + // The below flashes the Back key once on delete + // It incorrectly leaves the Back key 1 shade lighter than its default + if (keyRole == KEY_ROLE_CHAR || keyRole == KEY_ROLE_BACKSPACE) + TryStartButtonFlash(BUTTON_BACK, FALSE, TRUE); PlaySE(SE_BALL); } -static bool8 AppendCharToBuffer_CheckBufferFull(void) +// Returns TRUE if the text entry is now full +static bool8 AddTextCharacter(void) { s16 x; s16 y; GetCursorPos(&x, &y); - AddTextCharacter(GetCharAtKeyboardPos(x, y)); - PrintBufferCharactersOnScreen(); + BufferCharacter(GetCharAtKeyboardPos(x, y)); + DrawTextEntry(); CopyBgTilemapBufferToVram(3); PlaySE(SE_SELECT); - if (GetPreviousTextCaretPosition() != sNamingScreenData->template->maxChars - 1) + if (GetPreviousTextCaretPosition() != sNamingScreen->template->maxChars - 1) return FALSE; else return TRUE; } -static void AddTextCharacter(u8 ch) +static void BufferCharacter(u8 ch) { - u8 index = GetTextCaretPosition(); - - sNamingScreenData->textBuffer[index] = ch; + u8 index = GetTextEntryPosition(); + sNamingScreen->textBuffer[index] = ch; } -static void CopyStringToDestBuffer(void) +static void SaveInputText(void) { // Copy from the first non-whitespace character u8 i; - for (i = 0; i < sNamingScreenData->template->maxChars; i++) + for (i = 0; i < sNamingScreen->template->maxChars; i++) { - if (sNamingScreenData->textBuffer[i] != CHAR_SPACE && sNamingScreenData->textBuffer[i] != EOS) + if (sNamingScreen->textBuffer[i] != CHAR_SPACE && sNamingScreen->textBuffer[i] != EOS) { - StringCopyN(sNamingScreenData->destBuffer, sNamingScreenData->textBuffer, sNamingScreenData->template->maxChars + 1); + StringCopyN(sNamingScreen->destBuffer, sNamingScreen->textBuffer, sNamingScreen->template->maxChars + 1); break; } } } -static void choose_name_or_words_screen_load_bg_tile_patterns(void) +static void LoadGfx(void) { - LZ77UnCompWram(gNamingScreenMenu_Gfx, sNamingScreenData->tileBuffer); - LoadBgTiles(1, sNamingScreenData->tileBuffer, 0x600, 0); - LoadBgTiles(2, sNamingScreenData->tileBuffer, 0x600, 0); - LoadBgTiles(3, sNamingScreenData->tileBuffer, 0x600, 0); - LoadSpriteSheets(gUnknown_83E267C); - LoadSpritePalettes(gUnknown_83E26E4); + LZ77UnCompWram(gNamingScreenMenu_Gfx, sNamingScreen->tileBuffer); + LoadBgTiles(1, sNamingScreen->tileBuffer, sizeof(sNamingScreen->tileBuffer), 0); + LoadBgTiles(2, sNamingScreen->tileBuffer, sizeof(sNamingScreen->tileBuffer), 0); + LoadBgTiles(3, sNamingScreen->tileBuffer, sizeof(sNamingScreen->tileBuffer), 0); + LoadSpriteSheets(sSpriteSheets); + LoadSpritePalettes(sSpritePalettes); } -static void sub_809F8C0(void) +static void CreateHelperTasks(void) { - InputInit(); - sub_809E4F0(); + CreateInputHandlerTask(); + CreateButtonFlashTask(); } -static void choose_name_or_words_screen_apply_bg_pals(void) +static void LoadPalettes(void) { - LoadPalette(gNamingScreenMenu_Pal, 0, 0xC0); - LoadPalette(gUnknown_8E97FE4, 0xA0, 0x20); + LoadPalette(gNamingScreenMenu_Pal, 0, sizeof(gNamingScreenMenu_Pal)); + LoadPalette(gNamingScreenKeyboard_Pal, 0xA0, 0x20); LoadPalette(stdpal_get(2), 0xB0, 0x20); } @@ -1783,28 +1882,28 @@ static void DecompressToBgTilemapBuffer(u8 bg, const u32 *src) CopyToBgTilemapBuffer(bg, src, 0, 0); } -static void PrintBufferCharactersOnScreen(void) +static void DrawTextEntry(void) { u8 i; u8 temp[2]; - u16 xoff; - u8 maxChars = sNamingScreenData->template->maxChars; - u16 xpos = sNamingScreenData->inputCharBaseXPos - 0x40; + u16 extraWidth; + u8 maxChars = sNamingScreen->template->maxChars; + u16 xpos = sNamingScreen->inputCharBaseXPos - 0x40; - FillWindowPixelBuffer(sNamingScreenData->windows[2], PIXEL_FILL(1)); + FillWindowPixelBuffer(sNamingScreen->windows[WIN_TEXT_ENTRY], PIXEL_FILL(1)); for (i = 0; i < maxChars; i++) { - temp[0] = sNamingScreenData->textBuffer[i]; + temp[0] = sNamingScreen->textBuffer[i]; temp[1] = gExpandedPlaceholder_Empty[0]; - xoff = (IsLetter(temp[0]) == TRUE) ? 2 : 0; + extraWidth = (IsWideLetter(temp[0]) == TRUE) ? 2 : 0; - AddTextPrinterParameterized(sNamingScreenData->windows[2], FONT_2, temp, i * 8 + xpos + xoff, 1, TEXT_SKIP_DRAW, NULL); + AddTextPrinterParameterized(sNamingScreen->windows[WIN_TEXT_ENTRY], FONT_2, temp, i * 8 + xpos + extraWidth, 1, TEXT_SKIP_DRAW, NULL); } - CallAddGenderIconFunc(); - CopyWindowToVram(sNamingScreenData->windows[2], COPYWIN_GFX); - PutWindowTilemap(sNamingScreenData->windows[2]); + TryDrawGenderIcon(); + CopyWindowToVram(sNamingScreen->windows[WIN_TEXT_ENTRY], COPYWIN_GFX); + PutWindowTilemap(sNamingScreen->windows[WIN_TEXT_ENTRY]); } struct TextColor // Needed because of alignment @@ -1820,39 +1919,39 @@ static const struct TextColor sTextColorStruct = { } }; -static const u8 sFillValues[KBPAGE_COUNT] = { - [KBPAGE_LETTERS_LOWER] = PIXEL_FILL(14), - [KBPAGE_LETTERS_UPPER] = PIXEL_FILL(13), - [KBPAGE_SYMBOLS] = PIXEL_FILL(15) +static const u8 sFillValues[KBPAGE_COUNT] = +{ + [KEYBOARD_LETTERS_LOWER] = PIXEL_FILL(14), + [KEYBOARD_LETTERS_UPPER] = PIXEL_FILL(13), + [KEYBOARD_SYMBOLS] = PIXEL_FILL(15) }; -static const u8 *const sKeyboardTextColors[KBPAGE_COUNT] = { - [KBPAGE_LETTERS_LOWER] = sTextColorStruct.colors[1], - [KBPAGE_LETTERS_UPPER] = sTextColorStruct.colors[0], - [KBPAGE_SYMBOLS] = sTextColorStruct.colors[2] +static const u8 *const sKeyboardTextColors[KBPAGE_COUNT] = +{ + [KEYBOARD_LETTERS_LOWER] = sTextColorStruct.colors[1], + [KEYBOARD_LETTERS_UPPER] = sTextColorStruct.colors[0], + [KEYBOARD_SYMBOLS] = sTextColorStruct.colors[2] }; -static void sub_809F9E8(u8 window, u8 page) +static void PrintKeyboardKeys(u8 window, u8 page) { u8 i; FillWindowPixelBuffer(window, sFillValues[page]); for (i = 0; i < KBROW_COUNT; i++) - { AddTextPrinterParameterized3(window, FONT_1, 0, i * 16 + 1, sKeyboardTextColors[page], 0, sNamingScreenKeyboardText[page][i]); - } PutWindowTilemap(window); } -static const u32 *const gUnknown_83E244C[] = { - gUnknown_8E98398, - gUnknown_8E98458, - gUnknown_8E98518 +static const u32 *const sNextKeyboardPageTilemaps[] = { + [KBPAGE_SYMBOLS] = gNamingScreenKeyboardUpper_Tilemap, + [KBPAGE_LETTERS_UPPER] = gNamingScreenKeyboardLower_Tilemap, + [KBPAGE_LETTERS_LOWER] = gNamingScreenKeyboardSymbols_Tilemap }; -static void sub_809FA60(void) +static void DrawKeyboardPageOnDeck(void) { u8 bgId; u8 bgId_copy; @@ -1864,32 +1963,32 @@ static void sub_809FA60(void) { bgId = 1; bgId_copy = 1; - windowId = sNamingScreenData->windows[0]; + windowId = sNamingScreen->windows[WIN_KB_PAGE_1]; } else { bgId = 2; bgId_copy = 2; - windowId = sNamingScreenData->windows[1]; + windowId = sNamingScreen->windows[WIN_KB_PAGE_2]; } - DecompressToBgTilemapBuffer(bgId, gUnknown_83E244C[sNamingScreenData->currentPage]); - sub_809F9E8(windowId, sub_809DE30()); + DecompressToBgTilemapBuffer(bgId, sNextKeyboardPageTilemaps[sNamingScreen->currentPage]); + PrintKeyboardKeys(windowId, CurrentPageToNextKeyboardId()); CopyBgTilemapBufferToVram(bgId_copy); } -static void sub_809FAE4(void) +static void PrintControls(void) { const u8 color[3] = { TEXT_DYNAMIC_COLOR_6, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY }; int strwidth = GetStringWidth(FONT_0, gText_MoveOkBack, 0); - FillWindowPixelBuffer(sNamingScreenData->windows[4], PIXEL_FILL(15)); - AddTextPrinterParameterized3(sNamingScreenData->windows[4], FONT_0, 236 - strwidth, 0, color, 0, gText_MoveOkBack); - PutWindowTilemap(sNamingScreenData->windows[4]); - CopyWindowToVram(sNamingScreenData->windows[4], COPYWIN_FULL); + FillWindowPixelBuffer(sNamingScreen->windows[WIN_BANNER], PIXEL_FILL(15)); + AddTextPrinterParameterized3(sNamingScreen->windows[WIN_BANNER], FONT_0, DISPLAY_WIDTH - 4 - strwidth, 0, color, 0, gText_MoveOkBack); + PutWindowTilemap(sNamingScreen->windows[WIN_BANNER]); + CopyWindowToVram(sNamingScreen->windows[WIN_BANNER], COPYWIN_FULL); } -static void sub_809FB70(void) +static void CB2_NamingScreen(void) { RunTasks(); AnimateSprites(); @@ -1897,13 +1996,13 @@ static void sub_809FB70(void) UpdatePaletteFade(); } -static void NamingScreen_TurnOffScreen(void) +static void ResetVHBlank(void) { SetVBlankCallback(NULL); SetHBlankCallback(NULL); } -static void NamingScreen_InitDisplayMode(void) +static void SetVBlank(void) { SetVBlankCallback(VBlankCB_NamingScreen); } @@ -1913,15 +2012,15 @@ static void VBlankCB_NamingScreen(void) LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); - SetGpuReg(REG_OFFSET_BG1VOFS, sNamingScreenData->bg1vOffset); - SetGpuReg(REG_OFFSET_BG2VOFS, sNamingScreenData->bg2vOffset); + SetGpuReg(REG_OFFSET_BG1VOFS, sNamingScreen->bg1vOffset); + SetGpuReg(REG_OFFSET_BG2VOFS, sNamingScreen->bg2vOffset); SetGpuReg(REG_OFFSET_BG1CNT, GetGpuReg(REG_OFFSET_BG1CNT) & 0xFFFC); // clear priority bits - SetGpuRegBits(REG_OFFSET_BG1CNT, sNamingScreenData->bg1Priority); + SetGpuRegBits(REG_OFFSET_BG1CNT, sNamingScreen->bg1Priority); SetGpuReg(REG_OFFSET_BG2CNT, GetGpuReg(REG_OFFSET_BG2CNT) & 0xFFFC); // clear priority bits - SetGpuRegBits(REG_OFFSET_BG2CNT, sNamingScreenData->bg2Priority); + SetGpuRegBits(REG_OFFSET_BG2CNT, sNamingScreen->bg2Priority); } -static void ShowAllBgs(void) +static void NamingScreen_ShowBgs(void) { ShowBg(0); ShowBg(1); @@ -1929,7 +2028,8 @@ static void ShowAllBgs(void) ShowBg(3); } -static bool8 IsLetter(u8 character) +// Always false (presumably for non-latin languages) +static bool8 IsWideLetter(u8 character) { u8 i; @@ -1945,27 +2045,27 @@ static bool8 IsLetter(u8 character) // Unused debug functions //-------------------------------------------------- -static void Debug_DoNamingScreen_Player(void) +static void Debug_NamingScreenPlayer(void) { DoNamingScreen(NAMING_SCREEN_PLAYER, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, MON_MALE, 0, CB2_ReturnToFieldWithOpenMenu); } -static void Debug_DoNamingScreen_Box(void) +static void Debug_NamingScreenBox(void) { DoNamingScreen(NAMING_SCREEN_BOX, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, MON_MALE, 0, CB2_ReturnToFieldWithOpenMenu); } -static void Debug_DoNamingScreen_CaughtMon(void) +static void Debug_NamingScreenCaughtMon(void) { DoNamingScreen(NAMING_SCREEN_CAUGHT_MON, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, MON_MALE, 0, CB2_ReturnToFieldWithOpenMenu); } -static void Debug_DoNamingScreen_NameRater(void) +static void Debug_NamingScreenNickname(void) { - DoNamingScreen(NAMING_SCREEN_NAME_RATER, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, MON_MALE, 0, CB2_ReturnToFieldWithOpenMenu); + DoNamingScreen(NAMING_SCREEN_NICKNAME, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, MON_MALE, 0, CB2_ReturnToFieldWithOpenMenu); } -static void Debug_DoNamingScreen_Rival(void) +static void Debug_NamingScreenRival(void) { DoNamingScreen(NAMING_SCREEN_RIVAL, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, MON_MALE, 0, CB2_ReturnToFieldWithOpenMenu); } @@ -2010,15 +2110,16 @@ static const struct NamingScreenTemplate sRivalNamingScreenTemplate = { .title = gText_RivalsName, }; -static const struct NamingScreenTemplate *const sNamingScreenTemplates[] = { - &sPlayerNamingScreenTemplate, - &sPcBoxNamingScreenTemplate, - &sMonNamingScreenTemplate, - &sMonNamingScreenTemplate, - &sRivalNamingScreenTemplate, +static const struct NamingScreenTemplate *const sNamingScreenTemplates[] = +{ + [NAMING_SCREEN_PLAYER] = &sPlayerNamingScreenTemplate, + [NAMING_SCREEN_BOX] = &sPcBoxNamingScreenTemplate, + [NAMING_SCREEN_CAUGHT_MON] = &sMonNamingScreenTemplate, + [NAMING_SCREEN_NICKNAME] = &sMonNamingScreenTemplate, + [NAMING_SCREEN_RIVAL] = &sRivalNamingScreenTemplate, }; -static const struct OamData gOamData_858BFEC = { +static const struct OamData sOam_8x8 = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, @@ -2031,7 +2132,7 @@ static const struct OamData gOamData_858BFEC = { .paletteNum = 0, }; -static const struct OamData gOamData_858BFF4 = { +static const struct OamData sOam_16x16 = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, @@ -2044,7 +2145,7 @@ static const struct OamData gOamData_858BFF4 = { .paletteNum = 0, }; -static const struct OamData gOamData_858BFFC = { +static const struct OamData sOam_32x16 = { .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, @@ -2057,7 +2158,7 @@ static const struct OamData gOamData_858BFFC = { .paletteNum = 0, }; -static const struct Subsprite gUnknown_83E24B8[] = { +static const struct Subsprite sSubsprites_PageSwapFrame[] = { { .x = -20, .y = -16, @@ -2117,7 +2218,7 @@ static const struct Subsprite gUnknown_83E24B8[] = { } }; -static const struct Subsprite gUnknown_83E24D8[] = { +static const struct Subsprite sSubsprites_PageSwapText[] = { { .x = -12, .y = -4, @@ -2135,7 +2236,7 @@ static const struct Subsprite gUnknown_83E24D8[] = { } }; -static const struct Subsprite gUnknown_83E24E0[] = { +static const struct Subsprite sSubsprites_Button[] = { { .x = -20, .y = -12, @@ -2181,7 +2282,7 @@ static const struct Subsprite gUnknown_83E24E0[] = { } }; -static const struct Subsprite gUnknown_83E24F8[] = { +static const struct Subsprite sSubsprites_PCIcon[] = { { .x = -8, .y = -12, @@ -2206,163 +2307,163 @@ static const struct Subsprite gUnknown_83E24F8[] = { } }; -static const struct SubspriteTable gUnknown_83E2504[] = { - subsprite_table(gUnknown_83E24B8) +static const struct SubspriteTable sSubspriteTable_PageSwapFrame[] = { + {ARRAY_COUNT(sSubsprites_PageSwapFrame), sSubsprites_PageSwapFrame} }; -static const struct SubspriteTable gUnknown_83E250C[] = { - subsprite_table(gUnknown_83E24D8), - subsprite_table(gUnknown_83E24D8), - subsprite_table(gUnknown_83E24D8) +static const struct SubspriteTable sSubspriteTable_PageSwapText[] = { + {ARRAY_COUNT(sSubsprites_PageSwapText), sSubsprites_PageSwapText}, + {ARRAY_COUNT(sSubsprites_PageSwapText), sSubsprites_PageSwapText}, + {ARRAY_COUNT(sSubsprites_PageSwapText), sSubsprites_PageSwapText} }; -static const struct SubspriteTable gUnknown_83E2524[] = { - subsprite_table(gUnknown_83E24E0) +static const struct SubspriteTable sSubspriteTable_Button[] = { + {ARRAY_COUNT(sSubsprites_Button), sSubsprites_Button} }; -static const struct SubspriteTable gUnknown_83E252C[] = { - subsprite_table(gUnknown_83E24F8) +static const struct SubspriteTable sSubspriteTable_PCIcon[] = { + {ARRAY_COUNT(sSubsprites_PCIcon), sSubsprites_PCIcon} }; -static const struct SpriteFrameImage gUnknown_0858C080[] = { - {gUnknown_83E1800, sizeof(gUnknown_83E1800)}, - {gUnknown_83E18C0, sizeof(gUnknown_83E18C0)}, +static const struct SpriteFrameImage sImageTable_PCIcon[] = { + {sPCIconOff_Gfx, sizeof(sPCIconOff_Gfx)}, + {sPCIconOn_Gfx, sizeof(sPCIconOn_Gfx)}, }; -static const union AnimCmd gSpriteAnim_858C090[] = { +static const union AnimCmd sAnim_Loop[] = { ANIMCMD_FRAME(0, 1), ANIMCMD_JUMP(0) }; -static const union AnimCmd gSpriteAnim_858C098[] = { +static const union AnimCmd sAnim_CursorSquish[] = { ANIMCMD_FRAME(4, 8), ANIMCMD_FRAME(8, 8), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_858C0A4[] = { +static const union AnimCmd sAnim_PCIcon[] = { ANIMCMD_FRAME(0, 2), ANIMCMD_FRAME(1, 2), ANIMCMD_JUMP(0) }; -static const union AnimCmd *const gSpriteAnimTable_858C0B0[] = { - gSpriteAnim_858C090 +static const union AnimCmd *const sAnims_Loop[] = { + sAnim_Loop }; -static const union AnimCmd *const gSpriteAnimTable_858C0B4[] = { - gSpriteAnim_858C090, - gSpriteAnim_858C098 +static const union AnimCmd *const sAnims_Cursor[] = { + sAnim_Loop, + sAnim_CursorSquish }; -static const union AnimCmd *const gSpriteAnimTable_858C0BC[] = { - gSpriteAnim_858C0A4 +static const union AnimCmd *const sAnims_PCIcon[] = { + sAnim_PCIcon }; -static const struct SpriteTemplate gUnknown_83E2574 = { - .tileTag = 0x0002, - .paletteTag = 0x0004, - .oam = &gOamData_858BFEC, - .anims = gSpriteAnimTable_858C0B0, +static const struct SpriteTemplate sSpriteTemplate_PageSwapFrame = { + .tileTag = GFXTAG_PAGE_SWAP_FRAME, + .paletteTag = PALTAG_PAGE_SWAP, + .oam = &sOam_8x8, + .anims = sAnims_Loop, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCB_PageSwap }; -static const struct SpriteTemplate gUnknown_83E258C = { - .tileTag = 0x0003, - .paletteTag = 0x0001, - .oam = &gOamData_858BFFC, - .anims = gSpriteAnimTable_858C0B0, +static const struct SpriteTemplate sSpriteTemplate_PageSwapButton = { + .tileTag = GFXTAG_PAGE_SWAP_BUTTON, + .paletteTag = PALTAG_PAGE_SWAP_UPPER, + .oam = &sOam_32x16, + .anims = sAnims_Loop, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; -static const struct SpriteTemplate gUnknown_83E25A4 = { - .tileTag = 0x0004, - .paletteTag = 0x0004, - .oam = &gOamData_858BFEC, - .anims = gSpriteAnimTable_858C0B0, +static const struct SpriteTemplate sSpriteTemplate_PageSwapText = { + .tileTag = GFXTAG_PAGE_SWAP_UPPER, + .paletteTag = PALTAG_PAGE_SWAP, + .oam = &sOam_8x8, + .anims = sAnims_Loop, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; -static const struct SpriteTemplate gUnknown_83E25BC = { - .tileTag = 0x0000, - .paletteTag = 0x0006, - .oam = &gOamData_858BFEC, - .anims = gSpriteAnimTable_858C0B0, +static const struct SpriteTemplate sSpriteTemplate_BackButton = { + .tileTag = GFXTAG_BACK_BUTTON, + .paletteTag = PALTAG_BACK_BUTTON, + .oam = &sOam_8x8, + .anims = sAnims_Loop, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; -static const struct SpriteTemplate gUnknown_83E25D4 = { - .tileTag = 0x0001, - .paletteTag = 0x0007, - .oam = &gOamData_858BFEC, - .anims = gSpriteAnimTable_858C0B0, +static const struct SpriteTemplate sSpriteTemplate_OkButton = { + .tileTag = GFXTAG_OK_BUTTON, + .paletteTag = PALTAG_OK_BUTTON, + .oam = &sOam_8x8, + .anims = sAnims_Loop, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; -static const struct SpriteTemplate gUnknown_83E25EC = { - .tileTag = 0x0007, - .paletteTag = 0x0005, - .oam = &gOamData_858BFF4, - .anims = gSpriteAnimTable_858C0B4, +static const struct SpriteTemplate sSpriteTemplate_Cursor = { + .tileTag = GFXTAG_CURSOR, + .paletteTag = PALTAG_CURSOR, + .oam = &sOam_16x16, + .anims = sAnims_Cursor, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_809E700 + .callback = SpriteCB_Cursor }; static const struct SpriteTemplate sSpriteTemplate_InputArrow = { - .tileTag = 0x000A, - .paletteTag = 0x0003, - .oam = &gOamData_858BFEC, - .anims = gSpriteAnimTable_858C0B0, + .tileTag = GFXTAG_INPUT_ARROW, + .paletteTag = PALTAG_PAGE_SWAP_OTHERS, + .oam = &sOam_8x8, + .anims = sAnims_Loop, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_809E7F0 + .callback = SpriteCB_InputArrow }; static const struct SpriteTemplate sSpriteTemplate_Underscore = { - .tileTag = 0x000B, - .paletteTag = 0x0003, - .oam = &gOamData_858BFEC, - .anims = gSpriteAnimTable_858C0B0, + .tileTag = GFXTAG_UNDERSCORE, + .paletteTag = PALTAG_PAGE_SWAP_OTHERS, + .oam = &sOam_8x8, + .anims = sAnims_Loop, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_809E83C + .callback = SpriteCB_Underscore }; -static const struct SpriteTemplate gUnknown_83E2634 = { - .tileTag = 0xFFFF, - .paletteTag = 0x0000, - .oam = &gOamData_858BFEC, - .anims = gSpriteAnimTable_858C0BC, - .images = gUnknown_0858C080, +static const struct SpriteTemplate sSpriteTemplate_PCIcon = { + .tileTag = TAG_NONE, + .paletteTag = PALTAG_MENU, + .oam = &sOam_8x8, + .anims = sAnims_PCIcon, + .images = sImageTable_PCIcon, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; static const u8 *const sNamingScreenKeyboardText[KBPAGE_COUNT][KBROW_COUNT] = { - [KBPAGE_LETTERS_LOWER] = { + [KEYBOARD_LETTERS_LOWER] = { gText_NamingScreenKeyboard_abcdef, gText_NamingScreenKeyboard_ghijkl, gText_NamingScreenKeyboard_mnopqrs, gText_NamingScreenKeyboard_tuvwxyz }, - [KBPAGE_LETTERS_UPPER] = { + [KEYBOARD_LETTERS_UPPER] = { gText_NamingScreenKeyboard_ABCDEF, gText_NamingScreenKeyboard_GHIJKL, gText_NamingScreenKeyboard_MNOPQRS, gText_NamingScreenKeyboard_TUVWXYZ }, - [KBPAGE_SYMBOLS] = { + [KEYBOARD_SYMBOLS] = { gText_NamingScreenKeyboard_01234, gText_NamingScreenKeyboard_56789, gText_NamingScreenKeyboard_Symbols1, @@ -2370,31 +2471,30 @@ static const u8 *const sNamingScreenKeyboardText[KBPAGE_COUNT][KBROW_COUNT] = { }, }; -// FIXME: Sync with Emerald -static const struct SpriteSheet gUnknown_83E267C[] = { - {gUnknown_8E98858, 0x1E0, 0x0000}, - {gUnknown_8E98A38, 0x1E0, 0x0001}, - {gUnknown_8E985D8, 0x280, 0x0002}, - {gUnknown_8E98FD8, 0x100, 0x0003}, - {gUnknown_8E98C18, 0x060, 0x0004}, - {gUnknown_8E98CB8, 0x060, 0x0005}, - {gUnknown_8E98D58, 0x060, 0x0006}, - {gUnknown_8E98DF8, 0x080, 0x0007}, - {gUnknown_8E98E98, 0x080, 0x0008}, - {gUnknown_8E98F38, 0x080, 0x0009}, - {gUnknown_8E990D8, 0x020, 0x000A}, - {gUnknown_8E990F8, 0x020, 0x000B}, +static const struct SpriteSheet sSpriteSheets[] = { + {gNamingScreenBackButton_Gfx, 0x1E0, GFXTAG_BACK_BUTTON}, + {gNamingScreenOKButton_Gfx, 0x1E0, GFXTAG_OK_BUTTON}, + {gNamingScreenPageSwapFrame_Gfx, 0x280, GFXTAG_PAGE_SWAP_FRAME}, + {gNamingScreenPageSwapButton_Gfx, 0x100, GFXTAG_PAGE_SWAP_BUTTON}, + {gNamingScreenPageSwapUpper_Gfx, 0x060, GFXTAG_PAGE_SWAP_UPPER}, + {gNamingScreenPageSwapLower_Gfx, 0x060, GFXTAG_PAGE_SWAP_LOWER}, + {gNamingScreenPageSwapOthers_Gfx, 0x060, GFXTAG_PAGE_SWAP_OTHERS}, + {gNamingScreenCursor_Gfx, 0x080, GFXTAG_CURSOR}, + {gNamingScreenCursorSquished_Gfx, 0x080, GFXTAG_CURSOR_SQUISHED}, + {gNamingScreenCursorFilled_Gfx, 0x080, GFXTAG_CURSOR_FILLED}, + {gNamingScreenInputArrow_Gfx, 0x020, GFXTAG_INPUT_ARROW}, + {gNamingScreenUnderscore_Gfx, 0x020, GFXTAG_UNDERSCORE}, {} // terminator }; -static const struct SpritePalette gUnknown_83E26E4[] = { - {gNamingScreenMenu_Pal, 0x0000}, - {gNamingScreenMenu_Pal + 0x10, 0x0001}, - {gNamingScreenMenu_Pal + 0x20, 0x0002}, - {gNamingScreenMenu_Pal + 0x30, 0x0003}, - {gNamingScreenMenu_Pal + 0x40, 0x0004}, - {gNamingScreenMenu_Pal + 0x50, 0x0005}, - {gNamingScreenMenu_Pal + 0x40, 0x0006}, - {gNamingScreenMenu_Pal + 0x40, 0x0007}, +static const struct SpritePalette sSpritePalettes[] = { + {gNamingScreenMenu_Pal[0], PALTAG_MENU}, + {gNamingScreenMenu_Pal[1], PALTAG_PAGE_SWAP_UPPER}, + {gNamingScreenMenu_Pal[2], PALTAG_PAGE_SWAP_LOWER}, + {gNamingScreenMenu_Pal[3], PALTAG_PAGE_SWAP_OTHERS}, + {gNamingScreenMenu_Pal[4], PALTAG_PAGE_SWAP}, + {gNamingScreenMenu_Pal[5], PALTAG_CURSOR}, + {gNamingScreenMenu_Pal[4], PALTAG_BACK_BUTTON}, + {gNamingScreenMenu_Pal[4], PALTAG_OK_BUTTON}, {} // terminator }; diff --git a/src/new_menu_helpers.c b/src/new_menu_helpers.c index 39b86e132..e11dbb36b 100644 --- a/src/new_menu_helpers.c +++ b/src/new_menu_helpers.c @@ -425,16 +425,16 @@ u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed void AddTextPrinterDiffStyle(bool8 allowSkippingDelayWithButtonPress) { - u8 result; + u8 color; void *nptr = NULL; gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress; - result = ContextNpcGetTextColor(); - if (result == 0) + color = ContextNpcGetTextColor(); + if (color == NPC_TEXT_COLOR_MALE) AddTextPrinterParameterized2(0, FONT_4, gStringVar4, GetTextSpeedSetting(), nptr, TEXT_COLOR_BLUE, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY); - else if (result == 1) + else if (color == NPC_TEXT_COLOR_FEMALE) AddTextPrinterParameterized2(0, FONT_5, gStringVar4, GetTextSpeedSetting(), nptr, TEXT_COLOR_RED, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY); - else + else // NPC_TEXT_COLOR_MON / NPC_TEXT_COLOR_NEUTRAL AddTextPrinterParameterized2(0, FONT_2, gStringVar4, GetTextSpeedSetting(), nptr, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY); } diff --git a/src/overworld.c b/src/overworld.c index cefc6c140..23c59a729 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -439,7 +439,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; @@ -454,7 +454,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; @@ -757,7 +757,7 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum) ResetCyclingRoadChallengeData(); RestartWildEncounterImmunitySteps(); MapResetTrainerRematches(mapGroup, mapNum); - SetSav1WeatherFromCurrMapHeader(); + SetSavedWeatherFromCurrMapHeader(); ChooseAmbientCrySpecies(); SetDefaultFlashLevel(); Overworld_ClearSavedMusic(); @@ -792,7 +792,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); @@ -814,7 +814,7 @@ static void sub_80559A8(void) LoadObjEventTemplatesFromHeader(); isOutdoors = IsMapTypeOutdoors(gMapHeader.mapType); TrySetMapSaveWarpStatus(); - SetSav1WeatherFromCurrMapHeader(); + SetSavedWeatherFromCurrMapHeader(); ChooseAmbientCrySpecies(); SetDefaultFlashLevel(); sub_8110920(); @@ -957,7 +957,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/pokedex_screen.c b/src/pokedex_screen.c index 764d3c770..17f29ac13 100644 --- a/src/pokedex_screen.c +++ b/src/pokedex_screen.c @@ -797,7 +797,7 @@ const u8 (*const sCategoryPageIconCoords[])[4] = { sPageIconCoords_4Mons, }; -static const u8 * const sDexCategoryNamePtrs[] = { +static const u8 *const sDexCategoryNamePtrs[] = { gText_DexCategory_GrasslandPkmn, gText_DexCategory_ForestPkmn, gText_DexCategory_WatersEdgePkmn, diff --git a/src/pokemon.c b/src/pokemon.c index e2bfb20cf..bf8daac60 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1473,8 +1473,8 @@ const struct SpriteTemplate gSpriteTemplates_Battlers[] = .paletteTag = 0, .oam = &gOamData_BattlerPlayer, .anims = NULL, - .images = gSpriteImages_BattlerPlayerLeft, - .affineAnims = gSpriteAffineAnimTable_BattlerPlayer, + .images = gBattlerPicTable_PlayerLeft, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, .callback = SpriteCB_AllyMon, }, [B_POSITION_OPPONENT_LEFT] = { @@ -1482,8 +1482,8 @@ const struct SpriteTemplate gSpriteTemplates_Battlers[] = .paletteTag = 0, .oam = &gOamData_BattlerOpponent, .anims = NULL, - .images = gSpriteImages_BattlerOpponentLeft, - .affineAnims = gSpriteAffineAnimTable_BattlerOpponent, + .images = gBattlerPicTable_OpponentLeft, + .affineAnims = gAffineAnims_BattleSpriteOpponentSide, .callback = SpriteCB_EnemyMon, }, [B_POSITION_PLAYER_RIGHT] = { @@ -1491,8 +1491,8 @@ const struct SpriteTemplate gSpriteTemplates_Battlers[] = .paletteTag = 0, .oam = &gOamData_BattlerPlayer, .anims = NULL, - .images = gSpriteImages_BattlerPlayerRight, - .affineAnims = gSpriteAffineAnimTable_BattlerPlayer, + .images = gBattlerPicTable_PlayerRight, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, .callback = SpriteCB_AllyMon, }, [B_POSITION_OPPONENT_RIGHT] = { @@ -1500,8 +1500,8 @@ const struct SpriteTemplate gSpriteTemplates_Battlers[] = .paletteTag = 0, .oam = &gOamData_BattlerOpponent, .anims = NULL, - .images = gSpriteImages_BattlerOpponentRight, - .affineAnims = gSpriteAffineAnimTable_BattlerOpponent, + .images = gBattlerPicTable_OpponentRight, + .affineAnims = gAffineAnims_BattleSpriteOpponentSide, .callback = SpriteCB_EnemyMon, }, }; @@ -1514,7 +1514,7 @@ const struct SpriteTemplate gSpriteTemplates_TrainerBackpics[] = .oam = &gOamData_BattlerPlayer, .anims = NULL, .images = gTrainerBackPicTable_Red, - .affineAnims = gSpriteAffineAnimTable_BattlerPlayer, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, .callback = SpriteCB_AllyMon, }, { @@ -1523,7 +1523,7 @@ const struct SpriteTemplate gSpriteTemplates_TrainerBackpics[] = .oam = &gOamData_BattlerPlayer, .anims = NULL, .images = gTrainerBackPicTable_Leaf, - .affineAnims = gSpriteAffineAnimTable_BattlerPlayer, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, .callback = SpriteCB_AllyMon, }, { @@ -1532,7 +1532,7 @@ const struct SpriteTemplate gSpriteTemplates_TrainerBackpics[] = .oam = &gOamData_BattlerPlayer, .anims = NULL, .images = gTrainerBackPicTable_RSBrendan, - .affineAnims = gSpriteAffineAnimTable_BattlerPlayer, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, .callback = SpriteCB_AllyMon, }, { @@ -1541,7 +1541,7 @@ const struct SpriteTemplate gSpriteTemplates_TrainerBackpics[] = .oam = &gOamData_BattlerPlayer, .anims = NULL, .images = gTrainerBackPicTable_RSMay, - .affineAnims = gSpriteAffineAnimTable_BattlerPlayer, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, .callback = SpriteCB_AllyMon, }, { @@ -1550,7 +1550,7 @@ const struct SpriteTemplate gSpriteTemplates_TrainerBackpics[] = .oam = &gOamData_BattlerPlayer, .anims = NULL, .images = gTrainerBackPicTable_Pokedude, - .affineAnims = gSpriteAffineAnimTable_BattlerPlayer, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, .callback = SpriteCB_AllyMon, }, { @@ -1559,7 +1559,7 @@ const struct SpriteTemplate gSpriteTemplates_TrainerBackpics[] = .oam = &gOamData_BattlerPlayer, .anims = NULL, .images = gTrainerBackPicTable_OldMan, - .affineAnims = gSpriteAffineAnimTable_BattlerPlayer, + .affineAnims = gAffineAnims_BattleSpritePlayerSide, .callback = SpriteCB_AllyMon, }, }; @@ -1856,7 +1856,7 @@ void CreateMonWithGenderNatureLetter(struct Pokemon *mon, u16 species, u8 level, { u32 personality; - if ((u8)(unownLetter - 1) < 28) + if ((u8)(unownLetter - 1) < NUM_UNOWN_FORMS) { u16 actualLetter; @@ -2747,7 +2747,7 @@ void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition) } } gMultiuseSpriteTemplate.paletteTag = speciesTag; - gMultiuseSpriteTemplate.anims = gSpriteAnimTable_82349BC; + gMultiuseSpriteTemplate.anims = gAnims_MonPic; } void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition) @@ -3919,7 +3919,7 @@ static void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex) *hpSwitchout = gBattleMons[battlerId].hp; for (i = 0; i < 8; i++) - gBattleMons[battlerId].statStages[i] = 6; + gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE; gBattleMons[battlerId].status2 = 0; UpdateSentPokesToOpponentValue(battlerId); @@ -6125,7 +6125,7 @@ static void OakSpeechNidoranFSetupTemplateDummy(struct OakSpeechNidoranFStruct * for (j = 0; j < structPtr->frameCount; ++j) structPtr->frameImages[i * structPtr->spriteCount + j].data = &structPtr->bufferPtrs[i][j * 0x800]; structPtr->templates[i].images = &structPtr->frameImages[i * structPtr->spriteCount]; // should be frameCount logically - structPtr->templates[i].anims = gSpriteAnimTable_82349BC; + structPtr->templates[i].anims = gAnims_MonPic; structPtr->templates[i].paletteTag = i; } } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index fa3731083..0b510f5e8 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -626,14 +626,14 @@ static const u32 sBgTilemap_MovesPage[] = INCBIN_U32( "graphics/interface/pokesu #include "data/text/nature_names.h" -static const u8 * const sEggHatchTimeTexts[] = { +static const u8 *const sEggHatchTimeTexts[] = { gText_PokeSum_EggHatch_LongTime, gText_PokeSum_EggHatch_SomeTime, gText_PokeSum_EggHatch_Soon, gText_PokeSum_EggHatch_AlmostReady }; -static const u8 * const sEggOriginTexts[] = { +static const u8 *const sEggOriginTexts[] = { gText_PokeSum_EggOrigin_DayCare, gText_PokeSum_EggOrigin_Trade, gText_PokeSum_EggOrigin_TravelingMan, 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/rom_header_gf.c b/src/rom_header_gf.c index 9b7975c72..ee6dffcbd 100644 --- a/src/rom_header_gf.c +++ b/src/rom_header_gf.c @@ -16,7 +16,7 @@ struct GFRomHeader const struct CompressedSpriteSheet * monBackPics; const struct CompressedSpritePalette * monNormalPalettes; const struct CompressedSpritePalette * monShinyPalettes; - const u8 * const * monIcons; + const u8 *const * monIcons; const u8 * monIconPaletteIds; const struct SpritePalette * monIconPalettes; const u8 (* monSpeciesNames)[]; @@ -63,7 +63,7 @@ struct GFRomHeader u32 unk18; const struct BaseStats * baseStats; const u8 (* abilityNames)[]; - const u8 * const * abilityDescriptions; + const u8 *const * abilityDescriptions; const struct Item * items; const struct BattleMove * moves; const struct CompressedSpriteSheet * ballGfx; diff --git a/src/scrcmd.c b/src/scrcmd.c index 823593623..37e7bfefb 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)); @@ -577,7 +578,7 @@ bool8 ScrCmd_incrementgamestat(struct ScriptContext * ctx) return FALSE; } -bool8 ScrCmd_comparestattoword(struct ScriptContext * ctx) +bool8 ScrCmd_comparestat(struct ScriptContext * ctx) { u8 statIdx = ScriptReadByte(ctx); u32 value = ScriptReadWord(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,48 +1539,48 @@ 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; } bool8 ScrCmd_braillemessage(struct ScriptContext * ctx) { - u8 *ptr = (u8 *)ScriptReadWord(ctx); - if (ptr == NULL) - ptr = (u8 *)ctx->data[0]; + u8 *msg = (u8 *)ScriptReadWord(ctx); + if (msg == NULL) + msg = (u8 *)ctx->data[0]; LoadStdWindowFrameGfx(); DrawDialogueFrame(0, 1); - AddTextPrinterParameterized(0, FONT_6, ptr, 0, 1, 0, NULL); + AddTextPrinterParameterized(0, FONT_BRAILLE, msg, 0, 1, 0, NULL); return FALSE; } bool8 ScrCmd_getbraillestringwidth(struct ScriptContext * ctx) { - u8 *ptr = (u8 *)ScriptReadWord(ctx); - if (ptr == NULL) - ptr = (u8 *)ctx->data[0]; + u8 *msg = (u8 *)ScriptReadWord(ctx); + if (msg == NULL) + msg = (u8 *)ctx->data[0]; - gSpecialVar_0x8004 = GetStringWidth(FONT_6, ptr, -1); + gSpecialVar_0x8004 = GetStringWidth(FONT_BRAILLE, msg, -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/shop.c b/src/shop.c index e9eb7097f..7f815c486 100644 --- a/src/shop.c +++ b/src/shop.c @@ -217,7 +217,7 @@ static u8 CreateShopMenu(u8 a0) { gShopData.martType = GetMartTypeFromItemList(a0); gShopData.selectedRow = 0; - if (ContextNpcGetTextColor() == 0) + if (ContextNpcGetTextColor() == NPC_TEXT_COLOR_MALE) gShopData.fontId = FONT_4; else gShopData.fontId = FONT_5; diff --git a/src/trainer_pokemon_sprites.c b/src/trainer_pokemon_sprites.c index 0740ecdcf..2b58063b8 100644 --- a/src/trainer_pokemon_sprites.c +++ b/src/trainer_pokemon_sprites.c @@ -1,16 +1,7 @@ #include "global.h" #include "gflib.h" #include "decompress.h" - -extern const struct CompressedSpriteSheet gMonFrontPicTable[]; -extern const struct CompressedSpriteSheet gMonBackPicTable[]; -extern const struct CompressedSpriteSheet gTrainerFrontPicTable[]; -extern const struct CompressedSpriteSheet gTrainerBackPicTable[]; -extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; -extern const union AnimCmd *const gSpriteAnimTable_82349BC[]; -extern const union AnimCmd *const *const gTrainerFrontAnimsPtrTable[]; - -// Static type declarations +#include "data.h" struct PicData { @@ -131,7 +122,7 @@ void LoadPicPaletteBySlot(u16 species, u32 otId, u32 personality, u8 paletteSlot void AssignSpriteAnimsTable(bool8 isTrainer) { if (!isTrainer) - sCreatingSpriteTemplate.anims = gSpriteAnimTable_82349BC; + sCreatingSpriteTemplate.anims = gAnims_MonPic; else sCreatingSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[0]; } 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) diff --git a/src/vs_seeker.c b/src/vs_seeker.c index 47c2e251b..f3a1476c9 100644 --- a/src/vs_seeker.c +++ b/src/vs_seeker.c @@ -575,7 +575,7 @@ static const u8 sMovementScript_TrainerNoRematch[] = { }; static const u8 sMovementScript_TrainerRematch[] = { - MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_DOWN, + MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_DOWN, MOVEMENT_ACTION_EMOTE_DOUBLE_EXCL_MARK, MOVEMENT_ACTION_STEP_END }; @@ -640,9 +640,9 @@ void VsSeekerResetObjectMovementAfterChargeComplete(void) { if ((templates[i].objUnion.normal.trainerType == TRAINER_TYPE_NORMAL || templates[i].objUnion.normal.trainerType == TRAINER_TYPE_BURIED) - && (templates[i].objUnion.normal.movementType == MOVEMENT_TYPE_VS_SEEKER_4D - || templates[i].objUnion.normal.movementType == MOVEMENT_TYPE_VS_SEEKER_4E - || templates[i].objUnion.normal.movementType == MOVEMENT_TYPE_VS_SEEKER_4F)) + && (templates[i].objUnion.normal.movementType == MOVEMENT_TYPE_RAISE_HAND_AND_STOP + || templates[i].objUnion.normal.movementType == MOVEMENT_TYPE_RAISE_HAND_AND_JUMP + || templates[i].objUnion.normal.movementType == MOVEMENT_TYPE_RAISE_HAND_AND_SWIM)) { movementType = GetRandomFaceDirectionMovementType(); TryGetObjectEventIdByLocalIdAndMap(templates[i].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objEventId); @@ -700,7 +700,9 @@ static void ResetMovementOfRematchableTrainers(void) for (i = 0; i < OBJECT_EVENTS_COUNT; i++) { struct ObjectEvent * objectEvent = &gObjectEvents[i]; - if (objectEvent->movementType == MOVEMENT_TYPE_VS_SEEKER_4D || objectEvent->movementType == MOVEMENT_TYPE_VS_SEEKER_4E || objectEvent->movementType == MOVEMENT_TYPE_VS_SEEKER_4F) + if (objectEvent->movementType == MOVEMENT_TYPE_RAISE_HAND_AND_STOP + || objectEvent->movementType == MOVEMENT_TYPE_RAISE_HAND_AND_JUMP + || objectEvent->movementType == MOVEMENT_TYPE_RAISE_HAND_AND_SWIM) { u8 movementType = GetRandomFaceDirectionMovementType(); if (objectEvent->active && gSprites[objectEvent->spriteId].data[0] == i) @@ -1144,13 +1146,13 @@ static u8 GetRunningBehaviorFromGraphicsId(u8 graphicsId) case OBJ_EVENT_GFX_BLACKBELT: case OBJ_EVENT_GFX_HIKER: case OBJ_EVENT_GFX_SAILOR: - return MOVEMENT_TYPE_VS_SEEKER_4E; + return MOVEMENT_TYPE_RAISE_HAND_AND_JUMP; case OBJ_EVENT_GFX_TUBER_M_WATER: case OBJ_EVENT_GFX_SWIMMER_M_WATER: case OBJ_EVENT_GFX_SWIMMER_F_WATER: - return MOVEMENT_TYPE_VS_SEEKER_4F; + return MOVEMENT_TYPE_RAISE_HAND_AND_SWIM; default: - return MOVEMENT_TYPE_VS_SEEKER_4D; + return MOVEMENT_TYPE_RAISE_HAND_AND_STOP; } } diff --git a/sym_ewram.txt b/sym_ewram.txt index 9fe766a2b..719497748 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -132,7 +132,6 @@ .include "src/pokemon_jump.o" .include "src/berry_crush.o" .include "src/dodrio_berry_picking.o" - .include "src/dodrio_berry_picking_2.o" .include "src/teachy_tv.o" .include "src/digit_obj_util.o" .include "src/trainer_tower.o"