2014-05-22 22:13:20 +00:00
|
|
|
UsedCut: ; ef54 (3:6f54)
|
|
|
|
xor a
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wcd6a], a
|
|
|
|
ld a, [W_CURMAPTILESET] ; W_CURMAPTILESET
|
2014-05-22 22:13:20 +00:00
|
|
|
and a ; OVERWORLD
|
|
|
|
jr z, .asm_ef6b
|
|
|
|
cp GYM
|
|
|
|
jr nz, .asm_ef77
|
2014-09-13 07:50:56 +00:00
|
|
|
ld a, [wTileInFrontOfPlayer]
|
2014-05-22 22:13:20 +00:00
|
|
|
cp $50 ; gym cut tree
|
|
|
|
jr nz, .asm_ef77
|
|
|
|
jr asm_ef82
|
|
|
|
.asm_ef6b
|
|
|
|
dec a
|
2014-09-13 07:50:56 +00:00
|
|
|
ld a, [wTileInFrontOfPlayer]
|
2014-05-22 22:13:20 +00:00
|
|
|
cp $3d ; cut tree
|
|
|
|
jr z, asm_ef82
|
|
|
|
cp $52 ; grass
|
|
|
|
jr z, asm_ef82
|
|
|
|
.asm_ef77
|
|
|
|
ld hl, NothingToCutText
|
|
|
|
jp PrintText
|
|
|
|
|
|
|
|
NothingToCutText: ; ef7d (3:6f7d)
|
|
|
|
TX_FAR _NothingToCutText
|
|
|
|
db "@"
|
|
|
|
|
|
|
|
asm_ef82: ; ef82 (3:6f82)
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wcd4d], a
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a, $1
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wcd6a], a
|
|
|
|
ld a, [wWhichPokemon] ; wWhichPokemon
|
2014-06-14 11:12:40 +00:00
|
|
|
ld hl, wPartyMonNicks ; wPartyMonNicks
|
2014-05-22 22:13:20 +00:00
|
|
|
call GetPartyMonName
|
2014-05-26 21:04:56 +00:00
|
|
|
ld hl, wd730
|
2014-05-22 22:13:20 +00:00
|
|
|
set 6, [hl]
|
|
|
|
call GBPalWhiteOutWithDelay3
|
2014-05-23 22:34:35 +00:00
|
|
|
call ClearSprites
|
2014-09-10 03:55:19 +00:00
|
|
|
call RestoreScreenTilesAndReloadTilePatterns
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a, $90
|
2014-09-23 22:02:03 +00:00
|
|
|
ld [hWY], a
|
2014-05-22 22:13:20 +00:00
|
|
|
call Delay3
|
|
|
|
call LoadGBPal
|
|
|
|
call LoadCurrentMapView
|
|
|
|
call SaveScreenTilesToBuffer2
|
|
|
|
call Delay3
|
|
|
|
xor a
|
2014-09-23 22:02:03 +00:00
|
|
|
ld [hWY], a
|
2014-05-22 22:13:20 +00:00
|
|
|
ld hl, UsedCutText
|
|
|
|
call PrintText
|
|
|
|
call LoadScreenTilesFromBuffer2
|
2014-05-26 21:04:56 +00:00
|
|
|
ld hl, wd730
|
2014-05-22 22:13:20 +00:00
|
|
|
res 6, [hl]
|
|
|
|
ld a, $ff
|
2014-09-13 07:50:56 +00:00
|
|
|
ld [wUpdateSpritesEnabled], a
|
2014-05-22 22:13:20 +00:00
|
|
|
call AnimateCutTree
|
|
|
|
ld de, CutTreeBlockSwaps ; $7100
|
|
|
|
call Func_f09f
|
2014-09-14 18:29:18 +00:00
|
|
|
call RedrawMapView
|
2014-05-22 22:13:20 +00:00
|
|
|
callba Func_79e96
|
|
|
|
ld a, $1
|
2014-09-13 07:50:56 +00:00
|
|
|
ld [wUpdateSpritesEnabled], a
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a, (SFX_02_56 - SFX_Headers_02) / 3
|
|
|
|
call PlaySound
|
|
|
|
ld a, $90
|
2014-09-23 22:02:03 +00:00
|
|
|
ld [hWY], a
|
2014-05-22 22:13:20 +00:00
|
|
|
call UpdateSprites
|
2014-09-14 18:29:18 +00:00
|
|
|
jp RedrawMapView
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
|
|
UsedCutText: ; eff2 (3:6ff2)
|
|
|
|
TX_FAR _UsedCutText
|
|
|
|
db "@"
|
|
|
|
|
|
|
|
AnimateCutTree: ; eff7 (3:6ff7)
|
|
|
|
xor a
|
2014-05-26 21:04:56 +00:00
|
|
|
ld [wcd50], a
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a, $e4
|
|
|
|
ld [rOBP1], a ; $ff49
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [wcd4d]
|
2014-05-22 22:13:20 +00:00
|
|
|
cp $52
|
|
|
|
jr z, .asm_f020
|
|
|
|
ld de, Overworld_GFX + $2d0 ; $42d0 ; cuttable tree sprite top row
|
2014-05-29 08:31:46 +00:00
|
|
|
ld hl, vChars1 + $7c0
|
2014-05-22 22:13:20 +00:00
|
|
|
ld bc, (BANK(Overworld_GFX) << 8) + $02
|
|
|
|
call CopyVideoData
|
|
|
|
ld de, Overworld_GFX + $3d0 ; $43d0 ; cuttable tree sprite bottom row
|
2014-05-29 08:31:46 +00:00
|
|
|
ld hl, vChars1 + $7e0
|
2014-05-22 22:13:20 +00:00
|
|
|
ld bc, (BANK(Overworld_GFX) << 8) + $02
|
|
|
|
call CopyVideoData
|
2014-09-10 03:55:19 +00:00
|
|
|
jr WriteCutTreeBoulderDustAnimationOAMBlock
|
2014-05-22 22:13:20 +00:00
|
|
|
.asm_f020
|
2014-05-29 08:31:46 +00:00
|
|
|
ld hl, vChars1 + $7c0
|
2014-09-10 03:55:19 +00:00
|
|
|
call LoadCutTreeAnimationTilePattern
|
2014-05-29 08:31:46 +00:00
|
|
|
ld hl, vChars1 + $7d0
|
2014-09-10 03:55:19 +00:00
|
|
|
call LoadCutTreeAnimationTilePattern
|
2014-05-29 08:31:46 +00:00
|
|
|
ld hl, vChars1 + $7e0
|
2014-09-10 03:55:19 +00:00
|
|
|
call LoadCutTreeAnimationTilePattern
|
2014-05-29 08:31:46 +00:00
|
|
|
ld hl, vChars1 + $7f0
|
2014-09-10 03:55:19 +00:00
|
|
|
call LoadCutTreeAnimationTilePattern
|
|
|
|
call WriteCutTreeBoulderDustAnimationOAMBlock
|
2014-05-26 21:04:56 +00:00
|
|
|
ld hl, wOAMBuffer + $93
|
2014-05-22 22:13:20 +00:00
|
|
|
ld de, $4
|
|
|
|
ld a, $30
|
|
|
|
ld c, e
|
|
|
|
.asm_f044
|
|
|
|
ld [hl], a
|
|
|
|
add hl, de
|
|
|
|
xor $60
|
|
|
|
dec c
|
|
|
|
jr nz, .asm_f044
|
|
|
|
ret
|
|
|
|
|
2014-09-10 03:55:19 +00:00
|
|
|
LoadCutTreeAnimationTilePattern: ; f04c (3:704c)
|
2014-05-22 22:13:20 +00:00
|
|
|
ld de, AnimationTileset2 + $60 ; $474e ; tile depicting a leaf
|
|
|
|
ld bc, (BANK(AnimationTileset2) << 8) + $01
|
|
|
|
jp CopyVideoData
|
2014-09-10 03:55:19 +00:00
|
|
|
|
|
|
|
WriteCutTreeBoulderDustAnimationOAMBlock: ; f055 (3:7055)
|
|
|
|
call GetCutTreeBoulderDustAnimationOffsets
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a, $9
|
2014-09-10 03:55:19 +00:00
|
|
|
ld de, CutTreeBoulderDustAnimationTilesAndAttributes
|
2014-05-22 22:13:20 +00:00
|
|
|
jp WriteOAMBlock
|
|
|
|
|
2014-09-10 03:55:19 +00:00
|
|
|
CutTreeBoulderDustAnimationTilesAndAttributes: ; f060 (3:7060)
|
2014-05-22 22:13:20 +00:00
|
|
|
db $FC,$10,$FD,$10
|
|
|
|
db $FE,$10,$FF,$10
|
|
|
|
|
2014-09-10 03:55:19 +00:00
|
|
|
GetCutTreeBoulderDustAnimationOffsets: ; f068 (3:7068)
|
2014-05-26 21:04:56 +00:00
|
|
|
ld hl, wSpriteStateData1 + 4
|
2014-09-10 03:55:19 +00:00
|
|
|
ld a, [hli] ; player's sprite screen Y position
|
2014-05-22 22:13:20 +00:00
|
|
|
ld b, a
|
|
|
|
inc hl
|
2014-09-10 03:55:19 +00:00
|
|
|
ld a, [hli] ; player's sprite screen X position
|
2014-05-22 22:13:20 +00:00
|
|
|
ld c, a ; bc holds ypos/xpos of player's sprite
|
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
ld a, [hl] ; a holds direction of player (00: down, 04: up, 08: left, 0C: right)
|
|
|
|
srl a
|
|
|
|
ld e, a
|
|
|
|
ld d, $0 ; de holds direction (00: down, 02: up, 04: left, 06: right)
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [wcd50]
|
2014-05-22 22:13:20 +00:00
|
|
|
and a
|
2014-09-10 03:55:19 +00:00
|
|
|
ld hl, CutTreeAnimationOffsets
|
2014-05-22 22:13:20 +00:00
|
|
|
jr z, .asm_f084
|
2014-09-10 03:55:19 +00:00
|
|
|
ld hl, BoulderDustAnimationOffsets
|
2014-05-22 22:13:20 +00:00
|
|
|
.asm_f084
|
|
|
|
add hl, de
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
ld a, b
|
|
|
|
add d
|
|
|
|
ld b, a
|
|
|
|
ld a, c
|
|
|
|
add e
|
|
|
|
ld c, a
|
|
|
|
ret
|
|
|
|
|
|
|
|
CutTreeAnimationOffsets: ; f08f (3:708f)
|
|
|
|
; Each pair represents the x and y pixels offsets from the player of where the cut tree animation should be drawn
|
|
|
|
db 8, 36 ; player is facing down
|
|
|
|
db 8, 4 ; player is facing up
|
|
|
|
db -8, 20 ; player is facing left
|
|
|
|
db 24, 20 ; player is facing right
|
|
|
|
|
2014-09-10 03:55:19 +00:00
|
|
|
BoulderDustAnimationOffsets: ; f097 (3:7097)
|
2014-05-22 22:13:20 +00:00
|
|
|
; Each pair represents the x and y pixels offsets from the player of where the cut tree animation should be drawn
|
|
|
|
; These offsets represent 2 blocks away from the player
|
|
|
|
db 8, 52 ; player is facing down
|
|
|
|
db 8, -12 ; player is facing up
|
|
|
|
db -24, 20 ; player is facing left
|
|
|
|
db 40, 20 ; player is facing right
|
|
|
|
|
|
|
|
Func_f09f: ; f09f (3:709f)
|
|
|
|
push de
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [W_CURMAPWIDTH] ; wd369
|
2014-05-22 22:13:20 +00:00
|
|
|
add $6
|
|
|
|
ld c, a
|
|
|
|
ld b, $0
|
|
|
|
ld d, $0
|
2014-09-13 07:50:56 +00:00
|
|
|
ld hl, wCurrentTileBlockMapViewPointer
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
add hl, bc
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [wSpriteStateData1 + 9]
|
2014-05-22 22:13:20 +00:00
|
|
|
and a
|
|
|
|
jr z, .asm_f0c7
|
|
|
|
cp $4
|
|
|
|
jr z, .asm_f0cf
|
|
|
|
cp $8
|
|
|
|
jr z, .asm_f0d7
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [W_XBLOCKCOORD] ; wd364
|
2014-05-22 22:13:20 +00:00
|
|
|
and a
|
|
|
|
jr z, .asm_f0e0
|
|
|
|
jr .asm_f0ec
|
|
|
|
.asm_f0c7
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [W_YBLOCKCOORD] ; wd363
|
2014-05-22 22:13:20 +00:00
|
|
|
and a
|
|
|
|
jr z, .asm_f0e0
|
|
|
|
jr .asm_f0df
|
|
|
|
.asm_f0cf
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [W_YBLOCKCOORD] ; wd363
|
2014-05-22 22:13:20 +00:00
|
|
|
and a
|
|
|
|
jr z, .asm_f0e1
|
|
|
|
jr .asm_f0e0
|
|
|
|
.asm_f0d7
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [W_XBLOCKCOORD] ; wd364
|
2014-05-22 22:13:20 +00:00
|
|
|
and a
|
|
|
|
jr z, .asm_f0e6
|
|
|
|
jr .asm_f0e0
|
|
|
|
.asm_f0df
|
|
|
|
add hl, bc
|
|
|
|
.asm_f0e0
|
|
|
|
add hl, bc
|
|
|
|
.asm_f0e1
|
|
|
|
ld e, $2
|
|
|
|
add hl, de
|
|
|
|
jr .asm_f0f0
|
|
|
|
.asm_f0e6
|
|
|
|
ld e, $1
|
|
|
|
add hl, bc
|
|
|
|
add hl, de
|
|
|
|
jr .asm_f0f0
|
|
|
|
.asm_f0ec
|
|
|
|
ld e, $3
|
|
|
|
add hl, bc
|
|
|
|
add hl, de
|
|
|
|
.asm_f0f0
|
|
|
|
pop de
|
|
|
|
ld a, [hl]
|
|
|
|
ld c, a
|
|
|
|
.asm_f0f3
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
cp $ff
|
|
|
|
ret z
|
|
|
|
cp c
|
|
|
|
jr nz, .asm_f0f3
|
|
|
|
dec de
|
|
|
|
ld a, [de]
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
CutTreeBlockSwaps: ; f100 (3:7100)
|
|
|
|
; first byte = tileset block containing the cut tree
|
|
|
|
; second byte = corresponding tileset block after the cut animation happens
|
|
|
|
db $32, $6D
|
|
|
|
db $33, $6C
|
|
|
|
db $34, $6F
|
|
|
|
db $35, $4C
|
|
|
|
db $60, $6E
|
|
|
|
db $0B, $0A
|
|
|
|
db $3C, $35
|
|
|
|
db $3F, $35
|
|
|
|
db $3D, $36
|
|
|
|
db $FF ; list terminator
|