pokered/engine/overworld/ledges.asm

86 lines
1.8 KiB
NASM
Raw Normal View History

2014-05-22 22:13:20 +00:00
HandleLedges: ; 1a672 (6:6672)
ld a, [wd736]
2014-09-13 07:50:56 +00:00
bit 6, a ; already jumping down ledge
2014-05-22 22:13:20 +00:00
ret nz
ld a, [W_CURMAPTILESET]
2014-05-22 22:13:20 +00:00
and a ; OVERWORLD
ret nz
2014-09-13 07:50:56 +00:00
predef GetTileAndCoordsInFrontOfPlayer
ld a, [wSpriteStateData1 + 9]
2014-05-22 22:13:20 +00:00
ld b, a
aCoord 8, 9
2014-05-22 22:13:20 +00:00
ld c, a
2014-09-13 07:50:56 +00:00
ld a, [wTileInFrontOfPlayer]
2014-05-22 22:13:20 +00:00
ld d, a
2014-09-13 07:50:56 +00:00
ld hl, LedgeTiles
.loop
2014-05-22 22:13:20 +00:00
ld a, [hli]
cp $ff
ret z
cp b
2014-09-13 07:50:56 +00:00
jr nz, .nextLedgeTile1
2014-05-22 22:13:20 +00:00
ld a, [hli]
cp c
2014-09-13 07:50:56 +00:00
jr nz, .nextLedgeTile2
2014-05-22 22:13:20 +00:00
ld a, [hli]
cp d
2014-09-13 07:50:56 +00:00
jr nz, .nextLedgeTile3
2014-05-22 22:13:20 +00:00
ld a, [hl]
ld e, a
2014-09-13 07:50:56 +00:00
jr .foundMatch
.nextLedgeTile1
2014-05-22 22:13:20 +00:00
inc hl
2014-09-13 07:50:56 +00:00
.nextLedgeTile2
2014-05-22 22:13:20 +00:00
inc hl
2014-09-13 07:50:56 +00:00
.nextLedgeTile3
2014-05-22 22:13:20 +00:00
inc hl
2014-09-13 07:50:56 +00:00
jr .loop
.foundMatch
2014-05-25 17:51:53 +00:00
ld a, [hJoyHeld]
2014-05-22 22:13:20 +00:00
and e
ret z
ld a, $ff
2014-05-25 17:51:53 +00:00
ld [wJoyIgnore], a
ld hl, wd736
2014-09-13 07:50:56 +00:00
set 6, [hl] ; jumping down ledge
call StartSimulatingJoypadStates
2014-05-22 22:13:20 +00:00
ld a, e
ld [wSimulatedJoypadStatesEnd], a
ld [wSimulatedJoypadStatesEnd + 1], a
2014-05-22 22:13:20 +00:00
ld a, $2
ld [wSimulatedJoypadStatesIndex], a
2014-05-22 22:13:20 +00:00
call LoadHoppingShadowOAM
ld a, (SFX_02_4e - SFX_Headers_02) / 3
call PlaySound
ret
; (player direction) (tile player standing on) (ledge tile) (input required)
LedgeTiles: ; 1a6cf (6:66cf)
2014-09-13 07:50:56 +00:00
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
2014-05-22 22:13:20 +00:00
db $FF
LoadHoppingShadowOAM: ; 1a6f0 (6:66f0)
2014-05-29 08:31:46 +00:00
ld hl, vChars1 + $7f0
2014-09-13 07:50:56 +00:00
ld de, LedgeHoppingShadow
2014-05-22 22:13:20 +00:00
ld bc, (BANK(LedgeHoppingShadow) << 8) + $01
call CopyVideoDataDouble
ld a, $9
ld bc, $5448 ; b, c = y, x coordinates of shadow
2014-09-13 07:50:56 +00:00
ld de, LedgeHoppingShadowOAM
2014-05-22 22:13:20 +00:00
call WriteOAMBlock
ret
LedgeHoppingShadow: ; 1a708 (6:6708)
INCBIN "gfx/ledge_hopping_shadow.1bpp"
LedgeHoppingShadowOAM: ; 1a710 (6:6710)
db $FF,$10,$FF,$20
db $FF,$40,$FF,$60