2015-11-17 02:46:36 +00:00
|
|
|
PlayWhirlpoolSound: ; 8c7d4
|
|
|
|
call WaitSFX
|
|
|
|
ld de, SFX_SURF
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
ret
|
|
|
|
; 8c7e1
|
|
|
|
|
|
|
|
BlindingFlash: ; 8c7e1
|
2015-11-27 02:05:32 +00:00
|
|
|
callba FadeOutPalettes
|
2015-11-17 02:46:36 +00:00
|
|
|
ld hl, StatusFlags
|
|
|
|
set 2, [hl]
|
|
|
|
callba Function8c0e5
|
|
|
|
callba Function8c001
|
|
|
|
ld b, SCGB_09
|
|
|
|
call GetSGBLayout
|
|
|
|
callba Function49409
|
2015-11-27 02:05:32 +00:00
|
|
|
callba FadeInPalettes
|
2015-11-17 02:46:36 +00:00
|
|
|
ret
|
|
|
|
; 8c80a
|
|
|
|
|
|
|
|
ShakeHeadbuttTree: ; 8c80a
|
|
|
|
callba Function8cf53
|
|
|
|
ld de, CutGrassGFX
|
|
|
|
ld hl, VTiles1
|
|
|
|
lb bc, BANK(CutGrassGFX), 4
|
|
|
|
call Request2bpp
|
|
|
|
ld de, HeadbuttTreeGFX
|
|
|
|
ld hl, VTiles1 tile $04
|
|
|
|
lb bc, BANK(HeadbuttTreeGFX), 8
|
|
|
|
call Request2bpp
|
2015-12-01 20:35:28 +00:00
|
|
|
call Cut_Headbutt_GetPixelFacing
|
2015-11-17 02:46:36 +00:00
|
|
|
ld a, SPRITE_ANIM_INDEX_1B
|
|
|
|
call _InitSpriteAnimStruct
|
|
|
|
ld hl, $3
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $84
|
|
|
|
ld a, $90
|
|
|
|
ld [wc3b5], a
|
2015-12-01 20:35:28 +00:00
|
|
|
callba DoNextFrameForAllSprites
|
2015-11-17 02:46:36 +00:00
|
|
|
call GetHeadbuttTreeRelativeLocation
|
|
|
|
ld a, $20
|
|
|
|
ld [wcf64], a
|
|
|
|
call WaitSFX
|
|
|
|
ld de, SFX_SANDSTORM
|
|
|
|
call PlaySFX
|
|
|
|
.loop
|
|
|
|
ld hl, wcf64
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .done
|
|
|
|
dec [hl]
|
|
|
|
ld a, $90
|
|
|
|
ld [wc3b5], a
|
2015-12-01 20:35:28 +00:00
|
|
|
callba DoNextFrameForAllSprites
|
2015-11-17 02:46:36 +00:00
|
|
|
call DelayFrame
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.done
|
|
|
|
call OverworldTextModeSwitch
|
|
|
|
call WaitBGMap
|
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
callba Function8cf53
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, Sprites + 36 * 4
|
|
|
|
ld bc, SpritesEnd - (Sprites + 36 * 4)
|
2015-11-17 02:46:36 +00:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
ld de, Font
|
|
|
|
ld hl, VTiles1
|
|
|
|
lb bc, BANK(Font), $c
|
|
|
|
call Get1bpp
|
|
|
|
call ReplaceKrisSprite
|
|
|
|
ret
|
|
|
|
; 8c893
|
|
|
|
|
|
|
|
HeadbuttTreeGFX: ; 8c893
|
|
|
|
INCBIN "gfx/unknown/08c893.2bpp"
|
|
|
|
; 8c913
|
|
|
|
|
|
|
|
GetHeadbuttTreeRelativeLocation: ; 8c913
|
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
ld a, [PlayerDirection]
|
|
|
|
and %00001100
|
|
|
|
srl a
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
ld hl, TreeRelativeLocationTable
|
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
|
|
|
|
ld a, $5
|
|
|
|
ld [hli], a
|
|
|
|
ld [hld], a
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld [hli], a
|
|
|
|
ld [hld], a
|
|
|
|
call WaitBGMap
|
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
ret
|
|
|
|
; 8c938
|
|
|
|
|
|
|
|
TreeRelativeLocationTable: ; 8c938
|
|
|
|
dwcoord 8, 8 + 2 ; RIGHT
|
|
|
|
dwcoord 8, 8 - 2 ; LEFT
|
|
|
|
dwcoord 8 - 2, 8 ; DOWN
|
|
|
|
dwcoord 8 + 2, 8 ; UP
|
|
|
|
; 8c940
|
|
|
|
|
|
|
|
OWCutAnimation: ; 8c940
|
|
|
|
ld a, e
|
|
|
|
and $1
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
call .LoadCutGFX
|
|
|
|
call WaitSFX
|
|
|
|
ld de, SFX_PLACE_PUZZLE_PIECE_DOWN
|
|
|
|
call PlaySFX
|
|
|
|
.loop
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
|
|
|
jr nz, .finish
|
|
|
|
ld a, $90
|
|
|
|
ld [wc3b5], a
|
2015-12-01 20:35:28 +00:00
|
|
|
callab DoNextFrameForAllSprites
|
2015-11-17 02:46:36 +00:00
|
|
|
call OWCutJumptable
|
|
|
|
call DelayFrame
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.finish
|
|
|
|
ret
|
|
|
|
; 8c96d
|
|
|
|
|
|
|
|
.LoadCutGFX: ; 8c96d
|
|
|
|
callab Function8cf53 ; pointless to farcall
|
|
|
|
ld de, CutGrassGFX
|
|
|
|
ld hl, VTiles1
|
|
|
|
lb bc, BANK(CutGrassGFX), 4
|
|
|
|
call Request2bpp
|
|
|
|
ld de, CutTreeGFX
|
|
|
|
ld hl, VTiles1 tile $4
|
|
|
|
lb bc, BANK(CutTreeGFX), 4
|
|
|
|
call Request2bpp
|
|
|
|
ret
|
|
|
|
; 8c98c
|
|
|
|
|
|
|
|
CutTreeGFX: ; c898c
|
|
|
|
INCBIN "gfx/misc/cut_tree.2bpp"
|
|
|
|
; c89cc
|
|
|
|
|
|
|
|
CutGrassGFX: ; 8c9cc
|
|
|
|
INCBIN "gfx/misc/cut_grass.2bpp"
|
|
|
|
; 8ca0c
|
|
|
|
|
|
|
|
OWCutJumptable: ; 8ca0c
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
ld hl, .jumptable
|
|
|
|
rept 2
|
|
|
|
add hl, de
|
|
|
|
endr
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
jp [hl]
|
|
|
|
; 8ca1b
|
|
|
|
|
|
|
|
|
|
|
|
.jumptable: ; 8ca1b (23:4a1b)
|
2015-12-01 20:35:28 +00:00
|
|
|
dw Cut_SpawnAnimateTree
|
|
|
|
dw Cut_SpawnAnimateLeaves
|
|
|
|
dw Cut_StartWaiting
|
|
|
|
dw Cut_WaitAnimSFX
|
2015-11-17 02:46:36 +00:00
|
|
|
|
|
|
|
|
2015-12-01 20:35:28 +00:00
|
|
|
Cut_SpawnAnimateTree: ; 8ca23 (23:4a23)
|
|
|
|
call Cut_Headbutt_GetPixelFacing
|
|
|
|
ld a, SPRITE_ANIM_INDEX_CUT_TREE ; cut tree
|
2015-11-17 02:46:36 +00:00
|
|
|
call _InitSpriteAnimStruct
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_TILE_ID
|
2015-11-17 02:46:36 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $84
|
2015-12-01 20:35:28 +00:00
|
|
|
ld a, 32
|
2015-11-17 02:46:36 +00:00
|
|
|
ld [wcf64], a
|
2015-12-01 20:35:28 +00:00
|
|
|
; Cut_StartWaiting
|
2015-11-17 02:46:36 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
rept 2
|
|
|
|
inc [hl]
|
|
|
|
endr
|
|
|
|
ret
|
|
|
|
|
2015-12-01 20:35:28 +00:00
|
|
|
Cut_SpawnAnimateLeaves: ; 8ca3c (23:4a3c)
|
|
|
|
call Cut_GetLeafSpawnCoords
|
2015-11-17 02:46:36 +00:00
|
|
|
xor a
|
2015-12-01 20:35:28 +00:00
|
|
|
call Cut_SpawnLeaf
|
2015-11-17 02:46:36 +00:00
|
|
|
ld a, $10
|
2015-12-01 20:35:28 +00:00
|
|
|
call Cut_SpawnLeaf
|
2015-11-17 02:46:36 +00:00
|
|
|
ld a, $20
|
2015-12-01 20:35:28 +00:00
|
|
|
call Cut_SpawnLeaf
|
2015-11-17 02:46:36 +00:00
|
|
|
ld a, $30
|
2015-12-01 20:35:28 +00:00
|
|
|
call Cut_SpawnLeaf
|
|
|
|
ld a, 32 ; frames
|
2015-11-17 02:46:36 +00:00
|
|
|
ld [wcf64], a
|
2015-12-01 20:35:28 +00:00
|
|
|
; Cut_StartWaiting
|
2015-11-17 02:46:36 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-01 20:35:28 +00:00
|
|
|
Cut_StartWaiting: ; 8ca5c (23:4a5c)
|
2015-11-17 02:46:36 +00:00
|
|
|
ld a, $1
|
|
|
|
ld [hBGMapMode], a
|
2015-12-01 20:35:28 +00:00
|
|
|
; Cut_WaitAnimSFX
|
2015-11-17 02:46:36 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
inc [hl]
|
|
|
|
|
2015-12-01 20:35:28 +00:00
|
|
|
Cut_WaitAnimSFX: ; 8ca64 (23:4a64)
|
2015-11-17 02:46:36 +00:00
|
|
|
ld hl, wcf64
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
2015-12-01 20:35:28 +00:00
|
|
|
jr z, .finished
|
2015-11-17 02:46:36 +00:00
|
|
|
dec [hl]
|
|
|
|
ret
|
2015-12-01 20:35:28 +00:00
|
|
|
|
|
|
|
.finished
|
2015-11-17 02:46:36 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
set 7, [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-01 20:35:28 +00:00
|
|
|
Cut_SpawnLeaf: ; 8ca73 (23:4a73)
|
2015-11-17 02:46:36 +00:00
|
|
|
push de
|
|
|
|
push af
|
2015-12-01 20:35:28 +00:00
|
|
|
ld a, SPRITE_ANIM_INDEX_LEAF ; leaf
|
2015-11-17 02:46:36 +00:00
|
|
|
call _InitSpriteAnimStruct
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_TILE_ID
|
2015-11-17 02:46:36 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $80
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0E
|
2015-11-17 02:46:36 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], $4
|
|
|
|
pop af
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0C
|
2015-11-17 02:46:36 +00:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2015-12-01 20:35:28 +00:00
|
|
|
Cut_GetLeafSpawnCoords: ; 8ca8e (23:4a8e)
|
2015-11-17 02:46:36 +00:00
|
|
|
ld de, 0
|
2015-12-01 20:35:28 +00:00
|
|
|
ld a, [wMetatileStandingX]
|
2015-11-17 02:46:36 +00:00
|
|
|
bit 0, a
|
2015-12-01 20:35:28 +00:00
|
|
|
jr z, .left_side
|
2015-11-17 02:46:36 +00:00
|
|
|
set 0, e
|
2015-12-01 20:35:28 +00:00
|
|
|
.left_side
|
|
|
|
ld a, [wMetatileStandingY]
|
2015-11-17 02:46:36 +00:00
|
|
|
bit 0, a
|
2015-12-01 20:35:28 +00:00
|
|
|
jr z, .top_side
|
2015-11-17 02:46:36 +00:00
|
|
|
set 1, e
|
2015-12-01 20:35:28 +00:00
|
|
|
.top_side
|
2015-11-17 02:46:36 +00:00
|
|
|
ld a, [PlayerDirection]
|
2015-12-01 20:35:28 +00:00
|
|
|
and %00001100
|
2015-11-17 02:46:36 +00:00
|
|
|
add e
|
|
|
|
ld e, a
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, .Coords
|
2015-11-17 02:46:36 +00:00
|
|
|
rept 2
|
|
|
|
add hl, de
|
|
|
|
endr
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
ret
|
|
|
|
; 8cab3 (23:4ab3)
|
|
|
|
|
2015-12-01 20:35:28 +00:00
|
|
|
.Coords: ; 8cab3
|
|
|
|
dbpixel 11, 12 ; facing down, top left
|
|
|
|
dbpixel 9, 12 ; facing down, top right
|
|
|
|
dbpixel 11, 14 ; facing down, bottom left
|
|
|
|
dbpixel 9, 14 ; facing down, bottom right
|
|
|
|
|
|
|
|
dbpixel 11, 8 ; facing up, top left
|
|
|
|
dbpixel 9, 8 ; facing up, top right
|
|
|
|
dbpixel 11, 10 ; facing up, bottom left
|
|
|
|
dbpixel 9, 10 ; facing up, bottom right
|
|
|
|
|
|
|
|
dbpixel 7, 12 ; facing left, top left
|
|
|
|
dbpixel 9, 12 ; facing left, top right
|
|
|
|
dbpixel 7, 10 ; facing left, bottom left
|
|
|
|
dbpixel 9, 10 ; facing left, bottom right
|
|
|
|
|
|
|
|
dbpixel 11, 12 ; facing right, top left
|
|
|
|
dbpixel 13, 12 ; facing right, top right
|
|
|
|
dbpixel 11, 10 ; facing right, bottom left
|
|
|
|
dbpixel 13, 10 ; facing right, bottom right
|
2015-11-17 02:46:36 +00:00
|
|
|
; 8cad3
|
|
|
|
|
2015-12-01 20:35:28 +00:00
|
|
|
Cut_Headbutt_GetPixelFacing: ; 8cad3 (23:4ad3)
|
2015-11-17 02:46:36 +00:00
|
|
|
ld a, [PlayerDirection]
|
2015-12-01 20:35:28 +00:00
|
|
|
and %00001100
|
2015-11-17 02:46:36 +00:00
|
|
|
srl a
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, .Coords
|
2015-11-17 02:46:36 +00:00
|
|
|
add hl, de
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
ret
|
|
|
|
; 8cae5 (23:4ae5)
|
|
|
|
|
2015-12-01 20:35:28 +00:00
|
|
|
.Coords: ; 8cae5
|
|
|
|
dbpixel 10, 13
|
|
|
|
dbpixel 10, 9
|
|
|
|
dbpixel 8, 11
|
|
|
|
dbpixel 12, 11
|
2015-11-17 02:46:36 +00:00
|
|
|
; 8caed
|
2015-12-01 20:35:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
FlyFromAnim: ; 8caed
|
|
|
|
call DelayFrame
|
|
|
|
ld a, [VramState]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [VramState], a
|
|
|
|
call Function8cb9b
|
|
|
|
depixel 10, 10, 4, 0
|
|
|
|
ld a, SPRITE_ANIM_INDEX_0A
|
|
|
|
call _InitSpriteAnimStruct
|
|
|
|
ld hl, SPRITEANIMSTRUCT_TILE_ID
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $84
|
|
|
|
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $16
|
|
|
|
ld a, $80
|
|
|
|
ld [wcf64], a
|
|
|
|
.loop
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
|
|
|
jr nz, .exit
|
|
|
|
ld a, $0
|
|
|
|
ld [wc3b5], a
|
|
|
|
callab DoNextFrameForAllSprites
|
|
|
|
call Function8cbc8
|
|
|
|
call DelayFrame
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.exit
|
|
|
|
pop af
|
|
|
|
ld [VramState], a
|
|
|
|
ret
|
|
|
|
; 8cb33
|
|
|
|
|
|
|
|
FlyToAnim: ; 8cb33
|
|
|
|
call DelayFrame
|
|
|
|
ld a, [VramState]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [VramState], a
|
|
|
|
call Function8cb9b
|
|
|
|
depixel 31, 10, 4, 0
|
|
|
|
ld a, SPRITE_ANIM_INDEX_0A
|
|
|
|
call _InitSpriteAnimStruct
|
|
|
|
ld hl, SPRITEANIMSTRUCT_TILE_ID
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $84
|
|
|
|
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $18
|
|
|
|
ld hl, SPRITEANIMSTRUCT_0F
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $58
|
|
|
|
ld a, $40
|
|
|
|
ld [wcf64], a
|
|
|
|
.loop
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
|
|
|
jr nz, .exit
|
|
|
|
ld a, $0
|
|
|
|
ld [wc3b5], a
|
|
|
|
callab DoNextFrameForAllSprites
|
|
|
|
call Function8cbc8
|
|
|
|
call DelayFrame
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.exit
|
|
|
|
pop af
|
|
|
|
ld [VramState], a
|
|
|
|
call Function8cb82
|
|
|
|
ret
|
|
|
|
|
|
|
|
Function8cb82: ; 8cb82 (23:4b82)
|
|
|
|
ld hl, Sprites + 2 ; Tile ID
|
|
|
|
xor a
|
|
|
|
ld c, $4
|
|
|
|
.loop
|
|
|
|
ld [hli], a
|
|
|
|
rept 3
|
|
|
|
inc hl
|
|
|
|
endr
|
|
|
|
inc a
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
ld hl, Sprites + 4 * 4
|
|
|
|
ld bc, SpritesEnd - (Sprites + 4 * 4)
|
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
|
|
|
|
Function8cb9b: ; 8cb9b (23:4b9b)
|
|
|
|
callab Function8cf53
|
|
|
|
ld de, CutGrassGFX
|
|
|
|
ld hl, VTiles1 tile $00
|
|
|
|
lb bc, BANK(CutGrassGFX), 4
|
|
|
|
call Request2bpp
|
|
|
|
ld a, [CurPartyMon]
|
|
|
|
ld hl, PartySpecies
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wd265], a
|
|
|
|
ld e, $84
|
|
|
|
callba Function8e9bc
|
|
|
|
xor a
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
Function8cbc8: ; 8cbc8 (23:4bc8)
|
|
|
|
call Function8cbe6
|
|
|
|
ld hl, wcf64
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .exit
|
|
|
|
dec [hl]
|
|
|
|
cp $40
|
|
|
|
ret c
|
|
|
|
and $7
|
|
|
|
ret nz
|
|
|
|
ld de, SFX_FLY
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
|
|
|
.exit
|
|
|
|
ld hl, wJumptableIndex
|
|
|
|
set 7, [hl]
|
|
|
|
ret
|
|
|
|
|
|
|
|
Function8cbe6: ; 8cbe6 (23:4be6)
|
|
|
|
ld hl, wcf65
|
|
|
|
ld a, [hl]
|
|
|
|
inc [hl]
|
|
|
|
and $7
|
|
|
|
ret nz
|
|
|
|
ld a, [hl]
|
|
|
|
and $18
|
|
|
|
sla a
|
|
|
|
add $40
|
|
|
|
ld d, a
|
|
|
|
ld e, $0
|
|
|
|
ld a, SPRITE_ANIM_INDEX_18 ; fly land
|
|
|
|
call _InitSpriteAnimStruct
|
|
|
|
ld hl, SPRITEANIMSTRUCT_TILE_ID
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $80
|
|
|
|
ret
|