Recomment LoadMonData_.

This commit is contained in:
yenatch 2014-05-25 21:53:02 -07:00
parent 41906725d0
commit 6c94ac1248

View file

@ -3,6 +3,7 @@ INCLUDE "constants.asm"
INCLUDE "home.asm" INCLUDE "home.asm"
SECTION "bank1",ROMX,BANK[$1] SECTION "bank1",ROMX,BANK[$1]
INCLUDE "data/facing.asm" INCLUDE "data/facing.asm"
@ -56,6 +57,7 @@ Func_40b0::
ld a, $7 ; HealParty ld a, $7 ; HealParty
jp Predef jp Predef
MewPicFront:: INCBIN "pic/bmon/mew.pic" MewPicFront:: INCBIN "pic/bmon/mew.pic"
MewPicBack:: INCBIN "pic/monback/mewb.pic" MewPicBack:: INCBIN "pic/monback/mewb.pic"
INCLUDE "data/baseStats/mew.asm" INCLUDE "data/baseStats/mew.asm"
@ -67,58 +69,62 @@ INCLUDE "engine/titlescreen.asm"
NintenText: db "NINTEN@" NintenText: db "NINTEN@"
SonyText: db "SONY@" SonyText: db "SONY@"
; loads pokemon data from one of multiple sources to $cf98
; loads base stats to $d0b8 LoadMonData_:
; INPUT: ; Load monster [wWhichPokemon] from list [$cc49]:
; [$cf92] = index of pokemon within party/box ; 0: partymon
; [$cc49] = source ; 1: enemymon
; 00: player's party ; 2: boxmon
; 01: enemy's party ; 3: daycaremon
; 02: current box ; Return monster id at $cf91 and its data at $cf98.
; 03: daycare ; Also load base stats at $d0b8 for convenience.
; OUTPUT:
; [$cf91] = pokemon ID ld a, [W_DAYCAREMONDATA]
; $cf98 = base address of pokemon data
; $d0b8 = base address of base stats
LoadMonData_: ; 45b6 (1:45b6)
ld a,[W_DAYCAREMONDATA] ; daycare pokemon ID
ld [$cf91], a ld [$cf91], a
ld a, [$cc49] ld a, [$cc49]
cp a,$03 cp 3
jr z, .GetMonHeader jr z, .GetMonHeader
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
ld e, a ld e, a
callab Func_39c37 ; get pokemon ID callab Func_39c37 ; get pokemon ID
.GetMonHeader .GetMonHeader
ld a, [$cf91] ld a, [$cf91]
ld [$d0b5], a ; input for GetMonHeader ld [$d0b5], a ; input for GetMonHeader
call GetMonHeader ; load base stats to $d0b8 call GetMonHeader
ld hl, W_PARTYMON1DATA ld hl, W_PARTYMON1DATA
ld bc, 44 ld bc, 44
ld a, [$cc49] ld a, [$cc49]
cp a,$01 cp 1
jr c, .getMonEntry jr c, .getMonEntry
ld hl,wEnemyMons ; enemy pokemon 1 data
ld hl, wEnemyMons
jr z, .getMonEntry jr z, .getMonEntry
cp a,$02
ld hl,W_BOXMON1DATA ; box pokemon 1 data cp 2
ld hl, W_BOXMON1DATA
ld bc, 33 ld bc, 33
jr z, .getMonEntry jr z, .getMonEntry
ld hl, W_DAYCAREMONDATA ; daycare pokemon data
ld hl, W_DAYCAREMONDATA
jr .copyMonData jr .copyMonData
.getMonEntry ; add the product of the index and the size of each entry
.getMonEntry
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
call AddNTimes call AddNTimes
.copyMonData .copyMonData
ld de, $cf98 ld de, $cf98
ld bc, 44 ld bc, 44
jp CopyData jp CopyData
INCLUDE "data/item_prices.asm"
INCLUDE "data/item_prices.asm"
INCLUDE "text/item_names.asm" INCLUDE "text/item_names.asm"
UnusedNames: ; 4a92 (1:4a92) UnusedNames:
db "かみなりバッヂ@" db "かみなりバッヂ@"
db "かいがらバッヂ@" db "かいがらバッヂ@"
db "おじぞうバッヂ@" db "おじぞうバッヂ@"