SelectMenu

This commit is contained in:
yenatch 2013-07-02 23:01:34 -04:00
parent dca6fd37cd
commit 24daef7afb
2 changed files with 306 additions and 33 deletions

324
main.asm
View File

@ -2927,7 +2927,23 @@ CheckFacingSign: ; 2a8b
; 0x2ad4
INCBIN "baserom.gbc", $2ad4, $2b74 - $2ad4
INCBIN "baserom.gbc", $2ad4, $2b29 - $2ad4
FadeToMenu: ; 2b29
xor a
ld [hBGMapMode], a
call $1d6e
ld a, $23
ld hl, $4084
rst FarCall
call ClearSprites
call Function2ed3
ret
; 2b3c
INCBIN "baserom.gbc", $2b3c, $2b74 - $2b3c
Function2b74: ; 0x2b74
@ -3201,7 +3217,27 @@ Predef: ; 2d83
ret
; 2dba
INCBIN "baserom.gbc", $2dba, $2e6f-$2dba
ResetWindow: ; 2dba
call $1fbf
ld a, [hROMBank]
push af
ld a, $1
rst Bankswitch
call $6454
call $2e20
call $64bf
pop af
rst Bankswitch
ret
; 2dcf
INCBIN "baserom.gbc", $2dcf, $2e6f-$2dcf
BitTable1Func: ; 0x2e6f
ld hl, $da72
@ -3323,7 +3359,30 @@ InitString: ; 0x2ef9
ret
; 0x2f17
INCBIN "baserom.gbc", $2f17, $2f8c - $2f17
INCBIN "baserom.gbc", $2f17, $2f3f - $2f17
DoItemEffect: ; 2f3f
callba _DoItemEffect
ret
; 2f46
CheckTossableItem: ; 2f46
push hl
push de
push bc
callba _CheckTossableItem
pop bc
pop de
pop hl
ret
; 2f53
INCBIN "baserom.gbc", $2f53, $2f8c - $2f53
RNG: ; 2f8c
; Two random numbers are generated by adding and subtracting
@ -6763,7 +6822,7 @@ GetNumberedTMHM: ; d417
; d427
CheckTossableItem: ; d427
_CheckTossableItem: ; d427
; Return 1 in $d142 and carry if CurItem can't be removed from the bag.
ld a, 4
call GetItemAttr
@ -6872,7 +6931,7 @@ ClearPCItemScreen: ; e58b
INCBIN "baserom.gbc", $e5bb, $e722 - $e5bb
DoItemEffect: ; e722
_DoItemEffect: ; e722
ld a, [CurItem]
ld [$d265], a
call GetItemName
@ -7663,7 +7722,7 @@ StartMenu_Save: ; 1290b
StartMenu_Option: ; 1291c
; Game options.
call $2b29
call FadeToMenu
ld a, $1
ld hl, $5b64
rst FarCall
@ -7675,7 +7734,7 @@ StartMenu_Option: ; 1291c
StartMenu_Status: ; 12928
; Player status.
call $2b29
call FadeToMenu
ld a, $9
ld hl, $5105
rst FarCall
@ -7691,7 +7750,7 @@ StartMenu_Pokedex: ; 12937
and a
jr z, .asm_12949
call $2b29
call FadeToMenu
ld a, $10
ld hl, $4000
rst FarCall
@ -7705,7 +7764,7 @@ StartMenu_Pokedex: ; 12937
StartMenu_Pokegear: ; 1294c
call $2b29
call FadeToMenu
ld a, $24
ld hl, $4b8d
rst FarCall
@ -7717,7 +7776,7 @@ StartMenu_Pokegear: ; 1294c
StartMenu_Pack: ; 1295b
call $2b29
call FadeToMenu
ld a, $4
ld hl, $4000
rst FarCall
@ -7740,7 +7799,7 @@ StartMenu_Pokemon: ; 12976
and a
jr z, .return
call $2b29 ; fade in?
call FadeToMenu
.choosemenu
xor a
@ -7791,7 +7850,19 @@ StartMenu_Pokemon: ; 12976
; 129d5
INCBIN "baserom.gbc", $129d5, $12a6c - $129d5
INCBIN "baserom.gbc", $129d5, $12a60 - $129d5
CantUseItem: ; 12a60
ld hl, CantUseItemText
call $2012
ret
; 12a67
CantUseItemText: ; 12a67
text_jump UnknownText_0x1c1b03, BANK(UnknownText_0x1c1b03)
db "@"
; 12a6c
PartyMonItemName: ; 12a6c
@ -7989,7 +8060,7 @@ Function12ba9: ; 12ba9
cp 2
jr z, .next
call $2f46
call CheckTossableItem
ld a, [$d142]
and a
jr nz, .next
@ -8213,7 +8284,201 @@ OpenPartyStats: ; 12e00
; 12e1b
INCBIN "baserom.gbc", $12e1b, $13b87 - $12e1b
INCBIN "baserom.gbc", $12e1b, $13327 - $12e1b
SelectMenu: ; 13327
call CheckRegisteredItem
jr c, .NotRegistered
jp UseRegisteredItem
.NotRegistered
call $2e08
ld b, BANK(ItemMayBeRegisteredText)
ld hl, ItemMayBeRegisteredText
call $269a
call $0a46
jp $2dcf
; 13340
ItemMayBeRegisteredText: ; 13340
text_jump UnknownText_0x1c1cf3, BANK(UnknownText_0x1c1cf3)
db "@"
; 13345
CheckRegisteredItem: ; 13345
ld a, [WhichRegisteredItem]
and a
jr z, .NoRegisteredItem
and REGISTERED_POCKET
rlca
rlca
ld hl, .Pockets
rst $28
ret
.Pockets
dw .CheckItem
dw .CheckBall
dw .CheckKeyItem
dw .CheckTMHM
.CheckItem
ld hl, NumItems
call .CheckRegisteredNo
jr c, .NoRegisteredItem
inc hl
ld e, a
ld d, 0
add hl, de
add hl, de
call .IsSameItem
jr c, .NoRegisteredItem
and a
ret
.CheckKeyItem
ld a, [RegisteredItem]
ld hl, KeyItems
ld de, 1
call IsInArray
jr nc, .NoRegisteredItem
ld a, [RegisteredItem]
ld [CurItem], a
and a
ret
.CheckBall
ld hl, NumBalls
call .CheckRegisteredNo
jr nc, .NoRegisteredItem
inc hl
ld e, a
ld d, 0
add hl, de
add hl, de
call .IsSameItem
jr c, .NoRegisteredItem
ret
.CheckTMHM
jr .NoRegisteredItem
.NoRegisteredItem
xor a
ld [WhichRegisteredItem], a
ld [RegisteredItem], a
scf
ret
; 133a6
.CheckRegisteredNo ; 133a6
ld a, [WhichRegisteredItem]
and REGISTERED_NUMBER
dec a
cp [hl]
jr nc, .NotEnoughItems
ld [$d107], a
and a
ret
.NotEnoughItems
scf
ret
; 133b6
.IsSameItem ; 133b6
ld a, [RegisteredItem]
cp [hl]
jr nz, .NotSameItem
ld [CurItem], a
and a
ret
.NotSameItem
scf
ret
; 133c3
UseRegisteredItem: ; 133c3
callba CheckItemMenu
ld a, [$d142]
ld hl, .SwitchTo
rst $28
ret
.SwitchTo
dw .CantUse
dw .NoFunction
dw .NoFunction
dw .NoFunction
dw .Current
dw .Party
dw .Overworld
; 133df
.NoFunction ; 133df
call $2e08
call CantUseItem
call $2dcf
and a
ret
; 133ea
.Current ; 133ea
call $2e08
call DoItemEffect
call $2dcf
and a
ret
; 133f5
.Party ; 133f5
call ResetWindow
call FadeToMenu
call DoItemEffect
call $2b3c
call $2dcf
and a
ret
; 13406
.Overworld ; 13406
call ResetWindow
ld a, 1
ld [$d0ef], a
call DoItemEffect
xor a
ld [$d0ef], a
ld a, [$d0ec]
cp 1
jr nz, .asm_13425
scf
ld a, $80
ld [$ffa0], a
ret
; 13422
.CantUse ; 13422
call ResetWindow
.asm_13425
call CantUseItem
call $2dcf
and a
ret
; 1342d
INCBIN "baserom.gbc", $1342d, $13b87 - $1342d
GetSquareRoot: ; 13b87
@ -8401,8 +8666,8 @@ KrisWithdrawItemMenu: ; 0x157d1
Function157e9: ; 0x157e9
; check if the item has a quantity
ld a, BANK(CheckTossableItem)
ld hl, CheckTossableItem
ld a, BANK(_CheckTossableItem)
ld hl, _CheckTossableItem
rst $8
ld a, [$d142]
and a
@ -8525,7 +8790,7 @@ KrisDepositItemMenu: ; 0x1588b
jr z, .asm_158b3
call Function158cc
ld a, $4
ld hl, $7345
ld hl, CheckRegisteredItem
rst $8
jr .asm_1589c
@ -9105,8 +9370,8 @@ Function24ac3: ; 0x24ac3
push de
ld a, [MenuSelection]
ld [CurItem], a
ld a, BANK(CheckTossableItem)
ld hl, CheckTossableItem
ld a, BANK(_CheckTossableItem)
ld hl, _CheckTossableItem
rst $8
ld a, [$d142]
pop hl
@ -11803,7 +12068,7 @@ Function4484a: ; 0x4484a
dw .Cancel
.ReadMail ; 0x44869
call $2b29
call FadeToMenu
ld a, [MenuSelection]
dec a
ld b, a
@ -11863,7 +12128,7 @@ Function4484a: ; 0x4484a
; 0x448d2
.AttachMail ; 0x448d2
call $2b29
call FadeToMenu
xor a
ld [$d141], a
call $31f3
@ -16956,26 +17221,27 @@ CheckMenuOW: ; 96b30
StartMenuScript: ; 96b58
3callasm BANK(StartMenu), StartMenu
2jump UnknownScript_0x96b66
2jump StartMenuCallback
; 96b5f
SelectMenuScript: ; 96b5f
3callasm $04, $7327 ; SelectMenu
2jump UnknownScript_0x96b66
3callasm BANK(SelectMenu), SelectMenu
2jump SelectMenuCallback
; 96b66
UnknownScript_0x96b66: ; 96b66
StartMenuCallback:
SelectMenuCallback: ; 96b66
copybytetovar $ffa0
if_equal $80, UnknownScript_0x96b72
if_equal $ff, UnknownScript_0x96b75
if_equal $80, .Script
if_equal $ff, .Asm
end
; 96b72
UnknownScript_0x96b72: ; 96b72
.Script ; 96b72
2ptjump $d0e8
; 96b75
UnknownScript_0x96b75: ; 96b75
.Asm ; 96b75
2ptcallasm $d0e8
end
; 96b79

View File

@ -1665,19 +1665,26 @@ TMsHMs: ; d859
NumItems: ; d892
ds 1
Items: ; d893
ds 69
ds 41
NumKeyItems: ; d8bc
ds 1
KeyItems: ; d8bd
ds 13
ds 26
NumBalls: ; d8d7
ds 1
Balls: ; d8d8
ds 25
SECTION "overworld",BSS[$d95d]
SECTION "overworld",BSS[$d95b]
WhichRegisteredItem: ; d95b
REGISTERED_POCKET EQU %11000000
REGISTERED_NUMBER EQU %00111111
ds 1
RegisteredItem: ; d95c
ds 1
PlayerState: ; d95d
PLAYER_NORMAL EQU 0
PLAYER_BIKE EQU 1