mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Implement suggestions in PR #687
Merge mon_stats.asm, cry.asm, print_level.asm, and mon_data.asm into pokemon.asm Merge mon_party.asm into battle.asm Merge menu.asm, menu_window.asm, and menu2.asm into menu.asm
This commit is contained in:
parent
43eff93861
commit
7bd8d56ff9
8
home.asm
8
home.asm
@ -39,8 +39,6 @@ INCLUDE "home/map_objects.asm"
|
||||
INCLUDE "home/sine.asm"
|
||||
INCLUDE "home/movement.asm"
|
||||
INCLUDE "home/menu.asm"
|
||||
INCLUDE "home/menu_window.asm"
|
||||
INCLUDE "home/menu2.asm"
|
||||
INCLUDE "home/printer.asm"
|
||||
INCLUDE "home/game_time.asm"
|
||||
INCLUDE "home/map.asm"
|
||||
@ -71,12 +69,8 @@ INCLUDE "home/names.asm"
|
||||
INCLUDE "home/scrolling_menu.asm"
|
||||
INCLUDE "home/stone_queue.asm"
|
||||
INCLUDE "home/trainers.asm"
|
||||
INCLUDE "home/mon_stats.asm"
|
||||
INCLUDE "home/cry.asm"
|
||||
INCLUDE "home/print_level.asm"
|
||||
INCLUDE "home/mon_data.asm"
|
||||
INCLUDE "home/pokemon.asm"
|
||||
INCLUDE "home/print_bcd.asm"
|
||||
INCLUDE "home/mon_party.asm"
|
||||
INCLUDE "home/battle.asm"
|
||||
INCLUDE "home/sprite_anims.asm"
|
||||
INCLUDE "home/audio.asm"
|
||||
|
@ -1,3 +1,38 @@
|
||||
GetPartyParamLocation::
|
||||
; Get the location of parameter a from wCurPartyMon in hl
|
||||
push bc
|
||||
ld hl, wPartyMons
|
||||
ld c, a
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [wCurPartyMon]
|
||||
call GetPartyLocation
|
||||
pop bc
|
||||
ret
|
||||
|
||||
GetPartyLocation::
|
||||
; Add the length of a PartyMon struct to hl a times.
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
jp AddNTimes
|
||||
|
||||
Unreferenced_GetDexNumber::
|
||||
; Probably used in gen 1 to convert index number to dex number
|
||||
; Not required in gen 2 because index number == dex number
|
||||
push hl
|
||||
ld a, b
|
||||
dec a
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld hl, BaseData + BASE_DEX_NO
|
||||
ld bc, BASE_DATA_SIZE
|
||||
call AddNTimes
|
||||
ld a, BANK(BaseData)
|
||||
call GetFarHalfword
|
||||
ld b, l
|
||||
ld c, h
|
||||
pop hl
|
||||
ret
|
||||
|
||||
UserPartyAttr::
|
||||
push af
|
||||
ldh a, [hBattleTurn]
|
||||
|
101
home/cry.asm
101
home/cry.asm
@ -1,101 +0,0 @@
|
||||
PlayStereoCry::
|
||||
push af
|
||||
ld a, 1
|
||||
ld [wStereoPanningMask], a
|
||||
pop af
|
||||
call _PlayMonCry
|
||||
call WaitSFX
|
||||
ret
|
||||
|
||||
PlayStereoCry2::
|
||||
; Don't wait for the cry to end.
|
||||
; Used during pic animations.
|
||||
push af
|
||||
ld a, 1
|
||||
ld [wStereoPanningMask], a
|
||||
pop af
|
||||
jp _PlayMonCry
|
||||
|
||||
PlayMonCry::
|
||||
call PlayMonCry2
|
||||
call WaitSFX
|
||||
ret
|
||||
|
||||
PlayMonCry2::
|
||||
; Don't wait for the cry to end.
|
||||
push af
|
||||
xor a
|
||||
ld [wStereoPanningMask], a
|
||||
ld [wCryTracks], a
|
||||
pop af
|
||||
call _PlayMonCry
|
||||
ret
|
||||
|
||||
_PlayMonCry::
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
|
||||
call GetCryIndex
|
||||
jr c, .done
|
||||
|
||||
ld e, c
|
||||
ld d, b
|
||||
call PlayCry
|
||||
|
||||
.done
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
LoadCry::
|
||||
; Load cry bc.
|
||||
|
||||
call GetCryIndex
|
||||
ret c
|
||||
|
||||
ldh a, [hROMBank]
|
||||
push af
|
||||
ld a, BANK(PokemonCries)
|
||||
rst Bankswitch
|
||||
|
||||
ld hl, PokemonCries
|
||||
rept 6 ; sizeof(mon_cry)
|
||||
add hl, bc
|
||||
endr
|
||||
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
inc hl
|
||||
|
||||
ld a, [hli]
|
||||
ld [wCryPitch], a
|
||||
ld a, [hli]
|
||||
ld [wCryPitch + 1], a
|
||||
ld a, [hli]
|
||||
ld [wCryLength], a
|
||||
ld a, [hl]
|
||||
ld [wCryLength + 1], a
|
||||
|
||||
pop af
|
||||
rst Bankswitch
|
||||
and a
|
||||
ret
|
||||
|
||||
GetCryIndex::
|
||||
and a
|
||||
jr z, .no
|
||||
cp NUM_POKEMON + 1
|
||||
jr nc, .no
|
||||
|
||||
dec a
|
||||
ld c, a
|
||||
ld b, 0
|
||||
and a
|
||||
ret
|
||||
|
||||
.no
|
||||
scf
|
||||
ret
|
781
home/menu.asm
781
home/menu.asm
File diff suppressed because it is too large
Load Diff
539
home/menu2.asm
539
home/menu2.asm
File diff suppressed because it is too large
Load Diff
@ -1,242 +0,0 @@
|
||||
PushWindow::
|
||||
callfar _PushWindow
|
||||
ret
|
||||
|
||||
ExitMenu::
|
||||
push af
|
||||
callfar _ExitMenu
|
||||
pop af
|
||||
ret
|
||||
|
||||
InitVerticalMenuCursor::
|
||||
callfar _InitVerticalMenuCursor
|
||||
ret
|
||||
|
||||
CloseWindow::
|
||||
push af
|
||||
call ExitMenu
|
||||
call ApplyTilemap
|
||||
call UpdateSprites
|
||||
pop af
|
||||
ret
|
||||
|
||||
RestoreTileBackup::
|
||||
call MenuBoxCoord2Tile
|
||||
call .copy
|
||||
call MenuBoxCoord2Attr
|
||||
call .copy
|
||||
ret
|
||||
|
||||
.copy
|
||||
call GetMenuBoxDims
|
||||
inc b
|
||||
inc c
|
||||
|
||||
.row
|
||||
push bc
|
||||
push hl
|
||||
|
||||
.col
|
||||
ld a, [de]
|
||||
ld [hli], a
|
||||
dec de
|
||||
dec c
|
||||
jr nz, .col
|
||||
|
||||
pop hl
|
||||
ld bc, SCREEN_WIDTH
|
||||
add hl, bc
|
||||
pop bc
|
||||
dec b
|
||||
jr nz, .row
|
||||
|
||||
ret
|
||||
|
||||
PopWindow::
|
||||
ld b, $10
|
||||
ld de, wMenuFlags
|
||||
.loop
|
||||
ld a, [hld]
|
||||
ld [de], a
|
||||
inc de
|
||||
dec b
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
GetMenuBoxDims::
|
||||
ld a, [wMenuBorderTopCoord] ; top
|
||||
ld b, a
|
||||
ld a, [wMenuBorderBottomCoord] ; bottom
|
||||
sub b
|
||||
ld b, a
|
||||
ld a, [wMenuBorderLeftCoord] ; left
|
||||
ld c, a
|
||||
ld a, [wMenuBorderRightCoord] ; right
|
||||
sub c
|
||||
ld c, a
|
||||
ret
|
||||
|
||||
CopyMenuData::
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
push af
|
||||
ld hl, wMenuDataPointer
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld de, wMenuDataFlags
|
||||
ld bc, wMenuDataEnd - wMenuDataFlags
|
||||
call CopyBytes
|
||||
pop af
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
GetWindowStackTop::
|
||||
ld hl, wWindowStackPointer
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
inc hl
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ret
|
||||
|
||||
PlaceVerticalMenuItems::
|
||||
call CopyMenuData
|
||||
ld hl, wMenuDataPointer
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
call GetMenuTextStartCoord
|
||||
call Coord2Tile ; hl now contains the tilemap address where we will start printing text.
|
||||
inc de
|
||||
ld a, [de] ; Number of items
|
||||
inc de
|
||||
ld b, a
|
||||
.loop
|
||||
push bc
|
||||
call PlaceString
|
||||
inc de
|
||||
ld bc, 2 * SCREEN_WIDTH
|
||||
add hl, bc
|
||||
pop bc
|
||||
dec b
|
||||
jr nz, .loop
|
||||
|
||||
ld a, [wMenuDataFlags]
|
||||
bit 4, a
|
||||
ret z
|
||||
|
||||
call MenuBoxCoord2Tile
|
||||
ld a, [de]
|
||||
ld c, a
|
||||
inc de
|
||||
ld b, $0
|
||||
add hl, bc
|
||||
jp PlaceString
|
||||
|
||||
MenuBox::
|
||||
call MenuBoxCoord2Tile
|
||||
call GetMenuBoxDims
|
||||
dec b
|
||||
dec c
|
||||
jp Textbox
|
||||
|
||||
GetMenuTextStartCoord::
|
||||
ld a, [wMenuBorderTopCoord]
|
||||
ld b, a
|
||||
inc b
|
||||
ld a, [wMenuBorderLeftCoord]
|
||||
ld c, a
|
||||
inc c
|
||||
; bit 6: if not set, leave extra room on top
|
||||
ld a, [wMenuDataFlags]
|
||||
bit 6, a
|
||||
jr nz, .bit_6_set
|
||||
inc b
|
||||
|
||||
.bit_6_set
|
||||
; bit 7: if set, leave extra room on the left
|
||||
ld a, [wMenuDataFlags]
|
||||
bit 7, a
|
||||
jr z, .bit_7_clear
|
||||
inc c
|
||||
|
||||
.bit_7_clear
|
||||
ret
|
||||
|
||||
ClearMenuBoxInterior::
|
||||
call MenuBoxCoord2Tile
|
||||
ld bc, SCREEN_WIDTH + 1
|
||||
add hl, bc
|
||||
call GetMenuBoxDims
|
||||
dec b
|
||||
dec c
|
||||
call ClearBox
|
||||
ret
|
||||
|
||||
ClearWholeMenuBox::
|
||||
call MenuBoxCoord2Tile
|
||||
call GetMenuBoxDims
|
||||
inc c
|
||||
inc b
|
||||
call ClearBox
|
||||
ret
|
||||
|
||||
MenuBoxCoord2Tile::
|
||||
ld a, [wMenuBorderLeftCoord]
|
||||
ld c, a
|
||||
ld a, [wMenuBorderTopCoord]
|
||||
ld b, a
|
||||
|
||||
Coord2Tile::
|
||||
; Return the address of wTilemap(c, b) in hl.
|
||||
xor a
|
||||
ld h, a
|
||||
ld l, b
|
||||
ld a, c
|
||||
ld b, h
|
||||
ld c, l
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
add hl, bc
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
ld c, a
|
||||
xor a
|
||||
ld b, a
|
||||
add hl, bc
|
||||
bccoord 0, 0
|
||||
add hl, bc
|
||||
ret
|
||||
|
||||
MenuBoxCoord2Attr::
|
||||
ld a, [wMenuBorderLeftCoord]
|
||||
ld c, a
|
||||
ld a, [wMenuBorderTopCoord]
|
||||
ld b, a
|
||||
|
||||
Coord2Attr::
|
||||
; Return the address of wAttrmap(c, b) in hl.
|
||||
xor a
|
||||
ld h, a
|
||||
ld l, b
|
||||
ld a, c
|
||||
ld b, h
|
||||
ld c, l
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
add hl, bc
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
ld c, a
|
||||
xor a
|
||||
ld b, a
|
||||
add hl, bc
|
||||
bccoord 0, 0, wAttrmap
|
||||
add hl, bc
|
||||
ret
|
@ -1,87 +0,0 @@
|
||||
Unreferenced_GetNthMove::
|
||||
ld hl, wListMoves_MoveIndicesBuffer
|
||||
ld c, a
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
ret
|
||||
|
||||
GetBaseData::
|
||||
push bc
|
||||
push de
|
||||
push hl
|
||||
ldh a, [hROMBank]
|
||||
push af
|
||||
ld a, BANK(BaseData)
|
||||
rst Bankswitch
|
||||
|
||||
; Egg doesn't have BaseData
|
||||
ld a, [wCurSpecies]
|
||||
cp EGG
|
||||
jr z, .egg
|
||||
|
||||
; Get BaseData
|
||||
dec a
|
||||
ld bc, BASE_DATA_SIZE
|
||||
ld hl, BaseData
|
||||
call AddNTimes
|
||||
ld de, wCurBaseData
|
||||
ld bc, BASE_DATA_SIZE
|
||||
call CopyBytes
|
||||
jr .end
|
||||
|
||||
.egg
|
||||
ld de, UnknownEggPic
|
||||
|
||||
; Sprite dimensions
|
||||
ld b, $55 ; 5x5
|
||||
ld hl, wBasePicSize
|
||||
ld [hl], b
|
||||
|
||||
; Beta front and back sprites
|
||||
; (see pokegold-spaceworld's data/pokemon/base_stats/*)
|
||||
ld hl, wBaseUnusedFrontpic
|
||||
ld [hl], e
|
||||
inc hl
|
||||
ld [hl], d
|
||||
inc hl
|
||||
ld [hl], e
|
||||
inc hl
|
||||
ld [hl], d
|
||||
jr .end ; useless
|
||||
|
||||
.end
|
||||
; Replace Pokedex # with species
|
||||
ld a, [wCurSpecies]
|
||||
ld [wBaseDexNo], a
|
||||
|
||||
pop af
|
||||
rst Bankswitch
|
||||
pop hl
|
||||
pop de
|
||||
pop bc
|
||||
ret
|
||||
|
||||
GetCurNick::
|
||||
ld a, [wCurPartyMon]
|
||||
ld hl, wPartyMonNicknames
|
||||
|
||||
GetNick::
|
||||
; Get nickname a from list hl.
|
||||
|
||||
push hl
|
||||
push bc
|
||||
|
||||
call SkipNames
|
||||
ld de, wStringBuffer1
|
||||
|
||||
push de
|
||||
ld bc, MON_NAME_LENGTH
|
||||
call CopyBytes
|
||||
pop de
|
||||
|
||||
callfar CorrectNickErrors
|
||||
|
||||
pop bc
|
||||
pop hl
|
||||
ret
|
@ -1,34 +0,0 @@
|
||||
GetPartyParamLocation::
|
||||
; Get the location of parameter a from wCurPartyMon in hl
|
||||
push bc
|
||||
ld hl, wPartyMons
|
||||
ld c, a
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [wCurPartyMon]
|
||||
call GetPartyLocation
|
||||
pop bc
|
||||
ret
|
||||
|
||||
GetPartyLocation::
|
||||
; Add the length of a PartyMon struct to hl a times.
|
||||
ld bc, PARTYMON_STRUCT_LENGTH
|
||||
jp AddNTimes
|
||||
|
||||
Unreferenced_GetDexNumber::
|
||||
; Probably used in gen 1 to convert index number to dex number
|
||||
; Not required in gen 2 because index number == dex number
|
||||
push hl
|
||||
ld a, b
|
||||
dec a
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld hl, BaseData + BASE_DEX_NO
|
||||
ld bc, BASE_DATA_SIZE
|
||||
call AddNTimes
|
||||
ld a, BANK(BaseData)
|
||||
call GetFarHalfword
|
||||
ld b, l
|
||||
ld c, h
|
||||
pop hl
|
||||
ret
|
@ -1,104 +0,0 @@
|
||||
IsAPokemon::
|
||||
; Return carry if species a is not a Pokemon.
|
||||
and a
|
||||
jr z, .NotAPokemon
|
||||
cp EGG
|
||||
jr z, .Pokemon
|
||||
cp NUM_POKEMON + 1
|
||||
jr c, .Pokemon
|
||||
|
||||
.NotAPokemon:
|
||||
scf
|
||||
ret
|
||||
|
||||
.Pokemon:
|
||||
and a
|
||||
ret
|
||||
|
||||
DrawBattleHPBar::
|
||||
; Draw an HP bar d tiles long at hl
|
||||
; Fill it up to e pixels
|
||||
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
|
||||
; Place 'HP:'
|
||||
ld a, $60
|
||||
ld [hli], a
|
||||
ld a, $61
|
||||
ld [hli], a
|
||||
|
||||
; Draw a template
|
||||
push hl
|
||||
ld a, $62 ; empty bar
|
||||
.template
|
||||
ld [hli], a
|
||||
dec d
|
||||
jr nz, .template
|
||||
ld a, $6b ; bar end
|
||||
add b
|
||||
ld [hl], a
|
||||
pop hl
|
||||
|
||||
; Safety check # pixels
|
||||
ld a, e
|
||||
and a
|
||||
jr nz, .fill
|
||||
ld a, c
|
||||
and a
|
||||
jr z, .done
|
||||
ld e, 1
|
||||
|
||||
.fill
|
||||
; Keep drawing tiles until pixel length is reached
|
||||
ld a, e
|
||||
sub TILE_WIDTH
|
||||
jr c, .lastbar
|
||||
|
||||
ld e, a
|
||||
ld a, $6a ; full bar
|
||||
ld [hli], a
|
||||
ld a, e
|
||||
and a
|
||||
jr z, .done
|
||||
jr .fill
|
||||
|
||||
.lastbar
|
||||
ld a, $62 ; empty bar
|
||||
add e ; + e
|
||||
ld [hl], a
|
||||
|
||||
.done
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
PrepMonFrontpic::
|
||||
ld a, $1
|
||||
ld [wBoxAlignment], a
|
||||
|
||||
_PrepMonFrontpic::
|
||||
ld a, [wCurPartySpecies]
|
||||
call IsAPokemon
|
||||
jr c, .not_pokemon
|
||||
|
||||
push hl
|
||||
ld de, vTiles2
|
||||
predef GetMonFrontpic
|
||||
pop hl
|
||||
xor a
|
||||
ldh [hGraphicStartTile], a
|
||||
lb bc, 7, 7
|
||||
predef PlaceGraphic
|
||||
xor a
|
||||
ld [wBoxAlignment], a
|
||||
ret
|
||||
|
||||
.not_pokemon
|
||||
xor a
|
||||
ld [wBoxAlignment], a
|
||||
inc a
|
||||
ld [wCurPartySpecies], a
|
||||
ret
|
323
home/pokemon.asm
Normal file
323
home/pokemon.asm
Normal file
@ -0,0 +1,323 @@
|
||||
IsAPokemon::
|
||||
; Return carry if species a is not a Pokemon.
|
||||
and a
|
||||
jr z, .NotAPokemon
|
||||
cp EGG
|
||||
jr z, .Pokemon
|
||||
cp NUM_POKEMON + 1
|
||||
jr c, .Pokemon
|
||||
|
||||
.NotAPokemon:
|
||||
scf
|
||||
ret
|
||||
|
||||
.Pokemon:
|
||||
and a
|
||||
ret
|
||||
|
||||
DrawBattleHPBar::
|
||||
; Draw an HP bar d tiles long at hl
|
||||
; Fill it up to e pixels
|
||||
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
|
||||
; Place 'HP:'
|
||||
ld a, $60
|
||||
ld [hli], a
|
||||
ld a, $61
|
||||
ld [hli], a
|
||||
|
||||
; Draw a template
|
||||
push hl
|
||||
ld a, $62 ; empty bar
|
||||
.template
|
||||
ld [hli], a
|
||||
dec d
|
||||
jr nz, .template
|
||||
ld a, $6b ; bar end
|
||||
add b
|
||||
ld [hl], a
|
||||
pop hl
|
||||
|
||||
; Safety check # pixels
|
||||
ld a, e
|
||||
and a
|
||||
jr nz, .fill
|
||||
ld a, c
|
||||
and a
|
||||
jr z, .done
|
||||
ld e, 1
|
||||
|
||||
.fill
|
||||
; Keep drawing tiles until pixel length is reached
|
||||
ld a, e
|
||||
sub TILE_WIDTH
|
||||
jr c, .lastbar
|
||||
|
||||
ld e, a
|
||||
ld a, $6a ; full bar
|
||||
ld [hli], a
|
||||
ld a, e
|
||||
and a
|
||||
jr z, .done
|
||||
jr .fill
|
||||
|
||||
.lastbar
|
||||
ld a, $62 ; empty bar
|
||||
add e ; + e
|
||||
ld [hl], a
|
||||
|
||||
.done
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
PrepMonFrontpic::
|
||||
ld a, $1
|
||||
ld [wBoxAlignment], a
|
||||
|
||||
_PrepMonFrontpic::
|
||||
ld a, [wCurPartySpecies]
|
||||
call IsAPokemon
|
||||
jr c, .not_pokemon
|
||||
|
||||
push hl
|
||||
ld de, vTiles2
|
||||
predef GetMonFrontpic
|
||||
pop hl
|
||||
xor a
|
||||
ldh [hGraphicStartTile], a
|
||||
lb bc, 7, 7
|
||||
predef PlaceGraphic
|
||||
xor a
|
||||
ld [wBoxAlignment], a
|
||||
ret
|
||||
|
||||
.not_pokemon
|
||||
xor a
|
||||
ld [wBoxAlignment], a
|
||||
inc a
|
||||
ld [wCurPartySpecies], a
|
||||
ret
|
||||
|
||||
PlayStereoCry::
|
||||
push af
|
||||
ld a, 1
|
||||
ld [wStereoPanningMask], a
|
||||
pop af
|
||||
call _PlayMonCry
|
||||
call WaitSFX
|
||||
ret
|
||||
|
||||
PlayStereoCry2::
|
||||
; Don't wait for the cry to end.
|
||||
; Used during pic animations.
|
||||
push af
|
||||
ld a, 1
|
||||
ld [wStereoPanningMask], a
|
||||
pop af
|
||||
jp _PlayMonCry
|
||||
|
||||
PlayMonCry::
|
||||
call PlayMonCry2
|
||||
call WaitSFX
|
||||
ret
|
||||
|
||||
PlayMonCry2::
|
||||
; Don't wait for the cry to end.
|
||||
push af
|
||||
xor a
|
||||
ld [wStereoPanningMask], a
|
||||
ld [wCryTracks], a
|
||||
pop af
|
||||
call _PlayMonCry
|
||||
ret
|
||||
|
||||
_PlayMonCry::
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
|
||||
call GetCryIndex
|
||||
jr c, .done
|
||||
|
||||
ld e, c
|
||||
ld d, b
|
||||
call PlayCry
|
||||
|
||||
.done
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
LoadCry::
|
||||
; Load cry bc.
|
||||
|
||||
call GetCryIndex
|
||||
ret c
|
||||
|
||||
ldh a, [hROMBank]
|
||||
push af
|
||||
ld a, BANK(PokemonCries)
|
||||
rst Bankswitch
|
||||
|
||||
ld hl, PokemonCries
|
||||
rept 6 ; sizeof(mon_cry)
|
||||
add hl, bc
|
||||
endr
|
||||
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
inc hl
|
||||
|
||||
ld a, [hli]
|
||||
ld [wCryPitch], a
|
||||
ld a, [hli]
|
||||
ld [wCryPitch + 1], a
|
||||
ld a, [hli]
|
||||
ld [wCryLength], a
|
||||
ld a, [hl]
|
||||
ld [wCryLength + 1], a
|
||||
|
||||
pop af
|
||||
rst Bankswitch
|
||||
and a
|
||||
ret
|
||||
|
||||
GetCryIndex::
|
||||
and a
|
||||
jr z, .no
|
||||
cp NUM_POKEMON + 1
|
||||
jr nc, .no
|
||||
|
||||
dec a
|
||||
ld c, a
|
||||
ld b, 0
|
||||
and a
|
||||
ret
|
||||
|
||||
.no
|
||||
scf
|
||||
ret
|
||||
|
||||
PrintLevel::
|
||||
; Print wTempMonLevel at hl
|
||||
|
||||
ld a, [wTempMonLevel]
|
||||
ld [hl], "<LV>"
|
||||
inc hl
|
||||
|
||||
; How many digits?
|
||||
ld c, 2
|
||||
cp 100 ; This is distinct from MAX_LEVEL.
|
||||
jr c, Print8BitNumLeftAlign
|
||||
|
||||
; 3-digit numbers overwrite the :L.
|
||||
dec hl
|
||||
inc c
|
||||
jr Print8BitNumLeftAlign
|
||||
|
||||
PrintLevel_Force3Digits::
|
||||
; Print :L and all 3 digits
|
||||
ld [hl], "<LV>"
|
||||
inc hl
|
||||
ld c, 3
|
||||
|
||||
Print8BitNumLeftAlign::
|
||||
ld [wDeciramBuffer], a
|
||||
ld de, wDeciramBuffer
|
||||
ld b, PRINTNUM_LEFTALIGN | 1
|
||||
jp PrintNum
|
||||
|
||||
Unreferenced_GetNthMove::
|
||||
ld hl, wListMoves_MoveIndicesBuffer
|
||||
ld c, a
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
ret
|
||||
|
||||
GetBaseData::
|
||||
push bc
|
||||
push de
|
||||
push hl
|
||||
ldh a, [hROMBank]
|
||||
push af
|
||||
ld a, BANK(BaseData)
|
||||
rst Bankswitch
|
||||
|
||||
; Egg doesn't have BaseData
|
||||
ld a, [wCurSpecies]
|
||||
cp EGG
|
||||
jr z, .egg
|
||||
|
||||
; Get BaseData
|
||||
dec a
|
||||
ld bc, BASE_DATA_SIZE
|
||||
ld hl, BaseData
|
||||
call AddNTimes
|
||||
ld de, wCurBaseData
|
||||
ld bc, BASE_DATA_SIZE
|
||||
call CopyBytes
|
||||
jr .end
|
||||
|
||||
.egg
|
||||
ld de, UnknownEggPic
|
||||
|
||||
; Sprite dimensions
|
||||
ld b, $55 ; 5x5
|
||||
ld hl, wBasePicSize
|
||||
ld [hl], b
|
||||
|
||||
; Beta front and back sprites
|
||||
; (see pokegold-spaceworld's data/pokemon/base_stats/*)
|
||||
ld hl, wBaseUnusedFrontpic
|
||||
ld [hl], e
|
||||
inc hl
|
||||
ld [hl], d
|
||||
inc hl
|
||||
ld [hl], e
|
||||
inc hl
|
||||
ld [hl], d
|
||||
jr .end ; useless
|
||||
|
||||
.end
|
||||
; Replace Pokedex # with species
|
||||
ld a, [wCurSpecies]
|
||||
ld [wBaseDexNo], a
|
||||
|
||||
pop af
|
||||
rst Bankswitch
|
||||
pop hl
|
||||
pop de
|
||||
pop bc
|
||||
ret
|
||||
|
||||
GetCurNick::
|
||||
ld a, [wCurPartyMon]
|
||||
ld hl, wPartyMonNicknames
|
||||
|
||||
GetNick::
|
||||
; Get nickname a from list hl.
|
||||
|
||||
push hl
|
||||
push bc
|
||||
|
||||
call SkipNames
|
||||
ld de, wStringBuffer1
|
||||
|
||||
push de
|
||||
ld bc, MON_NAME_LENGTH
|
||||
call CopyBytes
|
||||
pop de
|
||||
|
||||
callfar CorrectNickErrors
|
||||
|
||||
pop bc
|
||||
pop hl
|
||||
ret
|
@ -1,28 +0,0 @@
|
||||
PrintLevel::
|
||||
; Print wTempMonLevel at hl
|
||||
|
||||
ld a, [wTempMonLevel]
|
||||
ld [hl], "<LV>"
|
||||
inc hl
|
||||
|
||||
; How many digits?
|
||||
ld c, 2
|
||||
cp 100 ; This is distinct from MAX_LEVEL.
|
||||
jr c, Print8BitNumLeftAlign
|
||||
|
||||
; 3-digit numbers overwrite the :L.
|
||||
dec hl
|
||||
inc c
|
||||
jr Print8BitNumLeftAlign
|
||||
|
||||
PrintLevel_Force3Digits::
|
||||
; Print :L and all 3 digits
|
||||
ld [hl], "<LV>"
|
||||
inc hl
|
||||
ld c, 3
|
||||
|
||||
Print8BitNumLeftAlign::
|
||||
ld [wDeciramBuffer], a
|
||||
ld de, wDeciramBuffer
|
||||
ld b, PRINTNUM_LEFTALIGN | 1
|
||||
jp PrintNum
|
Loading…
x
Reference in New Issue
Block a user