Use 'tile' and 'tiles' macros

This commit is contained in:
Rangi 2020-07-07 15:09:54 -04:00
parent b945988a0a
commit 4a7d1513f3
30 changed files with 188 additions and 303 deletions

View file

@ -80,23 +80,23 @@ InitCutAnimOAM:
cp $52
jr z, .grass
; tree
ld de, Overworld_GFX + $2d0 ; cuttable tree sprite top row
ld hl, vChars1 + $7c0
lb bc, BANK(Overworld_GFX), $02
ld de, Overworld_GFX tile $2d ; cuttable tree sprite top row
ld hl, vChars1 tile $7c
lb bc, BANK(Overworld_GFX), 2
call CopyVideoData
ld de, Overworld_GFX + $3d0 ; cuttable tree sprite bottom row
ld hl, vChars1 + $7e0
lb bc, BANK(Overworld_GFX), $02
ld de, Overworld_GFX tile $3d ; cuttable tree sprite bottom row
ld hl, vChars1 tile $7e
lb bc, BANK(Overworld_GFX), 2
call CopyVideoData
jr WriteCutOrBoulderDustAnimationOAMBlock
.grass
ld hl, vChars1 + $7c0
ld hl, vChars1 tile $7c
call LoadCutGrassAnimationTilePattern
ld hl, vChars1 + $7d0
ld hl, vChars1 tile $7d
call LoadCutGrassAnimationTilePattern
ld hl, vChars1 + $7e0
ld hl, vChars1 tile $7e
call LoadCutGrassAnimationTilePattern
ld hl, vChars1 + $7f0
ld hl, vChars1 tile $7f
call LoadCutGrassAnimationTilePattern
call WriteCutOrBoulderDustAnimationOAMBlock
ld hl, wOAMBuffer + $93
@ -112,8 +112,8 @@ InitCutAnimOAM:
ret
LoadCutGrassAnimationTilePattern:
ld de, AnimationTileset2 + $60 ; tile depicting a leaf
lb bc, BANK(AnimationTileset2), $01
ld de, AnimationTileset2 tile 6 ; tile depicting a leaf
lb bc, BANK(AnimationTileset2), 1
jp CopyVideoData
WriteCutOrBoulderDustAnimationOAMBlock:

View file

@ -69,14 +69,14 @@ MoveBoulderDustFunctionPointerTable:
dw AdjustOAMBlockXPos
LoadSmokeTileFourTimes::
ld hl, vChars1 + $7c0
ld c, $4
ld hl, vChars1 tile $7c
ld c, 4
.loop
push bc
push hl
call LoadSmokeTile
pop hl
ld bc, $10
ld bc, 1 tiles
add hl, bc
pop bc
dec c

View file

@ -8,8 +8,8 @@ EmotionBubble:
ld e, [hl]
inc hl
ld d, [hl]
ld hl, vChars1 + $780
lb bc, BANK(EmotionBubbles), $04
ld hl, vChars1 tile $78
lb bc, BANK(EmotionBubbles), 4
call CopyVideoData
ld a, [wUpdateSpritesEnabled]
push af

View file

@ -1,7 +1,7 @@
AnimateHealingMachine:
ld de, PokeCenterFlashingMonitorAndHealBall
ld hl, vChars0 + $7c0
lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03 ; loads one too many tiles
ld hl, vChars0 tile $7c
lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), 3 ; should be 2
call CopyVideoData
ld hl, wUpdateSpritesEnabled
ld a, [hl]

View file

@ -57,7 +57,7 @@ HandleLedges::
INCLUDE "data/tilesets/ledge_tiles.asm"
LoadHoppingShadowOAM:
ld hl, vChars1 + $7f0
ld hl, vChars1 tile $7f
ld de, LedgeHoppingShadow
lb bc, BANK(LedgeHoppingShadow), (LedgeHoppingShadowEnd - LedgeHoppingShadow) / $8
call CopyVideoDataDouble

View file

@ -130,25 +130,25 @@ LoadMapSpriteTilePatterns:
push de
push bc
ld hl, vNPCSprites ; VRAM base address
ld bc, $c0 ; number of bytes per VRAM slot
ld bc, 12 tiles ; number of bytes per VRAM slot
ldh a, [hVRAMSlot]
cp 11 ; is it a 4-tile sprite?
jr nc, .fourTileSpriteVRAMAddr
ld d, a
dec d
; hl = vSprites + [hVRAMSlot] * $C0 (the number of bytes in 12 tiles)
; hl = vSprites + [hVRAMSlot] * 12 tiles
.calculateVRAMAddrLoop
add hl, bc
dec d
jr nz, .calculateVRAMAddrLoop
jr .loadStillTilePattern
.fourTileSpriteVRAMAddr
ld hl, vSprites + $7c0 ; address for second 4-tile sprite
ld hl, vSprites tile $7c ; address for second 4-tile sprite
ldh a, [hFourTileSpriteCount]
and a
jr nz, .loadStillTilePattern
; if it's the first 4-tile sprite
ld hl, vSprites + $780 ; address for first 4-tile sprite
ld hl, vSprites tile $78 ; address for first 4-tile sprite
inc a
ldh [hFourTileSpriteCount], a
.loadStillTilePattern

View file

@ -250,11 +250,11 @@ DoFlyAnimation:
LoadBirdSpriteGraphics:
ld de, BirdSprite
ld hl, vNPCSprites
lb bc, BANK(BirdSprite), $0c
lb bc, BANK(BirdSprite), 12
call CopyVideoData
ld de, BirdSprite + $c0 ; moving animation sprite
ld de, BirdSprite tile 12 ; moving animation sprite
ld hl, vNPCSprites2
lb bc, BANK(BirdSprite), $0c
lb bc, BANK(BirdSprite), 12
jp CopyVideoData
InitFacingDirectionList:
@ -381,8 +381,8 @@ FishingAnim:
ld hl, wd736
set 6, [hl] ; reserve the last 4 OAM entries
ld de, RedSprite
ld hl, vNPCSprites
lb bc, BANK(RedSprite), $c
ld hl, vNPCSprites tile $00
lb bc, BANK(RedSprite), 12
call CopyVideoData
ld a, $4
ld hl, RedFishingTiles
@ -479,22 +479,18 @@ FishingRodOAM:
db $50, $40, $FE, $00 ; player facing left
db $50, $58, $FE, $20 ; player facing right ($20 means "horizontally flip the tile")
fishing_gfx: MACRO
dw \1
db \2
db BANK(\1)
dw vNPCSprites tile \3
ENDM
RedFishingTiles:
dw RedFishingTilesFront
db 2, BANK(RedFishingTilesFront)
dw vNPCSprites + $20
dw RedFishingTilesBack
db 2, BANK(RedFishingTilesBack)
dw vNPCSprites + $60
dw RedFishingTilesSide
db 2, BANK(RedFishingTilesSide)
dw vNPCSprites + $a0
dw RedFishingRodTiles
db 3, BANK(RedFishingRodTiles)
dw vNPCSprites2 + $7d0
fishing_gfx RedFishingTilesFront, 2, $02
fishing_gfx RedFishingTilesBack, 2, $06
fishing_gfx RedFishingTilesSide, 2, $0a
fishing_gfx RedFishingRodTiles, 3, $fd
_HandleMidJump::
ld a, [wPlayerJumpingYScreenCoordsIndex]