From a8dbea888b33f5889d42b2d1389e20c88ff61dff Mon Sep 17 00:00:00 2001 From: IIMarckus Date: Thu, 15 Dec 2011 18:05:30 -0700 Subject: [PATCH] =?UTF-8?q?Pok=C3=A9=20Ball=20animation=20code=20cleanup.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hg-commit-id: 812dc01df153 --- constants.asm | 13 ++++++++++--- pokered.asm | 53 ++++++++++++++++++++++++++++++--------------------- 2 files changed, 41 insertions(+), 25 deletions(-) diff --git a/constants.asm b/constants.asm index 509ed10a..2aafb6c0 100644 --- a/constants.asm +++ b/constants.asm @@ -71,11 +71,13 @@ W_OPPONENTSTATUS EQU $CFE9 ; active opponent's status condition W_TRAINERCLASS EQU $D031 +W_BATTLETYPE EQU $D057 ; in a wild battle, this is 1 + ; in a trainer battle, this is 2 + W_CUROPPONENT EQU $D059 ; in a wild battle, this is the species of pokemon ; in a trainer battle, this is the trainer class + $C8 W_LONEATTACKNO EQU $D05C ; which entry in LoneAttacks to use -W_ISTRAINERBATTLE EQU $D057 ; boolean W_TRAINERNO EQU $D05D ; which instance of [youngster, lass, etc] is this? W_CURENEMYLVL EQU $D127 @@ -789,10 +791,15 @@ SLASH EQU $A3 SUBSTITUTE EQU $A4 STRUGGLE EQU $A5 ; these do double duty as animation identifiers +SHOWPIC_ANIM EQU $A6 ; redraw monster pic SLP_ANIM EQU $BD ; sleeping monster CONF_ANIM EQU $BF ; confused monster -TOSS_ANIM EQU $C1 ; try to catch a monster -SEND_ANIM EQU $C3 ; send out a monster +TOSS_ANIM EQU $C1 ; toss Poké Ball +POOF_ANIM EQU $C3 ; puff of smoke +BLOCKBALL_ANIM EQU $C4 ; trainer knocks away Poké Ball +GREATTOSS_ANIM EQU $C5 ; toss Great Ball +ULTRATOSS_ANIM EQU $C6 ; toss Ultra Ball or Master Ball +HIDEPIC_ANIM EQU $C8 ; monster disappears ; super game boy palettes PAL_ROUTE EQU $00 diff --git a/pokered.asm b/pokered.asm index ce95d012..945e61aa 100644 --- a/pokered.asm +++ b/pokered.asm @@ -5658,7 +5658,7 @@ LanceData: TrainerAI: ; 652E ;XXX called at 34964, 3c342, 3c398 and a - ld a,[W_ISTRAINERBATTLE] + ld a,[W_BATTLETYPE] dec a ret z ; if not a trainer, we're done here ld a,[W_ISLINKBATTLE] @@ -10072,52 +10072,61 @@ Pointer4DCF: ; 4DCF INCBIN "baserom.gbc",$78DDB,$79E16 - $78DDB TossBallAnimation: ; 5E16 - ld a,[$D057] + ld a,[W_BATTLETYPE] cp a,2 - jr z,.next4\@ + jr z,.BlockBall\@ ; if in trainer battle, play different animation ld a,[$D11E] ld b,a + + ; upper nybble: how many animations (from PokeBallAnimations) to play + ; this will be 4 for successful capture, 6 for breakout and a,$F0 swap a ld c,a + + ; lower nybble: number of shakes + ; store these for later ld a,b and a,$F ld [$CD3D],a - ld hl,.Pointer5E50 + + ld hl,.PokeBallAnimations + ; choose which toss animation to use ld a,[$CF91] - cp a,4 - ld b,$C1 - jr z,.next2\@ - cp a,3 - ld b,$C5 - jr z,.next2\@ - ld b,$C6 -.next2\@ + cp a,POKE_BALL + ld b,TOSS_ANIM + jr z,.done\@ + cp a,GREAT_BALL + ld b,GREATTOSS_ANIM + jr z,.done\@ + ld b,ULTRATOSS_ANIM +.done\@ ld a,b -.next3\@ +.PlayNextAnimation\@ ld [$D07C],a push bc push hl - call $40F1 + call PlayAnimation pop hl ld a,[hli] pop bc dec c - jr nz,.next3\@ + jr nz,.PlayNextAnimation\@ ret -.Pointer5E50: ; 5E50 - db $C3,$C8,$C2,$C3,$A6 ; XXX what is this +.PokeBallAnimations: ; 5E50 +; sequence of animations that make up the Poké Ball toss + db POOF_ANIM,HIDEPIC_ANIM,$C2,POOF_ANIM,SHOWPIC_ANIM -.next4\@ ; 5E55 +.BlockBall\@ ; 5E55 ld a,$C1 ld [$D07C],a - call $40F1 + call PlayAnimation ld a,$95 - call $23B1 - ld a,$C4 + call $23B1 ; play sound effect + ld a,BLOCKBALL_ANIM ld [$D07C],a - jp $40F1 + jp PlayAnimation INCBIN "baserom.gbc",$79E6A,$7C000 - $79E6A