summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/battle_start.asm10
-rw-r--r--engine/party_menu.asm14
-rwxr-xr-xengine/startmenu.asm28
-rwxr-xr-xengine/switch_items.asm69
4 files changed, 67 insertions, 54 deletions
diff --git a/engine/battle_start.asm b/engine/battle_start.asm
index 162529999..929ac04c1 100644
--- a/engine/battle_start.asm
+++ b/engine/battle_start.asm
@@ -1,11 +1,11 @@
Predef_StartBattle: ; 8c20f
call Function8c26d
ld a, [rBGP]
- ld [wcfc7], a
+ ld [wBGP], a
ld a, [rOBP0]
- ld [wcfc8], a
+ ld [wOBP0], a
ld a, [rOBP1]
- ld [wcfc9], a
+ ld [wOBP1], a
call DelayFrame
ld hl, hVBlank
ld a, [hl]
@@ -35,7 +35,7 @@ Predef_StartBattle: ; 8c20f
ld [rSVBK], a
ld a, %11111111
- ld [wcfc7], a
+ ld [wBGP], a
call DmgToCgbBGPals
call DelayFrame
xor a
@@ -278,7 +278,7 @@ StartTrainerBattle_Flash: ; 8c3ab (23:43ab)
ld a, [hl]
cp %00000001
jr z, .done
- ld [wcfc7], a
+ ld [wBGP], a
call DmgToCgbBGPals
and a
ret
diff --git a/engine/party_menu.asm b/engine/party_menu.asm
index 7fc179b67..35f6e3d47 100644
--- a/engine/party_menu.asm
+++ b/engine/party_menu.asm
@@ -678,7 +678,7 @@ InitPartyMenuWithCancel: ; 50405
xor a
ld [wSwitchMon], a
ld de, PartyMenuAttributes
- call InitMenu3
+ call SetMenuAttributes
ld a, [PartyCount]
inc a
ld [w2DMenuNumRows], a ; list length
@@ -704,7 +704,7 @@ InitPartyMenuWithCancel: ; 50405
InitPartyMenuNoCancel: ; 0x5042d
; no cancel
ld de, PartyMenuAttributes
- call InitMenu3
+ call SetMenuAttributes
ld a, [PartyCount]
ld [w2DMenuNumRows], a ; list length
ld b, a
@@ -726,13 +726,17 @@ InitPartyMenuNoCancel: ; 0x5042d
PartyMenuAttributes: ; 5044f
; cursor y
; cursor x
-; list length
-; ?
+; num rows
+; num cols
; bit 6: animate sprites bit 5: wrap around
; ?
; distance between items (hi: y, lo: x)
; allowed buttons (mask)
- db $01, $00, $00, $01, $60, $00, $20, $00
+ db 1, 0
+ db 0, 1
+ db $60, $00
+ dn 2, 0
+ db 0
; 50457
PartyMenuSelect: ; 0x50457
diff --git a/engine/startmenu.asm b/engine/startmenu.asm
index c97b10ffc..9127611ff 100755
--- a/engine/startmenu.asm
+++ b/engine/startmenu.asm
@@ -270,7 +270,7 @@ endr
.GetMenuAccountTextPointer ; 12819
ld e, a
ld d, 0
- ld hl, wcf97
+ ld hl, wMenuData2PointerTableAddr
ld a, [hli]
ld h, [hl]
ld l, a
@@ -1475,8 +1475,8 @@ ChooseMoveToDelete: ; 12f5b
.asm_12f73: ; 12f73
call SetUpMoveScreenBG
- ld de, Unknown_12fb2
- call InitMenu3
+ ld de, DeleteMoveScreenAttrs
+ call SetMenuAttributes
call SetUpMoveList
ld hl, w2DMenuFlags1
set 6, [hl]
@@ -1514,8 +1514,12 @@ ChooseMoveToDelete: ; 12f5b
ret
; 12fb2
-Unknown_12fb2: ; 12fb2
- db $03, $01, $03, $01, $40, $00, $20, $c3
+DeleteMoveScreenAttrs: ; 12fb2
+ db 3, 1
+ db 3, 1
+ db $40, $00
+ dn 2, 0
+ db D_UP | D_DOWN | A_BUTTON | B_BUTTON
; 12fba
ManagePokemonMoves: ; 12fba
@@ -1539,11 +1543,11 @@ ManagePokemonMoves: ; 12fba
MoveScreenLoop: ; 12fd5
ld a, [CurPartyMon]
inc a
- ld [wd0d8], a
+ ld [wPartyMenuCursor], a
call SetUpMoveScreenBG
call Function132d3
- ld de, Unknown_13163
- call InitMenu3
+ ld de, MoveScreenAttributes
+ call SetMenuAttributes
.loop
call SetUpMoveList
ld hl, w2DMenuFlags1
@@ -1746,8 +1750,12 @@ MoveScreenLoop: ; 12fd5
jp ClearTileMap
; 13163
-Unknown_13163: ; 13163
- db $03, $01, $03, $01, $40, $00, $20, $f3
+MoveScreenAttributes: ; 13163
+ 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
; 1316b
String_1316b: ; 1316b
diff --git a/engine/switch_items.asm b/engine/switch_items.asm
index 46e000fd1..d1c8aa66c 100755
--- a/engine/switch_items.asm
+++ b/engine/switch_items.asm
@@ -8,9 +8,9 @@ SwitchItemsInBag: ; 2490c (9:490c)
cp b
jr z, .trivial
ld a, [wScrollingMenuCursorPosition]
- call Function24a5c
+ call ItemSwitch_GetNthItem
ld a, [hl]
- cp $ff
+ cp -1
ret z
ld a, [wSwitchItem]
dec a
@@ -45,10 +45,10 @@ SwitchItemsInBag: ; 2490c (9:490c)
call Function24a6c
push bc
ld a, [wSwitchItem]
- call Function24a5c
+ call ItemSwitch_GetNthItem
dec hl
push hl
- call Function24a80
+ call ItemSwitch_ConvertSpacingToDW
add hl, bc
ld d, h
ld e, l
@@ -71,10 +71,10 @@ SwitchItemsInBag: ; 2490c (9:490c)
call Function24a6c
push bc
ld a, [wSwitchItem]
- call Function24a5c
+ call ItemSwitch_GetNthItem
ld d, h
ld e, l
- call Function24a80
+ call ItemSwitch_ConvertSpacingToDW
add hl, bc
pop bc
call CopyBytes
@@ -86,11 +86,11 @@ SwitchItemsInBag: ; 2490c (9:490c)
Function249a7: ; 249a7 (9:49a7)
ld a, [wSwitchItem]
- call Function24a5c
+ call ItemSwitch_GetNthItem
ld d, h
ld e, l
ld a, [wScrollingMenuCursorPosition]
- call Function24a5c
+ call ItemSwitch_GetNthItem
ld a, [de]
cp [hl]
jr nz, .asm_249cd
@@ -112,11 +112,11 @@ Function249a7: ; 249a7 (9:49a7)
Function249d1: ; 249d1 (9:49d1)
ld a, [wSwitchItem]
- call Function24a5c
+ call ItemSwitch_GetNthItem
inc hl
push hl
ld a, [wScrollingMenuCursorPosition]
- call Function24a5c
+ call ItemSwitch_GetNthItem
inc hl
ld a, [hl]
pop hl
@@ -126,11 +126,11 @@ Function249d1: ; 249d1 (9:49d1)
sub 99
push af
ld a, [wScrollingMenuCursorPosition]
- call Function24a5c
+ call ItemSwitch_GetNthItem
inc hl
ld [hl], 99
ld a, [wSwitchItem]
- call Function24a5c
+ call ItemSwitch_GetNthItem
inc hl
pop af
ld [hl], a
@@ -141,7 +141,7 @@ Function249d1: ; 249d1 (9:49d1)
.asm_24a01
push af
ld a, [wScrollingMenuCursorPosition]
- call Function24a5c
+ call ItemSwitch_GetNthItem
inc hl
pop af
ld [hl], a
@@ -154,7 +154,7 @@ Function249d1: ; 249d1 (9:49d1)
jr nz, .asm_24a25
dec [hl]
ld a, [wSwitchItem]
- call Function24a5c
+ call ItemSwitch_GetNthItem
ld [hl], $ff
xor a
ld [wSwitchItem], a
@@ -162,10 +162,10 @@ Function249d1: ; 249d1 (9:49d1)
.asm_24a25
dec [hl]
- call Function24a80
+ call ItemSwitch_ConvertSpacingToDW
push bc
ld a, [wSwitchItem]
- call Function24a5c
+ call ItemSwitch_GetNthItem
pop bc
push hl
add hl, bc
@@ -181,24 +181,24 @@ Function249d1: ; 249d1 (9:49d1)
ret
Function24a40: ; 24a40 (9:4a40)
- call Function24a5c
+ call ItemSwitch_GetNthItem
ld de, wd002
- call Function24a80
+ call ItemSwitch_ConvertSpacingToDW
call CopyBytes
ret
Function24a4d: ; 24a4d (9:4a4d)
- call Function24a5c
+ call ItemSwitch_GetNthItem
ld d, h
ld e, l
ld hl, wd002
- call Function24a80
+ call ItemSwitch_ConvertSpacingToDW
call CopyBytes
ret
-Function24a5c: ; 24a5c (9:4a5c)
+ItemSwitch_GetNthItem: ; 24a5c (9:4a5c)
push af
- call Function24a80
+ call ItemSwitch_ConvertSpacingToDW
ld hl, wMenuData2_ItemsPointerAddr
ld a, [hli]
ld h, [hl]
@@ -210,13 +210,13 @@ Function24a5c: ; 24a5c (9:4a5c)
Function24a6c: ; 24a6c (9:4a6c)
push hl
- call Function24a80
+ call ItemSwitch_ConvertSpacingToDW
ld a, d
sub e
- jr nc, .asm_24a76
+ jr nc, .dont_negate
dec a
cpl
-.asm_24a76
+.dont_negate
ld hl, 0
call AddNTimes
ld b, h
@@ -224,12 +224,13 @@ Function24a6c: ; 24a6c (9:4a6c)
pop hl
ret
-Function24a80: ; 24a80 (9:4a80)
+ItemSwitch_ConvertSpacingToDW: ; 24a80 (9:4a80)
+; This function is absolutely idiotic.
push hl
- ld a, [wcf94]
+ ld a, [wMenuData2_ScrollingMenuSpacing]
ld c, a
ld b, 0
- ld hl, Unknown_24a91
+ ld hl, .spacing_dws
rept 2
add hl, bc
endr
@@ -241,23 +242,23 @@ endr
; 24a91 (9:4a91)
-Unknown_24a91: ; 24a91
+.spacing_dws: ; 24a91
dw 0, 1, 2
; 24a97
Function24a97: ; 24a97 (9:4a97)
push af
- call Function24a80
+ call ItemSwitch_ConvertSpacingToDW
ld a, c
- cp $2
- jr nz, .asm_24aa7
+ cp 2
+ jr nz, .not_2
pop af
- call Function24a5c
+ call ItemSwitch_GetNthItem
inc hl
ld a, [hl]
ret
-.asm_24aa7
+.not_2
pop af
ld a, $1
ret