More consistent data tables

This commit is contained in:
Remy Oukaour
2017-12-11 22:59:30 -05:00
parent f1f84743f7
commit 213dcc70d7
32 changed files with 653 additions and 583 deletions

View File

@@ -253,9 +253,9 @@ TryWildEncounter_BugContest: ; 97d64
ret
; 97d87
ContestMons: ; 97d87
INCLUDE "data/wild/bug_contest_mons.asm"
; 97db3
DoBikeStep:: ; 97db3
nop

View File

@@ -1112,7 +1112,7 @@ TimeCapsule_ReplaceTeruSama: ; 28771
and a
ret z
push hl
ld hl, .TimeCapsuleAlt
ld hl, TimeCapsule_CatchRateItems
.loop
ld a, [hli]
and a
@@ -1129,9 +1129,9 @@ TimeCapsule_ReplaceTeruSama: ; 28771
pop hl
ret
.TimeCapsuleAlt: ; 28785
INCLUDE "data/time_capsule/catch_rate_items.asm"
; 2879e
Link_CopyOTData: ; 2879e
.loop

View File

@@ -146,12 +146,7 @@ MysteryGiftFallbackItem: ; 2c722 (b:4722)
ret
; 2c725 (b:4725)
MysteryGiftItems: ; 2c725
INCLUDE "data/mystery_gift/items.asm"
MysteryGiftItemsEnd
; 2c74a
MysteryGiftDecos: ; 2c74a
INCLUDE "data/mystery_gift/items.asm"
INCLUDE "data/mystery_gift/decos.asm"
MysteryGiftDecosEnd
; 2c76f

View File

@@ -1708,12 +1708,12 @@ Pokedex_ABCMode: ; 40c30
.doneabc
ret
AlphabeticalPokedexOrder: ; 0x40c65
INCLUDE "data/pokedex/order_alpha.asm"
NewPokedexOrder: ; 0x40d60
INCLUDE "data/pokedex/order_new.asm"
Pokedex_DisplayModeDescription: ; 40e5b
xor a
ld [hBGMapMode], a

286
engine/pokedex_2.asm Normal file
View File

@@ -0,0 +1,286 @@
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, .SpriteData
ld de, Sprites
.loop
ld a, [hli]
cp -1
ret z
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [wDexSearchSlowpokeFrame]
ld b, a
add a
add b
add [hl]
inc hl
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
jr .loop
.SpriteData: ; 44228
dsprite 11, 0, 9, 0, $00, $00
dsprite 11, 0, 10, 0, $01, $00
dsprite 11, 0, 11, 0, $02, $00
dsprite 12, 0, 9, 0, $10, $00
dsprite 12, 0, 10, 0, $11, $00
dsprite 12, 0, 11, 0, $12, $00
dsprite 13, 0, 9, 0, $20, $00
dsprite 13, 0, 10, 0, $21, $00
dsprite 13, 0, 11, 0, $22, $00
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
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
and $3
ld hl, .PokedexEntryBanks
ld d, 0
ld e, a
add hl, de
ld b, [hl]
pop de
pop hl
ret
.PokedexEntryBanks: ; 44351
GLOBAL PokedexEntries1
GLOBAL PokedexEntries2
GLOBAL PokedexEntries3
GLOBAL PokedexEntries4
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

@@ -144,9 +144,8 @@ PlaceTradePartnerNamesAndParty: ; fb60d
jr .loop
; fb656
KantoMonSpecials: ; fb656
INCLUDE "data/time_capsule/special_stats.asm"
; fb6ed
INCLUDE "event/name_rater.asm"
@@ -274,6 +273,5 @@ ConvertMon_1to2: ; fb908
ret
; fb91c
Pokered_MonIndices: ; fb91c
INCLUDE "data/time_capsule/mon_order.asm"
; fba18

View File

@@ -784,9 +784,9 @@ _BackUpMapIndices: ; 2a3f6
ret
; 2a40f
RoamMaps: ; 2a40f
INCLUDE "data/wild/roammon_maps.asm"
; 2a4a0
ValidateTempWildMonSpecies: ; 2a4a0
; Due to a development oversight, this function is called with the wild Pokemon's level, not its species, in a.
@@ -1000,20 +1000,9 @@ RandomPhoneMon: ; 2a567
; 2a5e9
JohtoGrassWildMons: ; 0x2a5e9
INCLUDE "data/wild/johto_grass.asm"
JohtoWaterWildMons: ; 0x2b11d
INCLUDE "data/wild/johto_water.asm"
KantoGrassWildMons: ; 0x2b274
INCLUDE "data/wild/kanto_grass.asm"
KantoWaterWildMons: ; 0x2b7f7
INCLUDE "data/wild/kanto_water.asm"
SwarmGrassWildMons: ; 0x2b8d0
INCLUDE "data/wild/swarm_grass.asm"
SwarmWaterWildMons: ; 0x2b92f
INCLUDE "data/wild/swarm_water.asm"