pokered/engine/overworld/dust_smoke.asm
Narishma-gb f332678625
Some checks failed
CI / build (push) Has been cancelled
Use more hardware and graphics constants (#532)
- 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`.
2025-11-18 15:17:31 -05:00

88 lines
1.6 KiB
NASM

AnimateBoulderDust:
ld a, $1
ld [wWhichAnimationOffsets], a ; select the boulder dust offsets
ld a, [wUpdateSpritesEnabled]
push af
ld a, $ff
ld [wUpdateSpritesEnabled], a
ld a, %11100100
ldh [rOBP1], a
call LoadSmokeTileFourTimes
farcall WriteCutOrBoulderDustAnimationOAMBlock
ld c, 8 ; number of steps in animation
.loop
push bc
call GetMoveBoulderDustFunctionPointer
ld bc, .returnAddress
push bc
ld c, 4
jp hl
.returnAddress
ldh a, [rOBP1]
xor %01100100
ldh [rOBP1], a
call Delay3
pop bc
dec c
jr nz, .loop
pop af
ld [wUpdateSpritesEnabled], a
jp LoadPlayerSpriteGraphics
GetMoveBoulderDustFunctionPointer:
ld a, [wSpritePlayerStateData1FacingDirection]
ld hl, MoveBoulderDustFunctionPointerTable
ld c, a
ld b, $0
add hl, bc
ld a, [hli]
ld [wCoordAdjustmentAmount], a
ld a, [hli]
ld e, a
ld a, [hli]
ld h, [hl]
ld l, a
push hl
ld hl, wShadowOAMSprite36
ld d, $0
add hl, de
ld e, l
ld d, h
pop hl
ret
MACRO boulder_dust_adjust
db \1, \2 ; coords
dw \3 ; function
ENDM
MoveBoulderDustFunctionPointerTable:
boulder_dust_adjust -1, 0, AdjustOAMBlockYPos ; down
boulder_dust_adjust 1, 0, AdjustOAMBlockYPos ; up
boulder_dust_adjust 1, 1, AdjustOAMBlockXPos ; left
boulder_dust_adjust -1, 1, AdjustOAMBlockXPos ; right
LoadSmokeTileFourTimes::
ld hl, vChars1 tile $7c
ld c, 4
.loop
push bc
push hl
call LoadSmokeTile
pop hl
ld bc, TILE_SIZE
add hl, bc
pop bc
dec c
jr nz, .loop
ret
LoadSmokeTile:
ld de, SSAnneSmokePuffTile
lb bc, BANK(SSAnneSmokePuffTile), (SSAnneSmokePuffTileEnd - SSAnneSmokePuffTile) / TILE_SIZE
jp CopyVideoData
SSAnneSmokePuffTile:
INCBIN "gfx/overworld/smoke.2bpp"
SSAnneSmokePuffTileEnd: