Merge remote-tracking branch 'YamaArashi/master'

Conflicts:
	constants/misc_constants.asm
	engine/battle/core.asm
	engine/menu/pokedex.asm
	engine/town_map.asm
	home.asm
	hram.asm
This commit is contained in:
yenatch 2014-09-20 00:57:27 -04:00
commit dff0cdeb5a
224 changed files with 15213 additions and 4665 deletions

View file

@ -320,7 +320,7 @@ Func_21673: ; 21673 (8:5673)
jp Func_214e8
Func_216b3: ; 216b3 (8:56b3)
callba Func_738a1
callba ChangeBox
jp Func_214e8
Func_216be: ; 216be (8:56be)

View file

@ -3,7 +3,7 @@ DisplayDiploma: ; 566e2 (15:66e2)
call GBPalWhiteOutWithDelay3
call ClearScreen
xor a
ld [wcfcb], a
ld [wUpdateSpritesEnabled], a
ld hl, wd730
set 6, [hl]
call DisableLCD
@ -61,7 +61,7 @@ DisplayDiploma: ; 566e2 (15:66e2)
ld hl, wd730
res 6, [hl]
call GBPalWhiteOutWithDelay3
call Func_3dbe
call RestoreScreenTilesAndReloadTilePatterns
call Delay3
jp GBPalNormal

View file

@ -4,14 +4,14 @@ PKMNLeaguePC: ; 0x7657e
ld hl, wd730
set 6, [hl]
push hl
ld a, [wcfcb]
ld a, [wUpdateSpritesEnabled]
push af
ld a, [$ffD7]
ld a, [hTilesetType]
push af
xor a
ld [$ffD7], a
ld [hTilesetType], a
ld [W_SPRITEFLIPPED], a
ld [wcfcb], a
ld [wUpdateSpritesEnabled], a
ld [wTrainerScreenX], a
ld [wcd42], a
ld a, [wd5a2]
@ -38,9 +38,9 @@ PKMNLeaguePC: ; 0x7657e
jr nz, .first
.second
pop af
ld [$ffD7], a
ld [hTilesetType], a
pop af
ld [wcfcb], a
ld [wUpdateSpritesEnabled], a
pop hl
res 6, [hl]
call GBPalWhiteOutWithDelay3

View file

@ -111,16 +111,16 @@ MainMenu: ; 5af2 (1:5af2)
call DelayFrames
ld a,[wd5a2]
and a
jp z,Func_5d5f
jp z,SpecialEnterMap
ld a,[W_CURMAP] ; map ID
cp a,HALL_OF_FAME
jp nz,Func_5d5f
jp nz,SpecialEnterMap
xor a
ld [wd71a],a
ld [wDestinationMap],a
ld hl,wd732
set 2,[hl]
call Func_62ce
jp Func_5d5f
set 2,[hl] ; fly warp or dungeon warp
call SpecialWarpIn
jp SpecialEnterMap
Func_5bff: ; 5bff (1:5bff)
ld a,1
ld [wd358],a
@ -247,7 +247,7 @@ LinkMenu: ; 5c0a (1:5c0a)
cp $2
jr z, .asm_5d2d
xor a
ld [wd700], a
ld [wWalkBikeSurfState], a
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
and a
ld a, TRADE_CENTER
@ -262,8 +262,8 @@ LinkMenu: ; 5c0a (1:5c0a)
ld hl, wd732
res 1, [hl]
ld a, [W_ANIMATIONID] ; W_ANIMATIONID
ld [wd71a], a
call Func_62ce
ld [wDestinationMap], a
call SpecialWarpIn
ld c, $14
call DelayFrames
xor a
@ -272,7 +272,7 @@ LinkMenu: ; 5c0a (1:5c0a)
inc a
ld [W_ISLINKBATTLE], a ; W_ISLINKBATTLE
ld [wcc47], a
jr Func_5d5f
jr SpecialEnterMap
.asm_5d2d
xor a
ld [wMenuJoypadPollCount], a ; wMenuJoypadPollCount
@ -303,16 +303,17 @@ Func_5d52: ; 5d52 (1:5d52)
ld c, $14
call DelayFrames
Func_5d5f: ; 5d5f (1:5d5f)
; enter map after using a special warp or loading the game from the main menu
SpecialEnterMap: ; 5d5f (1:5d5f)
xor a
ld [hJoyPressed], a
ld [hJoyHeld], a
ld [hJoy5], a
ld [wd72d], a
ld hl, wd732
set 0, [hl]
set 0, [hl] ; count play time
call ResetPlayerSpriteData
ld c, $14
ld c, 20
call DelayFrames
ld a, [wcc47]
and a

View file

@ -22,10 +22,10 @@ AskName: ; 64eb (1:64eb)
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
and a
jr nz, .asm_654c
ld a, [wcfcb]
ld a, [wUpdateSpritesEnabled]
push af
xor a
ld [wcfcb], a
ld [wUpdateSpritesEnabled], a
push hl
ld a, $2
ld [wd07d], a
@ -33,12 +33,12 @@ AskName: ; 64eb (1:64eb)
ld a, [W_ISINBATTLE] ; W_ISINBATTLE
and a
jr nz, .asm_653e
call Func_3e08
call ReloadMapSpriteTilePatterns
.asm_653e
call LoadScreenTilesFromBuffer1
pop hl
pop af
ld [wcfcb], a
ld [wUpdateSpritesEnabled], a
ld a, [wcf4b]
cp $50
ret nz
@ -56,12 +56,12 @@ DoYouWantToNicknameText: ; 0x6557
Func_655c: ; 655c (1:655c)
ld hl, wHPBarMaxHP
xor a
ld [wcfcb], a
ld [wUpdateSpritesEnabled], a
ld a, $2
ld [wd07d], a
call DisplayNamingScreen
call GBPalWhiteOutWithDelay3
call Func_3dbe
call RestoreScreenTilesAndReloadTilePatterns
call LoadGBPal
ld a, [wcf4b]
cp $50
@ -171,8 +171,8 @@ DisplayNamingScreen: ; 6596 (1:6596)
ld a, [W_ISINBATTLE] ; W_ISINBATTLE
and a
jp z, LoadTextBoxTilePatterns
ld hl, Func_3ee5b
ld b, BANK(Func_3ee5b)
ld hl, LoadHudTilePatterns
ld b, BANK(LoadHudTilePatterns)
jp Bankswitch
.unknownPointerTable_665e: ; 665e (1:665e)

View file

@ -57,7 +57,7 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3)
call LoadMonData
pop hl
push hl
ld a,[wcc35]
ld a,[wMenuItemToSwap]
and a ; is the player swapping pokemon positions?
jr z,.skipUnfilledRightArrow
; if the player is swapping pokemon positions

View file

@ -86,7 +86,7 @@ BillsPC: ; 17ee4 (5:7ee4)
callba BillsPC_
ReloadMainMenu: ; 17f06 (5:7f06)
xor a
ld [wcc3c], a
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
call ReloadMapData
call UpdateSprites ;XXX: moves sprites
jp PCMainMenu

View file

@ -78,7 +78,7 @@ Func_796d: ; 796d (1:796d)
ld hl, wd730
res 6, [hl]
xor a
ld [wcc3c], a
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ret
Func_7995: ; 7995 (1:7995)

View file

@ -36,8 +36,8 @@ ShowPokedexMenu: ; 40000 (10:4000)
ld [wCurrentMenuItem],a
ld [wLastMenuItem],a
ld [hJoy7],a
ld [wcd3a],a
ld [wcd3b],a
ld [wWastedByteCD3A],a
ld [wOverrideSimulatedJoypadStatesMask],a
pop af
ld [wListScrollOffset],a
call GBPalWhiteOutWithDelay3
@ -404,10 +404,10 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2)
call GoPAL_SET
pop af
ld [wd11e],a
ld a,[$ffd7]
ld a,[hTilesetType]
push af
xor a
ld [$ffd7],a
ld [hTilesetType],a
hlCoord 0, 0
ld de,1
ld bc,$6414
@ -554,7 +554,7 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2)
and a,%00000011 ; A button and B button
jr z,.waitForButtonPress
pop af
ld [$ffd7],a
ld [hTilesetType],a
call GBPalWhiteOut
call ClearScreen
call GoPAL_SET_CF1C

647
engine/menu/pokedex.asm.orig Executable file
View file

@ -0,0 +1,647 @@
ShowPokedexMenu: ; 40000 (10:4000)
call GBPalWhiteOut
call ClearScreen
call UpdateSprites ; move sprites
ld a,[wListScrollOffset]
push af
xor a
ld [wCurrentMenuItem],a
ld [wListScrollOffset],a
ld [wLastMenuItem],a
inc a
ld [wd11e],a
ld [hJoy7],a
.setUpGraphics
ld b,$08
call GoPAL_SET
callab LoadPokedexTilePatterns
.doPokemonListMenu
ld hl,wTopMenuItemY
ld a,3
ld [hli],a ; top menu item Y
xor a
ld [hli],a ; top menu item X
inc a
ld [wcc37],a
inc hl
inc hl
ld a,6
ld [hli],a ; max menu item ID
ld [hl],%00110011 ; menu watched keys (Left, Right, B button, A button)
call HandlePokedexListMenu
jr c,.goToSideMenu ; if the player chose a pokemon from the list
.exitPokedex
xor a
ld [wcc37],a
ld [wCurrentMenuItem],a
ld [wLastMenuItem],a
<<<<<<< HEAD
ld [hJoy7],a
ld [wcd3a],a
ld [wcd3b],a
=======
ld [$ffb7],a
ld [wWastedByteCD3A],a
ld [wOverrideSimulatedJoypadStatesMask],a
>>>>>>> yama/master
pop af
ld [wListScrollOffset],a
call GBPalWhiteOutWithDelay3
call GoPAL_SET_CF1C
jp ReloadMapData
.goToSideMenu
call HandlePokedexSideMenu
dec b
jr z,.exitPokedex ; if the player chose Quit
dec b
jr z,.doPokemonListMenu ; if pokemon not seen or player pressed B button
jp .setUpGraphics ; if pokemon data or area was shown
; handles the menu on the lower right in the pokedex screen
; OUTPUT:
; b = reason for exiting menu
; 00: showed pokemon data or area
; 01: the player chose Quit
; 02: the pokemon has not been seen yet or the player pressed the B button
HandlePokedexSideMenu: ; 4006d (10:406d)
call PlaceUnfilledArrowMenuCursor
ld a,[wCurrentMenuItem]
push af
ld b,a
ld a,[wLastMenuItem]
push af
ld a,[wListScrollOffset]
push af
add b
inc a
ld [wd11e],a
ld a,[wd11e]
push af
ld a,[wWhichTrade]
push af
ld hl,wPokedexSeen
call IsPokemonBitSet
ld b,2
jr z,.exitSideMenu
call PokedexToIndex
ld hl,wTopMenuItemY
ld a,10
ld [hli],a ; top menu item Y
ld a,15
ld [hli],a ; top menu item X
xor a
ld [hli],a ; current menu item ID
inc hl
ld a,3
ld [hli],a ; max menu item ID
ld [hli],a ; menu watched keys (A button and B button)
xor a
ld [hli],a ; old menu item ID
ld [wcc37],a
.handleMenuInput
call HandleMenuInput
bit 1,a ; was the B button pressed?
ld b,2
jr nz,.buttonBPressed
ld a,[wCurrentMenuItem]
and a
jr z,.choseData
dec a
jr z,.choseCry
dec a
jr z,.choseArea
.choseQuit
ld b,1
.exitSideMenu
pop af
ld [wWhichTrade],a
pop af
ld [wd11e],a
pop af
ld [wListScrollOffset],a
pop af
ld [wLastMenuItem],a
pop af
ld [wCurrentMenuItem],a
push bc
hlCoord 0, 3
ld de,20
ld bc,$7f0d ; 13 blank tiles
call DrawTileLine ; cover up the menu cursor in the pokemon list
pop bc
ret
.buttonBPressed
push bc
hlCoord 15, 10
ld de,20
ld bc,$7f07 ; 7 blank tiles
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 ; get cry data
call PlaySound ; play sound
jr .handleMenuInput
.choseArea
predef LoadTownMap_Nest ; display pokemon areas
ld b,0
jr .exitSideMenu
; handles the list of pokemon on the left of the pokedex screen
; sets carry flag if player presses A, unsets carry flag if player presses B
HandlePokedexListMenu: ; 40111 (10:4111)
xor a
ld [H_AUTOBGTRANSFERENABLED],a
; draw the horizontal line separating the seen and owned amounts from the menu
hlCoord 15, 8
ld a,$7a ; horizontal line tile
ld [hli],a
ld [hli],a
ld [hli],a
ld [hli],a
ld [hli],a
hlCoord 14, 0
ld [hl],$71 ; vertical line tile
hlCoord 14, 1
call DrawPokedexVerticalLine
hlCoord 14, 9
call DrawPokedexVerticalLine
ld hl,wPokedexSeen
ld b,wPokedexSeenEnd - wPokedexSeen
call CountSetBits
ld de,wd11e
hlCoord 16, 3
ld bc,$0103
call PrintNumber ; print number of seen pokemon
ld hl,wPokedexOwned
ld b,wPokedexOwnedEnd - wPokedexOwned
call CountSetBits
ld de,wd11e
hlCoord 16, 6
ld bc,$0103
call PrintNumber ; print number of owned pokemon
hlCoord 16, 2
ld de,PokedexSeenText
call PlaceString
hlCoord 16, 5
ld de,PokedexOwnText
call PlaceString
hlCoord 1, 1
ld de,PokedexContentsText
call PlaceString
hlCoord 16, 10
ld de,PokedexMenuItemsText
call PlaceString
; find the highest pokedex number among the pokemon the player has seen
ld hl,wPokedexSeenEnd - 1
ld b,153
.maxSeenPokemonLoop
ld a,[hld]
ld c,8
.maxSeenPokemonInnerLoop
dec b
sla a
jr c,.storeMaxSeenPokemon
dec c
jr nz,.maxSeenPokemonInnerLoop
jr .maxSeenPokemonLoop
.storeMaxSeenPokemon
ld a,b
ld [wWhichTrade],a ; max seen pokemon
.loop
xor a
ld [H_AUTOBGTRANSFERENABLED],a
hlCoord 4, 2
ld bc,$0e0a
call ClearScreenArea
hlCoord 1, 3
ld a,[wListScrollOffset]
ld [wd11e],a
ld d,7
ld a,[wWhichTrade]
cp a,7
jr nc,.printPokemonLoop
ld d,a
dec a
ld [wMaxMenuItem],a
; loop to print pokemon pokedex numbers and names
; if the player has owned the pokemon, it puts a pokeball beside the name
.printPokemonLoop
ld a,[wd11e]
inc a
ld [wd11e],a
push af
push de
push hl
ld de,-20
add hl,de
ld de,wd11e
ld bc,$8103
call PrintNumber ; print the pokedex number
ld de,20
add hl,de
dec hl
push hl
ld hl,wPokedexOwned
call IsPokemonBitSet
pop hl
ld a," "
jr z,.writeTile
ld a,$72 ; pokeball tile
.writeTile
ld [hl],a ; put a pokeball next to pokemon that the player has owned
push hl
ld hl,wPokedexSeen
call IsPokemonBitSet
jr nz,.getPokemonName ; if the player has seen the pokemon
ld de,.dashedLine ; print a dashed line in place of the name if the player hasn't seen the pokemon
jr .skipGettingName
.dashedLine ; for unseen pokemon in the list
db "----------@"
.getPokemonName
call PokedexToIndex
call GetMonName
.skipGettingName
pop hl
inc hl
call PlaceString
pop hl
ld bc,2 * 20
add hl,bc
pop de
pop af
ld [wd11e],a
dec d
jr nz,.printPokemonLoop
ld a,01
ld [H_AUTOBGTRANSFERENABLED],a
call Delay3
call GBPalNormal
call HandleMenuInput
bit 1,a ; was the B button pressed?
jp nz,.buttonBPressed
.checkIfUpPressed
bit 6,a ; was Up pressed?
jr z,.checkIfDownPressed
.upPressed ; scroll up one row
ld a,[wListScrollOffset]
and a
jp z,.loop
dec a
ld [wListScrollOffset],a
jp .loop
.checkIfDownPressed
bit 7,a ; was Down pressed?
jr z,.checkIfRightPressed
.downPressed ; scroll down one row
ld a,[wWhichTrade]
cp a,7
jp c,.loop
sub a,7
ld b,a
ld a,[wListScrollOffset]
cp b
jp z,.loop
inc a
ld [wListScrollOffset],a
jp .loop
.checkIfRightPressed
bit 4,a ; was Right pressed?
jr z,.checkIfLeftPressed
.rightPressed ; scroll down 7 rows
ld a,[wWhichTrade]
cp a,7
jp c,.loop
sub a,6
ld b,a
ld a,[wListScrollOffset]
add a,7
ld [wListScrollOffset],a
cp b
jp c,.loop
dec b
ld a,b
ld [wListScrollOffset],a
jp .loop
.checkIfLeftPressed ; scroll up 7 rows
bit 5,a ; was Left pressed?
jr z,.buttonAPressed
.leftPressed
ld a,[wListScrollOffset]
sub a,7
ld [wListScrollOffset],a
jp nc,.loop
xor a
ld [wListScrollOffset],a
jp .loop
.buttonAPressed
scf
ret
.buttonBPressed
and a
ret
DrawPokedexVerticalLine: ; 4028e (10:428e)
ld c,9 ; height of line
ld de,20 ; width of screen
ld a,$71 ; vertical line tile
.loop
ld [hl],a
add hl,de
xor a,1 ; toggle between vertical line tile and box tile
dec c
jr nz,.loop
ret
PokedexSeenText: ; 4029d (10:429d)
db "SEEN@"
PokedexOwnText: ; 402a2 (10:42a2)
db "OWN@"
PokedexContentsText: ; 402a6 (10:42a6)
db "CONTENTS@"
PokedexMenuItemsText: ; 402af (10:42af)
db "DATA"
next "CRY"
next "AREA"
next "QUIT@"
; tests if a pokemon's bit is set in the seen or owned pokemon bit fields
; INPUT:
; [wd11e] = pokedex number
; hl = address of bit field
IsPokemonBitSet: ; 402c2 (10:42c2)
ld a,[wd11e]
dec a
ld c,a
ld b,2
predef FlagActionPredef
ld a,c
and a
ret
; function to display pokedex data from outside the pokedex
ShowPokedexData: ; 402d1 (10:42d1)
call GBPalWhiteOutWithDelay3
call ClearScreen
call UpdateSprites
callab LoadPokedexTilePatterns ; load pokedex tiles
; function to display pokedex data from inside the pokedex
ShowPokedexDataInternal: ; 402e2 (10:42e2)
ld hl,wd72c
set 1,[hl]
ld a,$33 ; 3/7 volume
ld [$ff24],a
call GBPalWhiteOut ; zero all palettes
call ClearScreen
ld a,[wd11e] ; pokemon ID
ld [wcf91],a
push af
ld b,04
call GoPAL_SET
pop af
ld [wd11e],a
ld a,[hTilesetType]
push af
xor a
ld [hTilesetType],a
hlCoord 0, 0
ld de,1
ld bc,$6414
call DrawTileLine ; draw top border
hlCoord 0, 17
ld b,$6f
call DrawTileLine ; draw bottom border
hlCoord 0, 1
ld de,20
ld bc,$6610
call DrawTileLine ; draw left border
hlCoord 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
Coorda 19, 0
ld a,$6c ; lower left corner tile
Coorda 0, 17
ld a,$6e ; lower right corner tile
Coorda 19, 17
hlCoord 0, 9
ld de,PokedexDataDividerLine
call PlaceString ; draw horizontal divider line
hlCoord 9, 6
ld de,HeightWeightText
call PlaceString
call GetMonName
hlCoord 9, 2
call PlaceString
ld hl,PokedexEntryPointers
ld a,[wd11e]
dec a
ld e,a
ld d,0
add hl,de
add hl,de
ld a,[hli]
ld e,a
ld d,[hl] ; de = address of pokedex entry
hlCoord 9, 4
call PlaceString ; print species name
ld h,b
ld l,c
push de
ld a,[wd11e]
push af
call IndexToPokedex
hlCoord 2, 8
ld a, "№"
ld [hli],a
ld a,$f2
ld [hli],a
ld de,wd11e
ld bc,$8103
call PrintNumber ; print pokedex number
ld hl,wPokedexOwned
call IsPokemonBitSet
pop af
ld [wd11e],a
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
hlCoord 1, 1
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
inc de ; de = address of feet (height)
ld a,[de] ; reads feet, but a is overwritten without being used
hlCoord 12, 6
ld bc,$0102
call PrintNumber ; print feet (height)
ld a,$60 ; feet symbol tile (one tick)
ld [hl],a
inc de
inc de ; de = address of inches (height)
hlCoord 15, 6
ld bc,$8102
call PrintNumber ; print inches (height)
ld a,$61 ; inches symbol tile (two ticks)
ld [hl],a
; now print the weight (note that weight is stored in tenths of pounds internally)
inc de
inc de
inc de ; de = address of upper byte of weight
push de
; put weight in big-endian order at $ff8b
ld hl,$ff8b
ld a,[hl] ; save existing value of [$ff8b]
push af
ld a,[de] ; a = upper byte of weight
ld [hli],a ; store upper byte of weight in [$ff8b]
ld a,[hl] ; save existing value of [$ff8c]
push af
dec de
ld a,[de] ; a = lower byte of weight
ld [hl],a ; store lower byte of weight in [$ff8c]
ld de,$ff8b
hlCoord 11, 8
ld bc,$0205 ; no leading zeroes, right-aligned, 2 bytes, 5 digits
call PrintNumber ; print weight
hlCoord 14, 8
ld a,[$ff8c]
sub a,10
ld a,[$ff8b]
sbc a,0
jr nc,.next
ld [hl],"0" ; if the weight is less than 10, put a 0 before the decimal point
.next
inc hl
ld a,[hli]
ld [hld],a ; make space for the decimal point by moving the last digit forward one tile
ld [hl],$f2 ; decimal point tile
pop af
ld [$ff8c],a ; restore original value of [$ff8c]
pop af
ld [$ff8b],a ; restore original value of [$ff8b]
pop hl
inc hl ; hl = address of pokedex description text
bcCoord 1, 11
ld a,2
ld [$fff4],a
call TextCommandProcessor ; print pokedex description text
xor a
ld [$fff4],a
.waitForButtonPress
call JoypadLowSensitivity
ld a,[hJoy5]
and a,%00000011 ; A button and B button
jr z,.waitForButtonPress
pop af
ld [hTilesetType],a
call GBPalWhiteOut
call ClearScreen
call GoPAL_SET_CF1C
call LoadTextBoxTilePatterns
call GBPalNormal
ld hl,wd72c
res 1,[hl]
ld a,$77 ; max volume
ld [$ff24],a
ret
HeightWeightText: ; 40448 (10:4448)
db "HT ?",$60,"??",$61,$4E,"WT ???lb@"
; XXX does anything point to this?
Unknown_4045D: ; 4045d (10:445d)
db $54,$50
; horizontal line that divides the pokedex text description from the rest of the data
PokedexDataDividerLine: ; 4045f (10:445f)
db $68,$69,$6B,$69,$6B
db $69,$6B,$69,$6B,$6B
db $6B,$6B,$69,$6B,$69
db $6B,$69,$6B,$69,$6A
db $50
; draws a line of tiles
; INPUT:
; b = tile ID
; c = number of tile ID's to write
; de = amount to destination address after each tile (1 for horizontal, 20 for vertical)
; hl = destination address
DrawTileLine: ; 40474 (10:4474)
push bc
push de
.loop
ld [hl],b
add hl,de
dec c
jr nz,.loop
pop de
pop bc
ret
INCLUDE "data/pokedex_entries.asm"
PokedexToIndex: ; 40ff9 (10:4ff9)
; converts the Pokédex number at wd11e to an index
push bc
push hl
ld a,[wd11e]
ld b,a
ld c,0
ld hl,PokedexOrder
.loop ; go through the list until we find an entry with a matching dex number
inc c
ld a,[hli]
cp b
jr nz,.loop
ld a,c
ld [wd11e],a
pop hl
pop bc
ret
IndexToPokedex: ; 41010 (10:5010)
; converts the indexédex number at wd11e to a Pokédex number
push bc
push hl
ld a,[wd11e]
dec a
ld hl,PokedexOrder
ld b,0
ld c,a
add hl,bc
ld a,[hl]
ld [wd11e],a
pop hl
pop bc
ret
INCLUDE "data/pokedex_order.asm"

View file

@ -2,8 +2,8 @@ DisplayStartMenu:: ; 2acd (0:2acd)
ld a,$04 ; hardcoded Bank, not sure what's it refers to
ld [H_LOADEDROMBANK],a
ld [$2000],a ; ROM bank 4
ld a,[wd700] ; walking/biking/surfing
ld [wd11a],a
ld a,[wWalkBikeSurfState] ; walking/biking/surfing
ld [wWalkBikeSurfStateCopy],a
ld a, (SFX_02_3f - SFX_Headers_02) / 3 ; Start menu sound
call PlaySound

View file

@ -11,21 +11,21 @@ StartMenu_Pokemon: ; 130a9 (4:70a9)
and a
jp z,RedisplayStartMenu
xor a
ld [wcc35],a
ld [wMenuItemToSwap],a
ld [wd07d],a
ld [wcfcb],a
ld [wUpdateSpritesEnabled],a
call DisplayPartyMenu
jr .checkIfPokemonChosen
.loop
xor a
ld [wcc35],a
ld [wMenuItemToSwap],a
ld [wd07d],a
call GoBackToPartyMenu
.checkIfPokemonChosen
jr nc,.chosePokemon
.exitMenu
call GBPalWhiteOutWithDelay3
call Func_3dbe
call RestoreScreenTilesAndReloadTilePatterns
call LoadGBPal
jp RedisplayStartMenu
.chosePokemon
@ -184,7 +184,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9)
bit 0,a ; does the player have the Boulder Badge?
jp z,.newBadgeRequired
xor a
ld [wd35d],a
ld [wMapPalOffset],a
ld hl,.flashLightsAreaText
call PrintText
call GBPalWhiteOutWithDelay3
@ -273,7 +273,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9)
TX_FAR _NotHealthyEnoughText
db "@"
.goBackToMap
call Func_3dbe
call RestoreScreenTilesAndReloadTilePatterns
jp CloseTextDisplay
.newBadgeRequired
ld hl,.newBadgeRequiredText
@ -336,7 +336,7 @@ StartMenu_Item: ; 13302 (4:7302)
Coorda 5, 10
call PlaceUnfilledArrowMenuCursor
xor a
ld [wcc35],a
ld [wMenuItemToSwap],a
ld a,[wcf91]
cp a,BICYCLE
jp z,.useOrTossItem
@ -406,20 +406,20 @@ StartMenu_Item: ; 13302 (4:7302)
jp z,ItemMenuLoop
jp CloseStartMenu
.useItem_partyMenu
ld a,[wcfcb]
ld a,[wUpdateSpritesEnabled]
push af
call UseItem
ld a,[wcd6a]
cp a,$02
jp z,.partyMenuNotDisplayed
call GBPalWhiteOutWithDelay3
call Func_3dbe
call RestoreScreenTilesAndReloadTilePatterns
pop af
ld [wcfcb],a
ld [wUpdateSpritesEnabled],a
jp StartMenu_Item
.partyMenuNotDisplayed
pop af
ld [wcfcb],a
ld [wUpdateSpritesEnabled],a
jp ItemMenuLoop
.tossItem
call IsKeyItem
@ -500,10 +500,10 @@ StartMenu_TrainerInfo: ; 13460 (4:7460)
call GBPalWhiteOut
call ClearScreen
call UpdateSprites ; move sprites
ld a,[$ffd7]
ld a,[hTilesetType]
push af
xor a
ld [$ffd7],a
ld [hTilesetType],a
call DrawTrainerInfo
predef DrawBadges ; draw badges
ld b,$0d
@ -517,7 +517,7 @@ StartMenu_TrainerInfo: ; 13460 (4:7460)
call ReloadMapData
call LoadGBPal
pop af
ld [$ffd7],a
ld [hTilesetType],a
jp RedisplayStartMenu
; loads tile patterns and draws everything except for gym leader faces / badges
@ -738,17 +738,17 @@ SwitchPartyMon_OAM: ; 13625 (4:7625)
jp PlaySound
SwitchPartyMon_Stats: ; 13653 (4:7653)
ld a, [wcc35]
ld a, [wMenuItemToSwap]
and a
jr nz, .asm_13661
ld a, [wWhichPokemon] ; wWhichPokemon
inc a
ld [wcc35], a
ld [wMenuItemToSwap], a
ret
.asm_13661
xor a
ld [wd07d], a
ld a, [wcc35]
ld a, [wMenuItemToSwap]
dec a
ld b, a
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
@ -756,12 +756,12 @@ SwitchPartyMon_Stats: ; 13653 (4:7653)
cp b
jr nz, .asm_1367b
xor a
ld [wcc35], a
ld [wMenuItemToSwap], a
ld [wd07d], a
ret
.asm_1367b
ld a, b
ld [wcc35], a
ld [wMenuItemToSwap], a
push hl
push de
ld hl, wPartySpecies
@ -773,7 +773,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653)
jr nc, .asm_1368e
inc h
.asm_1368e
ld a, [wcc35]
ld a, [wMenuItemToSwap]
add e
ld e, a
jr nc, .asm_13696
@ -790,61 +790,61 @@ SwitchPartyMon_Stats: ; 13653 (4:7653)
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
call AddNTimes
push hl
ld de, wcc97
ld de, wSwitchPartyMonTempBuffer
ld bc, $2c
call CopyData
ld hl, wPartyMons
ld bc, $2c
ld a, [wcc35]
ld a, [wMenuItemToSwap]
call AddNTimes
pop de
push hl
ld bc, $2c
call CopyData
pop de
ld hl, wcc97
ld hl, wSwitchPartyMonTempBuffer
ld bc, $2c
call CopyData
ld hl, wPartyMonOT ; wd273
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
call SkipFixedLengthTextEntries
push hl
ld de, wcc97
ld de, wSwitchPartyMonTempBuffer
ld bc, $b
call CopyData
ld hl, wPartyMonOT ; wd273
ld a, [wcc35]
ld a, [wMenuItemToSwap]
call SkipFixedLengthTextEntries
pop de
push hl
ld bc, $b
call CopyData
pop de
ld hl, wcc97
ld hl, wSwitchPartyMonTempBuffer
ld bc, $b
call CopyData
ld hl, wPartyMonNicks ; wPartyMonNicks
ld a, [wCurrentMenuItem] ; wCurrentMenuItem
call SkipFixedLengthTextEntries
push hl
ld de, wcc97
ld de, wSwitchPartyMonTempBuffer
ld bc, $b
call CopyData
ld hl, wPartyMonNicks ; wPartyMonNicks
ld a, [wcc35]
ld a, [wMenuItemToSwap]
call SkipFixedLengthTextEntries
pop de
push hl
ld bc, $b
call CopyData
pop de
ld hl, wcc97
ld hl, wSwitchPartyMonTempBuffer
ld bc, $b
call CopyData
ld a, [wcc35]
ld a, [wMenuItemToSwap]
ld [wWhichTrade], a ; wWhichTrade
xor a
ld [wcc35], a
ld [wMenuItemToSwap], a
ld [wd07d], a
pop de
pop hl

View file

@ -36,10 +36,10 @@ StatusScreen: ; 12953 (4:6953)
ld hl, vChars2 + $720
ld bc,(BANK(PTile) << 8 | $01)
call CopyVideoDataDouble ; P (for PP), inline
ld a, [$ffd7]
ld a, [hTilesetType]
push af
xor a
ld [$ffd7], a
ld [hTilesetType], a
hlCoord 19, 1
ld bc, $060a
call DrawLineBox ; Draws the box around name, HP and status
@ -109,7 +109,7 @@ StatusScreen: ; 12953 (4:6953)
call PlayCry ; play Pokémon cry
call WaitForTextScrollButtonPress ; wait for button
pop af
ld [$ffd7], a
ld [hTilesetType], a
ret
.unk_12a7e ; 0x12a7e ; I don't know what this does, iterates over pointers?
ld a, [wcc49]
@ -227,10 +227,10 @@ StatsText: ; 12b3a (4:6b3a)
next "SPECIAL@"
StatusScreen2: ; 12b57 (4:6b57)
ld a, [$ffd7]
ld a, [hTilesetType]
push af
xor a
ld [$ffd7], a
ld [hTilesetType], a
ld [$ffba], a
ld bc, $0005
ld hl, wd0dc
@ -360,7 +360,7 @@ StatusScreen2: ; 12b57 (4:6b57)
call Delay3
call WaitForTextScrollButtonPress ; wait for button
pop af
ld [$ffd7], a
ld [hTilesetType], a
ld hl, wd72c
res 1, [hl]
ld a, $77