-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f614429
commit 5be3802
Showing
36 changed files
with
1,100 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
--- | ||
slug: / | ||
--- | ||
|
||
# ROM Hacking | ||
|
||
Learn how to make your own modifications to the Pokemon BDSP ROM. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# (58) _ADD_WK | ||
|
||
## Effect | ||
|
||
Increments a work by a given value. | ||
|
||
## Syntax | ||
|
||
```c | ||
_ADD_WK(work, value) | ||
``` | ||
| Argument | Description | Types | Required | | ||
| - | - | - | - | | ||
| **work** | The work that gets incremented | Work | Required | | ||
| **value** | The value to add | Work, Float | Required | | ||
## Example | ||
```c | ||
_LDVAL(@LOCALWORK1, 3) | ||
_ADD_WK(@LOCALWORK1, 4) | ||
``` | ||
|
||
The above script will set the work variable @LOCALWORK1 to 3. | ||
|
||
Then, @LOCALWORK1's value is incremented by 4, making it 7. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# (42) _ARRIVE_FLAG_SET | ||
|
||
## Effect | ||
|
||
Sets the given system flag to true. | ||
|
||
Also updates the player's badge count. | ||
|
||
## Syntax | ||
|
||
```c | ||
_FLAG_SET(sysflag) | ||
``` | ||
| Argument | Description | Types | Required | | ||
| - | - | - | - | | ||
| **sysflag** | The system flag to set | SysFlag | Required | | ||
## Example | ||
```c | ||
_ARRIVE_FLAG_SET($SYS_FLAG_PAIR) | ||
``` | ||
|
||
The above script will set the $SYS_FLAG_PAIR system flag. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# (28) _CALL | ||
|
||
## Synonyms | ||
|
||
- _CHG_COMMON_SCR | ||
|
||
## Effect | ||
|
||
Calls a script. | ||
|
||
The position of the call is saved. Execution returns to this command once a _RET is executed. | ||
|
||
## Syntax | ||
|
||
```c | ||
_CALL(label) | ||
``` | ||
| Argument | Description | Types | Required | | ||
| - | - | - | - | | ||
| **label** | The label to call | String | Required | | ||
## Example | ||
```c | ||
_CALL('ev_dummy') | ||
_SE_PLAY('S_BOO') | ||
ev_dummy: | ||
_SE_PLAY('S_PINPON') | ||
_RET() | ||
``` | ||
|
||
The above script will jump to the ev_dummy script. | ||
|
||
Once there, the sound effect 'S_PINPON' plays. Then, execution returns to where the last call happened. | ||
|
||
After returning, the sound effect 'S_BOO' plays. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# (38) _CASE_CANCEL | ||
|
||
## Effect | ||
|
||
Compares the values of @SCWK_REG0 and @EV_WIN_B_CANCEL. Jumps to a script if they are equal. | ||
|
||
The position of the jump is not saved. Execution does not return to this command once a _RET is executed. | ||
|
||
:::caution | ||
|
||
Broken and always considers @SCWK_REG0 as greater and therefore does nothing. | ||
|
||
::: | ||
|
||
## Syntax | ||
|
||
```c | ||
_CASE_JUMP(val, label) | ||
``` | ||
| Argument | Description | Types | Required | | ||
| - | - | - | - | | ||
| **label** | The label to jump to | String | Required | | ||
## Example | ||
```c | ||
_LDVAL(@LOCALWORK1, 4) | ||
_SWITCH(@LOCALWORK1) | ||
_CASE_JUMP(1, 'ev_dummy_1') | ||
_CASE_JUMP(2, 'ev_dummy_2') | ||
_CASE_JUMP(3, 'ev_dummy_3') | ||
_CASE_CANCEL('ev_dummy_cancel') | ||
``` | ||
|
||
The above script will set the work variable @LOCALWORK1 to 4. | ||
|
||
Then, a switch statement using @LOCALWORK1 is prepared. | ||
|
||
First, the value of @LOCALWORK1 is compared to 1. Since they're not equal, execution continues. | ||
|
||
The same happens for values 2 and 3. | ||
|
||
Finally, _CASE_CANCEL executes and, due to a bug, does nothing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# (37) _CASE_JUMP | ||
|
||
## Effect | ||
|
||
Compares the value of the work of the last prepared "switch" statement to the given value. Jumps to a script if they are equal. | ||
|
||
The position of the jump is not saved. Execution does not return to this command once a _RET is executed. | ||
|
||
## Syntax | ||
|
||
```c | ||
_CASE_JUMP(val, label) | ||
``` | ||
| Argument | Description | Types | Required | | ||
| - | - | - | - | | ||
| **val** | The value to compare to | Work, Float | Required | | ||
| **label** | The label to jump to | String | Required | | ||
## Example | ||
```c | ||
_LDVAL(@LOCALWORK1, 2) | ||
_SWITCH(@LOCALWORK1) | ||
_CASE_JUMP(1, 'ev_dummy_1') | ||
_CASE_JUMP(2, 'ev_dummy_2') | ||
_CASE_JUMP(3, 'ev_dummy_3') | ||
``` | ||
|
||
The above script will set the work variable @LOCALWORK1 to 2. | ||
|
||
Then, a switch statement using @LOCALWORK1 is prepared. | ||
|
||
First, the value of @LOCALWORK1 is compared to 1. Since they're not equal, execution continues. | ||
|
||
Then, the value of @LOCALWORK1 is compared to 2. Since they're equal, ev_dummy_2 is jumped to. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# (19) _CMPWK | ||
|
||
## Effect | ||
|
||
Compares the value of a work to the value of another work. | ||
|
||
When passing a work, it will check its value and use that as the work to use. When passing a float, it will use that value as the work to use. | ||
|
||
:::caution | ||
|
||
Broken and always considers **work1** as greater. | ||
|
||
::: | ||
|
||
## Syntax | ||
|
||
```c | ||
_CMPWK(work1, work2) | ||
``` | ||
| Argument | Description | Types | Required | | ||
| - | - | - | - | | ||
| **work1** | The work to compare | Work, Float | Required | | ||
| **work2** | The work to compare to | Work, Float | Required | | ||
## Example | ||
```c | ||
_LDVAL(@LOCALWORK4, 9) | ||
_LDVAL(@LOCALWORK8, 13) | ||
_LDVAL(@LOCALWORK1, 4) | ||
_CMPWK(@LOCALWORK1, 8) | ||
_IF_JUMP('EQ', 'ev_dummy') | ||
``` | ||
|
||
The above script will set: | ||
- Work variable @LOCALWORK4 to 9; | ||
- Work variable @LOCALWORK8 to 13; | ||
- Work variable @LOCALWORK1 to 4. | ||
|
||
Then, the values of work 4 (@LOCALWORK4) and work 8 (@LOCALWORK8) are compared. Due to a bug, no matter their values, @LOCALWORK4 is determined to be greater. | ||
|
||
Next, the result of the comparison is checked. Since the result is "greater" and not "equal", ev_dummy is not jumped to and script execution continues on the next line. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# (49) _FLAG_CHECK_WK | ||
|
||
## Effect | ||
|
||
Checks the flag corresponding to the value of a work. | ||
|
||
Sets a work with the result. | ||
|
||
:::caution | ||
|
||
Contrary to what might be expected, a result of 0 is true and 1 is false. | ||
|
||
::: | ||
|
||
## Syntax | ||
|
||
```c | ||
_FLAG_CHECK_WK(flag, result) | ||
``` | ||
| Argument | Description | Types | Required | | ||
| - | - | - | - | | ||
| **flag** | The work containing the flag to check or the direct flag number | Work, Float | Required | | ||
| **result** | The work to put the result in | Work | Required | | ||
## Example | ||
```c | ||
_FLAG_SET(#FH_03) | ||
_FLAG_CHECK_WK(#FH_03, @LOCALWORK1) | ||
_IFVAL_JUMP(@LOCALWORK1, 'EQ', 0, 'ev_dummy') | ||
``` | ||
|
||
The above script will set the #FH_03 flag. | ||
|
||
Next, it checks the same flag. Since it is true, 0 is put into @LOCALWORK1. | ||
|
||
Finally, @LOCALWORK1 is compared to 0. Since it is equal to it, the script jumps to ev_dummy. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# (44) _FLAG_CHECK | ||
|
||
## Effect | ||
|
||
Checks the value of a flag and sets the comparison result. | ||
|
||
:::caution | ||
|
||
The comparison result is "less" if the flag is true, and "equal" if the flag is false. Keep this in mind if using "FLGON" and "FLGOFF" as the comparison operator since they correspond to "equal" and "less" respectively (so the opposite of what you would expect here). | ||
|
||
::: | ||
|
||
## Syntax | ||
|
||
```c | ||
_FLAG_CHECK(flag) | ||
``` | ||
| Argument | Description | Types | Required | | ||
| - | - | - | - | | ||
| **flag** | The flag to check | Flag | Required | | ||
## Example | ||
```c | ||
_FLAG_SET(#FH_03) | ||
_FLAG_CHECK(#FH_03) | ||
_IF_JUMP('FLGON', 'ev_dummy') | ||
``` | ||
|
||
The above script will set the #FH_03 flag. | ||
|
||
Then, the #FH_03 flag is checked and the comprison result is set. | ||
|
||
Next, the result of the comparison is checked. Since the condition is "FLGON" which corresponds to "equal", ev_dummy will not be jumped to. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# (43) _FLAG_RESET | ||
|
||
## Effect | ||
|
||
Resets the given flag to false. | ||
|
||
## Syntax | ||
|
||
```c | ||
_FLAG_RESET(flag) | ||
``` | ||
| Argument | Description | Types | Required | | ||
| - | - | - | - | | ||
| **flag** | The flag to reset | Flag | Required | | ||
## Example | ||
```c | ||
_FLAG_RESET(#FH_03) | ||
``` | ||
|
||
The above script will reset the #FH_03 flag. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# (50) _FLAG_SET_WK | ||
|
||
## Effect | ||
|
||
Sets the flag corresponding to the given value to true. | ||
|
||
## Syntax | ||
|
||
```c | ||
_FLAG_SET_WK(flag) | ||
``` | ||
| Argument | Description | Types | Required | | ||
| - | - | - | - | | ||
| **flag** | The work containing the flag to set or the direct flag number | Work, Float | Required | | ||
## Example | ||
```c | ||
_LDVAL(@LOCALWORK1, 3) | ||
_FLAG_SET_WK(@LOCALWORK1) | ||
``` | ||
|
||
The above script will set the work variable @LOCALWORK1 to 3. | ||
|
||
Then, the flag number contained in @LOCALWORK1 (in this case 3) is the flag that gets set to true. This corresponds to flag #FH_04. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# (41) _FLAG_SET | ||
|
||
## Effect | ||
|
||
Sets the given flag to true. | ||
|
||
If the flag is #FLAG_STOP_ZONE_PROGRAM, also updates FieldManager's eventTownMapPos to the player's world position. | ||
|
||
## Syntax | ||
|
||
```c | ||
_FLAG_SET(flag) | ||
``` | ||
| Argument | Description | Types | Required | | ||
| - | - | - | - | | ||
| **flag** | The flag to set | Flag | Required | | ||
## Example | ||
```c | ||
_FLAG_SET(#FH_03) | ||
``` | ||
|
||
The above script will set the #FH_03 flag. |
Oops, something went wrong.