pokered/engine/overworld/ledges.asm

77 lines
1.4 KiB
NASM
Raw Normal View History

HandleLedges::
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
2015-08-31 02:38:41 +00:00
ld a, [wCurMapTileset]
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
2015-07-19 08:46:12 +00:00
ld a, SFX_LEDGE
2014-05-22 22:13:20 +00:00
call PlaySound
ret
INCLUDE "data/ledge_tiles.asm"
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
LoadHoppingShadowOAM:
2014-05-29 08:31:46 +00:00
ld hl, vChars1 + $7f0
2014-09-13 07:50:56 +00:00
ld de, LedgeHoppingShadow
2015-08-10 04:56:20 +00:00
lb bc, BANK(LedgeHoppingShadow), (LedgeHoppingShadowEnd - LedgeHoppingShadow) / $8
2014-05-22 22:13:20 +00:00
call CopyVideoDataDouble
ld a, $9
2015-08-05 21:20:29 +00:00
lb bc, $54, $48 ; 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
2016-06-12 00:24:04 +00:00
LedgeHoppingShadow:
2020-06-27 20:27:30 +00:00
INCBIN "gfx/overworld/shadow.1bpp"
2015-08-10 04:56:20 +00:00
LedgeHoppingShadowEnd:
2014-05-22 22:13:20 +00:00
2016-06-12 00:24:04 +00:00
LedgeHoppingShadowOAM:
2014-05-22 22:13:20 +00:00
db $FF,$10,$FF,$20
db $FF,$40,$FF,$60