diff options
Diffstat (limited to 'engine/give_pokemon.asm')
-rwxr-xr-x | engine/give_pokemon.asm | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/engine/give_pokemon.asm b/engine/give_pokemon.asm index 64876d22..49596782 100755 --- a/engine/give_pokemon.asm +++ b/engine/give_pokemon.asm @@ -1,54 +1,57 @@ -_GivePokemon: ; 4fda5 (13:7da5) +_GivePokemon: +; returns success in carry +; and whether the mon was added to the party in [wAddedToParty] call EnableAutoTextBoxDrawing xor a - ld [wccd3], a - ld a, [wPartyCount] ; wPartyCount + ld [wAddedToParty], a + ld a, [wPartyCount] cp PARTY_LENGTH - jr c, .asm_4fe01 - ld a, [W_NUMINBOX] ; wda80 + jr c, .addToParty + ld a, [wNumInBox] cp MONS_PER_BOX - jr nc, .asm_4fdf9 + jr nc, .boxFull +; add to box xor a - ld [W_ENEMYBATTSTATUS3], a ; W_ENEMYBATTSTATUS3 + ld [wEnemyBattleStatus3], a ld a, [wcf91] ld [wEnemyMonSpecies2], a callab LoadEnemyMonData call SetPokedexOwnedFlag callab SendNewMonToBox ld hl, wcf4b - ld a, [wd5a0] + ld a, [wCurrentBoxNum] and $7f cp 9 - jr c, .asm_4fdec + jr c, .singleDigitBoxNum sub 9 ld [hl], "1" inc hl add "0" - jr .asm_4fdee -.asm_4fdec + jr .next +.singleDigitBoxNum add "1" -.asm_4fdee +.next ld [hli], a ld [hl], "@" ld hl, SetToBoxText call PrintText scf ret -.asm_4fdf9 +.boxFull ld hl, BoxIsFullText call PrintText and a ret -.asm_4fe01 +.addToParty call SetPokedexOwnedFlag call AddPartyMon - ld a, $1 + ld a, 1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a - ld [wccd3], a + ld [wAddedToParty], a scf ret -SetPokedexOwnedFlag: ; 4fe11 (13:7e11) +SetPokedexOwnedFlag: ld a, [wcf91] push af ld [wd11e], a @@ -56,8 +59,8 @@ SetPokedexOwnedFlag: ; 4fe11 (13:7e11) ld a, [wd11e] dec a ld c, a - ld hl, wPokedexOwned ; wPokedexOwned - ld b, $1 + ld hl, wPokedexOwned + ld b, FLAG_SET predef FlagActionPredef pop af ld [wd11e], a @@ -65,15 +68,15 @@ SetPokedexOwnedFlag: ; 4fe11 (13:7e11) ld hl, GotMonText jp PrintText -GotMonText: ; 4fe39 (13:7e39) +GotMonText: TX_FAR _GotMonText - db $0b + TX_SFX_ITEM_1 db "@" -SetToBoxText: ; 4fe3f (13:7e3f) +SetToBoxText: TX_FAR _SetToBoxText db "@" -BoxIsFullText: ; 4fe44 (13:7e44) +BoxIsFullText: TX_FAR _BoxIsFullText db "@" |