mirror of
https://github.com/pret/pokeyellow.git
synced 2026-05-20 17:58:03 -05:00
91 lines
1.9 KiB
NASM
Executable File
91 lines
1.9 KiB
NASM
Executable File
HandleLedges: ; 1a7f4 (6:67f4)
|
|
ld a, [wd736]
|
|
bit 6, a ; already jumping down ledge
|
|
ret nz
|
|
ld a, [wCurMapTileset]
|
|
and a ; OVERWORLD
|
|
ret nz
|
|
predef GetTileAndCoordsInFrontOfPlayer
|
|
ld a, [wSpriteStateData1 + 9]
|
|
ld b, a
|
|
aCoord 8, 9
|
|
ld c, a
|
|
ld a, [wTileInFrontOfPlayer]
|
|
ld d, a
|
|
ld hl, LedgeTiles
|
|
.loop
|
|
ld a, [hli]
|
|
cp $ff
|
|
ret z
|
|
cp b
|
|
jr nz, .nextLedgeTile1
|
|
ld a, [hli]
|
|
cp c
|
|
jr nz, .nextLedgeTile2
|
|
ld a, [hli]
|
|
cp d
|
|
jr nz, .nextLedgeTile3
|
|
ld a, [hl]
|
|
ld e, a
|
|
jr .foundMatch
|
|
.nextLedgeTile1
|
|
inc hl
|
|
.nextLedgeTile2
|
|
inc hl
|
|
.nextLedgeTile3
|
|
inc hl
|
|
jr .loop
|
|
.foundMatch
|
|
ld a, [hJoyHeld]
|
|
and e
|
|
ret z
|
|
ld a, $ff
|
|
ld [wJoyIgnore], a
|
|
ld hl, wd736
|
|
set 6, [hl] ; jumping down ledge
|
|
call StartSimulatingJoypadStates
|
|
ld a, e
|
|
ld [wSimulatedJoypadStatesEnd], a
|
|
ld [wSimulatedJoypadStatesEnd + 1], a
|
|
ld a, $2
|
|
ld [wSimulatedJoypadStatesIndex], a
|
|
call LoadHoppingShadowOAM
|
|
ld a, SFX_LEDGE
|
|
call PlaySound
|
|
ret
|
|
|
|
; (player direction) (tile player standing on) (ledge tile) (input required)
|
|
LedgeTiles: ; 1a851 (6:6851)
|
|
db SPRITE_FACING_DOWN, $2C,$37,D_DOWN
|
|
db SPRITE_FACING_DOWN, $39,$36,D_DOWN
|
|
db SPRITE_FACING_DOWN, $39,$37,D_DOWN
|
|
db SPRITE_FACING_LEFT, $2C,$27,D_LEFT
|
|
db SPRITE_FACING_LEFT, $39,$27,D_LEFT
|
|
db SPRITE_FACING_RIGHT,$2C,$0D,D_RIGHT
|
|
db SPRITE_FACING_RIGHT,$2C,$1D,D_RIGHT
|
|
db SPRITE_FACING_RIGHT,$39,$0D,D_RIGHT
|
|
db $FF
|
|
|
|
LoadHoppingShadowOAM: ; 1a872 (6:6872)
|
|
ld hl, vChars1 + $7f0
|
|
ld de, LedgeHoppingShadow
|
|
lb bc, BANK(LedgeHoppingShadow), (LedgeHoppingShadowEnd - LedgeHoppingShadow) / $8
|
|
call CopyVideoDataDouble
|
|
ld hl, LedgeHoppingShadowOAM
|
|
ld de, wOAMBuffer + 36 * 4
|
|
ld bc, LedgeHoppingShadowOAMEnd - LedgeHoppingShadowOAM
|
|
call CopyData
|
|
ld a, $a0
|
|
ld [wOAMBuffer + 38 * 4], a
|
|
ld [wOAMBuffer + 39 * 4], a
|
|
ret
|
|
|
|
LedgeHoppingShadow: ; 1a893 (6:6893)
|
|
INCBIN "gfx/ledge_hopping_shadow.1bpp"
|
|
LedgeHoppingShadowEnd:
|
|
|
|
LedgeHoppingShadowOAM: ; 1a89b (6:689b)
|
|
db $58,$48,$FF,$00
|
|
db $58,$50,$FF,$20
|
|
LedgeHoppingShadowOAMEnd: ; 1a8a3 (6:68a3)
|