Group engine/pokedex files

This commit is contained in:
Remy Oukaour
2018-01-21 18:00:23 -05:00
parent 5e4fa42fa7
commit 7f54df58bf
8 changed files with 8 additions and 8 deletions

View File

@@ -0,0 +1,52 @@
NewPokedexEntry: ; fb877
ld a, [hMapAnims]
push af
xor a
ld [hMapAnims], a
call LowVolume
call ClearBGPalettes
call ClearTileMap
call UpdateSprites
call ClearSprites
ld a, [wPokedexStatus]
push af
ld a, [hSCX]
add POKEDEX_SCX
ld [hSCX], a
xor a
ld [wPokedexStatus], a
farcall _NewPokedexEntry
call WaitPressAorB_BlinkCursor
ld a, 1 ; page 2
ld [wPokedexStatus], a
farcall DisplayDexEntry
call WaitPressAorB_BlinkCursor
pop af
ld [wPokedexStatus], a
call MaxVolume
call RotateThreePalettesRight
ld a, [hSCX]
add -POKEDEX_SCX
ld [hSCX], a
call .ReturnFromDexRegistration
pop af
ld [hMapAnims], a
ret
; fb8c8
.ReturnFromDexRegistration: ; fb8c8
call ClearTileMap
call LoadFontsExtra
call LoadStandardFont
farcall Pokedex_PlaceFrontpicTopLeftCorner
call WaitBGMap2
farcall GetEnemyMonDVs
ld a, [hli]
ld [TempMonDVs], a
ld a, [hl]
ld [TempMonDVs + 1], a
ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call SetPalettes
ret
; fb8f1

2592
engine/pokedex/pokedex.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,280 @@
AnimateDexSearchSlowpoke: ; 441cf
ld hl, .FrameIDs
ld b, 25
.loop
ld a, [hli]
; Wrap around
cp $fe
jr nz, .ok
ld hl, .FrameIDs
ld a, [hli]
.ok
ld [wDexSearchSlowpokeFrame], a
ld a, [hli]
ld c, a
push bc
push hl
call DoDexSearchSlowpokeFrame
pop hl
pop bc
call DelayFrames
dec b
jr nz, .loop
xor a
ld [wDexSearchSlowpokeFrame], a
call DoDexSearchSlowpokeFrame
ld c, 32
call DelayFrames
ret
.FrameIDs: ; 441fc
; frame ID, duration
db 0, 7
db 1, 7
db 2, 7
db 3, 7
db 4, 7
db -2
DoDexSearchSlowpokeFrame: ; 44207
ld a, [wDexSearchSlowpokeFrame]
ld hl, .SlowpokeSpriteData
ld de, Sprite01
.loop
ld a, [hli]
cp -1
ret z
ld [de], a ; y
inc de
ld a, [hli]
ld [de], a ; x
inc de
ld a, [wDexSearchSlowpokeFrame]
ld b, a
add a
add b
add [hl]
inc hl
ld [de], a ; tile id
inc de
ld a, [hli]
ld [de], a ; attributes
inc de
jr .loop
.SlowpokeSpriteData: ; 44228
dsprite 11, 0, 9, 0, $00, 0
dsprite 11, 0, 10, 0, $01, 0
dsprite 11, 0, 11, 0, $02, 0
dsprite 12, 0, 9, 0, $10, 0
dsprite 12, 0, 10, 0, $11, 0
dsprite 12, 0, 11, 0, $12, 0
dsprite 13, 0, 9, 0, $20, 0
dsprite 13, 0, 10, 0, $21, 0
dsprite 13, 0, 11, 0, $22, 0
db -1
DisplayDexEntry: ; 4424d
call GetPokemonName
hlcoord 9, 3
call PlaceString ; mon species
ld a, [wd265]
ld b, a
call GetDexEntryPointer
ld a, b
push af
hlcoord 9, 5
call FarString ; dex species
ld h, b
ld l, c
push de
; Print dex number
hlcoord 2, 8
ld a, $5c ; No
ld [hli], a
ld a, $5d ; .
ld [hli], a
ld de, wd265
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
call PrintNum
; Check to see if we caught it. Get out of here if we haven't.
ld a, [wd265]
dec a
call CheckCaughtMon
pop hl
pop bc
ret z
; Get the height of the Pokemon.
ld a, [CurPartySpecies]
ld [CurSpecies], a
inc hl
ld a, b
push af
push hl
call GetFarHalfword
ld d, l
ld e, h
pop hl
inc hl
inc hl
ld a, d
or e
jr z, .skip_height
push hl
push de
ld hl, sp+$0
ld d, h
ld e, l
hlcoord 12, 7
lb bc, 2, PRINTNUM_MONEY | 4
call PrintNum
hlcoord 14, 7
ld [hl], $5e ; ft symbol
pop af
pop hl
.skip_height
pop af
push af
inc hl
push hl
dec hl
call GetFarHalfword
ld d, l
ld e, h
ld a, e
or d
jr z, .skip_weight
push de
ld hl, sp+$0
ld d, h
ld e, l
hlcoord 11, 9
lb bc, 2, PRINTNUM_RIGHTALIGN | 5
call PrintNum
pop de
.skip_weight
; Page 1
lb bc, 5, SCREEN_WIDTH - 2
hlcoord 2, 11
call ClearBox
hlcoord 1, 10
ld bc, SCREEN_WIDTH - 1
ld a, $61 ; horizontal divider
call ByteFill
; page number
hlcoord 1, 9
ld [hl], $55
inc hl
ld [hl], $55
hlcoord 1, 10
ld [hl], $56 ; P.
inc hl
ld [hl], $57 ; 1
pop de
inc de
pop af
hlcoord 2, 11
push af
call FarString
pop bc
ld a, [wPokedexStatus]
or a ; check for page 2
ret z
; Page 2
push bc
push de
lb bc, 5, SCREEN_WIDTH - 2
hlcoord 2, 11
call ClearBox
hlcoord 1, 10
ld bc, SCREEN_WIDTH - 1
ld a, $61
call ByteFill
; page number
hlcoord 1, 9
ld [hl], $55
inc hl
ld [hl], $55
hlcoord 1, 10
ld [hl], $56 ; P.
inc hl
ld [hl], $58 ; 2
pop de
inc de
pop af
hlcoord 2, 11
call FarString
ret
String_44331: ; 44331
db "#@"
GetDexEntryPointer: ; 44333
; return dex entry pointer b:de
push hl
ld hl, PokedexDataPointerTable
ld a, b
dec a
ld d, 0
ld e, a
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
push de
rlca
rlca
maskbits NUM_DEX_ENTRY_BANKS
ld hl, .PokedexEntryBanks
ld d, 0
ld e, a
add hl, de
ld b, [hl]
pop de
pop hl
ret
.PokedexEntryBanks: ; 44351
db BANK(PokedexEntries1)
db BANK(PokedexEntries2)
db BANK(PokedexEntries3)
db BANK(PokedexEntries4)
GetDexEntryPagePointer: ; 44355
call GetDexEntryPointer ; b:de
push hl
ld h, d
ld l, e
; skip species name
.loop1
ld a, b
call GetFarByte
inc hl
cp "@"
jr nz, .loop1
; skip height and weight
rept 4
inc hl
endr
; if c != 1: skip entry
dec c
jr z, .done
; skip entry
.loop2
ld a, b
call GetFarByte
inc hl
cp "@"
jr nz, .loop2
.done
ld d, h
ld e, l
pop hl
ret

View File

@@ -0,0 +1,162 @@
LoadSGBPokedexGFX: ; 1ddf1c
ld hl, SGBPokedexGFX_LZ
ld de, vTiles2 tile $31
call Decompress
ret
LoadSGBPokedexGFX2: ; 1ddf26 (77:5f26)
ld hl, SGBPokedexGFX_LZ
ld de, vTiles2 tile $31
lb bc, BANK(SGBPokedexGFX_LZ), 58
call DecompressRequest2bpp
ret
SGBPokedexGFX_LZ: ; 1ddf33
INCBIN "gfx/pokedex/sgb.2bpp.lz"
LoadQuestionMarkPic: ; 1de0d7
ld hl, .QuestionMarkLZ
ld de, sScratch
call Decompress
ret
.QuestionMarkLZ: ; 1de0e1
INCBIN "gfx/pokemon/questionmark/front.2bpp.lz"
DrawPokedexListWindow: ; 1de171 (77:6171)
ld a, $32
hlcoord 0, 17
ld bc, 12
call ByteFill
hlcoord 0, 1
lb bc, 15, 11
call ClearBox
ld a, $34
hlcoord 0, 0
ld bc, 11
call ByteFill
ld a, $39
hlcoord 0, 16
ld bc, 11
call ByteFill
hlcoord 5, 0
ld [hl], $3f
hlcoord 5, 16
ld [hl], $40
ld a, [wCurrentDexMode]
cp DEXMODE_OLD
jr z, .OldMode
; scroll bar
hlcoord 11, 0
ld [hl], $50
ld a, $51
hlcoord 11, 1
ld b, SCREEN_HEIGHT - 3
call Bank77_FillColumn
ld [hl], $52
jr .Done
.OldMode:
; no scroll bar
hlcoord 11, 0
ld [hl], $66
ld a, $67
hlcoord 11, 1
ld b, SCREEN_HEIGHT - 3
call Bank77_FillColumn
ld [hl], $68
.Done:
ret
DrawPokedexSearchResultsWindow: ; 1de1d1 (77:61d1)
ld a, $34
hlcoord 0, 0
ld bc, 11
call ByteFill
ld a, $39
hlcoord 0, 10
ld bc, 11
call ByteFill
hlcoord 5, 0
ld [hl], $3f
hlcoord 5, 10
ld [hl], $40
hlcoord 11, 0
ld [hl], $66
ld a, $67
hlcoord 11, 1
ld b, SCREEN_HEIGHT / 2
call Bank77_FillColumn
ld [hl], $68
ld a, $34
hlcoord 0, 11
ld bc, 11
call ByteFill
ld a, $39
hlcoord 0, 17
ld bc, 11
call ByteFill
hlcoord 11, 11
ld [hl], $66
ld a, $67
hlcoord 11, 12
ld b, 5
call Bank77_FillColumn
ld [hl], $68
hlcoord 0, 12
lb bc, 5, 11
call ClearBox
ld de, .esults_D
hlcoord 0, 12
call PlaceString
ret
.esults_D ; 1de23c
; (SEARCH R)
db "ESULTS"
next ""
; (### FOUN)
next "D!@"
DrawDexEntryScreenRightEdge: ; 1de247
ld a, [hBGMapAddress]
ld l, a
ld a, [hBGMapAddress + 1]
ld h, a
push hl
inc hl
ld a, l
ld [hBGMapAddress], a
ld a, h
ld [hBGMapAddress + 1], a
hlcoord 19, 0
ld [hl], $66
hlcoord 19, 1
ld a, $67
ld b, 15
call Bank77_FillColumn
ld [hl], $68
hlcoord 19, 17
ld [hl], $3c
xor a
ld b, SCREEN_HEIGHT
hlcoord 19, 0, AttrMap
call Bank77_FillColumn
call WaitBGMap2
pop hl
ld a, l
ld [hBGMapAddress], a
ld a, h
ld [hBGMapAddress + 1], a
ret
Bank77_FillColumn: ; 1de27f
push de
ld de, SCREEN_WIDTH
.loop
ld [hl], a
add hl, de
dec b
jr nz, .loop
pop de
ret

52
engine/pokedex/unown_dex.asm Executable file
View File

@@ -0,0 +1,52 @@
UpdateUnownDex: ; fba18
ld a, [UnownLetter]
ld c, a
ld b, NUM_UNOWN
ld hl, UnownDex
.loop
ld a, [hli]
and a
jr z, .done
cp c
ret z
dec b
jr nz, .loop
ret
.done
dec hl
ld [hl], c
ret
; fba2e
PrintUnownWord: ; fba2e (3e:7a2e)
hlcoord 4, 15
ld bc, 12
ld a, " "
call ByteFill
ld a, [wDexCurrentUnownIndex]
ld e, a
ld d, 0
ld hl, UnownDex
add hl, de
ld a, [hl]
ld e, a
ld d, 0
ld hl, UnownWords
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
hlcoord 4, 15
.loop
ld a, [de]
cp -1
ret z
inc de
ld [hli], a
jr .loop
; fba5a (3e:7a5a)
INCLUDE "data/unown_words.asm"