2016-06-12 00:24:04 +00:00
|
|
|
HandleLedges:
|
2014-05-26 21:04:56 +00:00
|
|
|
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
|
2014-05-26 21:04:56 +00:00
|
|
|
ld a, [wSpriteStateData1 + 9]
|
2014-05-22 22:13:20 +00:00
|
|
|
ld b, a
|
2014-06-25 20:58:27 +00:00
|
|
|
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
|
2014-05-26 21:04:56 +00:00
|
|
|
ld hl, wd736
|
2014-09-13 07:50:56 +00:00
|
|
|
set 6, [hl] ; jumping down ledge
|
2014-09-10 03:55:19 +00:00
|
|
|
call StartSimulatingJoypadStates
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a, e
|
2014-09-10 03:55:19 +00:00
|
|
|
ld [wSimulatedJoypadStatesEnd], a
|
|
|
|
ld [wSimulatedJoypadStatesEnd + 1], a
|
2014-05-22 22:13:20 +00:00
|
|
|
ld a, $2
|
2014-09-10 03:55:19 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
; (player direction) (tile player standing on) (ledge tile) (input required)
|
2016-06-12 00:24:04 +00:00
|
|
|
LedgeTiles:
|
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
|
|
|
|
|
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:
|
2014-05-22 22:13:20 +00:00
|
|
|
INCBIN "gfx/ledge_hopping_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
|