Celebi Event

This commit is contained in:
PikalaxALT 2015-12-05 15:38:25 -05:00
parent e83a5bae87
commit 6eac26732a
16 changed files with 286 additions and 258 deletions

View File

@ -350,7 +350,7 @@ MAX_OUTDOOR_SPRITES EQU 23
const_def const_def
const SPRITEANIMSTRUCT_INDEX const SPRITEANIMSTRUCT_INDEX
const SPRITEANIMSTRUCT_01 const SPRITEANIMSTRUCT_FRAMESET_ID
const SPRITEANIMSTRUCT_ANIM_SEQ_ID const SPRITEANIMSTRUCT_ANIM_SEQ_ID
const SPRITEANIMSTRUCT_TILE_ID const SPRITEANIMSTRUCT_TILE_ID
const SPRITEANIMSTRUCT_XCOORD const SPRITEANIMSTRUCT_XCOORD

View File

@ -1,4 +1,4 @@
Unknown_8d6e6: ; 8d6e6 SpriteAnimFrameData: ; 8d6e6
dw Unknown_8d76a ; 00 dw Unknown_8d76a ; 00
dw Unknown_8d76d ; 01 dw Unknown_8d76d ; 01
dw Unknown_8d772 ; 02 dw Unknown_8d772 ; 02
@ -63,11 +63,11 @@ Unknown_8d6e6: ; 8d6e6
dw Unknown_8d932 ; 3d dw Unknown_8d932 ; 3d
dw Unknown_8d93d ; 3e dw Unknown_8d93d ; 3e
dw Unknown_8d940 ; 3f dw Unknown_8d940 ; 3f
dw Unknown_8d943 ; 40 dw Unknown_8d943 ; 40 celebi on the left
dw Unknown_8d948 ; 41 dw Unknown_8d948 ; 41 celebi on the right
; 8d76a ; 8d76a
; OAM idx (see SpriteAnimOAMData), flip flags/duration
Unknown_8d76a: db $00, $20 ; lowest 6 bits of second byte are duration, upper two bits are flags Unknown_8d76a: db $00, $20
db -1 db -1
Unknown_8d76d: db $00, $08 Unknown_8d76d: db $00, $08
db $01, $08 db $01, $08
@ -106,10 +106,10 @@ Unknown_8d7a6: db $1e, $01
db $1f, $01 db $1f, $01
db -2 db -2
Unknown_8d7ab: db $20, $01 Unknown_8d7ab: db $20, $01
db $fd, $01 db -3, $01
db -2 db -2
Unknown_8d7b0: db $21, $01 Unknown_8d7b0: db $21, $01
db $fd, $01 db -3, $01
db -2 db -2
Unknown_8d7b5: db $81, $0c Unknown_8d7b5: db $81, $0c
db $82, $01 db $82, $01
@ -208,17 +208,17 @@ Unknown_8d82f: db $41, $08
db $4d, $20 db $4d, $20
db -1 db -1
db $4e, $03 db $4e, $03
db $fd, $03 db -3, $03
db -2 db -2
Unknown_8d861: db $fd, $20 Unknown_8d861: db -3, $20
db -1 db -1
Unknown_8d864: db $4f, $20 Unknown_8d864: db $4f, $20
db -1 db -1
Unknown_8d867: db $50, $02 Unknown_8d867: db $50, $02
db $51, $10 db $51, $10
db $fd, $01 db -3, $01
db $52, $01 db $52, $01
db $fd, $01 db -3, $01
db $53, $01 db $53, $01
db -4 db -4
Unknown_8d874: db $54, $20 Unknown_8d874: db $54, $20
@ -338,7 +338,7 @@ Unknown_8d932: db $79, $03
db -1 db -1
Unknown_8d93d: db $7e, $03 Unknown_8d93d: db $7e, $03
db -1 db -1
Unknown_8d940: db $fd, $00 Unknown_8d940: db -3, $00
db -1 db -1
Unknown_8d943: db $7f, $08 Unknown_8d943: db $7f, $08
db $80, $08 db $80, $08
@ -348,7 +348,7 @@ Unknown_8d948: db $7f, $48
db -1 db -1
; 8d94d ; 8d94d
Unknown_8d94d: ; 8d94d SpriteAnimOAMData: ; 8d94d
; vtile offset, pointer ; vtile offset, pointer
dbw $00, Unknown_8dd8a ; 00 dbw $00, Unknown_8dd8a ; 00
dbw $04, Unknown_8dd8a ; 01 dbw $04, Unknown_8dd8a ; 01

View File

@ -829,7 +829,7 @@ Function173b3: ; 173b3 (5:73b3)
ld [hl], $0 ld [hl], $0
pop de pop de
ld a, e ld a, e
ld hl, SPRITEANIMSTRUCT_01 ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
add [hl] add [hl]
ld [hl], a ld [hl], a

View File

@ -182,7 +182,7 @@ endr
ld [wc6d5], a ld [wc6d5], a
ld a, b ld a, b
ld [wc6d6], a ld [wc6d6], a
ld hl, SPRITEANIMSTRUCT_01 ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld hl, SPRITEANIMSTRUCT_0E ld hl, SPRITEANIMSTRUCT_0E
@ -298,7 +298,7 @@ Function120c1: ; 120c1 (4:60c1)
ld hl, SPRITEANIMSTRUCT_0E ld hl, SPRITEANIMSTRUCT_0E
add hl, bc add hl, bc
add [hl] add [hl]
ld hl, SPRITEANIMSTRUCT_01 ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ld hl, SPRITEANIMSTRUCT_0C ld hl, SPRITEANIMSTRUCT_0C

View File

@ -1627,7 +1627,7 @@ CrystalIntro_InitUnownAnim: ; e51dc (39:51dc)
add hl, bc add hl, bc
ld [hl], $8 ld [hl], $8
ld a, $3c ld a, $3c
call Function3b3c call ReinitSpriteAnimFrame
pop de pop de
push de push de
@ -1637,7 +1637,7 @@ CrystalIntro_InitUnownAnim: ; e51dc (39:51dc)
add hl, bc add hl, bc
ld [hl], $18 ld [hl], $18
ld a, $3b ld a, $3b
call Function3b3c call ReinitSpriteAnimFrame
pop de pop de
push de push de
@ -1647,7 +1647,7 @@ CrystalIntro_InitUnownAnim: ; e51dc (39:51dc)
add hl, bc add hl, bc
ld [hl], $28 ld [hl], $28
ld a, $39 ld a, $39
call Function3b3c call ReinitSpriteAnimFrame
pop de pop de
ld a, SPRITE_ANIM_INDEX_29 ld a, SPRITE_ANIM_INDEX_29
@ -1656,7 +1656,7 @@ CrystalIntro_InitUnownAnim: ; e51dc (39:51dc)
add hl, bc add hl, bc
ld [hl], $38 ld [hl], $38
ld a, $3a ld a, $3a
call Function3b3c call ReinitSpriteAnimFrame
ret ret
CrystalIntro_UnownFade: ; e5223 (39:5223) CrystalIntro_UnownFade: ; e5223 (39:5223)

View File

@ -79,7 +79,7 @@ Function8e86c: ; 8e86c (23:686c)
.asm_8e890 .asm_8e890
ld a, $4 ld a, $4
.asm_8e892 .asm_8e892
ld hl, SPRITEANIMSTRUCT_01 ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ret ret
@ -150,7 +150,7 @@ Function8e8d5: ; 8e8d5 (23:68d5)
.mail .mail
ld a, $2 ld a, $2
.okay .okay
ld hl, SPRITEANIMSTRUCT_01 ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ret ret

View File

@ -176,7 +176,7 @@ Function117f5: ; 117f5 (4:57f5)
depixel 4, 4, 4, 0 depixel 4, 4, 4, 0
ld a, SPRITE_ANIM_INDEX_0A ld a, SPRITE_ANIM_INDEX_0A
call _InitSpriteAnimStruct call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_01 ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
ld [hl], $0 ld [hl], $0
hlcoord 5, 2 hlcoord 5, 2
@ -411,7 +411,7 @@ Function1197b: ; 1197b (4:597b)
ld [wc6d5], a ld [wc6d5], a
ld a, b ld a, b
ld [wc6d6], a ld [wc6d6], a
ld hl, SPRITEANIMSTRUCT_01 ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld hl, SPRITEANIMSTRUCT_0E ld hl, SPRITEANIMSTRUCT_0E
@ -553,7 +553,7 @@ Function11a3b: ; 11a3b (4:5a3b)
ld hl, SPRITEANIMSTRUCT_0E ld hl, SPRITEANIMSTRUCT_0E
add hl, bc add hl, bc
add [hl] add [hl]
ld hl, SPRITEANIMSTRUCT_01 ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ld hl, SPRITEANIMSTRUCT_0C ld hl, SPRITEANIMSTRUCT_0C

View File

@ -100,7 +100,7 @@ Function927af: ; 927af (24:67af)
call Function92844 call Function92844
call Function92b0f call Function92b0f
xor a xor a
ld [wOAMRetentionSize], a ld [wCurrSpriteOAMAddr], a
callab DoNextFrameForFirst16Sprites callab DoNextFrameForFirst16Sprites
call Function927f8 call Function927f8
call Function927d3 call Function927d3

View File

@ -36,7 +36,7 @@ endr
dw .eighteen dw .eighteen
dw .nineteen ; finish egg hatching animation dw .nineteen ; finish egg hatching animation
dw .twenty ; radio tuning knob dw .twenty ; radio tuning knob
dw .twentyone dw .twentyone ; cut grass leaves
dw .twentytwo ; flying sprite dw .twentytwo ; flying sprite
dw .twentythree ; flying leaves dw .twentythree ; flying leaves
dw .twentyfour dw .twentyfour
@ -370,7 +370,7 @@ endr
ret nz ret nz
ld [hl], $3 ld [hl], $3
ld a, $f ld a, $f
call Function8d120 call _ReinitSpriteAnimFrame
ret ret
.eleven: ; 8d43e (23:543e) .eleven: ; 8d43e (23:543e)
@ -434,7 +434,7 @@ endr
.sixteen_zero: ; 8d493 .sixteen_zero: ; 8d493
ld a, $14 ld a, $14
call Function8d120 call _ReinitSpriteAnimFrame
ld hl, SPRITEANIMSTRUCT_0B ld hl, SPRITEANIMSTRUCT_0B
add hl, bc add hl, bc
@ -786,7 +786,7 @@ endr
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ld a, $36 ld a, $36
call Function8d120 call _ReinitSpriteAnimFrame
ret ret
.thirty: ; 8d666 (23:5666) .thirty: ; 8d666 (23:5666)
@ -840,7 +840,7 @@ endr
cp $40 cp $40
ret nz ret nz
ld a, $3d ld a, $3d
call Function8d120 call _ReinitSpriteAnimFrame
ret ret
.thirtyfour: ; 8d6ae (23:56ae) .thirtyfour: ; 8d6ae (23:56ae)
@ -856,7 +856,7 @@ endr
ret ret
.thirtyone: ; 8d6be (23:56be) .thirtyone: ; 8d6be (23:56be)
callba Function49aa2 callba UpdateCelebiPosition
ret ret
.anonymous_jumptable: ; 8d6c5 (23:56c5) .anonymous_jumptable: ; 8d6c5 (23:56c5)

View File

@ -24,7 +24,7 @@ PlaySpriteAnimations: ; 8cf69
push af push af
ld a, 0 * 4 ld a, 0 * 4
ld [wOAMRetentionSize], a ld [wCurrSpriteOAMAddr], a
call DoNextFrameForAllSprites call DoNextFrameForAllSprites
pop af pop af
@ -47,7 +47,7 @@ DoNextFrameForAllSprites: ; 8cf7a
push hl push hl
push de push de
call DoAnimFrame ; Uses a massive jumptable call DoAnimFrame ; Uses a massive jumptable
call Function8d04c call UpdateAnimFrame
pop de pop de
pop hl pop hl
jr c, .done jr c, .done
@ -58,11 +58,11 @@ DoNextFrameForAllSprites: ; 8cf7a
dec e dec e
jr nz, .loop jr nz, .loop
ld a, [wOAMRetentionSize] ld a, [wCurrSpriteOAMAddr]
ld l, a ld l, a
ld h, Sprites / $0100 ld h, Sprites / $0100
.loop2 ; Clear (Sprites + [wOAMRetentionSize] --> SpritesEnd) .loop2 ; Clear (Sprites + [wCurrSpriteOAMAddr] --> SpritesEnd)
ld a, l ld a, l
cp SpritesEnd % $100 cp SpritesEnd % $100
jr nc, .done jr nc, .done
@ -87,7 +87,7 @@ DoNextFrameForFirst16Sprites: ; 8cfa8 (23:4fa8)
push hl push hl
push de push de
call DoAnimFrame ; Uses a massive jumptable call DoAnimFrame ; Uses a massive jumptable
call Function8d04c call UpdateAnimFrame
pop de pop de
pop hl pop hl
jr c, .done jr c, .done
@ -98,11 +98,11 @@ DoNextFrameForFirst16Sprites: ; 8cfa8 (23:4fa8)
dec e dec e
jr nz, .loop jr nz, .loop
ld a, [wOAMRetentionSize] ld a, [wCurrSpriteOAMAddr]
ld l, a ld l, a
ld h, (Sprites + $40) / $100 ld h, (Sprites + $40) / $100
.loop2 ; Clear (Sprites + [wOAMRetentionSize] --> Sprites + $40) .loop2 ; Clear (Sprites + [wCurrSpriteOAMAddr] --> Sprites + $40)
ld a, l ld a, l
cp (Sprites + 16 * 4) % $100 cp (Sprites + 16 * 4) % $100
jr nc, .done jr nc, .done
@ -149,11 +149,11 @@ InitSpriteAnimStruct:: ; 8cfd6
inc [hl] inc [hl]
.initialized .initialized
; Get row a of Unknown_8d1c4, copy the pointer into de ; Get row a of SpriteAnimSeqData, copy the pointer into de
pop af pop af
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, Unknown_8d1c4 ld hl, SpriteAnimSeqData
rept 3 rept 3
add hl, de add hl, de
endr endr
@ -235,14 +235,14 @@ DeinitializeAllSprites: ; 8d03d (23:503d)
ret ret
Function8d04c: ; 8d04c UpdateAnimFrame: ; 8d04c
call InitSpriteAnimBuffer ; init WRAM call InitSpriteAnimBuffer ; init WRAM
call Function8d132 ; read from a memory array call GetSpriteAnimFrame ; read from a memory array
cp -3 cp -3
jr z, .done jr z, .done
cp -4 cp -4
jr z, .delete jr z, .delete
call Function8d1a2 ; OAM? call GetFrameOAMPointer
; add byte to [wCurrAnimVTile] ; add byte to [wCurrAnimVTile]
ld a, [wCurrAnimVTile] ld a, [wCurrAnimVTile]
add [hl] add [hl]
@ -253,7 +253,7 @@ Function8d04c: ; 8d04c
ld h, [hl] ld h, [hl]
ld l, a ld l, a
push bc push bc
ld a, [wOAMRetentionSize] ld a, [wCurrSpriteOAMAddr]
ld e, a ld e, a
ld d, Sprites / $100 ld d, Sprites / $100
ld a, [hli] ld a, [hli]
@ -297,13 +297,13 @@ Function8d04c: ; 8d04c
inc hl inc hl
inc de inc de
; fourth byte: attributes ; fourth byte: attributes
; [de] = Function8d0de([hl]) ; [de] = GetSpriteOAMAttr([hl])
call Function8d0de call GetSpriteOAMAttr
ld [de], a ld [de], a
inc hl inc hl
inc de inc de
ld a, e ld a, e
ld [wOAMRetentionSize], a ld [wCurrSpriteOAMAddr], a
cp SpritesEnd % $100 cp SpritesEnd % $100
jr nc, .reached_the_end jr nc, .reached_the_end
dec c dec c
@ -356,7 +356,7 @@ AddOrSubtractX: ; 8d0ce
ret ret
; 8d0de ; 8d0de
Function8d0de: ; 8d0de GetSpriteOAMAttr: ; 8d0de
ld a, [wCurrSpriteAddSubFlags] ld a, [wCurrSpriteAddSubFlags]
ld b, a ld b, a
ld a, [hl] ld a, [hl]
@ -414,8 +414,8 @@ GetSpriteAnimVTile: ; 8d109
ret ret
; 8d120 ; 8d120
Function8d120:: ; 8d120 _ReinitSpriteAnimFrame:: ; 8d120
ld hl, SPRITEANIMSTRUCT_01 ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ld hl, SPRITEANIMSTRUCT_DURATION ld hl, SPRITEANIMSTRUCT_DURATION
@ -428,7 +428,7 @@ Function8d120:: ; 8d120
; 8d132 ; 8d132
Function8d132: ; 8d132 GetSpriteAnimFrame: ; 8d132
.loop .loop
ld hl, SPRITEANIMSTRUCT_DURATION ld hl, SPRITEANIMSTRUCT_DURATION
add hl, bc add hl, bc
@ -436,7 +436,7 @@ Function8d132: ; 8d132
and a and a
jr z, .next_frame ; finished the current sequence jr z, .next_frame ; finished the current sequence
dec [hl] dec [hl]
call Function8d189 ; load pointer from Unknown_8d6e6 call GetSpriteFrameDataPointer ; load pointer from SpriteAnimFrameData
ld a, [hli] ld a, [hli]
push af push af
jr .okay jr .okay
@ -445,12 +445,12 @@ Function8d132: ; 8d132
ld hl, SPRITEANIMSTRUCT_FRAME ld hl, SPRITEANIMSTRUCT_FRAME
add hl, bc add hl, bc
inc [hl] inc [hl]
call Function8d189 ; load pointer from Unknown_8d6e6 call GetSpriteFrameDataPointer ; load pointer from SpriteAnimFrameData
ld a, [hli] ld a, [hli]
cp -2 cp -2
jr z, .minus_2 jr z, .restart
cp -1 cp -1
jr z, .minus_1 jr z, .repeat_last
push af push af
ld a, [hl] ld a, [hl]
@ -471,7 +471,7 @@ Function8d132: ; 8d132
pop af pop af
ret ret
.minus_1 .repeat_last
xor a xor a
ld hl, SPRITEANIMSTRUCT_DURATION ld hl, SPRITEANIMSTRUCT_DURATION
add hl, bc add hl, bc
@ -484,7 +484,7 @@ rept 2
endr endr
jr .loop jr .loop
.minus_2 .restart
xor a xor a
ld hl, SPRITEANIMSTRUCT_DURATION ld hl, SPRITEANIMSTRUCT_DURATION
add hl, bc add hl, bc
@ -497,15 +497,15 @@ endr
jr .loop jr .loop
; 8d189 ; 8d189
Function8d189: ; 8d189 GetSpriteFrameDataPointer: ; 8d189
; Get the data for the current frame for the current animation sequence ; Get the data for the current frame for the current animation sequence
; Unknown_8d6e6[SpriteAnim[SPRITEANIMSTRUCT_01]][SpriteAnim[SPRITEANIMSTRUCT_FRAME]] ; SpriteAnimFrameData[SpriteAnim[SPRITEANIMSTRUCT_FRAMESET_ID]][SpriteAnim[SPRITEANIMSTRUCT_FRAME]]
ld hl, SPRITEANIMSTRUCT_01 ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
ld e, [hl] ld e, [hl]
ld d, 0 ld d, 0
ld hl, Unknown_8d6e6 ld hl, SpriteAnimFrameData
rept 2 rept 2
add hl, de add hl, de
endr endr
@ -521,11 +521,11 @@ endr
ret ret
; 8d1a2 ; 8d1a2
Function8d1a2: ; 8d1a2 GetFrameOAMPointer: ; 8d1a2
; Load OAM data pointer ; Load OAM data pointer
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, Unknown_8d94d ld hl, SpriteAnimOAMData
rept 3 rept 3
add hl, de add hl, de
endr endr
@ -555,7 +555,7 @@ endr
ret ret
; 8d1c4 ; 8d1c4
Unknown_8d1c4: ; 8d1c4 SpriteAnimSeqData: ; 8d1c4
; ??, sequence, tile ; ??, sequence, tile
db $01, SPRITE_ANIM_SEQ_01, $00 ; 00 db $01, SPRITE_ANIM_SEQ_01, $00 ; 00
db $07, SPRITE_ANIM_SEQ_04, $00 ; 01 db $07, SPRITE_ANIM_SEQ_04, $00 ; 01
@ -579,7 +579,7 @@ Unknown_8d1c4: ; 8d1c4
db $19, SPRITE_ANIM_SEQ_13, $00 ; 13 db $19, SPRITE_ANIM_SEQ_13, $00 ; 13
db $1a, SPRITE_ANIM_SEQ_14, $00 ; 14 radio tuning knob db $1a, SPRITE_ANIM_SEQ_14, $00 ; 14 radio tuning knob
db $1b, SPRITE_ANIM_SEQ_00, $00 ; 15 db $1b, SPRITE_ANIM_SEQ_00, $00 ; 15
db $1d, SPRITE_ANIM_SEQ_15, $00 ; 16 db $1d, SPRITE_ANIM_SEQ_15, $00 ; 16 leaves when cutting down a tree
db $1e, SPRITE_ANIM_SEQ_00, $00 ; 17 db $1e, SPRITE_ANIM_SEQ_00, $00 ; 17
db $1d, SPRITE_ANIM_SEQ_17, $00 ; 18 flying leaves db $1d, SPRITE_ANIM_SEQ_17, $00 ; 18 flying leaves
db $1f, SPRITE_ANIM_SEQ_00, $00 ; 19 db $1f, SPRITE_ANIM_SEQ_00, $00 ; 19
@ -607,12 +607,13 @@ Unknown_8d1c4: ; 8d1c4
INCLUDE "engine/sprite_anims.asm" ; DoAnimFrame INCLUDE "engine/sprite_anims.asm" ; DoAnimFrame
INCLUDE "data/sprite_engine.asm" INCLUDE "data/sprite_engine.asm"
; Unknown_8d6e6 ; SpriteAnimFrameData
; Unknown_8d94d ; SpriteAnimOAMData
Sprites_Cosine: ; 8e72a Sprites_Cosine: ; 8e72a
add $10 add $10
Sprites_Sine: ; 8e72c Sprites_Sine: ; 8e72c
; floor(d * sin(a * pi/32))
and $3f and $3f
cp $20 cp $20
jr nc, .negative jr nc, .negative
@ -669,8 +670,8 @@ AnimateEndOfExpBar: ; 8e79d
ld hl, VTiles0 tile $00 ld hl, VTiles0 tile $00
lb bc, BANK(EndOfExpBarGFX), 1 lb bc, BANK(EndOfExpBarGFX), 1
call Request2bpp call Request2bpp
ld c, $8 ld c, 8
ld d, $0 ld d, 0
.loop .loop
push bc push bc
call .AnimateFrame call .AnimateFrame
@ -694,6 +695,7 @@ endr
ret z ret z
dec c dec c
ld a, c ld a, c
; multiply by 8
sla a sla a
sla a sla a
sla a sla a

View File

@ -8,17 +8,17 @@ Special_CelebiShrineEvent: ; 4989a
depixel 0, 10, 7, 0 depixel 0, 10, 7, 0
ld a, SPRITE_ANIM_INDEX_2C ld a, SPRITE_ANIM_INDEX_2C
call _InitSpriteAnimStruct call _InitSpriteAnimStruct
ld hl, $3 ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc add hl, bc
ld [hl], $84 ld [hl], $84
ld hl, $2 ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc add hl, bc
ld [hl], $1f ld [hl], SPRITE_ANIM_SEQ_1F
ld hl, $f ld hl, SPRITEANIMSTRUCT_0F
add hl, bc add hl, bc
ld a, $80 ld a, $80
ld [hl], a ld [hl], a
ld a, $a0 ld a, 160 ; frame count
ld [wcf64], a ld [wcf64], a
ld d, $0 ld d, $0
.loop .loop
@ -26,44 +26,47 @@ Special_CelebiShrineEvent: ; 4989a
bit 7, a bit 7, a
jr nz, .done jr nz, .done
push bc push bc
call Function49bae call GetCelebiSpriteTile
inc d inc d
push de push de
ld a, $90 ld a, $90
ld [wOAMRetentionSize], a ld [wCurrSpriteOAMAddr], a
callba DoNextFrameForAllSprites callba DoNextFrameForAllSprites
call Function49935 call CelebiEvent_CountDown
ld c, 2 ld c, 2
call DelayFrames call DelayFrames
pop de pop de
pop bc pop bc
jr .loop jr .loop
.done .done
pop af pop af
ld [VramState], a ld [VramState], a
call Function498f9 call .RefreshPlayerSprite_ClearAllOthers
call Function49bf3 call CelebiEvent_SetBattleType
ret ret
; 498f9 ; 498f9
Function498f9: ; 498f9 .RefreshPlayerSprite_ClearAllOthers: ; 498f9
ld hl, Sprites + 2 ld hl, Sprites + 2
xor a xor a
ld c, $4 ld c, $4
.loop .OAMloop
ld [hli], a ld [hli], a
rept 3 rept 3
inc hl inc hl
endr endr
inc a inc a
dec c dec c
jr nz, .loop jr nz, .OAMloop
ld hl, Sprites + $10 ld hl, Sprites + $10
ld bc, $90 ld bc, $90
xor a xor a
call ByteFill call ByteFill
ret ret
; 49912 ; 49912
LoadCelebiGFX: ; 49912 LoadCelebiGFX: ; 49912
@ -79,23 +82,27 @@ LoadCelebiGFX: ; 49912
xor a xor a
ld [wJumptableIndex], a ld [wJumptableIndex], a
ret ret
; 49935 ; 49935
Function49935: ; 49935 CelebiEvent_CountDown: ; 49935
ld hl, wcf64 ld hl, wcf64
ld a, [hl] ld a, [hl]
and a and a
jr z, .asm_4993e jr z, .done
dec [hl] dec [hl]
ret ret
.asm_4993e
.done
ld hl, wJumptableIndex ld hl, wJumptableIndex
set 7, [hl] set 7, [hl]
ret ret
; 49944 ; 49944
Function49944: ; 49944 CelebiEvent_SpawnLeaf: ; 49944
; unused
ld hl, wcf65 ld hl, wcf65
ld a, [hl] ld a, [hl]
inc [hl] inc [hl]
@ -109,10 +116,11 @@ Function49944: ; 49944
ld e, $0 ld e, $0
ld a, SPRITE_ANIM_INDEX_18 ; fly land ld a, SPRITE_ANIM_INDEX_18 ; fly land
call _InitSpriteAnimStruct call _InitSpriteAnimStruct
ld hl, $3 ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc add hl, bc
ld [hl], $80 ld [hl], $80
ret ret
; 49962 ; 49962
SpecialCelebiLeafGFX: ; 49962 SpecialCelebiLeafGFX: ; 49962
@ -124,105 +132,110 @@ INCBIN "gfx/special/celebi/3.2bpp"
INCBIN "gfx/special/celebi/4.2bpp" INCBIN "gfx/special/celebi/4.2bpp"
Function49aa2: ; 49aa2 (12:5aa2) UpdateCelebiPosition: ; 49aa2 (12:5aa2)
ld hl, $6 ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
push af push af
ld hl, $5 ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp $52 cp 8 * 10 + 2
jp nc, Function49b30 jp nc, .FreezeCelebiPosition
ld hl, $5 ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc add hl, bc
inc [hl] inc [hl]
ld hl, $f ld hl, SPRITEANIMSTRUCT_0F
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld d, a ld d, a
cp $3a cp $3a
jr c, .asm_49ac6 jr c, .skip
jr z, .asm_49ac6 jr z, .skip
sub $3 sub $3
ld [hl], a ld [hl], a
.asm_49ac6 .skip
ld hl, $e ld hl, SPRITEANIMSTRUCT_0E
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
inc [hl] inc [hl]
call CelebiEvent_Cosine call CelebiEvent_Cosine
ld hl, $6 ld hl, SPRITEANIMSTRUCT_XOFFSET
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ld d, a ld d, a
ld hl, $4 ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc add hl, bc
add [hl] add [hl]
cp $5c cp 8 * 11 + 4
jr nc, .asm_49ae2 jr nc, .ShiftY
cp $44 cp 8 * 8 + 4
jr nc, .asm_49b0d jr nc, .ReinitSpriteAnimFrame
.asm_49ae2 .ShiftY
pop af pop af
push af push af
cp d cp d
jr nc, .asm_49af2 jr nc, .moving_left
ld hl, $4 ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc add hl, bc
add [hl] add [hl]
cp $50 cp 8 * 10
jr c, .asm_49b05 jr c, .float_up
jr .asm_49afb jr .float_down
.asm_49af2
ld hl, $4 .moving_left
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc add hl, bc
add [hl] add [hl]
cp $50 cp 8 * 10
jr nc, .asm_49b05 jr nc, .float_up
.asm_49afb .float_down
ld hl, $5 ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
sub $2 sub $2
ld [hl], a ld [hl], a
jr .asm_49b0d jr .ReinitSpriteAnimFrame
.asm_49b05
ld hl, $5 .float_up
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
add $1 add $1
ld [hl], a ld [hl], a
.asm_49b0d .ReinitSpriteAnimFrame
pop af pop af
ld hl, $4 ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc add hl, bc
add [hl] add [hl]
cp $50 cp 8 * 10
jr c, .asm_49b26 jr c, .left
cp $e6 cp -(8 * 3 + 2)
jr nc, .asm_49b26 jr nc, .left
ld hl, $1 ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
ld a, $41 ld a, $41
call Function3b3c call ReinitSpriteAnimFrame
jr .asm_49b2f jr .done
.asm_49b26
ld hl, $1 .left
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
ld a, $40 ld a, $40
call Function3b3c call ReinitSpriteAnimFrame
.asm_49b2f .done
ret ret
Function49b30: ; 49b30 (12:5b30)
.FreezeCelebiPosition: ; 49b30 (12:5b30)
pop af pop af
ld hl, $1 ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
ld a, $40 ld a, $40
call Function3b3c call ReinitSpriteAnimFrame
ret ret
CelebiEvent_Cosine: ; 49b3b (12:5b3b) CelebiEvent_Cosine: ; 49b3b (12:5b3b)
add $10 add $10
and $3f and $3f
@ -231,6 +244,7 @@ CelebiEvent_Cosine: ; 49b3b (12:5b3b)
call .SineFunction call .SineFunction
ld a, h ld a, h
ret ret
.asm_49b48 .asm_49b48
and $1f and $1f
call .SineFunction call .SineFunction
@ -239,6 +253,7 @@ CelebiEvent_Cosine: ; 49b3b (12:5b3b)
inc a inc a
ret ret
.SineFunction: ; 49b52 (12:5b52) .SineFunction: ; 49b52 (12:5b52)
ld e, a ld e, a
ld a, d ld a, d
@ -261,13 +276,14 @@ endr
and a and a
jr nz, .multiply jr nz, .multiply
ret ret
; 49b6e (12:5b6e) ; 49b6e (12:5b6e)
.sinewave: ; 49b6e .sinewave: ; 49b6e
sine_wave $100 sine_wave $100
; 49bae ; 49bae
Function49bae: ; 49bae GetCelebiSpriteTile: ; 49bae
push hl push hl
push bc push bc
push de push de
@ -275,66 +291,74 @@ Function49bae: ; 49bae
ld d, $3 ld d, $3
ld e, d ld e, d
cp $0 cp $0
jr z, .asm_49bd0 jr z, .Frame1
cp d cp d
jr z, .asm_49bd4 jr z, .Frame2
call Function49bed call .AddE
cp d cp d
jr z, .asm_49bd8 jr z, .Frame3
call Function49bed call .AddE
cp d cp d
jr z, .asm_49bdc jr z, .Frame4
call Function49bed call .AddE
cp d cp d
jr c, .asm_49be9 jr c, .done
jr .asm_49be5 jr .restart
.asm_49bd0
.Frame1
ld a, $84 ld a, $84
jr .asm_49bde jr .load_tile
.asm_49bd4
.Frame2
ld a, $88 ld a, $88
jr .asm_49bde jr .load_tile
.asm_49bd8
.Frame3
ld a, $8c ld a, $8c
jr .asm_49bde jr .load_tile
.asm_49bdc
.Frame4
ld a, $90 ld a, $90
.asm_49bde .load_tile
ld hl, $3 ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc add hl, bc
ld [hl], a ld [hl], a
jr .asm_49be9 jr .done
.asm_49be5
.restart
pop de pop de
ld d, $ff ld d, $ff
push de push de
.asm_49be9 .done
pop de pop de
pop bc pop bc
pop hl pop hl
ret ret
; 49bed ; 49bed
Function49bed: ; 49bed .AddE: ; 49bed
push af push af
ld a, d ld a, d
add e add e
ld d, a ld d, a
pop af pop af
ret ret
; 49bf3 ; 49bf3
Function49bf3: ; 49bf3 CelebiEvent_SetBattleType: ; 49bf3
ld a, BATTLETYPE_CELEBI ld a, BATTLETYPE_CELEBI
ld [BattleType], a ld [BattleType], a
ret ret
; 49bf9 ; 49bf9
CheckCaughtCelebi: ; 49bf9 CheckCaughtCelebi: ; 49bf9
@ -345,10 +369,12 @@ CheckCaughtCelebi: ; 49bf9
ld [ScriptVar], a ld [ScriptVar], a
jr .done jr .done
.false .false
xor a xor a
ld [ScriptVar], a ld [ScriptVar], a
.done .done
ret ret
; 49c0c ; 49c0c

View File

@ -36,7 +36,7 @@ ShakeHeadbuttTree: ; 8c80a
add hl, bc add hl, bc
ld [hl], $84 ld [hl], $84
ld a, 36 * 4 ld a, 36 * 4
ld [wOAMRetentionSize], a ld [wCurrSpriteOAMAddr], a
callba DoNextFrameForAllSprites callba DoNextFrameForAllSprites
call GetHeadbuttTreeRelativeLocation call GetHeadbuttTreeRelativeLocation
ld a, $20 ld a, $20
@ -51,7 +51,7 @@ ShakeHeadbuttTree: ; 8c80a
jr z, .done jr z, .done
dec [hl] dec [hl]
ld a, 36 * 4 ld a, 36 * 4
ld [wOAMRetentionSize], a ld [wCurrSpriteOAMAddr], a
callba DoNextFrameForAllSprites callba DoNextFrameForAllSprites
call DelayFrame call DelayFrame
jr .loop jr .loop
@ -125,7 +125,7 @@ OWCutAnimation: ; 8c940
bit 7, a bit 7, a
jr nz, .finish jr nz, .finish
ld a, 36 * 4 ld a, 36 * 4
ld [wOAMRetentionSize], a ld [wCurrSpriteOAMAddr], a
callab DoNextFrameForAllSprites callab DoNextFrameForAllSprites
call OWCutJumptable call OWCutJumptable
call DelayFrame call DelayFrame
@ -342,7 +342,7 @@ FlyFromAnim: ; 8caed
bit 7, a bit 7, a
jr nz, .exit jr nz, .exit
ld a, 0 * 4 ld a, 0 * 4
ld [wOAMRetentionSize], a ld [wCurrSpriteOAMAddr], a
callab DoNextFrameForAllSprites callab DoNextFrameForAllSprites
call Function8cbc8 call Function8cbc8
call DelayFrame call DelayFrame
@ -380,7 +380,7 @@ FlyToAnim: ; 8cb33
bit 7, a bit 7, a
jr nz, .exit jr nz, .exit
ld a, 0 * 4 ld a, 0 * 4
ld [wOAMRetentionSize], a ld [wCurrSpriteOAMAddr], a
callab DoNextFrameForAllSprites callab DoNextFrameForAllSprites
call Function8cbc8 call Function8cbc8
call DelayFrame call DelayFrame

View File

@ -2036,17 +2036,17 @@ _InitSpriteAnimStruct:: ; 3b2a
; 3b3c ; 3b3c
Function3b3c:: ; 3b3c ReinitSpriteAnimFrame:: ; 3b3c
ld [wSpriteAnimIDBuffer], a ld [wSpriteAnimIDBuffer], a
ld a, [hROMBank] ld a, [hROMBank]
push af push af
ld a, BANK(Function8d120) ld a, BANK(_ReinitSpriteAnimFrame)
rst Bankswitch rst Bankswitch
ld a, [wSpriteAnimIDBuffer] ld a, [wSpriteAnimIDBuffer]
call Function8d120 call _ReinitSpriteAnimFrame
pop af pop af
rst Bankswitch rst Bankswitch

View File

@ -2478,7 +2478,7 @@ Function11d0f5: ; 11d0f5 (47:50f5)
ld d, $0 ld d, $0
add hl, de add hl, de
ld a, [hl] ld a, [hl]
call Function3b3c call ReinitSpriteAnimFrame
ld a, [CreditsTimer] ld a, [CreditsTimer]
sla a sla a
ld hl, Unknown_11d23e ld hl, Unknown_11d23e
@ -2487,7 +2487,7 @@ Function11d0f5: ; 11d0f5 (47:50f5)
Function11d10f: ; 11d10f (47:510f) Function11d10f: ; 11d10f (47:510f)
ld a, $27 ld a, $27
call Function3b3c call ReinitSpriteAnimFrame
ld a, [wcd25] ld a, [wcd25]
sla a sla a
ld hl, Unknown_11d29e ld hl, Unknown_11d29e
@ -2514,7 +2514,7 @@ asm_11d11e: ; 11d11e (47:511e)
Function11d134: ; 11d134 (47:5134) Function11d134: ; 11d134 (47:5134)
ld a, $27 ld a, $27
call Function3b3c call ReinitSpriteAnimFrame
ld a, [wcd2a] ld a, [wcd2a]
sla a sla a
ld hl, Unknown_11d2b6 ld hl, Unknown_11d2b6
@ -2523,7 +2523,7 @@ Function11d134: ; 11d134 (47:5134)
Function11d145: ; 11d145 (47:5145) Function11d145: ; 11d145 (47:5145)
ld a, $27 ld a, $27
call Function3b3c call ReinitSpriteAnimFrame
ld a, [wcd2c] ld a, [wcd2c]
sla a sla a
ld hl, Unknown_11d2ba ld hl, Unknown_11d2ba
@ -2532,7 +2532,7 @@ Function11d145: ; 11d145 (47:5145)
Function11d156: ; 11d156 (47:5156) Function11d156: ; 11d156 (47:5156)
ld a, $2a ld a, $2a
call Function3b3c call ReinitSpriteAnimFrame
ld a, [wcd4a] ld a, [wcd4a]
sla a sla a
sla a sla a
@ -2557,7 +2557,7 @@ Function11d175: ; 11d175 (47:5175)
.asm_11d180 .asm_11d180
ld a, $26 ld a, $26
.asm_11d182 .asm_11d182
call Function3b3c call ReinitSpriteAnimFrame
ld a, [wcd4d] ld a, [wcd4d]
cp $4 cp $4
jr z, .asm_11d1b1 jr z, .asm_11d1b1
@ -2611,7 +2611,7 @@ Function11d1d7: ; 11d1d7 (47:51d7)
asm_11d1db: ; 11d1db (47:51db) asm_11d1db: ; 11d1db (47:51db)
push de push de
call Function3b3c call ReinitSpriteAnimFrame
ld a, [wcd4a] ld a, [wcd4a]
sla a sla a
sla a sla a
@ -2632,7 +2632,7 @@ asm_11d1db: ; 11d1db (47:51db)
Function11d1fc: ; 11d1fc (47:51fc) Function11d1fc: ; 11d1fc (47:51fc)
ld a, $26 ld a, $26
call Function3b3c call ReinitSpriteAnimFrame
ld a, $8 ld a, $8
ld e, a ld e, a
call Function11d2ee call Function11d2ee

View File

@ -5885,7 +5885,7 @@ Function11ac51: ; 11ac51
call Function11acb7 call Function11acb7
call Function11ad6e call Function11ad6e
ld a, 30 * 4 ld a, 30 * 4
ld [wOAMRetentionSize], a ld [wCurrSpriteOAMAddr], a
callba DoNextFrameForAllSprites callba DoNextFrameForAllSprites
callba ReloadMapPart callba ReloadMapPart
jr .asm_11ac82 jr .asm_11ac82

View File

@ -395,7 +395,7 @@ TilePermissions:: ; c2fe
SECTION "wSpriteAnims", WRAM0 [$c300] SECTION "wSpriteAnims", WRAM0 [$c300]
; wc300 - wc313 is a 10x2 dictionary. ; wc300 - wc313 is a 10x2 dictionary.
; keys: taken from third column of Unknown_8d1c4 ; keys: taken from third column of SpriteAnimSeqData
; values: VTiles ; values: VTiles
wSpriteAnimDict:: ds 10 * 2 wSpriteAnimDict:: ds 10 * 2
ds wSpriteAnimDict - @ ds wSpriteAnimDict - @
@ -429,8 +429,8 @@ sprite_anim_struct: MACRO
\1YCoord:: ds 1 ; 5 \1YCoord:: ds 1 ; 5
\1XOffset:: ds 1 ; 6 \1XOffset:: ds 1 ; 6
\1YOffset:: ds 1 ; 7 \1YOffset:: ds 1 ; 7
\1FrameTimer:: ds 1 ; 8 \1Duration:: ds 1 ; 8
\1Sprite09:: ds 1 ; 9 \1DurationOffset:: ds 1 ; 9
\1FrameIndex:: ds 1 ; a \1FrameIndex:: ds 1 ; a
\1Sprite0b:: ds 1 \1Sprite0b:: ds 1
\1Sprite0c:: ds 1 \1Sprite0c:: ds 1
@ -440,7 +440,7 @@ sprite_anim_struct: MACRO
ENDM ENDM
; Field 0: Index ; Field 0: Index
; Fields 1-3: Loaded from Unknown_8d1c4 ; Fields 1-3: Loaded from SpriteAnimSeqData
wc314:: wc314::
SpriteAnim1:: sprite_anim_struct SpriteAnim1 SpriteAnim1:: sprite_anim_struct SpriteAnim1
wc324:: wc324::
@ -466,7 +466,7 @@ wSpriteAnimationStructsEnd::
wc3ac:: ds 8 ; c3ac wc3ac:: ds 8 ; c3ac
wSpriteAnimCount:: wSpriteAnimCount::
wc3b4:: ds 1 wc3b4:: ds 1
wOAMRetentionSize:: ds 1 wCurrSpriteOAMAddr:: ds 1
CurIcon:: ; c3b6 CurIcon:: ; c3b6
ds 1 ds 1