diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/battle_anim_commands.md | 3 | ||||
-rw-r--r-- | docs/design_flaws.md | 2 | ||||
-rw-r--r-- | docs/event_commands.md | 4 | ||||
-rw-r--r-- | docs/images/hp_exp_bar_border.png | bin | 125 -> 116 bytes | |||
-rw-r--r-- | docs/images/hp_exp_bar_border_fix.png | bin | 124 -> 187 bytes | |||
-rw-r--r-- | docs/images/port.png | bin | 1055 -> 1048 bytes | |||
-rw-r--r-- | docs/images/port_fix.png | bin | 1056 -> 1547 bytes | |||
-rw-r--r-- | docs/map_scripts.md | 28 | ||||
-rw-r--r-- | docs/menu.md | 269 | ||||
-rw-r--r-- | docs/move_effect_commands.md | 2 |
10 files changed, 295 insertions, 13 deletions
diff --git a/docs/battle_anim_commands.md b/docs/battle_anim_commands.md index e7eb4a98f..4c29aea30 100644 --- a/docs/battle_anim_commands.md +++ b/docs/battle_anim_commands.md @@ -9,7 +9,8 @@ Defined in [macros/scripts/battle_anims.asm](/macros/scripts/battle_anims.asm) a ## `$D0`: `anim_obj` *object*, *x*, *y*, *param* -*Alternate*: `anim_obj` *object*, *x_tile*, *x*, *y_tile*, *y*, *param* + +***Alternate*: `anim_obj` *object*, *x_tile*, *x*, *y_tile*, *y*, *param*** Spawns an *object* at coordinate (*x*, *y*). diff --git a/docs/design_flaws.md b/docs/design_flaws.md index 21a222743..7dbe79cfb 100644 --- a/docs/design_flaws.md +++ b/docs/design_flaws.md @@ -471,7 +471,7 @@ GetNumberedTMHM: ; d417 ## `GetForestTreeFrame` works, but it's still bad -In [tilesets/animations.asm](/tilesets/animations.asm): +In [engine/tileset_anims.asm](/engine/tileset_anims.asm): ```asm GetForestTreeFrame: ; fc54c diff --git a/docs/event_commands.md b/docs/event_commands.md index b4314bd24..dfbe943f1 100644 --- a/docs/event_commands.md +++ b/docs/event_commands.md @@ -133,7 +133,7 @@ Defined in [macros/scripts/events.asm](/macros/scripts/events.asm) and [engine/s ## `$3E`: `readcoins` *memory* -## `$3F`: `RAM2MEM` *memory* +## `$3F`: `vartomem` *memory* ## `$40`: `pokenamemem` *mon_id*, *memory* @@ -151,7 +151,7 @@ Defined in [macros/scripts/events.asm](/macros/scripts/events.asm) and [engine/s ## `$47`: `opentext` -## `$48`: `refreshscreen` *dummy* +## `$48`: `refreshscreen` [*dummy*=0] ## `$49`: `closetext` diff --git a/docs/images/hp_exp_bar_border.png b/docs/images/hp_exp_bar_border.png Binary files differindex 9d16a042b..f0f5d31a6 100644 --- a/docs/images/hp_exp_bar_border.png +++ b/docs/images/hp_exp_bar_border.png diff --git a/docs/images/hp_exp_bar_border_fix.png b/docs/images/hp_exp_bar_border_fix.png Binary files differindex 02d36f8a0..26135576f 100644 --- a/docs/images/hp_exp_bar_border_fix.png +++ b/docs/images/hp_exp_bar_border_fix.png diff --git a/docs/images/port.png b/docs/images/port.png Binary files differindex 8a18aad7d..3e05e0da7 100644 --- a/docs/images/port.png +++ b/docs/images/port.png diff --git a/docs/images/port_fix.png b/docs/images/port_fix.png Binary files differindex 055a377a5..3156b065d 100644 --- a/docs/images/port_fix.png +++ b/docs/images/port_fix.png diff --git a/docs/map_scripts.md b/docs/map_scripts.md index c6b1c58ba..e6794b543 100644 --- a/docs/map_scripts.md +++ b/docs/map_scripts.md @@ -16,7 +16,7 @@ ## `.MapCallbacks: db` *N* -- **`dbw` *type*, *script*** +- **`callback` *type*, *script*** Callback types: @@ -30,11 +30,21 @@ Callback types: - **`MAPCALLBACK_CMDQUEUE`** - **`dbw CMDQUEUE_STONETABLE,` *table_pointer*** - - **`stonetable` *warp_id*, *person*, *script*** - - **`db -1 ; end`** +<!-- need pre tags here; can't use inline bold/italic formatting in Markdown code blocks --> +<pre> + callback MAPCALLBACK_CMDQUEUE, .Boulders + +.Boulders: + writecmdqueue .BoulderCmdQueue + return + +.BoulderCmdQueue: + cmdqueue CMDQUEUE_STONETABLE, .BoulderTable + +.BoulderTable: + stonetable <i>warp_id</i>, <i>person</i>, <i>script</i> + db -1 ; end +</pre> ## Event scripts @@ -54,8 +64,10 @@ Callback types: ## `MapName_MapEventHeader:` +```asm ; filler db 0, 0 +``` ## `.Warps: db` *N* @@ -80,11 +92,11 @@ BG event types: - **`BGEVENT_IFSET/IFNOTSET`** - **`dw` *event_flag*, *script*** + **`conditional_event` *event_flag*, *script*** - **`BGEVENT_ITEM`** - **`dwb` *event_flag*, *item_id*** + **`hiddenitem` *event_flag*, *item_id*** - **`BGEVENT_COPY`** diff --git a/docs/menu.md b/docs/menu.md new file mode 100644 index 000000000..b8bb6fddf --- /dev/null +++ b/docs/menu.md @@ -0,0 +1,269 @@ +### Everything you've ever wanted to know about menus* + +##### *but were afraid to ask + +## Contents + +- [ScrollingMenu](#scrollingmenu) +- [\_2DMenu](#_2dmenu) +- [DoNthMenu/SetUpMenu](#donthmenusetupmenu) +- [VerticalMenu](#verticalmenu) +- [Misc/Generic](#miscgeneric) + +## ScrollingMenu + +This is the only menu that does scrolling. It doesn't draw any TextBox around the menu. + +Structure: +``` +.MenuDataHeader: + db MENU_BACKUP_TILES ; flags + menu_coords 2, 4, SCREEN_WIDTH - 1, 13 + dw .MenuData2 + db 1 ; default option + +.MenuData2: + db 0 ; flags + db 5, 0 ; rows, columns + db 1 ; horizontal spacing + dba Items + dba Function1 + dba Function2 + dba Function3 +``` + +wMenuData2Flags: +``` +7: Select is functional +6: Start is functional +5: Call Function3 +4: Show arrows on the right-hand side +3: D-Left is functional +2: D-Right is functional +1: Call Function3 only if [wSwitchItem] is 0 +0: Call Function1 to display the cancel entry +``` + +If the columns entry in MenuDataHeader2 of a scrolling menu is 0, Function2 isn't called either. It doesn't affect the position of the arrows. + +Call state for functions in MenuDataHeader2 of ScrollingMenu: +``` +All of them: +[MenuSelection] = Current item. -1 is the CANCEL item. +[MenuSelectionQuantity] = Quantity of the current item. + +Function1: Called to display a menu entry. +de = Cursor position in TileMap + +Function2: Called to display the quantity of a menu entry. +de = Cursor position in TileMap + columns + +Function3: Called to display anything else, whenever the cursor is moved. +``` +There is no register of importance that should be preserved in any of these functions. + +The `; horizontal spacing` item in each MenuData2 is a misnomer. It changes how the Items struct looks. +If it's 1: +``` +db entries not including cancel +db entry1 +db entry2 +db -1 ; cancel +... +``` +If it's 2: +``` +db entries not including cancel +db entry1, quantity1 +db entry2, quantity2 +db -1 ; cancel +... +``` +In case it's 1, [MenuSelectionQuantity] will simply contain the next entry. + +## \_2DMenu + +This, like is implied by the name, is a 2-dimensional menu, where you can move your cursor in all 4 directions. It's only used for the battle menus as well as earl's academy. + +Structure: +``` +.MenuDataHeader: + db MENU_BACKUP_TILES ; flags + db 12, 08 ; start coords + db 17, 19 ; end coords + dw .MenuData2 + db 1 ; default option + +.MenuData2: + db STATICMENU_CURSOR ; flags + dn 2, 2 ; rows, columns + db 6 ; spacing + dba Strings + dba Function +``` + +wMenuData2Flags: +``` +7: Leave one tile of spacing between the left textbox border and the text, enabling the cursor. +6: Don't leave one tile of spacing between the top textbox border and the text +5: Set bits 4 and 5 in w2DMenuFlags1 (Wrap around horizontally and vertically) +4: Unused +3: Unused +2: Unused +1: Select is functional +0: Disable B button +``` + +The bank for the Strings is generated when you call `_2DMenu`, and as such it doesn't really matter what bank you specify there (unless you callba `_2DMenu_` directly, of course). +`; spacing` is not a misnomer here, it's used to define how much space there is between columns. +`Function` is called after printing all the strings. `hl` will be pointed at the row below the last in the menu in TileMap. We don't know of its purpose, since it's never actually used anywhere. Only the bank number is always set to the same bank as the menu, but not used otherwise, since the address is 0. + +## DoNthMenu/SetUpMenu + +These are like the regular VerticalMenu, except they allow for creating slightly more "dynamic" menus, where the options aren't predefined, much like the ScrollingMenu. + +Structure: +``` +.MenuDataHeader: + db MENU_BACKUP_TILES ; flags + menu_coords 0, 0, 10, 7 + dw .MenuData2 + db 1 ; default option + +.MenuData2: + db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags + db 0 ; items + dw Items + dw DisplayFunction + dw StringPointers +``` + +wMenuData2Flags: +``` +7: Unused +6: Unused +5: Set bit 5 in w2DMenuFlags1 (Wrap around vertically) +4: Unused +3: Start is functional +2: D-left and D-right are functional +1: Unused +0: Unused +``` + +The `; items` entry should be left empty, as it's autogenerated with the `Items` array in `GetMenuIndexSet`. +The bottom coord (`07` in the example) is autogenerated regardless of what you specify when building the MenuBox in `AutomaticGetMenuBottomCoord`, which also calculates the `bc` passed to MenuBox, which is useless because it's calculated again by MenuBox in `GetMenuBoxDims`. +[wWhichIndexSet] decides which menu is used through `GetMenuIndexSet`. You can define multiple menus at the Items pointer as such: +``` +Items: +db entries not including cancel +db entry1, entry2, entry3 +db -1 ; cancel +db entries not including cancel for 2nd menu +db entry1, entry2, entry3, entry4 +db -1 ; cancel +``` +This is actively used in MainMenu. + +StringPointers isn't handled by DoNthMenu internally. It's handled by different `DisplayFunction`s. +A custom one could choose to completely ignore it. + +StringPointers struct handled through `PlaceNthMenuStrings` as DisplayFunction and `MenuJumptable`: +``` +StringPointers: +dw FunctionToCall, PointerToString ; index 1 +dw FunctionToCall, PointerToString ; index 2 +... +``` + +StringPointers struct handled through `PlaceMenuStrings`: +``` +StringPointers: +db "STRING1@" +db "STRING2@" +... +``` + +Call state for DisplayFunction: +``` +[MenuSelection] = Current item. -1 is the CANCEL item. +de = Cursor position in TileMap +``` + +## VerticalMenu + +This is the simplest menu. Like, the most boring. Nothing special. Just normal. ...nooooooormal... + +Structure: +``` +.MenuDataHeader: + db MENU_SPRITE_ANIMS | MENU_BACKUP_TILES ; flags + menu_coords 12, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 + dw .MenuData2 + db 1 ; default option + +.MenuData2: + db STATICMENU_CURSOR ; flags + db 2 ; # items + db "GIVE@" + db "TAKE@" +``` + +wMenuData2Flags: +``` +7: Leave one tile of spacing between the left textbox border and the text +6: Don't leave one tile of spacing between the top textbox border and the text +5: Set bit 5 in w2DMenuFlags1 (Wrap around vertically) +4: Place menubox "title". See notes. +3: Unused +2: Unused +1: Select is functional +0: Disable B button +``` + +If bit 4 is set, a string at the end of the items array will be put at an offset from the start coord of the menu box. This string is defined like this: +``` + db 2 ; # items + db "GIVE@" + db "TAKE@" + db 2 ; x offset + db "TEST@" +``` +This is used in the menu for selecting the character's name. + +## Misc/Generic + +MenuDataHeader flags (wMenuFlags): +``` +7: Save a backup of the tiles +6: Save a backup of the tiles +5: Unused +4: Set bit 6 in w2DMenuFlags1 (Enable sprite animations) +3: Disable click sound +2: Unused +1: Unused +0: Call RestoreTileBackup when exiting the menu. This bit depends on whether bit 6 or 7 are set. +``` + +w2DMenuFlags1: +``` +7: Disable checking of wMenuJoypadFilter +6: Enable sprite animations +5: Wrap around vertically +4: Wrap around horizontally +3: Set bit 7 in w2DMenuFlags2 and exit the loop if bit 5 is disabled and we tried to go too far down +2: Set bit 7 in w2DMenuFlags2 and exit the loop if bit 5 is disabled and we tried to go too far up +1: Set bit 7 in w2DMenuFlags2 and exit the loop if bit 4 is disabled and we tried to go too far left +0: Set bit 7 in w2DMenuFlags2 and exit the loop if bit 4 is disabled and we tried to go too far right +``` + +w2DMenuFlags2: +``` +7: ????? +6: ????? +5: ????? +4: ????? +3: ????? +2: ????? +1: ????? +0: ????? +``` diff --git a/docs/move_effect_commands.md b/docs/move_effect_commands.md index b8b09c5c2..a7a779123 100644 --- a/docs/move_effect_commands.md +++ b/docs/move_effect_commands.md @@ -1,6 +1,6 @@ # Move Effect Commands -Defined in [macros/scripts/battle_commands.asm](/macros/scripts/battle_commands.asm) and [data/battle_command_pointers.asm:BattleCommandPointers](/data/battle_command_pointers.asm). +Defined in [macros/scripts/battle_commands.asm](/macros/scripts/battle_commands.asm) and [data/battle/effect_command_pointers.asm:BattleCommandPointers](/data/battle/effect_command_pointers.asm). ## `$01`: `checkturn` |