mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Finish updating macro comments
This commit is contained in:
parent
b5b5d95de6
commit
c89dfd9f56
@ -76,63 +76,62 @@
|
|||||||
.byte \function
|
.byte \function
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Executes a script stored in a default RAM location.
|
@ Equivalent to the 'return' command for a RAM script.
|
||||||
.macro returnram
|
.macro returnram
|
||||||
.byte 0x0c
|
.byte 0x0c
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Terminates script execution and "resets the script RAM".
|
@ Equivalent to the 'end' command for a RAM script.
|
||||||
.macro killscript
|
.macro endram
|
||||||
.byte 0x0d
|
.byte 0x0d
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Sets some status related to Mystery Event.
|
@ Sets the Mystery Event script status (MEVENT_STATUS_*).
|
||||||
.macro setmysteryeventstatus value:req
|
.macro setmysteryeventstatus value:req
|
||||||
.byte 0x0e
|
.byte 0x0e
|
||||||
.byte \value
|
.byte \value
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Sets the specified script bank to value.
|
@ Sets the value at the specified script data index to a fixed 4-byte value.
|
||||||
.macro loadword destination:req, value:req
|
.macro loadword destIndex:req, value:req
|
||||||
.byte 0x0f
|
.byte 0x0f
|
||||||
.byte \destination
|
.byte \destIndex
|
||||||
.4byte \value
|
.4byte \value
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Sets the specified script bank to value.
|
@ Sets the value at the specified script data index to a fixed byte value.
|
||||||
.macro loadbyte destination:req, value:req
|
.macro loadbyte destIndex:req, value:req
|
||||||
.byte 0x10
|
.byte 0x10
|
||||||
.byte \destination
|
.byte \destIndex
|
||||||
.byte \value
|
.byte \value
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Sets the byte at offset to value.
|
@ Sets the value at the specified pointer.
|
||||||
.macro writebytetoaddr value:req, offset:req
|
.macro setptr value:req, ptr:req
|
||||||
.byte 0x11
|
.byte 0x11
|
||||||
.byte \value
|
.byte \value
|
||||||
.4byte \offset
|
.4byte \ptr
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Copies the byte value at source into the specified script bank.
|
@ Sets the value at the specified script data index to the value at pointer 'source'.
|
||||||
.macro loadbytefromaddr destination:req, source:req
|
.macro loadbytefromptr destIndex:req, source:req
|
||||||
.byte 0x12
|
.byte 0x12
|
||||||
.byte \destination
|
.byte \destIndex
|
||||||
.4byte \source
|
.4byte \source
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ TODO
|
@ Sets the value at pointer 'destination' to the contents of the script data at 'srcIndex'.
|
||||||
@ 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 srcIndex:req, destination:req
|
||||||
.macro setptrbyte source:req, destination:req
|
|
||||||
.byte 0x13
|
.byte 0x13
|
||||||
.byte \source
|
.byte \srcIndex
|
||||||
.4byte \destination
|
.4byte \destination
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Copies the contents of bank source into bank destination.
|
@ Copies the contents of the script data from one index to another.
|
||||||
.macro copylocal destination:req, source:req
|
.macro copylocal destIndex:req, srcIndex:req
|
||||||
.byte 0x14
|
.byte 0x14
|
||||||
.byte \destination
|
.byte \destIndex
|
||||||
.byte \source
|
.byte \srcIndex
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Copies the byte at source to destination, replacing whatever byte was previously there.
|
@ Copies the byte at source to destination, replacing whatever byte was previously there.
|
||||||
@ -177,56 +176,64 @@
|
|||||||
.2byte \source
|
.2byte \source
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Compares the values of script banks a and b, after forcing the values to bytes.
|
@ Compares the values of the script data at indexes 'local1' and 'local2'.
|
||||||
.macro compare_local_to_local byte1:req, byte2:req
|
@ 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 0x1b
|
||||||
.byte \byte1
|
.byte \local1
|
||||||
.byte \byte2
|
.byte \local2
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Compares the least-significant byte of the value of script bank a to a fixed byte value (b).
|
@ Compares the value of the script data at index 'local' to a fixed value.
|
||||||
.macro compare_local_to_value a:req, b:req
|
@ 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 0x1c
|
||||||
.byte \a
|
.byte \local
|
||||||
.byte \b
|
.byte \value
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Compares the least-significant byte of the value of script bank a to the byte located at offset b.
|
@ Compares the value of the script data at index 'local' to the value at 'ptr'
|
||||||
.macro compare_local_to_addr a:req, b:req
|
@ 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 0x1d
|
||||||
.byte \a
|
.byte \local
|
||||||
.4byte \b
|
.4byte \ptr
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Compares the byte located at offset a to the least-significant byte of the value of script bank b.
|
@ Compares the value at 'ptr' to the value of the script data at index 'local'.
|
||||||
.macro compare_addr_to_local a:req, b:req
|
@ 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
|
.byte 0x1e
|
||||||
.4byte \a
|
.4byte \ptr
|
||||||
.byte \b
|
.byte \local
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Compares the byte located at offset a to a fixed byte value (b).
|
@ Compares the value at 'ptr' to a fixed value.
|
||||||
.macro compare_addr_to_value a:req, b:req
|
@ 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
|
.byte 0x1f
|
||||||
.4byte \a
|
.4byte \ptr
|
||||||
.byte \b
|
.byte \value
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Compares the byte located at offset a to the byte located at offset b.
|
@ Compares the value at 'ptr1' to the value at 'ptr2'.
|
||||||
.macro compare_addr_to_addr a:req, b:req
|
@ 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
|
.byte 0x20
|
||||||
.4byte \a
|
.4byte \ptr1
|
||||||
.4byte \b
|
.4byte \ptr2
|
||||||
.endm
|
.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
|
.macro compare_var_to_value var:req, value:req
|
||||||
.byte 0x21
|
.byte 0x21
|
||||||
.2byte \var
|
.2byte \var
|
||||||
.2byte \value
|
.2byte \value
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Compares the value of `var1` 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
|
.macro compare_var_to_var var1:req, var2:req
|
||||||
.byte 0x22
|
.byte 0x22
|
||||||
.2byte \var1
|
.2byte \var1
|
||||||
@ -269,9 +276,8 @@
|
|||||||
.2byte SPECIAL_\function
|
.2byte SPECIAL_\function
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific
|
@ Blocks script execution until a command or C 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
|
@ commands and specials. Calling EnableBothScriptContexts for instance will allow execution to continue.
|
||||||
@ state, the script will remain blocked indefinitely (essentially a hang).
|
|
||||||
.macro waitstate
|
.macro waitstate
|
||||||
.byte 0x27
|
.byte 0x27
|
||||||
.endm
|
.endm
|
||||||
@ -308,7 +314,7 @@
|
|||||||
.2byte \minute
|
.2byte \minute
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Runs time based events.
|
@ Updates local time using the RTC and runs time based events.
|
||||||
.macro dotimebasedevents
|
.macro dotimebasedevents
|
||||||
.byte 0x2d
|
.byte 0x2d
|
||||||
.endm
|
.endm
|
||||||
@ -649,12 +655,14 @@
|
|||||||
.2byte \y
|
.2byte \y
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Sets the specified object's invisibility to FALSE.
|
||||||
.macro showobjectat localId:req, map:req
|
.macro showobjectat localId:req, map:req
|
||||||
.byte 0x58
|
.byte 0x58
|
||||||
.2byte \localId
|
.2byte \localId
|
||||||
map \map
|
map \map
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Sets the specified object's invisibility to TRUE.
|
||||||
.macro hideobjectat localId:req, map:req
|
.macro hideobjectat localId:req, map:req
|
||||||
.byte 0x59
|
.byte 0x59
|
||||||
.2byte \localId
|
.2byte \localId
|
||||||
@ -673,7 +681,7 @@
|
|||||||
.byte \direction
|
.byte \direction
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ TODO
|
@ 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
|
.macro trainerbattle type:req, trainer:req, local_id:req, pointer1:req, pointer2, pointer3, pointer4
|
||||||
.byte 0x5c
|
.byte 0x5c
|
||||||
.byte \type
|
.byte \type
|
||||||
@ -770,9 +778,9 @@
|
|||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
|
||||||
@ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this
|
@ Starts a trainer battle using the battle information stored in RAM (usually by the scripts in trainer_battle.inc, which
|
||||||
@ command behind-the-scenes), and blocks script execution until the battle finishes.
|
@ are run by trainerbattle), and blocks script execution until the battle finishes.
|
||||||
.macro trainerbattlebegin
|
.macro dotrainerbattle
|
||||||
.byte 0x5d
|
.byte 0x5d
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ -1129,7 +1137,7 @@
|
|||||||
.byte \growthStage
|
.byte \growthStage
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ This allows you to choose a Pokemon to use in a contest
|
@ Opens the party menu to select a Pokemon for a contest.
|
||||||
.macro choosecontestmon
|
.macro choosecontestmon
|
||||||
.byte 0x8b
|
.byte 0x8b
|
||||||
.endm
|
.endm
|
||||||
@ -1262,7 +1270,7 @@
|
|||||||
.2byte \animation
|
.2byte \animation
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Sets which healing place the player will return to if all of the Pokemon in their party faint.
|
@ Sets which healing location (HEAL_LOCATION_*) the player will return to if all of the Pokemon in their party faint.
|
||||||
.macro setrespawn heallocation:req
|
.macro setrespawn heallocation:req
|
||||||
.byte 0x9f
|
.byte 0x9f
|
||||||
.2byte \heallocation
|
.2byte \heallocation
|
||||||
@ -1437,43 +1445,51 @@
|
|||||||
.byte 0xb7
|
.byte 0xb7
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Sets a relative address to be used by the other vcommands as part of a Mystery Gift script.
|
||||||
.macro setvaddress pointer:req
|
.macro setvaddress pointer:req
|
||||||
.byte 0xb8
|
.byte 0xb8
|
||||||
.4byte \pointer
|
.4byte \pointer
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Equivalent to goto using the relative address set by setvaddress.
|
||||||
.macro vgoto pointer:req
|
.macro vgoto pointer:req
|
||||||
.byte 0xb9
|
.byte 0xb9
|
||||||
.4byte \pointer
|
.4byte \pointer
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Equivalent to call using the relative address set by setvaddress.
|
||||||
.macro vcall pointer:req
|
.macro vcall pointer:req
|
||||||
.byte 0xba
|
.byte 0xba
|
||||||
.4byte \pointer
|
.4byte \pointer
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Equivalent to goto_if using the relative address set by setvaddress.
|
||||||
.macro vgoto_if byte:req, pointer:req
|
.macro vgoto_if byte:req, pointer:req
|
||||||
.byte 0xbb
|
.byte 0xbb
|
||||||
.byte \byte
|
.byte \byte
|
||||||
.4byte \pointer
|
.4byte \pointer
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Equivalent to call_if using the relative address set by setvaddress.
|
||||||
.macro vcall_if byte:req, pointer:req
|
.macro vcall_if byte:req, pointer:req
|
||||||
.byte 0xbc
|
.byte 0xbc
|
||||||
.byte \byte
|
.byte \byte
|
||||||
.4byte \pointer
|
.4byte \pointer
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Equivalent to message using the relative address set by setvaddress.
|
||||||
.macro vmessage pointer:req
|
.macro vmessage pointer:req
|
||||||
.byte 0xbd
|
.byte 0xbd
|
||||||
.4byte \pointer
|
.4byte \pointer
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro vloadptr pointer:req
|
@ Expands the given text at the pointer (- the relative address set by setvaddress) into gStringVar4
|
||||||
|
.macro vbuffermessage ptr:req
|
||||||
.byte 0xbe
|
.byte 0xbe
|
||||||
.4byte \pointer
|
.4byte \ptr
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Equivalent to bufferstring using the relative address set by setvaddress.
|
||||||
.macro vbufferstring stringVarIndex:req, pointer:req
|
.macro vbufferstring stringVarIndex:req, pointer:req
|
||||||
.byte 0xbf
|
.byte 0xbf
|
||||||
stringvar \stringVarIndex
|
stringvar \stringVarIndex
|
||||||
@ -1576,7 +1592,7 @@
|
|||||||
|
|
||||||
@ Jumps to the ram script saved from a Wonder Card. If there is no valid saved Wonder Card or if the
|
@ 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.
|
@ ram script is invalid then this does nothing.
|
||||||
.macro gotowondercardscript
|
.macro trywondercardscript
|
||||||
.byte 0xcf
|
.byte 0xcf
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ -1586,6 +1602,8 @@
|
|||||||
.2byte \worldmapflag
|
.2byte \worldmapflag
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ 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
|
@ 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.
|
@ or a pair of x/y coordinates to go to directly on the destination map.
|
||||||
.macro warpspinenter map:req, a, b, c
|
.macro warpspinenter map:req, a, b, c
|
||||||
@ -1625,6 +1643,8 @@
|
|||||||
.byte 0xd6
|
.byte 0xd6
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Warp used by the teleport tiles in the Mossdeep Gym. Plays SE_WARP_IN and does a simple fade transition.
|
||||||
|
@ Also skips reloading object events by setting SKIP_OBJECT_EVENT_LOAD.
|
||||||
@ Warp commands can be given either the id of which warp location to go to on the destination 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.
|
@ or a pair of x/y coordinates to go to directly on the destination map.
|
||||||
.macro warpmossdeepgym map:req, a, b, c
|
.macro warpmossdeepgym map:req, a, b, c
|
||||||
@ -1655,15 +1675,19 @@
|
|||||||
.4byte \text
|
.4byte \text
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Equivalent to fadescreen but copies gPlttBufferUnfaded to gPaletteDecompressionBuffer on the fade out
|
||||||
|
@ and the reverse on the fade in, in effect saving gPlttBufferUnfaded to restore it.
|
||||||
.macro fadescreenswapbuffers mode:req
|
.macro fadescreenswapbuffers mode:req
|
||||||
.byte 0xdc
|
.byte 0xdc
|
||||||
.byte \mode
|
.byte \mode
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro buffertrainerclassname stringVarId:req, class:req
|
@ Buffers the specified trainer's class name to the given string var.
|
||||||
|
@ If the trainer id is >= TRAINERS_COUNT it will be treated as TRAINER_NONE.
|
||||||
|
.macro buffertrainerclassname stringVarId:req, trainerId:req
|
||||||
.byte 0xdd
|
.byte 0xdd
|
||||||
stringvar \stringVarId
|
stringvar \stringVarId
|
||||||
.2byte \class
|
.2byte \trainerId
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Buffers the specified trainer's name to the given string var.
|
@ Buffers the specified trainer's name to the given string var.
|
||||||
@ -1680,9 +1704,10 @@
|
|||||||
.4byte \text
|
.4byte \text
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Warp with a fade to white. Used during the Sootopolis legendary fight.
|
||||||
@ Warp commands can be given either the id of which warp location to go to on the destination 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.
|
@ or a pair of x/y coordinates to go to directly on the destination map.
|
||||||
.macro warpsootopolislegend map:req, a, b, c
|
.macro warpwhitefade map:req, a, b, c
|
||||||
.byte 0xe0
|
.byte 0xe0
|
||||||
formatwarp \map, \a, \b, \c
|
formatwarp \map, \a, \b, \c
|
||||||
.endm
|
.endm
|
||||||
@ -1835,6 +1860,7 @@
|
|||||||
YES = 1
|
YES = 1
|
||||||
NO = 0
|
NO = 0
|
||||||
|
|
||||||
|
@ Buffers the given text and calls the relevant standard message script (see gStdScripts).
|
||||||
.macro msgbox text:req, type=MSGBOX_DEFAULT
|
.macro msgbox text:req, type=MSGBOX_DEFAULT
|
||||||
loadword 0, \text
|
loadword 0, \text
|
||||||
callstd \type
|
callstd \type
|
||||||
@ -1850,17 +1876,21 @@
|
|||||||
callstd STD_OBTAIN_ITEM
|
callstd STD_OBTAIN_ITEM
|
||||||
.endm
|
.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
|
.macro finditem item:req, amount=1
|
||||||
setorcopyvar VAR_0x8000, \item
|
setorcopyvar VAR_0x8000, \item
|
||||||
setorcopyvar VAR_0x8001, \amount
|
setorcopyvar VAR_0x8001, \amount
|
||||||
callstd STD_FIND_ITEM
|
callstd STD_FIND_ITEM
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Equivalent to giveitem but for a single decoration.
|
||||||
.macro givedecoration decoration:req
|
.macro givedecoration decoration:req
|
||||||
setorcopyvar VAR_0x8000, \decoration
|
setorcopyvar VAR_0x8000, \decoration
|
||||||
callstd STD_OBTAIN_DECORATION
|
callstd STD_OBTAIN_DECORATION
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Registers the specified trainer in Match Call and plays a fanfare with a notification message.
|
||||||
.macro register_matchcall trainer:req
|
.macro register_matchcall trainer:req
|
||||||
setvar VAR_0x8004, \trainer
|
setvar VAR_0x8004, \trainer
|
||||||
special SetMatchCallRegisteredFlag
|
special SetMatchCallRegisteredFlag
|
||||||
@ -1868,6 +1898,7 @@
|
|||||||
callstd STD_REGISTER_MATCH_CALL
|
callstd STD_REGISTER_MATCH_CALL
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ Does a sparkle field effect (e.g. when the Trick Master is hiding) at the given coordinates.
|
||||||
.macro dofieldeffectsparkle x:req, y:req, priority:req
|
.macro dofieldeffectsparkle x:req, y:req, priority:req
|
||||||
setfieldeffectargument 0, \x
|
setfieldeffectargument 0, \x
|
||||||
setfieldeffectargument 1, \y
|
setfieldeffectargument 1, \y
|
||||||
|
@ -565,7 +565,7 @@ SootopolisCity_EventScript_RayquazaSceneFromPokeCenter::
|
|||||||
fadenewbgm MUS_SOOTOPOLIS
|
fadenewbgm MUS_SOOTOPOLIS
|
||||||
delay 120
|
delay 120
|
||||||
clearflag FLAG_HIDE_MAP_NAME_POPUP
|
clearflag FLAG_HIDE_MAP_NAME_POPUP
|
||||||
warpsootopolislegend MAP_SOOTOPOLIS_CITY, 43, 32
|
warpwhitefade MAP_SOOTOPOLIS_CITY, 43, 32
|
||||||
waitstate
|
waitstate
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -618,7 +618,7 @@ SootopolisCity_EventScript_RayquazaSceneFromDive::
|
|||||||
fadenewbgm MUS_SURF
|
fadenewbgm MUS_SURF
|
||||||
delay 120
|
delay 120
|
||||||
clearflag FLAG_HIDE_MAP_NAME_POPUP
|
clearflag FLAG_HIDE_MAP_NAME_POPUP
|
||||||
warpsootopolislegend MAP_SOOTOPOLIS_CITY, 29, 53
|
warpwhitefade MAP_SOOTOPOLIS_CITY, 29, 53
|
||||||
waitstate
|
waitstate
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -13,12 +13,12 @@ gScriptCmdTable::
|
|||||||
.4byte ScrCmd_gotostd_if @ 0x0a
|
.4byte ScrCmd_gotostd_if @ 0x0a
|
||||||
.4byte ScrCmd_callstd_if @ 0x0b
|
.4byte ScrCmd_callstd_if @ 0x0b
|
||||||
.4byte ScrCmd_returnram @ 0x0c
|
.4byte ScrCmd_returnram @ 0x0c
|
||||||
.4byte ScrCmd_killscript @ 0x0d
|
.4byte ScrCmd_endram @ 0x0d
|
||||||
.4byte ScrCmd_setmysteryeventstatus @ 0x0e
|
.4byte ScrCmd_setmysteryeventstatus @ 0x0e
|
||||||
.4byte ScrCmd_loadword @ 0x0f
|
.4byte ScrCmd_loadword @ 0x0f
|
||||||
.4byte ScrCmd_loadbyte @ 0x10
|
.4byte ScrCmd_loadbyte @ 0x10
|
||||||
.4byte ScrCmd_writebytetoaddr @ 0x11
|
.4byte ScrCmd_setptr @ 0x11
|
||||||
.4byte ScrCmd_loadbytefromaddr @ 0x12
|
.4byte ScrCmd_loadbytefromptr @ 0x12
|
||||||
.4byte ScrCmd_setptrbyte @ 0x13
|
.4byte ScrCmd_setptrbyte @ 0x13
|
||||||
.4byte ScrCmd_copylocal @ 0x14
|
.4byte ScrCmd_copylocal @ 0x14
|
||||||
.4byte ScrCmd_copybyte @ 0x15
|
.4byte ScrCmd_copybyte @ 0x15
|
||||||
@ -29,10 +29,10 @@ gScriptCmdTable::
|
|||||||
.4byte ScrCmd_setorcopyvar @ 0x1a
|
.4byte ScrCmd_setorcopyvar @ 0x1a
|
||||||
.4byte ScrCmd_compare_local_to_local @ 0x1b
|
.4byte ScrCmd_compare_local_to_local @ 0x1b
|
||||||
.4byte ScrCmd_compare_local_to_value @ 0x1c
|
.4byte ScrCmd_compare_local_to_value @ 0x1c
|
||||||
.4byte ScrCmd_compare_local_to_addr @ 0x1d
|
.4byte ScrCmd_compare_local_to_ptr @ 0x1d
|
||||||
.4byte ScrCmd_compare_addr_to_local @ 0x1e
|
.4byte ScrCmd_compare_ptr_to_local @ 0x1e
|
||||||
.4byte ScrCmd_compare_addr_to_value @ 0x1f
|
.4byte ScrCmd_compare_ptr_to_value @ 0x1f
|
||||||
.4byte ScrCmd_compare_addr_to_addr @ 0x20
|
.4byte ScrCmd_compare_ptr_to_ptr @ 0x20
|
||||||
.4byte ScrCmd_compare_var_to_value @ 0x21
|
.4byte ScrCmd_compare_var_to_value @ 0x21
|
||||||
.4byte ScrCmd_compare_var_to_var @ 0x22
|
.4byte ScrCmd_compare_var_to_var @ 0x22
|
||||||
.4byte ScrCmd_callnative @ 0x23
|
.4byte ScrCmd_callnative @ 0x23
|
||||||
@ -190,7 +190,7 @@ gScriptCmdTable::
|
|||||||
.4byte ScrCmd_vgoto_if @ 0xbb
|
.4byte ScrCmd_vgoto_if @ 0xbb
|
||||||
.4byte ScrCmd_vcall_if @ 0xbc
|
.4byte ScrCmd_vcall_if @ 0xbc
|
||||||
.4byte ScrCmd_vmessage @ 0xbd
|
.4byte ScrCmd_vmessage @ 0xbd
|
||||||
.4byte ScrCmd_vloadword @ 0xbe
|
.4byte ScrCmd_vbuffermessage @ 0xbe
|
||||||
.4byte ScrCmd_vbufferstring @ 0xbf
|
.4byte ScrCmd_vbufferstring @ 0xbf
|
||||||
.4byte ScrCmd_showcoinsbox @ 0xc0
|
.4byte ScrCmd_showcoinsbox @ 0xc0
|
||||||
.4byte ScrCmd_hidecoinsbox @ 0xc1
|
.4byte ScrCmd_hidecoinsbox @ 0xc1
|
||||||
@ -207,7 +207,7 @@ gScriptCmdTable::
|
|||||||
.4byte ScrCmd_nop1 @ 0xcc
|
.4byte ScrCmd_nop1 @ 0xcc
|
||||||
.4byte ScrCmd_setmoneventlegal @ 0xcd
|
.4byte ScrCmd_setmoneventlegal @ 0xcd
|
||||||
.4byte ScrCmd_checkmoneventlegal @ 0xce
|
.4byte ScrCmd_checkmoneventlegal @ 0xce
|
||||||
.4byte ScrCmd_gotowondercardscript @ 0xcf
|
.4byte ScrCmd_trywondercardscript @ 0xcf
|
||||||
.4byte ScrCmd_nop1 @ 0xd0
|
.4byte ScrCmd_nop1 @ 0xd0
|
||||||
.4byte ScrCmd_warpspinenter @ 0xd1
|
.4byte ScrCmd_warpspinenter @ 0xd1
|
||||||
.4byte ScrCmd_setmonmetlocation @ 0xd2
|
.4byte ScrCmd_setmonmetlocation @ 0xd2
|
||||||
@ -224,7 +224,7 @@ gScriptCmdTable::
|
|||||||
.4byte ScrCmd_buffertrainerclassname @ 0xdd
|
.4byte ScrCmd_buffertrainerclassname @ 0xdd
|
||||||
.4byte ScrCmd_buffertrainername @ 0xde
|
.4byte ScrCmd_buffertrainername @ 0xde
|
||||||
.4byte ScrCmd_pokenavcall @ 0xdf
|
.4byte ScrCmd_pokenavcall @ 0xdf
|
||||||
.4byte ScrCmd_warpsootopolislegend @ 0xe0
|
.4byte ScrCmd_warpwhitefade @ 0xe0
|
||||||
.4byte ScrCmd_buffercontestname @ 0xe1
|
.4byte ScrCmd_buffercontestname @ 0xe1
|
||||||
.4byte ScrCmd_bufferitemnameplural @ 0xe2
|
.4byte ScrCmd_bufferitemnameplural @ 0xe2
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ CableClub_EventScript_MysteryGiftMan::
|
|||||||
end
|
end
|
||||||
|
|
||||||
CableClub_EventScript_TryWonderCardScript::
|
CableClub_EventScript_TryWonderCardScript::
|
||||||
gotowondercardscript
|
trywondercardscript
|
||||||
CableClub_EventScript_MysteryGiftThankYou::
|
CableClub_EventScript_MysteryGiftThankYou::
|
||||||
msgbox gText_ThankYouForAccessingMysteryGift, MSGBOX_NPC
|
msgbox gText_ThankYouForAccessingMysteryGift, MSGBOX_NPC
|
||||||
end
|
end
|
||||||
|
@ -50,7 +50,7 @@ EventScript_DoNoIntroTrainerBattle::
|
|||||||
applymovement VAR_LAST_TALKED, Movement_RevealTrainer
|
applymovement VAR_LAST_TALKED, Movement_RevealTrainer
|
||||||
waitmovement 0
|
waitmovement 0
|
||||||
special PlayTrainerEncounterMusic
|
special PlayTrainerEncounterMusic
|
||||||
trainerbattlebegin
|
dotrainerbattle
|
||||||
gotopostbattlescript
|
gotopostbattlescript
|
||||||
|
|
||||||
EventScript_TryDoRematchBattle::
|
EventScript_TryDoRematchBattle::
|
||||||
@ -117,7 +117,7 @@ EventScript_ShowTrainerIntroMsg::
|
|||||||
goto EventScript_DoTrainerBattle
|
goto EventScript_DoTrainerBattle
|
||||||
|
|
||||||
EventScript_DoTrainerBattle::
|
EventScript_DoTrainerBattle::
|
||||||
trainerbattlebegin
|
dotrainerbattle
|
||||||
@ Below battle mode check only needed in FRLG
|
@ Below battle mode check only needed in FRLG
|
||||||
specialvar VAR_RESULT, GetTrainerBattleMode
|
specialvar VAR_RESULT, GetTrainerBattleMode
|
||||||
compare VAR_RESULT, TRAINER_BATTLE_SINGLE
|
compare VAR_RESULT, TRAINER_BATTLE_SINGLE
|
||||||
|
@ -22,7 +22,7 @@ void FieldCB_ReturnToFieldNoScript(void);
|
|||||||
void FieldCB_ReturnToFieldNoScriptCheckMusic(void);
|
void FieldCB_ReturnToFieldNoScriptCheckMusic(void);
|
||||||
void DoWarp(void);
|
void DoWarp(void);
|
||||||
void DoDiveWarp(void);
|
void DoDiveWarp(void);
|
||||||
void DoSootopolisLegendWarp(void);
|
void DoWhiteFadeWarp(void);
|
||||||
void DoDoorWarp(void);
|
void DoDoorWarp(void);
|
||||||
void DoFallWarp(void);
|
void DoFallWarp(void);
|
||||||
void DoEscalatorWarp(u8 metatileBehavior);
|
void DoEscalatorWarp(u8 metatileBehavior);
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
#ifndef GUARD_MYSTERY_EVENT_SCRIPT_H
|
#ifndef GUARD_MYSTERY_EVENT_SCRIPT_H
|
||||||
#define GUARD_MYSTERY_EVENT_SCRIPT_H
|
#define GUARD_MYSTERY_EVENT_SCRIPT_H
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MEVENT_STATUS_LOAD_OK,
|
||||||
|
MEVENT_STATUS_LOAD_ERROR,
|
||||||
|
MEVENT_STATUS_SUCCESS,
|
||||||
|
MEVENT_STATUS_FAILURE,
|
||||||
|
MEVENT_STATUS_FF = 0xFF
|
||||||
|
};
|
||||||
|
|
||||||
void InitMysteryEventScriptContext(u8 *script);
|
void InitMysteryEventScriptContext(u8 *script);
|
||||||
bool32 RunMysteryEventScriptContextCommand(u32 *script);
|
bool32 RunMysteryEventScriptContextCommand(u32 *status);
|
||||||
u32 RunMysteryEventScript(u8 *script);
|
u32 RunMysteryEventScript(u8 *script);
|
||||||
void SetMysteryEventScriptStatus(u32 val);
|
void SetMysteryEventScriptStatus(u32 val);
|
||||||
u16 GetRecordMixingGift(void);
|
u16 GetRecordMixingGift(void);
|
||||||
|
@ -502,7 +502,7 @@ void DoDiveWarp(void)
|
|||||||
CreateTask(Task_WarpAndLoadMap, 10);
|
CreateTask(Task_WarpAndLoadMap, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoSootopolisLegendWarp(void)
|
void DoWhiteFadeWarp(void)
|
||||||
{
|
{
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
TryFadeOutOldMapMusic();
|
TryFadeOutOldMapMusic();
|
||||||
|
@ -111,16 +111,16 @@ static bool8 GetEventLoadMessage(u8 *dest, u32 status)
|
|||||||
{
|
{
|
||||||
bool8 retVal = TRUE;
|
bool8 retVal = TRUE;
|
||||||
|
|
||||||
if (status == 0)
|
if (status == MEVENT_STATUS_LOAD_OK)
|
||||||
{
|
{
|
||||||
StringCopy(dest, gText_EventSafelyLoaded);
|
StringCopy(dest, gText_EventSafelyLoaded);
|
||||||
retVal = FALSE;
|
retVal = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == 2)
|
if (status == MEVENT_STATUS_SUCCESS)
|
||||||
retVal = FALSE;
|
retVal = FALSE;
|
||||||
|
|
||||||
if (status == 1)
|
if (status == MEVENT_STATUS_LOAD_ERROR)
|
||||||
StringCopy(dest, gText_LoadErrorEndingSession);
|
StringCopy(dest, gText_LoadErrorEndingSession);
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
@ -193,7 +193,7 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetEventLoadMessage(gStringVar4, 1);
|
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
|
||||||
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
||||||
gMain.state = 13;
|
gMain.state = 13;
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
if (GetLinkPlayerDataExchangeStatusTimed(2, 2) == EXCHANGE_DIFF_SELECTIONS)
|
if (GetLinkPlayerDataExchangeStatusTimed(2, 2) == EXCHANGE_DIFF_SELECTIONS)
|
||||||
{
|
{
|
||||||
SetCloseLinkCallback();
|
SetCloseLinkCallback();
|
||||||
GetEventLoadMessage(gStringVar4, 1);
|
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
|
||||||
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
||||||
gMain.state = 13;
|
gMain.state = 13;
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CloseLink();
|
CloseLink();
|
||||||
GetEventLoadMessage(gStringVar4, 1);
|
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
|
||||||
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
||||||
gMain.state = 13;
|
gMain.state = 13;
|
||||||
}
|
}
|
||||||
@ -252,9 +252,9 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
case 11:
|
case 11:
|
||||||
if (gReceivedRemoteLinkPlayers == 0)
|
if (gReceivedRemoteLinkPlayers == 0)
|
||||||
{
|
{
|
||||||
u16 unkVal = RunMysteryEventScript(gDecompressionBuffer);
|
u16 status = RunMysteryEventScript(gDecompressionBuffer);
|
||||||
CpuFill32(0, gDecompressionBuffer, 0x7D4);
|
CpuFill32(0, gDecompressionBuffer, 0x7D4);
|
||||||
if (!GetEventLoadMessage(gStringVar4, unkVal))
|
if (!GetEventLoadMessage(gStringVar4, status))
|
||||||
TrySavingData(SAVE_NORMAL);
|
TrySavingData(SAVE_NORMAL);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
}
|
}
|
||||||
@ -290,7 +290,7 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
if (gLinkStatus & 0x40 && !IsLinkMaster())
|
if (gLinkStatus & 0x40 && !IsLinkMaster())
|
||||||
{
|
{
|
||||||
CloseLink();
|
CloseLink();
|
||||||
GetEventLoadMessage(gStringVar4, 1);
|
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
|
||||||
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
||||||
gMain.state = 13;
|
gMain.state = 13;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,11 @@ extern ScrCmdFunc gMysteryEventScriptCmdTableEnd[];
|
|||||||
#define LANGUAGE_MASK 0x1
|
#define LANGUAGE_MASK 0x1
|
||||||
#define VERSION_MASK 0x200
|
#define VERSION_MASK 0x200
|
||||||
|
|
||||||
|
#define mScriptBase data[0]
|
||||||
|
#define mOffset data[1]
|
||||||
|
#define mStatus data[2]
|
||||||
|
#define mValid data[3]
|
||||||
|
|
||||||
EWRAM_DATA static struct ScriptContext sMysteryEventScriptContext = {0};
|
EWRAM_DATA static struct ScriptContext sMysteryEventScriptContext = {0};
|
||||||
|
|
||||||
static bool32 CheckCompatibility(u16 a1, u32 a2, u16 a3, u32 a4)
|
static bool32 CheckCompatibility(u16 a1, u32 a2, u16 a3, u32 a4)
|
||||||
@ -44,22 +49,22 @@ static bool32 CheckCompatibility(u16 a1, u32 a2, u16 a3, u32 a4)
|
|||||||
static void SetIncompatible(void)
|
static void SetIncompatible(void)
|
||||||
{
|
{
|
||||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventCantBeUsed);
|
StringExpandPlaceholders(gStringVar4, gText_MysteryEventCantBeUsed);
|
||||||
SetMysteryEventScriptStatus(3);
|
SetMysteryEventScriptStatus(MEVENT_STATUS_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitMysteryEventScript(struct ScriptContext *ctx, u8 *script)
|
static void InitMysteryEventScript(struct ScriptContext *ctx, u8 *script)
|
||||||
{
|
{
|
||||||
InitScriptContext(ctx, gMysteryEventScriptCmdTable, gMysteryEventScriptCmdTableEnd);
|
InitScriptContext(ctx, gMysteryEventScriptCmdTable, gMysteryEventScriptCmdTableEnd);
|
||||||
SetupBytecodeScript(ctx, script);
|
SetupBytecodeScript(ctx, script);
|
||||||
ctx->data[0] = (u32)script;
|
ctx->mScriptBase = (u32)script;
|
||||||
ctx->data[1] = 0;
|
ctx->mOffset = 0;
|
||||||
ctx->data[2] = 0;
|
ctx->mStatus = MEVENT_STATUS_LOAD_OK;
|
||||||
ctx->data[3] = 0;
|
ctx->mValid = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 RunMysteryEventScriptCommand(struct ScriptContext *ctx)
|
static bool32 RunMysteryEventScriptCommand(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
if (RunScriptCommand(ctx) && ctx->data[3])
|
if (RunScriptCommand(ctx) && ctx->mValid)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -70,10 +75,10 @@ void InitMysteryEventScriptContext(u8 *script)
|
|||||||
InitMysteryEventScript(&sMysteryEventScriptContext, script);
|
InitMysteryEventScript(&sMysteryEventScriptContext, script);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 RunMysteryEventScriptContextCommand(u32 *script)
|
bool32 RunMysteryEventScriptContextCommand(u32 *status)
|
||||||
{
|
{
|
||||||
bool32 ret = RunMysteryEventScriptCommand(&sMysteryEventScriptContext);
|
bool32 ret = RunMysteryEventScriptCommand(&sMysteryEventScriptContext);
|
||||||
*script = sMysteryEventScriptContext.data[2];
|
*status = sMysteryEventScriptContext.mStatus;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -84,12 +89,12 @@ u32 RunMysteryEventScript(u8 *script)
|
|||||||
InitMysteryEventScript(ctx, script);
|
InitMysteryEventScript(ctx, script);
|
||||||
while (RunMysteryEventScriptCommand(ctx));
|
while (RunMysteryEventScriptCommand(ctx));
|
||||||
|
|
||||||
return ctx->data[2];
|
return ctx->mStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetMysteryEventScriptStatus(u32 val)
|
void SetMysteryEventScriptStatus(u32 status)
|
||||||
{
|
{
|
||||||
sMysteryEventScriptContext.data[2] = val;
|
sMysteryEventScriptContext.mStatus = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CalcRecordMixingGiftChecksum(void)
|
static int CalcRecordMixingGiftChecksum(void)
|
||||||
@ -174,14 +179,14 @@ bool8 MEScrCmd_checkcompat(struct ScriptContext *ctx)
|
|||||||
u16 v3;
|
u16 v3;
|
||||||
u32 v4;
|
u32 v4;
|
||||||
|
|
||||||
ctx->data[1] = ScriptReadWord(ctx);
|
ctx->mOffset = ScriptReadWord(ctx);
|
||||||
v1 = ScriptReadHalfword(ctx);
|
v1 = ScriptReadHalfword(ctx);
|
||||||
v2 = ScriptReadWord(ctx);
|
v2 = ScriptReadWord(ctx);
|
||||||
v3 = ScriptReadHalfword(ctx);
|
v3 = ScriptReadHalfword(ctx);
|
||||||
v4 = ScriptReadWord(ctx);
|
v4 = ScriptReadWord(ctx);
|
||||||
|
|
||||||
if (CheckCompatibility(v1, v2, v3, v4) == TRUE)
|
if (CheckCompatibility(v1, v2, v3, v4) == TRUE)
|
||||||
ctx->data[3] = 1;
|
ctx->mValid = TRUE;
|
||||||
else
|
else
|
||||||
SetIncompatible();
|
SetIncompatible();
|
||||||
|
|
||||||
@ -195,23 +200,23 @@ bool8 MEScrCmd_nop(struct ScriptContext *ctx)
|
|||||||
|
|
||||||
bool8 MEScrCmd_setstatus(struct ScriptContext *ctx)
|
bool8 MEScrCmd_setstatus(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u8 value = ScriptReadByte(ctx);
|
u8 status = ScriptReadByte(ctx);
|
||||||
ctx->data[2] = value;
|
ctx->mStatus = status;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 MEScrCmd_setmsg(struct ScriptContext *ctx)
|
bool8 MEScrCmd_setmsg(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u8 value = ScriptReadByte(ctx);
|
u8 status = ScriptReadByte(ctx);
|
||||||
u8 *str = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
u8 *str = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||||
if (value == 0xFF || value == ctx->data[2])
|
if (status == MEVENT_STATUS_FF || status == ctx->mStatus)
|
||||||
StringExpandPlaceholders(gStringVar4, str);
|
StringExpandPlaceholders(gStringVar4, str);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 MEScrCmd_runscript(struct ScriptContext *ctx)
|
bool8 MEScrCmd_runscript(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u8 *script = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
u8 *script = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||||
ScriptContext2_RunNewScript(script);
|
ScriptContext2_RunNewScript(script);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -221,7 +226,7 @@ bool8 MEScrCmd_setenigmaberry(struct ScriptContext *ctx)
|
|||||||
u8 *str;
|
u8 *str;
|
||||||
const u8 *message;
|
const u8 *message;
|
||||||
bool32 haveBerry = IsEnigmaBerryValid();
|
bool32 haveBerry = IsEnigmaBerryValid();
|
||||||
u8 *berry = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
u8 *berry = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||||
StringCopyN(gStringVar1, gSaveBlock1Ptr->enigmaBerry.berry.name, BERRY_NAME_LENGTH + 1);
|
StringCopyN(gStringVar1, gSaveBlock1Ptr->enigmaBerry.berry.name, BERRY_NAME_LENGTH + 1);
|
||||||
SetEnigmaBerry(berry);
|
SetEnigmaBerry(berry);
|
||||||
StringCopyN(gStringVar2, gSaveBlock1Ptr->enigmaBerry.berry.name, BERRY_NAME_LENGTH + 1);
|
StringCopyN(gStringVar2, gSaveBlock1Ptr->enigmaBerry.berry.name, BERRY_NAME_LENGTH + 1);
|
||||||
@ -244,12 +249,12 @@ bool8 MEScrCmd_setenigmaberry(struct ScriptContext *ctx)
|
|||||||
|
|
||||||
StringExpandPlaceholders(str, message);
|
StringExpandPlaceholders(str, message);
|
||||||
|
|
||||||
ctx->data[2] = 2;
|
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||||
|
|
||||||
if (IsEnigmaBerryValid() == TRUE)
|
if (IsEnigmaBerryValid() == TRUE)
|
||||||
VarSet(VAR_ENIGMA_BERRY_AVAILABLE, 1);
|
VarSet(VAR_ENIGMA_BERRY_AVAILABLE, 1);
|
||||||
else
|
else
|
||||||
ctx->data[2] = 1;
|
ctx->mStatus = MEVENT_STATUS_LOAD_ERROR;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -260,7 +265,7 @@ bool8 MEScrCmd_giveribbon(struct ScriptContext *ctx)
|
|||||||
u8 ribbonId = ScriptReadByte(ctx);
|
u8 ribbonId = ScriptReadByte(ctx);
|
||||||
GiveGiftRibbonToParty(index, ribbonId);
|
GiveGiftRibbonToParty(index, ribbonId);
|
||||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventSpecialRibbon);
|
StringExpandPlaceholders(gStringVar4, gText_MysteryEventSpecialRibbon);
|
||||||
ctx->data[2] = 2;
|
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,8 +274,8 @@ bool8 MEScrCmd_initramscript(struct ScriptContext *ctx)
|
|||||||
u8 mapGroup = ScriptReadByte(ctx);
|
u8 mapGroup = ScriptReadByte(ctx);
|
||||||
u8 mapNum = ScriptReadByte(ctx);
|
u8 mapNum = ScriptReadByte(ctx);
|
||||||
u8 objectId = ScriptReadByte(ctx);
|
u8 objectId = ScriptReadByte(ctx);
|
||||||
u8 *script = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
u8 *script = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||||
u8 *scriptEnd = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
u8 *scriptEnd = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||||
InitRamScript(script, scriptEnd - script, mapGroup, mapNum, objectId);
|
InitRamScript(script, scriptEnd - script, mapGroup, mapNum, objectId);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -279,7 +284,7 @@ bool8 MEScrCmd_givenationaldex(struct ScriptContext *ctx)
|
|||||||
{
|
{
|
||||||
EnableNationalPokedex();
|
EnableNationalPokedex();
|
||||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventNationalDex);
|
StringExpandPlaceholders(gStringVar4, gText_MysteryEventNationalDex);
|
||||||
ctx->data[2] = 2;
|
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,7 +292,7 @@ bool8 MEScrCmd_addrareword(struct ScriptContext *ctx)
|
|||||||
{
|
{
|
||||||
UnlockAdditionalPhrase(ScriptReadByte(ctx));
|
UnlockAdditionalPhrase(ScriptReadByte(ctx));
|
||||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventRareWord);
|
StringExpandPlaceholders(gStringVar4, gText_MysteryEventRareWord);
|
||||||
ctx->data[2] = 2;
|
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +311,7 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
|
|||||||
struct Pokemon pokemon;
|
struct Pokemon pokemon;
|
||||||
u16 species;
|
u16 species;
|
||||||
u16 heldItem;
|
u16 heldItem;
|
||||||
u32 data = ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0];
|
u32 data = ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase;
|
||||||
void *pokemonPtr = (void *)data;
|
void *pokemonPtr = (void *)data;
|
||||||
void *mailPtr = (void *)(data + sizeof(struct Pokemon));
|
void *mailPtr = (void *)(data + sizeof(struct Pokemon));
|
||||||
|
|
||||||
@ -321,7 +326,7 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
|
|||||||
if (gPlayerPartyCount == PARTY_SIZE)
|
if (gPlayerPartyCount == PARTY_SIZE)
|
||||||
{
|
{
|
||||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventFullParty);
|
StringExpandPlaceholders(gStringVar4, gText_MysteryEventFullParty);
|
||||||
ctx->data[2] = 3;
|
ctx->mStatus = MEVENT_STATUS_FAILURE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -341,7 +346,7 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
|
|||||||
CompactPartySlots();
|
CompactPartySlots();
|
||||||
CalculatePlayerPartyCount();
|
CalculatePlayerPartyCount();
|
||||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventSentOver);
|
StringExpandPlaceholders(gStringVar4, gText_MysteryEventSentOver);
|
||||||
ctx->data[2] = 2;
|
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -349,11 +354,11 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
|
|||||||
|
|
||||||
bool8 MEScrCmd_addtrainer(struct ScriptContext *ctx)
|
bool8 MEScrCmd_addtrainer(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u32 data = ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0];
|
u32 data = ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase;
|
||||||
memcpy(&gSaveBlock2Ptr->frontier.ereaderTrainer, (void *)data, sizeof(gSaveBlock2Ptr->frontier.ereaderTrainer));
|
memcpy(&gSaveBlock2Ptr->frontier.ereaderTrainer, (void *)data, sizeof(gSaveBlock2Ptr->frontier.ereaderTrainer));
|
||||||
ValidateEReaderTrainer();
|
ValidateEReaderTrainer();
|
||||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventNewTrainer);
|
StringExpandPlaceholders(gStringVar4, gText_MysteryEventNewTrainer);
|
||||||
ctx->data[2] = 2;
|
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,19 +366,19 @@ bool8 MEScrCmd_enableresetrtc(struct ScriptContext *ctx)
|
|||||||
{
|
{
|
||||||
EnableResetRTC();
|
EnableResetRTC();
|
||||||
StringExpandPlaceholders(gStringVar4, gText_InGameClockUsable);
|
StringExpandPlaceholders(gStringVar4, gText_InGameClockUsable);
|
||||||
ctx->data[2] = 2;
|
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 MEScrCmd_checksum(struct ScriptContext *ctx)
|
bool8 MEScrCmd_checksum(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
int checksum = ScriptReadWord(ctx);
|
int checksum = ScriptReadWord(ctx);
|
||||||
u8 *data = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
u8 *data = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||||
u8 *dataEnd = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
u8 *dataEnd = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||||
if (checksum != CalcByteArraySum(data, dataEnd - data))
|
if (checksum != CalcByteArraySum(data, dataEnd - data))
|
||||||
{
|
{
|
||||||
ctx->data[3] = 0;
|
ctx->mValid = FALSE;
|
||||||
ctx->data[2] = 1;
|
ctx->mStatus = MEVENT_STATUS_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -381,12 +386,12 @@ bool8 MEScrCmd_checksum(struct ScriptContext *ctx)
|
|||||||
bool8 MEScrCmd_crc(struct ScriptContext *ctx)
|
bool8 MEScrCmd_crc(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
int crc = ScriptReadWord(ctx);
|
int crc = ScriptReadWord(ctx);
|
||||||
u8 *data = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
u8 *data = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||||
u8 *dataEnd = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
u8 *dataEnd = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||||
if (crc != CalcCRC16(data, dataEnd - data))
|
if (crc != CalcCRC16(data, dataEnd - data))
|
||||||
{
|
{
|
||||||
ctx->data[3] = 0;
|
ctx->mValid = FALSE;
|
||||||
ctx->data[2] = 1;
|
ctx->mStatus = MEVENT_STATUS_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
26
src/scrcmd.c
26
src/scrcmd.c
@ -286,7 +286,7 @@ bool8 ScrCmd_returnram(struct ScriptContext *ctx)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ScrCmd_killscript(struct ScriptContext *ctx)
|
bool8 ScrCmd_endram(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
ClearRamScript();
|
ClearRamScript();
|
||||||
StopScript(ctx);
|
StopScript(ctx);
|
||||||
@ -295,9 +295,9 @@ bool8 ScrCmd_killscript(struct ScriptContext *ctx)
|
|||||||
|
|
||||||
bool8 ScrCmd_setmysteryeventstatus(struct ScriptContext *ctx)
|
bool8 ScrCmd_setmysteryeventstatus(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u8 value = ScriptReadByte(ctx);
|
u8 status = ScriptReadByte(ctx);
|
||||||
|
|
||||||
SetMysteryEventScriptStatus(value);
|
SetMysteryEventScriptStatus(status);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ bool8 ScrCmd_loadword(struct ScriptContext *ctx)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ScrCmd_loadbytefromaddr(struct ScriptContext *ctx)
|
bool8 ScrCmd_loadbytefromptr(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u8 index = ScriptReadByte(ctx);
|
u8 index = ScriptReadByte(ctx);
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ bool8 ScrCmd_loadbytefromaddr(struct ScriptContext *ctx)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ScrCmd_writebytetoaddr(struct ScriptContext *ctx)
|
bool8 ScrCmd_setptr(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u8 value = ScriptReadByte(ctx);
|
u8 value = ScriptReadByte(ctx);
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ bool8 ScrCmd_compare_local_to_value(struct ScriptContext *ctx)
|
|||||||
return FALSE;
|
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 value1 = ctx->data[ScriptReadByte(ctx)];
|
||||||
const u8 value2 = *(const u8 *)ScriptReadWord(ctx);
|
const u8 value2 = *(const u8 *)ScriptReadWord(ctx);
|
||||||
@ -414,7 +414,7 @@ bool8 ScrCmd_compare_local_to_addr(struct ScriptContext *ctx)
|
|||||||
return FALSE;
|
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 value1 = *(const u8 *)ScriptReadWord(ctx);
|
||||||
const u8 value2 = ctx->data[ScriptReadByte(ctx)];
|
const u8 value2 = ctx->data[ScriptReadByte(ctx)];
|
||||||
@ -423,7 +423,7 @@ bool8 ScrCmd_compare_addr_to_local(struct ScriptContext *ctx)
|
|||||||
return FALSE;
|
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 value1 = *(const u8 *)ScriptReadWord(ctx);
|
||||||
const u8 value2 = ScriptReadByte(ctx);
|
const u8 value2 = ScriptReadByte(ctx);
|
||||||
@ -432,7 +432,7 @@ bool8 ScrCmd_compare_addr_to_value(struct ScriptContext *ctx)
|
|||||||
return FALSE;
|
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 value1 = *(const u8 *)ScriptReadWord(ctx);
|
||||||
const u8 value2 = *(const u8 *)ScriptReadWord(ctx);
|
const u8 value2 = *(const u8 *)ScriptReadWord(ctx);
|
||||||
@ -1653,7 +1653,7 @@ bool8 ScrCmd_bufferstring(struct ScriptContext *ctx)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ScrCmd_vloadword(struct ScriptContext *ctx)
|
bool8 ScrCmd_vbuffermessage(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
const u8 *ptr = (u8 *)(ScriptReadWord(ctx) - sAddressOffset);
|
const u8 *ptr = (u8 *)(ScriptReadWord(ctx) - sAddressOffset);
|
||||||
|
|
||||||
@ -2227,7 +2227,7 @@ bool8 ScrCmd_checkmoneventlegal(struct ScriptContext *ctx)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ScrCmd_gotowondercardscript(struct ScriptContext *ctx)
|
bool8 ScrCmd_trywondercardscript(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
const u8* script = GetSavedRamScriptIfValid();
|
const u8* script = GetSavedRamScriptIfValid();
|
||||||
|
|
||||||
@ -2295,7 +2295,7 @@ void SetMovingNpcId(u16 npcId)
|
|||||||
sMovingNpcId = npcId;
|
sMovingNpcId = npcId;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ScrCmd_warpsootopolislegend(struct ScriptContext *ctx)
|
bool8 ScrCmd_warpwhitefade(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u8 mapGroup = ScriptReadByte(ctx);
|
u8 mapGroup = ScriptReadByte(ctx);
|
||||||
u8 mapNum = ScriptReadByte(ctx);
|
u8 mapNum = ScriptReadByte(ctx);
|
||||||
@ -2304,7 +2304,7 @@ bool8 ScrCmd_warpsootopolislegend(struct ScriptContext *ctx)
|
|||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||||
DoSootopolisLegendWarp();
|
DoWhiteFadeWarp();
|
||||||
ResetInitialPlayerAvatarState();
|
ResetInitialPlayerAvatarState();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user