From 79bb2784e92de0524c69c87556f7647861c47fb8 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sat, 20 Jun 2020 17:56:18 +0200 Subject: [PATCH] Better label 2D menu data --- engine/items/item_effects.asm | 2 +- engine/pokemon/mon_menu.asm | 32 +++++++++--------- engine/pokemon/party_menu.asm | 28 ++++++--------- home/menu.asm | 16 +++++---- mobile/mobile_40.asm | 64 +++++++++++++++++------------------ 5 files changed, 68 insertions(+), 74 deletions(-) diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 4de0fc3bc..36bdd8a8d 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1141,7 +1141,7 @@ EvoStoneEffect: cp EVERSTONE jr z, .NoEffect - ld a, $1 + ld a, TRUE ld [wForceEvolution], a farcall EvolvePokemon diff --git a/engine/pokemon/mon_menu.asm b/engine/pokemon/mon_menu.asm index c8d35a59f..fd51ae928 100644 --- a/engine/pokemon/mon_menu.asm +++ b/engine/pokemon/mon_menu.asm @@ -811,8 +811,8 @@ ChooseMoveToDelete: .ChooseMoveToDelete call SetUpMoveScreenBG - ld de, DeleteMoveScreenAttrs - call SetMenuAttributes + ld de, DeleteMoveScreen2DMenuData + call Load2DMenuData call SetUpMoveList ld hl, w2DMenuFlags1 set 6, [hl] @@ -848,12 +848,12 @@ ChooseMoveToDelete: pop af ret -DeleteMoveScreenAttrs: - db 3, 1 - db 3, 1 - db $40, $00 - dn 2, 0 - db D_UP | D_DOWN | A_BUTTON | B_BUTTON +DeleteMoveScreen2DMenuData: + db 3, 1 ; cursor start y, x + db 3, 1 ; rows, columns + db $40, $00 ; flags + dn 2, 0 ; cursor offset + db D_UP | D_DOWN | A_BUTTON | B_BUTTON ; accepted buttons ManagePokemonMoves: ld a, [wCurPartySpecies] @@ -878,8 +878,8 @@ MoveScreenLoop: ld [wPartyMenuCursor], a call SetUpMoveScreenBG call PlaceMoveScreenArrows - ld de, MoveScreenAttributes - call SetMenuAttributes + ld de, MoveScreen2DMenuData + call Load2DMenuData .loop call SetUpMoveList ld hl, w2DMenuFlags1 @@ -1077,12 +1077,12 @@ MoveScreenLoop: call ClearSprites jp ClearTilemap -MoveScreenAttributes: - db 3, 1 - db 3, 1 - db $40, $00 - dn 2, 0 - db D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON +MoveScreen2DMenuData: + db 3, 1 ; cursor start y, x + db 3, 1 ; rows, columns + db $40, $00 ; flags + dn 2, 0 ; cursor offsets + db D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON ; accepted buttons String_MoveWhere: db "Where?@" diff --git a/engine/pokemon/party_menu.asm b/engine/pokemon/party_menu.asm index c9f4dde31..fe470ed96 100644 --- a/engine/pokemon/party_menu.asm +++ b/engine/pokemon/party_menu.asm @@ -612,8 +612,8 @@ InitPartyMenuWithCancel: ; with cancel xor a ld [wSwitchMon], a - ld de, PartyMenuAttributes - call SetMenuAttributes + ld de, PartyMenu2DMenuData + call Load2DMenuData ld a, [wPartyCount] inc a ld [w2DMenuNumRows], a ; list length @@ -637,8 +637,8 @@ InitPartyMenuWithCancel: InitPartyMenuNoCancel: ; no cancel - ld de, PartyMenuAttributes - call SetMenuAttributes + ld de, PartyMenu2DMenuData + call Load2DMenuData ld a, [wPartyCount] ld [w2DMenuNumRows], a ; list length ld b, a @@ -656,20 +656,12 @@ InitPartyMenuNoCancel: ld [wMenuJoypadFilter], a ret -PartyMenuAttributes: -; cursor y -; cursor x -; num rows -; num cols -; bit 6: animate sprites bit 5: wrap around -; ? -; distance between items (hi: y, lo: x) -; allowed buttons (mask) - db 1, 0 - db 0, 1 - db $60, $00 - dn 2, 0 - db 0 +PartyMenu2DMenuData: + db 1, 0 ; cursor start y, x + db 0, 1 ; rows, columns + db $60, $00 ; flags + dn 2, 0 ; cursor offset + db 0 ; accepted buttons PartyMenuSelect: ; sets carry if exitted menu. diff --git a/home/menu.asm b/home/menu.asm index 3d026075c..cfa1cd444 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -1,20 +1,22 @@ -SetMenuAttributes:: +Load2DMenuData:: push hl push bc - ld hl, w2DMenuCursorInitY - ld b, $8 + ld hl, w2DMenuData + ld b, w2DMenuDataEnd - w2DMenuData .loop ld a, [de] inc de ld [hli], a dec b jr nz, .loop + + ; Reset menu state ld a, $1 - ld [hli], a - ld [hli], a + ld [hli], a ; wMenuCursorY + ld [hli], a ; wMenuCursorX xor a - ld [hli], a - ld [hli], a + ld [hli], a ; wCursorOffCharacter + ld [hli], a ; wCursorCurrentTile ld [hli], a pop bc pop hl diff --git a/mobile/mobile_40.asm b/mobile/mobile_40.asm index 1b93c8985..434615490 100644 --- a/mobile/mobile_40.asm +++ b/mobile/mobile_40.asm @@ -1765,7 +1765,7 @@ MobileMoveSelectionScreen: .GetMoveSelection: xor a ldh [hBGMapMode], a - call Function100c74 + call .ListMoves call Function100c98 .master_loop farcall MoveInfoBox @@ -1860,7 +1860,7 @@ MobileMoveSelectionScreen: call SafeLoadTempTilemapToTilemap jp .GetMoveSelection -Function100c74: +.ListMoves: hlcoord 0, 8 ld b, 8 ld c, 8 @@ -1876,8 +1876,8 @@ Function100c74: ret Function100c98: - ld de, .attrs - call SetMenuAttributes + ld de, .data + call Load2DMenuData ld a, [wNumMoves] inc a ld [w2DMenuNumRows], a @@ -1886,12 +1886,12 @@ Function100c98: ld [wMenuCursorY], a ret -.attrs - db 10, 1 - db 255, 1 - db $a0, $00 - dn 2, 0 - db D_UP | D_DOWN | A_BUTTON | B_BUTTON +.data: + db 10, 1 ; cursor start y, x + db -1, 1 ; rows, columns + db $a0, $00 ; flags + dn 2, 0 ; cursor offsets + db D_UP | D_DOWN | A_BUTTON | B_BUTTON ; accepted buttons Mobile_PartyMenuSelect: call Function100dd8 @@ -5944,7 +5944,7 @@ Function1029cf: ld hl, wcd4b set 1, [hl] ld de, MenuData3_102a33 - call SetMenuAttributes + call Load2DMenuData ld a, [wcd4a] inc a ld [wcd4a], a @@ -5981,11 +5981,11 @@ String_102a26: db "@" MenuData3_102a33: - db 8, 11 - db 2, 1 - db $80, $00 - dn 2, 0 - db A_BUTTON + db 8, 11 ; cursor start y, x + db 2, 1 ; rows, columns + db $80, $00 ; flags + dn 2, 0 ; cursor offset + db A_BUTTON ; accepted buttons Function102a3b: ld a, [wcd30] @@ -6115,8 +6115,8 @@ Function102b4e: ld [wMonType], a ld a, [wMenuCursorY] push af - ld de, Unknown_102b73 - call SetMenuAttributes + ld de, MenuData_102b73 + call Load2DMenuData pop af ld [wMenuCursorY], a ld a, [wOTPartyCount] @@ -6130,32 +6130,32 @@ Function102b68: ; unreferenced call ByteFill ret -Unknown_102b73: - db 9, 6 - db 255, 1 - db $a0, $00 - dn 1, 0 - db D_UP | D_DOWN | A_BUTTON +MenuData_102b73: + db 9, 6 ; cursor start y, x + db -1, 1 ; rows, columns + db $a0, $00 ; flags + dn 1, 0 ; cursor offset + db D_UP | D_DOWN | A_BUTTON ; accepted buttons Function102b7b: xor a ld [wMonType], a ld a, [wMenuCursorY] push af - ld de, Unknown_102b94 - call SetMenuAttributes + ld de, MenuData_102b94 + call Load2DMenuData pop af ld [wMenuCursorY], a ld a, [wPartyCount] ld [w2DMenuNumRows], a ret -Unknown_102b94: - db 1, 6 - db 255, 1 - db $a0, $00 - dn 1, 0 - db D_UP | D_DOWN | A_BUTTON +MenuData_102b94: + db 1, 6 ; cursor start y, x + db 255, 1 ; rows, columns + db $a0, $00 ; flags + dn 1, 0 ; cursor offset + db D_UP | D_DOWN | A_BUTTON ; accepted buttons Function102b9c: ld a, [wcd4d]