2018-07-15 15:58:01 +00:00
|
|
|
FIELDMOVE_GRASS EQU $80
|
|
|
|
FIELDMOVE_TREE EQU $84
|
|
|
|
FIELDMOVE_FLY EQU $84
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
PlayWhirlpoolSound:
|
2015-11-17 02:46:36 +00:00
|
|
|
call WaitSFX
|
|
|
|
ld de, SFX_SURF
|
|
|
|
call PlaySFX
|
|
|
|
call WaitSFX
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
BlindingFlash:
|
2018-01-24 16:17:05 +00:00
|
|
|
farcall FadeOutPalettes
|
2017-12-28 12:15:46 +00:00
|
|
|
ld hl, wStatusFlags
|
2018-01-22 20:40:43 +00:00
|
|
|
set STATUSFLAGS_FLASH_F, [hl]
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ReplaceTimeOfDayPals
|
|
|
|
farcall UpdateTimeOfDayPal
|
2015-12-22 23:03:00 +00:00
|
|
|
ld b, SCGB_MAPPALS
|
2015-11-17 02:46:36 +00:00
|
|
|
call GetSGBLayout
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall LoadOW_BGPal7
|
2018-01-24 16:17:05 +00:00
|
|
|
farcall FadeInPalettes
|
2015-11-17 02:46:36 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ShakeHeadbuttTree:
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ClearSpriteAnims
|
2015-11-17 02:46:36 +00:00
|
|
|
ld de, CutGrassGFX
|
2018-07-15 15:58:01 +00:00
|
|
|
ld hl, vTiles0 tile FIELDMOVE_GRASS
|
2015-11-17 02:46:36 +00:00
|
|
|
lb bc, BANK(CutGrassGFX), 4
|
|
|
|
call Request2bpp
|
|
|
|
ld de, HeadbuttTreeGFX
|
2018-07-15 15:58:01 +00:00
|
|
|
ld hl, vTiles0 tile FIELDMOVE_TREE
|
2015-11-17 02:46:36 +00:00
|
|
|
lb bc, BANK(HeadbuttTreeGFX), 8
|
|
|
|
call Request2bpp
|
2015-12-01 20:35:28 +00:00
|
|
|
call Cut_Headbutt_GetPixelFacing
|
2017-12-09 05:50:59 +00:00
|
|
|
ld a, SPRITE_ANIM_INDEX_HEADBUTT
|
2020-02-11 12:42:36 +00:00
|
|
|
call InitSpriteAnimStruct
|
2015-12-14 16:12:18 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_TILE_ID
|
2015-11-17 02:46:36 +00:00
|
|
|
add hl, bc
|
2018-07-15 15:58:01 +00:00
|
|
|
ld [hl], FIELDMOVE_TREE
|
|
|
|
ld a, 36 * SPRITEOAMSTRUCT_LENGTH
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurSpriteOAMAddr], a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall DoNextFrameForAllSprites
|
2015-12-14 16:12:18 +00:00
|
|
|
call HideHeadbuttTree
|
2018-01-11 20:36:11 +00:00
|
|
|
ld a, 32
|
|
|
|
ld [wFrameCounter], a
|
2015-11-17 02:46:36 +00:00
|
|
|
call WaitSFX
|
|
|
|
ld de, SFX_SANDSTORM
|
|
|
|
call PlaySFX
|
|
|
|
.loop
|
2018-01-11 20:36:11 +00:00
|
|
|
ld hl, wFrameCounter
|
2015-11-17 02:46:36 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .done
|
|
|
|
dec [hl]
|
2018-07-15 15:58:01 +00:00
|
|
|
ld a, 36 * SPRITEOAMSTRUCT_LENGTH
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurSpriteOAMAddr], a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall DoNextFrameForAllSprites
|
2015-11-17 02:46:36 +00:00
|
|
|
call DelayFrame
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.done
|
|
|
|
call OverworldTextModeSwitch
|
|
|
|
call WaitBGMap
|
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ClearSpriteAnims
|
2018-01-30 19:52:46 +00:00
|
|
|
ld hl, wVirtualOAMSprite36
|
2018-01-30 19:55:20 +00:00
|
|
|
ld bc, wVirtualOAMEnd - wVirtualOAMSprite36
|
2015-11-17 02:46:36 +00:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
ld de, Font
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles1
|
2015-12-02 18:24:18 +00:00
|
|
|
lb bc, BANK(Font), 12
|
2015-11-17 02:46:36 +00:00
|
|
|
call Get1bpp
|
|
|
|
call ReplaceKrisSprite
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
HeadbuttTreeGFX:
|
2017-12-11 05:17:39 +00:00
|
|
|
INCBIN "gfx/overworld/headbutt_tree.2bpp"
|
2015-11-17 02:46:36 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
HideHeadbuttTree:
|
2015-11-17 02:46:36 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPlayerDirection]
|
2015-11-17 02:46:36 +00:00
|
|
|
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
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-17 02:46:36 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
TreeRelativeLocationTable:
|
2015-11-17 02:46:36 +00:00
|
|
|
dwcoord 8, 8 + 2 ; RIGHT
|
|
|
|
dwcoord 8, 8 - 2 ; LEFT
|
|
|
|
dwcoord 8 - 2, 8 ; DOWN
|
|
|
|
dwcoord 8 + 2, 8 ; UP
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
OWCutAnimation:
|
2015-12-14 16:12:18 +00:00
|
|
|
; Animation index in e
|
|
|
|
; 0: Split tree in half
|
|
|
|
; 1: Mow the lawn
|
2015-11-17 02:46:36 +00:00
|
|
|
ld a, e
|
2018-07-15 15:58:01 +00:00
|
|
|
and 1
|
2015-11-17 02:46:36 +00:00
|
|
|
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
|
2018-07-15 15:58:01 +00:00
|
|
|
ld a, 36 * SPRITEOAMSTRUCT_LENGTH
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurSpriteOAMAddr], a
|
2017-12-24 17:47:30 +00:00
|
|
|
callfar DoNextFrameForAllSprites
|
2015-11-17 02:46:36 +00:00
|
|
|
call OWCutJumptable
|
|
|
|
call DelayFrame
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.finish
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.LoadCutGFX:
|
2017-12-24 17:47:30 +00:00
|
|
|
callfar ClearSpriteAnims ; pointless to farcall
|
2015-11-17 02:46:36 +00:00
|
|
|
ld de, CutGrassGFX
|
2018-07-15 15:58:01 +00:00
|
|
|
ld hl, vTiles0 tile FIELDMOVE_GRASS
|
2015-11-17 02:46:36 +00:00
|
|
|
lb bc, BANK(CutGrassGFX), 4
|
|
|
|
call Request2bpp
|
|
|
|
ld de, CutTreeGFX
|
2018-07-15 15:58:01 +00:00
|
|
|
ld hl, vTiles0 tile FIELDMOVE_TREE
|
2015-11-17 02:46:36 +00:00
|
|
|
lb bc, BANK(CutTreeGFX), 4
|
|
|
|
call Request2bpp
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CutTreeGFX:
|
2017-12-11 05:17:39 +00:00
|
|
|
INCBIN "gfx/overworld/cut_tree.2bpp"
|
2015-11-17 02:46:36 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CutGrassGFX:
|
2017-12-11 05:17:39 +00:00
|
|
|
INCBIN "gfx/overworld/cut_grass.2bpp"
|
2015-11-17 02:46:36 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
OWCutJumptable:
|
2015-11-17 02:46:36 +00:00
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2015-12-27 02:59:03 +00:00
|
|
|
ld hl, .dw
|
2015-11-17 02:46:36 +00:00
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, de
|
2015-11-17 02:46:36 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2015-11-17 02:46:36 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.dw
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Cut_SpawnAnimateTree:
|
2015-12-01 20:35:28 +00:00
|
|
|
call Cut_Headbutt_GetPixelFacing
|
|
|
|
ld a, SPRITE_ANIM_INDEX_CUT_TREE ; cut tree
|
2020-02-11 12:42: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
|
2018-07-15 15:58:01 +00:00
|
|
|
ld [hl], FIELDMOVE_TREE
|
2015-12-01 20:35:28 +00:00
|
|
|
ld a, 32
|
2018-01-11 20:36:11 +00:00
|
|
|
ld [wFrameCounter], a
|
2015-12-01 20:35:28 +00:00
|
|
|
; Cut_StartWaiting
|
2015-11-17 02:46:36 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
inc [hl]
|
2016-05-04 15:46:23 +00:00
|
|
|
inc [hl]
|
2015-11-17 02:46:36 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Cut_SpawnAnimateLeaves:
|
2015-12-01 20:35:28 +00:00
|
|
|
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
|
2018-01-11 20:36:11 +00:00
|
|
|
ld [wFrameCounter], 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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Cut_StartWaiting:
|
2015-11-17 02:46:36 +00:00
|
|
|
ld a, $1
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [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]
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Cut_WaitAnimSFX:
|
2018-01-11 20:36:11 +00:00
|
|
|
ld hl, wFrameCounter
|
2015-11-17 02:46:36 +00:00
|
|
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Cut_SpawnLeaf:
|
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
|
2020-02-11 12:42: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
|
2018-07-15 15:58:01 +00:00
|
|
|
ld [hl], FIELDMOVE_GRASS
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Cut_GetLeafSpawnCoords:
|
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
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPlayerDirection]
|
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
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, de
|
2015-11-17 02:46:36 +00:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Coords:
|
2015-12-01 20:35:28 +00:00
|
|
|
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
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Cut_Headbutt_GetPixelFacing:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wPlayerDirection]
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Coords:
|
2015-12-01 20:35:28 +00:00
|
|
|
dbpixel 10, 13
|
|
|
|
dbpixel 10, 9
|
|
|
|
dbpixel 8, 11
|
|
|
|
dbpixel 12, 11
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
FlyFromAnim:
|
2015-12-01 20:35:28 +00:00
|
|
|
call DelayFrame
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wVramState]
|
2015-12-01 20:35:28 +00:00
|
|
|
push af
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wVramState], a
|
2015-12-04 13:46:11 +00:00
|
|
|
call FlyFunction_InitGFX
|
2015-12-01 20:35:28 +00:00
|
|
|
depixel 10, 10, 4, 0
|
2016-01-10 04:41:03 +00:00
|
|
|
ld a, SPRITE_ANIM_INDEX_RED_WALK
|
2020-02-11 12:42:36 +00:00
|
|
|
call InitSpriteAnimStruct
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_TILE_ID
|
|
|
|
add hl, bc
|
2018-07-15 15:58:01 +00:00
|
|
|
ld [hl], FIELDMOVE_FLY
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
|
|
|
|
add hl, bc
|
2015-12-19 01:07:09 +00:00
|
|
|
ld [hl], SPRITE_ANIM_SEQ_FLY_FROM
|
|
|
|
ld a, 128
|
2018-01-11 20:36:11 +00:00
|
|
|
ld [wFrameCounter], a
|
2015-12-01 20:35:28 +00:00
|
|
|
.loop
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
|
|
|
jr nz, .exit
|
2018-07-15 15:58:01 +00:00
|
|
|
ld a, 0 * SPRITEOAMSTRUCT_LENGTH
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurSpriteOAMAddr], a
|
2017-12-24 17:47:30 +00:00
|
|
|
callfar DoNextFrameForAllSprites
|
2015-12-19 01:07:09 +00:00
|
|
|
call FlyFunction_FrameTimer
|
2015-12-01 20:35:28 +00:00
|
|
|
call DelayFrame
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.exit
|
|
|
|
pop af
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wVramState], a
|
2015-12-01 20:35:28 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
FlyToAnim:
|
2015-12-01 20:35:28 +00:00
|
|
|
call DelayFrame
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wVramState]
|
2015-12-01 20:35:28 +00:00
|
|
|
push af
|
|
|
|
xor a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wVramState], a
|
2015-12-04 13:46:11 +00:00
|
|
|
call FlyFunction_InitGFX
|
2015-12-01 20:35:28 +00:00
|
|
|
depixel 31, 10, 4, 0
|
2016-01-10 04:41:03 +00:00
|
|
|
ld a, SPRITE_ANIM_INDEX_RED_WALK
|
2020-02-11 12:42:36 +00:00
|
|
|
call InitSpriteAnimStruct
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_TILE_ID
|
|
|
|
add hl, bc
|
2018-07-15 15:58:01 +00:00
|
|
|
ld [hl], FIELDMOVE_FLY
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
|
|
|
|
add hl, bc
|
2015-12-19 01:07:09 +00:00
|
|
|
ld [hl], SPRITE_ANIM_SEQ_FLY_TO
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_0F
|
|
|
|
add hl, bc
|
2015-12-19 01:07:09 +00:00
|
|
|
ld [hl], 11 * 8
|
|
|
|
ld a, 64
|
2018-01-11 20:36:11 +00:00
|
|
|
ld [wFrameCounter], a
|
2015-12-01 20:35:28 +00:00
|
|
|
.loop
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
|
|
|
jr nz, .exit
|
2018-07-15 15:58:01 +00:00
|
|
|
ld a, 0 * SPRITEOAMSTRUCT_LENGTH
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurSpriteOAMAddr], a
|
2017-12-24 17:47:30 +00:00
|
|
|
callfar DoNextFrameForAllSprites
|
2015-12-19 01:07:09 +00:00
|
|
|
call FlyFunction_FrameTimer
|
2015-12-01 20:35:28 +00:00
|
|
|
call DelayFrame
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.exit
|
|
|
|
pop af
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wVramState], a
|
2015-12-19 01:07:09 +00:00
|
|
|
call .RestorePlayerSprite_DespawnLeaves
|
2015-12-01 20:35:28 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.RestorePlayerSprite_DespawnLeaves:
|
2018-01-30 19:52:46 +00:00
|
|
|
ld hl, wVirtualOAMSprite00TileID
|
2015-12-01 20:35:28 +00:00
|
|
|
xor a
|
2018-01-10 18:47:57 +00:00
|
|
|
ld c, 4
|
|
|
|
.OAMloop
|
|
|
|
ld [hli], a ; tile id
|
2018-02-03 03:55:38 +00:00
|
|
|
rept SPRITEOAMSTRUCT_LENGTH + -1
|
2016-05-10 16:31:49 +00:00
|
|
|
inc hl
|
2018-01-10 18:47:57 +00:00
|
|
|
endr
|
2015-12-01 20:35:28 +00:00
|
|
|
inc a
|
|
|
|
dec c
|
2018-01-10 18:47:57 +00:00
|
|
|
jr nz, .OAMloop
|
2018-01-30 19:52:46 +00:00
|
|
|
ld hl, wVirtualOAMSprite04
|
2018-01-30 19:55:20 +00:00
|
|
|
ld bc, wVirtualOAMEnd - wVirtualOAMSprite04
|
2015-12-01 20:35:28 +00:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
FlyFunction_InitGFX:
|
2017-12-24 17:47:30 +00:00
|
|
|
callfar ClearSpriteAnims
|
2015-12-01 20:35:28 +00:00
|
|
|
ld de, CutGrassGFX
|
2018-07-15 15:58:01 +00:00
|
|
|
ld hl, vTiles0 tile FIELDMOVE_GRASS
|
2015-12-01 20:35:28 +00:00
|
|
|
lb bc, BANK(CutGrassGFX), 4
|
|
|
|
call Request2bpp
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartyMon]
|
|
|
|
ld hl, wPartySpecies
|
2015-12-01 20:35:28 +00:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
2018-07-28 23:27:34 +00:00
|
|
|
ld [wTempIconSpecies], a
|
2018-07-15 15:58:01 +00:00
|
|
|
ld e, FIELDMOVE_FLY
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall FlyFunction_GetMonIcon
|
2015-12-01 20:35:28 +00:00
|
|
|
xor a
|
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
FlyFunction_FrameTimer:
|
2015-12-19 01:07:09 +00:00
|
|
|
call .SpawnLeaf
|
2018-01-11 20:36:11 +00:00
|
|
|
ld hl, wFrameCounter
|
2015-12-01 20:35:28 +00:00
|
|
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.SpawnLeaf:
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, wcf65
|
|
|
|
ld a, [hl]
|
|
|
|
inc [hl]
|
|
|
|
and $7
|
|
|
|
ret nz
|
|
|
|
ld a, [hl]
|
2015-12-19 01:07:09 +00:00
|
|
|
and (6 * 8) >> 1
|
2015-12-01 20:35:28 +00:00
|
|
|
sla a
|
2015-12-19 01:07:09 +00:00
|
|
|
add 8 * 8 ; gives a number in [$40, $50, $60, $70]
|
2015-12-01 20:35:28 +00:00
|
|
|
ld d, a
|
|
|
|
ld e, $0
|
2015-12-19 01:07:09 +00:00
|
|
|
ld a, SPRITE_ANIM_INDEX_FLY_LEAF ; fly land
|
2020-02-11 12:42:36 +00:00
|
|
|
call InitSpriteAnimStruct
|
2015-12-01 20:35:28 +00:00
|
|
|
ld hl, SPRITEANIMSTRUCT_TILE_ID
|
|
|
|
add hl, bc
|
2018-07-15 15:58:01 +00:00
|
|
|
ld [hl], FIELDMOVE_GRASS
|
2015-12-01 20:35:28 +00:00
|
|
|
ret
|