Poké Ball animation code cleanup.

hg-commit-id: 812dc01df153
This commit is contained in:
IIMarckus 2011-12-15 18:05:30 -07:00
parent c04a77529a
commit a8dbea888b
2 changed files with 41 additions and 25 deletions

View file

@ -71,11 +71,13 @@ W_OPPONENTSTATUS EQU $CFE9 ; active opponent's status condition
W_TRAINERCLASS EQU $D031 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 W_CUROPPONENT EQU $D059 ; in a wild battle, this is the species of pokemon
; in a trainer battle, this is the trainer class + $C8 ; in a trainer battle, this is the trainer class + $C8
W_LONEATTACKNO EQU $D05C ; which entry in LoneAttacks to use 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_TRAINERNO EQU $D05D ; which instance of [youngster, lass, etc] is this?
W_CURENEMYLVL EQU $D127 W_CURENEMYLVL EQU $D127
@ -789,10 +791,15 @@ SLASH EQU $A3
SUBSTITUTE EQU $A4 SUBSTITUTE EQU $A4
STRUGGLE EQU $A5 STRUGGLE EQU $A5
; these do double duty as animation identifiers ; these do double duty as animation identifiers
SHOWPIC_ANIM EQU $A6 ; redraw monster pic
SLP_ANIM EQU $BD ; sleeping monster SLP_ANIM EQU $BD ; sleeping monster
CONF_ANIM EQU $BF ; confused monster CONF_ANIM EQU $BF ; confused monster
TOSS_ANIM EQU $C1 ; try to catch a monster TOSS_ANIM EQU $C1 ; toss Poké Ball
SEND_ANIM EQU $C3 ; send out a monster 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 ; super game boy palettes
PAL_ROUTE EQU $00 PAL_ROUTE EQU $00

View file

@ -5658,7 +5658,7 @@ LanceData:
TrainerAI: ; 652E TrainerAI: ; 652E
;XXX called at 34964, 3c342, 3c398 ;XXX called at 34964, 3c342, 3c398
and a and a
ld a,[W_ISTRAINERBATTLE] ld a,[W_BATTLETYPE]
dec a dec a
ret z ; if not a trainer, we're done here ret z ; if not a trainer, we're done here
ld a,[W_ISLINKBATTLE] ld a,[W_ISLINKBATTLE]
@ -10072,52 +10072,61 @@ Pointer4DCF: ; 4DCF
INCBIN "baserom.gbc",$78DDB,$79E16 - $78DDB INCBIN "baserom.gbc",$78DDB,$79E16 - $78DDB
TossBallAnimation: ; 5E16 TossBallAnimation: ; 5E16
ld a,[$D057] ld a,[W_BATTLETYPE]
cp a,2 cp a,2
jr z,.next4\@ jr z,.BlockBall\@ ; if in trainer battle, play different animation
ld a,[$D11E] ld a,[$D11E]
ld b,a 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 and a,$F0
swap a swap a
ld c,a ld c,a
; lower nybble: number of shakes
; store these for later
ld a,b ld a,b
and a,$F and a,$F
ld [$CD3D],a ld [$CD3D],a
ld hl,.Pointer5E50
ld hl,.PokeBallAnimations
; choose which toss animation to use
ld a,[$CF91] ld a,[$CF91]
cp a,4 cp a,POKE_BALL
ld b,$C1 ld b,TOSS_ANIM
jr z,.next2\@ jr z,.done\@
cp a,3 cp a,GREAT_BALL
ld b,$C5 ld b,GREATTOSS_ANIM
jr z,.next2\@ jr z,.done\@
ld b,$C6 ld b,ULTRATOSS_ANIM
.next2\@ .done\@
ld a,b ld a,b
.next3\@ .PlayNextAnimation\@
ld [$D07C],a ld [$D07C],a
push bc push bc
push hl push hl
call $40F1 call PlayAnimation
pop hl pop hl
ld a,[hli] ld a,[hli]
pop bc pop bc
dec c dec c
jr nz,.next3\@ jr nz,.PlayNextAnimation\@
ret ret
.Pointer5E50: ; 5E50 .PokeBallAnimations: ; 5E50
db $C3,$C8,$C2,$C3,$A6 ; XXX what is this ; 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 a,$C1
ld [$D07C],a ld [$D07C],a
call $40F1 call PlayAnimation
ld a,$95 ld a,$95
call $23B1 call $23B1 ; play sound effect
ld a,$C4 ld a,BLOCKBALL_ANIM
ld [$D07C],a ld [$D07C],a
jp $40F1 jp PlayAnimation
INCBIN "baserom.gbc",$79E6A,$7C000 - $79E6A INCBIN "baserom.gbc",$79E6A,$7C000 - $79E6A