summaryrefslogtreecommitdiff
path: root/engine/menu
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2016-05-22 21:02:18 -0400
committerluckytyphlosion <alan.rj.huang@gmail.com>2016-05-22 21:02:18 -0400
commitf3de3a20dfccb8a57cdf9feb860bf1e89a733f50 (patch)
tree5d3f60d4b7fdcf44f4202e7db915213d041f663d /engine/menu
parent3da00e31f8698c1b994c24ca55b5b9c3d3454af8 (diff)
Bank11 and 14 misc functions.
Diffstat (limited to 'engine/menu')
-rwxr-xr-xengine/menu/prize_menu.asm225
1 files changed, 113 insertions, 112 deletions
diff --git a/engine/menu/prize_menu.asm b/engine/menu/prize_menu.asm
index 626f670a..0fedcca4 100755
--- a/engine/menu/prize_menu.asm
+++ b/engine/menu/prize_menu.asm
@@ -1,4 +1,4 @@
-CeladonPrizeMenu: ; 5271b (14:671b)
+CeladonPrizeMenu: ; 5267d (14:667d)
ld b,COIN_CASE
call IsItemInBag
jr nz,.havingCoinCase
@@ -23,8 +23,7 @@ CeladonPrizeMenu: ; 5271b (14:671b)
ld [wTopMenuItemX],a
call PrintPrizePrice
coord hl, 0, 2
- ld b,$08
- ld c,$10
+ lb bc, 8, 16
call TextBoxBorder
call GetPrizeMenuId
call UpdateSprites
@@ -32,30 +31,30 @@ CeladonPrizeMenu: ; 5271b (14:671b)
call PrintText
call HandleMenuInput ; menu choice handler
bit 1,a ; keypress = B (Cancel)
- jr nz,.NoChoice
+ jr nz, .noChoice
ld a,[wCurrentMenuItem]
- cp a,$03 ; "NO,THANKS" choice
- jr z,.NoChoice
+ cp $03 ; "NO,THANKS" choice
+ jr z, .noChoice
call HandlePrizeChoice
-.NoChoice
- ld hl,wd730
- res 6,[hl]
+.noChoice
+ ld hl, wd730
+ res 6, [hl]
ret
-RequireCoinCaseTextPtr: ; 5277e (14:677e)
+RequireCoinCaseTextPtr: ; 526df (14:66df)
TX_FAR _RequireCoinCaseText
db $0D
db "@"
-ExchangeCoinsForPrizesTextPtr: ; 52784 (14:6784)
+ExchangeCoinsForPrizesTextPtr: ; 526e5 (14:66e5)
TX_FAR _ExchangeCoinsForPrizesText
db "@"
-WhichPrizeTextPtr: ; 52789 (14:6789)
+WhichPrizeTextPtr: ; 526ea (14:66ea)
TX_FAR _WhichPrizeText
db "@"
-GetPrizeMenuId: ; 5278e (14:678e)
+GetPrizeMenuId: ; 526ef (14:66ef)
; determine which one among the three
; prize-texts has been selected
; using the text ID (stored in [hSpriteIndexOrTextID])
@@ -64,70 +63,70 @@ GetPrizeMenuId: ; 5278e (14:678e)
; display the three prizes' names
; (distinguishing between Pokemon names
; and Items (specifically TMs) names)
- ld a,[hSpriteIndexOrTextID]
- sub a,3 ; prize-texts' id are 3, 4 and 5
- ld [wWhichPrizeWindow],a ; prize-texts' id (relative, i.e. 0, 1 or 2)
+ ld a, [hSpriteIndexOrTextID]
+ sub 3 ; prize-texts' id are 3, 4 and 5
+ ld [wWhichPrizeWindow], a ; prize-texts' id (relative, i.e. 0, 1 or 2)
add a
add a
- ld d,0
- ld e,a
- ld hl,PrizeDifferentMenuPtrs
- add hl,de
- ld a,[hli]
- ld d,[hl]
- ld e,a
+ ld d, $0
+ ld e, a
+ ld hl, PrizeDifferentMenuPtrs
+ add hl, de
+ ld a, [hli]
+ ld d, [hl]
+ ld e, a
inc hl
push hl
- ld hl,W_PRIZE1
+ ld hl, wPrize1
call CopyString
pop hl
- ld a,[hli]
- ld h,[hl]
- ld l,a
- ld de,wPrize1Price
- ld bc,6
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, wPrize1Price
+ ld bc, $6
call CopyData
- ld a,[wWhichPrizeWindow]
- cp a,$02 ;is TM_menu?
- jr nz,.putMonName
- ld a,[W_PRIZE1]
- ld [wd11e],a
+ ld a, [wWhichPrizeWindow]
+ cp $02 ;is TM_menu?
+ jr nz, .putMonName
+ ld a, [wPrize1]
+ ld [wd11e], a
call GetItemName
coord hl, 2, 4
call PlaceString
- ld a,[W_PRIZE2]
- ld [wd11e],a
+ ld a, [wPrize2]
+ ld [wd11e], a
call GetItemName
coord hl, 2, 6
call PlaceString
- ld a,[W_PRIZE3]
- ld [wd11e],a
+ ld a, [wPrize3]
+ ld [wd11e], a
call GetItemName
coord hl, 2, 8
call PlaceString
jr .putNoThanksText
.putMonName
- ld a,[W_PRIZE1]
- ld [wd11e],a
+ ld a, [wPrize1]
+ ld [wd11e], a
call GetMonName
coord hl, 2, 4
call PlaceString
- ld a,[W_PRIZE2]
- ld [wd11e],a
+ ld a, [wPrize2]
+ ld [wd11e], a
call GetMonName
coord hl, 2, 6
call PlaceString
- ld a,[W_PRIZE3]
- ld [wd11e],a
+ ld a, [wPrize3]
+ ld [wd11e], a
call GetMonName
coord hl, 2, 8
call PlaceString
.putNoThanksText
coord hl, 2, 10
- ld de,NoThanksText
+ ld de, NoThanksText
call PlaceString
; put prices on the right side of the textbox
- ld de,wPrize1Price
+ ld de, wPrize1Price
coord hl, 13, 5
; reg. c:
; [low nybble] number of bytes
@@ -138,91 +137,93 @@ GetPrizeMenuId: ; 5278e (14:678e)
call PrintBCDNumber
ld de,wPrize2Price
coord hl, 13, 7
- ld c,(%1 << 7 | 2)
+ ld c, (1 << 7 | 2)
call PrintBCDNumber
- ld de,wPrize3Price
+ ld de, wPrize3Price
coord hl, 13, 9
- ld c,(1 << 7 | 2)
+ ld c, (1 << 7 | 2)
jp PrintBCDNumber
+NoThanksText: ; 527a4 (14:67a4)
+ db "NO THANKS@"
+
INCLUDE "data/prizes.asm"
-PrintPrizePrice: ; 5287a (14:687a)
+PrintPrizePrice: ; 527db (14:67db)
coord hl, 11, 0
- ld b,$01
- ld c,$07
+ lb bc, 1, 7
call TextBoxBorder
call UpdateSprites
coord hl, 12, 0
- ld de,.CoinText
+ ld de, CoinString
call PlaceString
coord hl, 13, 1
- ld de,.SixSpacesText
+ ld de, SixSpacesString
call PlaceString
coord hl, 13, 1
ld de,wPlayerCoins
- ld c,%10000010
+ ld c, (1 << 7 | 2)
call PrintBCDNumber
ret
-.CoinText
+CoinString: ; 52805 (14:6805)
db "COIN@"
-.SixSpacesText
+SixSpacesString: ; 5280a (14:680a)
db " @"
-LoadCoinsToSubtract: ; 528b1 (14:68b1)
+LoadCoinsToSubtract: ; 52811 (14:6811)
ld a,[wWhichPrize]
add a
- ld d,0
- ld e,a
- ld hl,wPrize1Price
- add hl,de ; get selected prize's price
+ ld d, $0
+ ld e, a
+ ld hl, wPrize1Price
+ add hl, de ; get selected prize's price
xor a
- ld [hUnusedCoinsByte],a
- ld a,[hli]
- ld [hCoins],a
- ld a,[hl]
- ld [hCoins + 1],a
+ ld [hUnusedCoinsByte], a
+ ld a, [hli]
+ ld [hCoins], a
+ ld a, [hl]
+ ld [hCoins + 1], a
ret
-HandlePrizeChoice: ; 528c6 (14:68c6)
- ld a,[wCurrentMenuItem]
- ld [wWhichPrize],a
- ld d,0
- ld e,a
- ld hl,W_PRIZE1
- add hl,de
- ld a,[hl]
- ld [wd11e],a
- ld a,[wWhichPrizeWindow]
- cp a,$02 ; is prize a TM?
- jr nz,.GetMonName
+HandlePrizeChoice: ; 52826 (14:6826)
+ ld a, [wCurrentMenuItem]
+ ld [wWhichPrize], a
+ ld d, $0
+ ld e, a
+ ld hl, wPrize1
+ add hl, de
+ ld a, [hl]
+ ld [wd11e], a
+ ld a, [wWhichPrizeWindow]
+ cp $02 ; is prize a TM?
+ jr nz, .getMonName
call GetItemName
- jr .GivePrize
-.GetMonName
+ jr .givePrize
+.getMonName
call GetMonName
-.GivePrize
+.givePrize
ld hl,SoYouWantPrizeTextPtr
call PrintText
call YesNoChoice
- ld a,[wCurrentMenuItem] ; yes/no answer (Y=0, N=1)
+ ld a, [wCurrentMenuItem] ; yes/no answer (Y=0, N=1)
and a
- jr nz,.PrintOhFineThen
+ jr nz, .printOhFineThen
call LoadCoinsToSubtract
call HasEnoughCoins
- jr c,.NotEnoughCoins
- ld a,[wWhichPrizeWindow]
- cp a,$02
- jr nz,.GiveMon
+ jr c, .notEnoughCoins
+ ld a, [wWhichPrizeWindow]
+ cp $02
+ jr nz, .giveMon
ld a,[wd11e]
- ld b,a
- ld a,1
- ld c,a
+ ld b, a
+ ld a, 1
+ ld c, a
call GiveItem
- jr nc,.BagFull
- jr .SubtractCoins
-.GiveMon
+ jr nc, .bagFull
+ jr .subtractCoins
+.giveMon
ld a,[wd11e]
ld [wcf91],a
push af
@@ -243,64 +244,64 @@ HandlePrizeChoice: ; 528c6 (14:68c6)
; were full), return without subtracting coins.
ret nc
-.SubtractCoins
+.subtractCoins
call LoadCoinsToSubtract
ld hl,hCoins + 1
ld de,wPlayerCoins + 1
ld c,$02 ; how many bytes
predef SubBCDPredef
jp PrintPrizePrice
-.BagFull
+.bagFull
ld hl,PrizeRoomBagIsFullTextPtr
jp PrintText
-.NotEnoughCoins
+.notEnoughCoins
ld hl,SorryNeedMoreCoinsText
jp PrintText
-.PrintOhFineThen
+.printOhFineThen
ld hl,OhFineThenTextPtr
jp PrintText
-UnknownData52951: ; 52951 (14:6951)
+UnknownData528b1: ; 528b1 (14:68b1)
; XXX what's this?
db $00,$01,$00,$01,$00,$01,$00,$00,$01
-HereYouGoTextPtr: ; 5295a (14:695a)
+HereYouGoTextPtr: ; 528ca (14:68ba)
TX_FAR _HereYouGoText
db $0D
db "@"
-SoYouWantPrizeTextPtr: ; 52960 (14:6960)
+SoYouWantPrizeTextPtr: ; 528c0 (14:68c0)
TX_FAR _SoYouWantPrizeText
db "@"
-SorryNeedMoreCoinsText: ; 52965 (14:6965)
+SorryNeedMoreCoinsText: ; 528c5 (14:68c5)
TX_FAR _SorryNeedMoreCoinsText
db $0D
db "@"
-PrizeRoomBagIsFullTextPtr: ; 5296b (14:696b)
+PrizeRoomBagIsFullTextPtr: ; 528cb (14:68cb)
TX_FAR _OopsYouDontHaveEnoughRoomText
db $0D
db "@"
-OhFineThenTextPtr: ; 52971 (14:6971)
+OhFineThenTextPtr: ; 528d1 (14:68d1)
TX_FAR _OhFineThenText
db $0D ; wait keypress (A/B) without blink
db "@"
-GetPrizeMonLevel: ; 52977 (14:6977)
- ld a,[wcf91]
- ld b,a
- ld hl,PrizeMonLevelDictionary
+GetPrizeMonLevel: ; 528d7 (14:68d7)
+ ld a, [wcf91]
+ ld b, a
+ ld hl, PrizeMonLevelDictionary
.loop
- ld a,[hli]
+ ld a, [hli]
cp b
- jr z,.matchFound
+ jr z, .matchFound
inc hl
jr .loop
.matchFound
- ld a,[hl]
- ld [wCurEnemyLVL],a
+ ld a, [hl]
+ ld [wCurEnemyLVL], a
ret
INCLUDE "data/prize_mon_levels.asm"