mirror of
https://github.com/pret/pokered.git
synced 2026-05-07 13:53:15 -05:00
Some checks failed
CI / build (push) Has been cancelled
- Use `OBJ_SIZE` and `TILE_SIZE` from hardware.inc. - `SPRITESTATEDATA1_LENGTH`, `NUM_SPRITESTATEDATA_STRUCTS` and `TILE_1BPP_SIZE` are used in some places. - Highlight an oversight in `OakSpeech` where several direct MBC bank switches are requested. - Remove redundant comments in home/overworld.asm. - Add unreferenced `FillBgMap` function to avoid a byte of dead code. - Some constants added in wram.asm. - Correctly separate the commented code in `SaveMainData`.
80 lines
1.5 KiB
NASM
80 lines
1.5 KiB
NASM
HandleLedges::
|
|
ld a, [wMovementFlags]
|
|
bit BIT_LEDGE_OR_FISHING, a
|
|
ret nz
|
|
ld a, [wCurMapTileset]
|
|
and a ; OVERWORLD
|
|
ret nz
|
|
predef GetTileAndCoordsInFrontOfPlayer
|
|
ld a, [wSpritePlayerStateData1FacingDirection]
|
|
ld b, a
|
|
lda_coord 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
|
|
ldh a, [hJoyHeld]
|
|
and e
|
|
ret z
|
|
ld a, PAD_BUTTONS | PAD_CTRL_PAD
|
|
ld [wJoyIgnore], a
|
|
ld hl, wMovementFlags
|
|
set BIT_LEDGE_OR_FISHING, [hl]
|
|
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
|
|
|
|
INCLUDE "data/tilesets/ledge_tiles.asm"
|
|
|
|
LoadHoppingShadowOAM:
|
|
ld hl, vChars1 tile $7f
|
|
ld de, LedgeHoppingShadow
|
|
lb bc, BANK(LedgeHoppingShadow), (LedgeHoppingShadowEnd - LedgeHoppingShadow) / TILE_1BPP_SIZE
|
|
call CopyVideoDataDouble
|
|
ld a, $9
|
|
lb bc, $54, $48 ; b, c = y, x coordinates of shadow
|
|
ld de, LedgeHoppingShadowOAMBlock
|
|
call WriteOAMBlock
|
|
ret
|
|
|
|
LedgeHoppingShadow:
|
|
INCBIN "gfx/overworld/shadow.1bpp"
|
|
LedgeHoppingShadowEnd:
|
|
|
|
LedgeHoppingShadowOAMBlock:
|
|
; tile ID, attributes
|
|
db $ff, OAM_PAL1
|
|
db $ff, OAM_XFLIP
|
|
db $ff, OAM_YFLIP
|
|
db $ff, OAM_XFLIP | OAM_YFLIP
|