sync engine code with pokeyellow

This commit is contained in:
YamaArashi 2016-06-11 21:30:05 -07:00
parent a51037eeee
commit fd2235e678
47 changed files with 385 additions and 350 deletions

View file

@ -248,7 +248,7 @@ BillsPCDeposit:
add "1"
.next
ld [hli], a
ld [hl], $50
ld [hl], "@"
ld hl, MonWasStoredText
call PrintText
jp BillsPCMenu

View file

@ -7,7 +7,7 @@ AskName:
coord hl, 0, 0
ld b, 4
ld c, 11
call z, ClearScreenArea ; only if in wild batle
call z, ClearScreenArea ; only if in wild battle
ld a, [wcf91]
ld [wd11e], a
call GetMonName
@ -40,7 +40,7 @@ AskName:
pop af
ld [wUpdateSpritesEnabled], a
ld a, [wcf4b]
cp $50
cp "@"
ret nz
.declinedNickname
ld d, h
@ -108,7 +108,7 @@ DisplayNamingScreen:
ld [wMenuWatchedKeys], a
ld a, 7
ld [wMaxMenuItem], a
ld a, $50
ld a, "@"
ld [wcf4b], a
xor a
ld hl, wNamingScreenSubmitName
@ -153,7 +153,7 @@ DisplayNamingScreen:
ld h, [hl]
ld l, a
push de
jp [hl]
jp hl
.submitNickname
pop de
@ -259,7 +259,7 @@ DisplayNamingScreen:
.addLetter
ld a, [wNamingScreenLetter]
ld [hli], a
ld [hl], $50
ld [hl], "@"
ld a, SFX_PRESS_AB
call PlaySound
ret

View file

@ -7,9 +7,9 @@ OpenOaksPC:
call YesNoChoice
ld a, [wCurrentMenuItem]
and a
jr nz, .asm_1e932
jr nz, .closePC
predef DisplayDexRating
.asm_1e932
.closePC
ld hl, ClosedOaksPCText
call PrintText
jp LoadScreenTilesFromBuffer2

View file

@ -121,18 +121,18 @@ RemoveItemByID:
ld b, a
xor a
ld [hItemToRemoveIndex], a
.asm_17f40
.loop
ld a, [hli]
cp $ff
cp -1 ; reached terminator?
ret z
cp b
jr z, .asm_17f4f
jr z, .foundItem
inc hl
ld a, [hItemToRemoveIndex]
inc a
ld [hItemToRemoveIndex], a
jr .asm_17f40
.asm_17f4f
jr .loop
.foundItem
ld a, $1
ld [wItemQuantity], a
ld a, [hItemToRemoveIndex]

View file

@ -125,6 +125,7 @@ HandlePokedexSideMenu:
call DrawTileLine ; cover up the menu cursor in the pokemon list
pop bc
ret
.buttonBPressed
push bc
coord hl, 15, 10
@ -133,16 +134,19 @@ HandlePokedexSideMenu:
call DrawTileLine ; cover up the menu cursor in the side menu
pop bc
jr .exitSideMenu
.choseData
call ShowPokedexDataInternal
ld b,0
jr .exitSideMenu
; play pokemon cry
.choseCry
ld a,[wd11e]
call GetCryData
call PlaySound
jr .handleMenuInput
.choseArea
predef LoadTownMap_Nest ; display pokemon areas
ld b,0
@ -206,6 +210,7 @@ HandlePokedexListMenu:
dec c
jr nz,.maxSeenPokemonInnerLoop
jr .maxSeenPokemonLoop
.storeMaxSeenPokemon
ld a,b
ld [wDexMaxSeenMon],a
@ -409,20 +414,25 @@ ShowPokedexDataInternal:
push af
xor a
ld [hTilesetType],a
coord hl, 0, 0
ld de,1
lb bc, $64, SCREEN_WIDTH
call DrawTileLine ; draw top border
coord hl, 0, 17
ld b, $6f
call DrawTileLine ; draw bottom border
coord hl, 0, 1
ld de,20
lb bc, $66, $10
call DrawTileLine ; draw left border
coord hl, 19, 1
ld b,$67
call DrawTileLine ; draw right border
ld a,$63 ; upper left corner tile
Coorda 0, 0
ld a,$65 ; upper right corner tile
@ -431,15 +441,19 @@ ShowPokedexDataInternal:
Coorda 0, 17
ld a,$6e ; lower right corner tile
Coorda 19, 17
coord hl, 0, 9
ld de,PokedexDataDividerLine
call PlaceString ; draw horizontal divider line
coord hl, 9, 6
ld de,HeightWeightText
call PlaceString
call GetMonName
coord hl, 9, 2
call PlaceString
ld hl,PokedexEntryPointers
ld a,[wd11e]
dec a
@ -450,14 +464,17 @@ ShowPokedexDataInternal:
ld a,[hli]
ld e,a
ld d,[hl] ; de = address of pokedex entry
coord hl, 9, 4
call PlaceString ; print species name
ld h,b
ld l,c
push de
ld a,[wd11e]
push af
call IndexToPokedex
coord hl, 2, 8
ld a, "№"
ld [hli],a
@ -466,6 +483,7 @@ ShowPokedexDataInternal:
ld de,wd11e
lb bc, LEADING_ZEROES | 1, 3
call PrintNumber ; print pokedex number
ld hl,wPokedexOwned
call IsPokemonBitSet
pop af
@ -473,10 +491,12 @@ ShowPokedexDataInternal:
ld a,[wcf91]
ld [wd0b5],a
pop de
push af
push bc
push de
push hl
call Delay3
call GBPalNormal
call GetMonHeader ; load pokemon picture location
@ -484,10 +504,12 @@ ShowPokedexDataInternal:
call LoadFlippedFrontSpriteByMonIndex ; draw pokemon picture
ld a,[wcf91]
call PlayCry ; play pokemon cry
pop hl
pop de
pop bc
pop af
ld a,c
and a
jp z,.waitForButtonPress ; if the pokemon has not been owned, don't print the height, weight, or description

View file

@ -23,8 +23,8 @@ CeladonPrizeMenu:
ld [wTopMenuItemX],a
call PrintPrizePrice
coord hl, 0, 2
ld b,$08
ld c,$10
ld b, 8
ld c, 16
call TextBoxBorder
call GetPrizeMenuId
call UpdateSprites
@ -32,12 +32,12 @@ CeladonPrizeMenu:
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 3 ; "NO,THANKS" choice
jr z, .noChoice
call HandlePrizeChoice
.NoChoice
.noChoice
ld hl,wd730
res 6,[hl]
ret
@ -65,7 +65,7 @@ GetPrizeMenuId:
; (distinguishing between Pokemon names
; and Items (specifically TMs) names)
ld a,[hSpriteIndexOrTextID]
sub a,3 ; prize-texts' id are 3, 4 and 5
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
@ -88,7 +88,7 @@ GetPrizeMenuId:
ld bc,6
call CopyData
ld a,[wWhichPrizeWindow]
cp a,$02 ;is TM_menu?
cp 2 ;is TM_menu?
jr nz,.putMonName
ld a,[wPrize1]
ld [wd11e],a
@ -138,7 +138,7 @@ GetPrizeMenuId:
call PrintBCDNumber
ld de,wPrize2Price
coord hl, 13, 7
ld c,(%1 << 7 | 2)
ld c,(1 << 7 | 2)
call PrintBCDNumber
ld de,wPrize3Price
coord hl, 13, 9
@ -149,15 +149,15 @@ INCLUDE "data/prizes.asm"
PrintPrizePrice:
coord hl, 11, 0
ld b,$01
ld c,$07
ld b, 1
ld c, 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
@ -165,10 +165,10 @@ PrintPrizePrice:
call PrintBCDNumber
ret
.CoinText
.CoinString:
db "COIN@"
.SixSpacesText
.SixSpacesString:
db " @"
LoadCoinsToSubtract:
@ -196,33 +196,33 @@ HandlePrizeChoice:
ld a,[hl]
ld [wd11e],a
ld a,[wWhichPrizeWindow]
cp a,$02 ; is prize a TM?
jr nz,.GetMonName
cp 2 ; 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)
and a
jr nz,.PrintOhFineThen
jr nz, .printOhFineThen
call LoadCoinsToSubtract
call HasEnoughCoins
jr c,.NotEnoughCoins
jr c, .notEnoughCoins
ld a,[wWhichPrizeWindow]
cp a,$02
jr nz,.GiveMon
cp $02
jr nz, .giveMon
ld a,[wd11e]
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,24 +243,24 @@ HandlePrizeChoice:
; 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:
UnknownPrizeData:
; XXX what's this?
db $00,$01,$00,$01,$00,$01,$00,$00,$01

View file

@ -34,7 +34,7 @@ StartMenu_Pokemon:
ld [wTextBoxID],a
call DisplayTextBoxID ; display pokemon menu options
ld hl,wFieldMoves
lb bc, $02, $0c ; max menu item ID, top menu item Y
lb bc, 2, 12 ; max menu item ID, top menu item Y
ld e,5
.adjustMenuVariablesLoop
dec e
@ -222,7 +222,7 @@ StartMenu_Pokemon:
res 4,[hl]
ld c,60
call DelayFrames
call GBPalWhiteOutWithDelay3 ; zero all three palettes and wait 3 V-blanks
call GBPalWhiteOutWithDelay3
jp .goBackToMap
.warpToLastPokemonCenterText
TX_FAR _WarpToLastPokemonCenterText

View file

@ -249,16 +249,16 @@ PrintStatsBox:
and a ; a is 0 from the status screen
jr nz, .DifferentBox
coord hl, 0, 8
ld b, $8
ld c, $8
ld b, 8
ld c, 8
call TextBoxBorder ; Draws the box
coord hl, 1, 9 ; Start printing stats from here
ld bc, $0019 ; Number offset
jr .PrintStats
.DifferentBox
coord hl, 9, 2
ld b, $8
ld c, $9
ld b, 8
ld c, 9
call TextBoxBorder
coord hl, 11, 3
ld bc, $0018
@ -279,7 +279,7 @@ PrintStatsBox:
call PrintStat
ld de, wLoadedMonSpecial
jp PrintNumber
PrintStat
PrintStat:
push hl
call PrintNumber
pop hl

View file

@ -130,6 +130,9 @@ LoadVendingMachineItem:
ret
VendingPrices:
db FRESH_WATER,$00,$02,$00
db SODA_POP, $00,$03,$00
db LEMONADE, $00,$03,$50
db FRESH_WATER
money 200
db SODA_POP
money 300
db LEMONADE
money 350