pokered/engine/menu/party_menu.asm

326 lines
6.1 KiB
NASM
Raw Normal View History

; [wPartyMenuTypeOrMessageID] = menu type / message ID
2014-05-22 22:13:20 +00:00
; if less than $F0, it is a menu type
; menu types:
; 00: normal pokemon menu (e.g. Start menu)
; 01: use healing item on pokemon menu
; 02: in-battle switch pokemon menu
; 03: learn TM/HM menu
; 04: swap pokemon positions menu
; 05: use evolution stone on pokemon menu
; otherwise, it is a message ID
; f0: poison healed
; f1: burn healed
; f2: freeze healed
; f3: sleep healed
; f4: paralysis healed
; f5: HP healed
; f6: health returned
; f7: revitalized
; f8: leveled up
2016-06-12 00:24:04 +00:00
DrawPartyMenu_:
2014-05-22 22:13:20 +00:00
xor a
ld [H_AUTOBGTRANSFERENABLED],a
call ClearScreen
call UpdateSprites
2015-03-14 02:22:55 +00:00
callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
RedrawPartyMenu_:
ld a,[wPartyMenuTypeOrMessageID]
cp a,SWAP_MONS_PARTY_MENU
2014-05-22 22:13:20 +00:00
jp z,.printMessage
call ErasePartyMenuCursors
2015-08-12 09:16:56 +00:00
callba InitPartyMenuBlkPacket
2015-07-18 20:52:03 +00:00
coord hl, 3, 0
ld de,wPartySpecies
2014-05-22 22:13:20 +00:00
xor a
ld c,a
2015-03-13 12:33:16 +00:00
ld [hPartyMonIndex],a
2015-08-12 09:16:56 +00:00
ld [wWhichPartyMenuHPBar],a
2014-05-22 22:13:20 +00:00
.loop
ld a,[de]
cp a,$FF ; reached the terminator?
jp z,.afterDrawingMonEntries
push bc
push de
push hl
ld a,c
push hl
ld hl,wPartyMonNicks
2014-05-22 22:13:20 +00:00
call GetPartyMonName
pop hl
call PlaceString ; print the pokemon's name
2015-03-13 12:33:16 +00:00
callba WriteMonPartySpriteOAMByPartyIndex ; place the appropriate pokemon icon
ld a,[hPartyMonIndex]
2014-05-22 22:13:20 +00:00
ld [wWhichPokemon],a
inc a
2015-03-13 12:33:16 +00:00
ld [hPartyMonIndex],a
2014-05-22 22:13:20 +00:00
call LoadMonData
pop hl
push hl
2014-08-09 05:39:13 +00:00
ld a,[wMenuItemToSwap]
2014-05-22 22:13:20 +00:00
and a ; is the player swapping pokemon positions?
jr z,.skipUnfilledRightArrow
; if the player is swapping pokemon positions
dec a
ld b,a
ld a,[wWhichPokemon]
cp b ; is the player swapping the current pokemon in the list?
jr nz,.skipUnfilledRightArrow
; the player is swapping the current pokemon in the list
dec hl
dec hl
dec hl
2016-07-18 06:17:03 +00:00
ld a,"▷" ; unfilled right arrow menu cursor
2014-05-22 22:13:20 +00:00
ld [hli],a ; place the cursor
inc hl
inc hl
.skipUnfilledRightArrow
ld a,[wPartyMenuTypeOrMessageID] ; menu type
cp a,TMHM_PARTY_MENU
2014-05-22 22:13:20 +00:00
jr z,.teachMoveMenu
cp a,EVO_STONE_PARTY_MENU
2014-05-22 22:13:20 +00:00
jr z,.evolutionStoneMenu
push hl
ld bc,14 ; 14 columns to the right
add hl,bc
2015-02-08 02:37:40 +00:00
ld de,wLoadedMonStatus
2014-05-22 22:13:20 +00:00
call PrintStatusCondition
pop hl
push hl
2016-07-18 06:17:03 +00:00
ld bc,SCREEN_WIDTH + 1 ; down 1 row and right 1 column
2015-02-08 00:24:16 +00:00
ld a,[hFlags_0xFFF6]
2014-05-22 22:13:20 +00:00
set 0,a
2015-02-08 00:24:16 +00:00
ld [hFlags_0xFFF6],a
2014-05-22 22:13:20 +00:00
add hl,bc
2015-02-08 06:18:42 +00:00
predef DrawHP2 ; draw HP bar and prints current / max HP
2015-02-08 00:24:16 +00:00
ld a,[hFlags_0xFFF6]
2014-05-22 22:13:20 +00:00
res 0,a
2015-02-08 00:24:16 +00:00
ld [hFlags_0xFFF6],a
2015-08-12 09:16:56 +00:00
call SetPartyMenuHPBarColor ; color the HP bar (on SGB)
2014-05-22 22:13:20 +00:00
pop hl
jr .printLevel
.teachMoveMenu
push hl
predef CanLearnTM ; check if the pokemon can learn the move
2014-05-22 22:13:20 +00:00
pop hl
ld de,.ableToLearnMoveText
ld a,c
and a
jr nz,.placeMoveLearnabilityString
ld de,.notAbleToLearnMoveText
.placeMoveLearnabilityString
ld bc,20 + 9 ; down 1 row and right 9 columns
push hl
add hl,bc
call PlaceString
pop hl
.printLevel
ld bc,10 ; move 10 columns to the right
add hl,bc
call PrintLevel
pop hl
pop de
inc de
ld bc,2 * 20
add hl,bc
pop bc
inc c
jp .loop
.ableToLearnMoveText
db "ABLE@"
.notAbleToLearnMoveText
db "NOT ABLE@"
.evolutionStoneMenu
push hl
ld hl,EvosMovesPointerTable
ld b,0
2015-02-08 02:37:40 +00:00
ld a,[wLoadedMonSpecies]
2014-05-22 22:13:20 +00:00
dec a
add a
rl b
ld c,a
add hl,bc
ld de,wcd6d
2014-05-22 22:13:20 +00:00
ld a,BANK(EvosMovesPointerTable)
ld bc,2
call FarCopyData
ld hl,wcd6d
2014-05-22 22:13:20 +00:00
ld a,[hli]
ld h,[hl]
ld l,a
ld de,wcd6d
2014-05-22 22:13:20 +00:00
ld a,BANK(EvosMovesPointerTable)
2015-08-10 04:56:20 +00:00
ld bc,Mon133_EvosEnd - Mon133_EvosMoves
2014-05-22 22:13:20 +00:00
call FarCopyData
ld hl,wcd6d
2014-05-22 22:13:20 +00:00
ld de,.notAbleToEvolveText
; loop through the pokemon's evolution entries
.checkEvolutionsLoop
ld a,[hli]
and a ; reached terminator?
jr z,.placeEvolutionStoneString ; if so, place the "NOT ABLE" string
inc hl
inc hl
cp a,EV_ITEM
jr nz,.checkEvolutionsLoop
; if it's a stone evolution entry
dec hl
dec hl
ld b,[hl]
2015-07-26 02:26:54 +00:00
ld a,[wEvoStoneItemID] ; the stone the player used
2014-05-22 22:13:20 +00:00
inc hl
inc hl
inc hl
cp b ; does the player's stone match this evolution entry's stone?
jr nz,.checkEvolutionsLoop
; if it does match
ld de,.ableToEvolveText
.placeEvolutionStoneString
ld bc,20 + 9 ; down 1 row and right 9 columns
pop hl
push hl
add hl,bc
call PlaceString
pop hl
jr .printLevel
.ableToEvolveText
db "ABLE@"
.notAbleToEvolveText
db "NOT ABLE@"
.afterDrawingMonEntries
2015-08-12 09:16:56 +00:00
ld b, SET_PAL_PARTY_MENU
call RunPaletteCommand
2014-05-22 22:13:20 +00:00
.printMessage
ld hl,wd730
2014-05-22 22:13:20 +00:00
ld a,[hl]
push af
push hl
set 6,[hl] ; turn off letter printing delay
ld a,[wPartyMenuTypeOrMessageID] ; message ID
2014-05-22 22:13:20 +00:00
cp a,$F0
jr nc,.printItemUseMessage
add a
ld hl,PartyMenuMessagePointers
ld b,0
ld c,a
add hl,bc
ld a,[hli]
ld h,[hl]
ld l,a
call PrintText
.done
pop hl
pop af
ld [hl],a
ld a,1
ld [H_AUTOBGTRANSFERENABLED],a
call Delay3
jp GBPalNormal
.printItemUseMessage
and a,$0F
ld hl,PartyMenuItemUseMessagePointers
add a
ld c,a
ld b,0
add hl,bc
ld a,[hli]
ld h,[hl]
ld l,a
push hl
2015-07-15 06:16:06 +00:00
ld a,[wUsedItemOnWhichPokemon]
ld hl,wPartyMonNicks
2014-05-22 22:13:20 +00:00
call GetPartyMonName
pop hl
call PrintText
jr .done
2016-06-12 00:24:04 +00:00
PartyMenuItemUseMessagePointers:
2014-05-22 22:13:20 +00:00
dw AntidoteText
dw BurnHealText
dw IceHealText
dw AwakeningText
dw ParlyzHealText
dw PotionText
dw FullHealText
dw ReviveText
dw RareCandyText
2016-06-12 00:24:04 +00:00
PartyMenuMessagePointers:
2014-05-22 22:13:20 +00:00
dw PartyMenuNormalText
dw PartyMenuItemUseText
dw PartyMenuBattleText
dw PartyMenuUseTMText
dw PartyMenuSwapMonText
dw PartyMenuItemUseText
2016-06-12 00:24:04 +00:00
PartyMenuNormalText:
2014-05-22 22:13:20 +00:00
TX_FAR _PartyMenuNormalText
db "@"
2016-06-12 00:24:04 +00:00
PartyMenuItemUseText:
2014-05-22 22:13:20 +00:00
TX_FAR _PartyMenuItemUseText
db "@"
2016-06-12 00:24:04 +00:00
PartyMenuBattleText:
2014-05-22 22:13:20 +00:00
TX_FAR _PartyMenuBattleText
db "@"
2016-06-12 00:24:04 +00:00
PartyMenuUseTMText:
2014-05-22 22:13:20 +00:00
TX_FAR _PartyMenuUseTMText
db "@"
2016-06-12 00:24:04 +00:00
PartyMenuSwapMonText:
2014-05-22 22:13:20 +00:00
TX_FAR _PartyMenuSwapMonText
db "@"
2016-06-12 00:24:04 +00:00
PotionText:
2014-05-22 22:13:20 +00:00
TX_FAR _PotionText
db "@"
2016-06-12 00:24:04 +00:00
AntidoteText:
2014-05-22 22:13:20 +00:00
TX_FAR _AntidoteText
db "@"
2016-06-12 00:24:04 +00:00
ParlyzHealText:
2014-05-22 22:13:20 +00:00
TX_FAR _ParlyzHealText
db "@"
2016-06-12 00:24:04 +00:00
BurnHealText:
2014-05-22 22:13:20 +00:00
TX_FAR _BurnHealText
db "@"
2016-06-12 00:24:04 +00:00
IceHealText:
2014-05-22 22:13:20 +00:00
TX_FAR _IceHealText
db "@"
2016-06-12 00:24:04 +00:00
AwakeningText:
2014-05-22 22:13:20 +00:00
TX_FAR _AwakeningText
db "@"
2016-06-12 00:24:04 +00:00
FullHealText:
2014-05-22 22:13:20 +00:00
TX_FAR _FullHealText
db "@"
2016-06-12 00:24:04 +00:00
ReviveText:
2014-05-22 22:13:20 +00:00
TX_FAR _ReviveText
db "@"
2016-06-12 00:24:04 +00:00
RareCandyText:
2014-05-22 22:13:20 +00:00
TX_FAR _RareCandyText
2016-07-18 06:17:03 +00:00
TX_SFX_ITEM_1 ; probably supposed to play SFX_LEVEL_UP but the wrong music bank is loaded
TX_BLINK
2014-05-22 22:13:20 +00:00
db "@"
2016-06-12 00:24:04 +00:00
SetPartyMenuHPBarColor:
2015-08-12 09:16:56 +00:00
ld hl, wPartyMenuHPBarColors
ld a, [wWhichPartyMenuHPBar]
2014-05-22 22:13:20 +00:00
ld c, a
2015-08-12 09:16:56 +00:00
ld b, 0
2014-05-22 22:13:20 +00:00
add hl, bc
call GetHealthBarColor
2015-08-12 09:16:56 +00:00
ld b, UPDATE_PARTY_MENU_BLK_PACKET
call RunPaletteCommand
ld hl, wWhichPartyMenuHPBar
2014-05-22 22:13:20 +00:00
inc [hl]
ret