This commit is contained in:
Remy Oukaour 2018-01-10 13:47:57 -05:00
parent cc95d1208d
commit 417937cffc
35 changed files with 350 additions and 300 deletions

View File

@ -20,3 +20,12 @@ HP_BAR_LENGTH_PX EQU HP_BAR_LENGTH * TILE_WIDTH ; pixels
EXP_BAR_LENGTH_PX EQU EXP_BAR_LENGTH * TILE_WIDTH ; pixels
PALPACKET_LENGTH EQU $10
; sprite_oam_struct members (see macros/wram.asm)
const_def
const SPRITEOAMSTRUCT_YCOORD ; 0
const SPRITEOAMSTRUCT_XCOORD ; 1
const SPRITEOAMSTRUCT_TILE_ID ; 2
const SPRITEOAMSTRUCT_ATTRIBUTES ; 3
SPRITEOAMSTRUCT_LENGTH EQU const_value
NUM_SPRITE_OAM_STRUCTS EQU 40 ; see Sprites

View File

@ -9329,27 +9329,27 @@ CopyBackpic: ; 3fc30
; 3fc5b
.LoadTrainerBackpicAsOAM: ; 3fc5b
ld hl, Sprites
ld hl, Sprite01
xor a
ld [hMapObjectIndexBuffer], a
ld b, $6
ld e, 21 * 8
ld b, 6
ld e, (SCREEN_WIDTH + 1) * TILE_WIDTH
.outer_loop
ld c, $3
ld d, 8 * 8
ld c, 3
ld d, 8 * TILE_WIDTH
.inner_loop
ld [hl], d
ld [hl], d ; y
inc hl
ld [hl], e
ld [hl], e ; x
inc hl
ld a, [hMapObjectIndexBuffer]
ld [hli], a
ld [hli], a ; tile id
inc a
ld [hMapObjectIndexBuffer], a
ld a, $1
ld [hli], a
ld a, PAL_BATTLE_OB_PLAYER
ld [hli], a ; attributes
ld a, d
add $8
add 1 * TILE_WIDTH
ld d, a
dec c
jr nz, .inner_loop
@ -9357,7 +9357,7 @@ CopyBackpic: ; 3fc30
add $3
ld [hMapObjectIndexBuffer], a
ld a, e
add $8
add 1 * TILE_WIDTH
ld e, a
dec b
jr nz, .outer_loop

View File

@ -60,9 +60,9 @@ BattleIntroSlidingPics: ; 4e980
; 4e9d6
.subfunction3 ; 4e9d6
ld hl, Sprites + 1 ; x pixel
ld hl, Sprite01XCoord
ld c, $12 ; 18
ld de, $4
ld de, SPRITEOAMSTRUCT_LENGTH
.loop3
dec [hl]
dec [hl]

View File

@ -28,7 +28,7 @@ ShowPlayerMonsRemaining: ; 2c01c
ld [hl], a
ld a, 8
ld [wPlaceBallsDirection], a
ld hl, Sprites
ld hl, Sprite01
jp LoadTrainerHudOAM
; 2c03a
@ -44,7 +44,7 @@ ShowOTTrainerMonsRemaining: ; 2c03a
ld [hl], 4 * 8
ld a, -8
ld [wPlaceBallsDirection], a
ld hl, Sprites + PARTY_LENGTH * 4
ld hl, Sprite07
jp LoadTrainerHudOAM
; 2c059
@ -193,7 +193,7 @@ LinkBattle_TrainerHuds: ; 2c10d
ld [hl], 8 * 8
ld a, $8
ld [wPlaceBallsDirection], a
ld hl, Sprites
ld hl, Sprite01
call LoadTrainerHudOAM
ld hl, OTPartyMon1HP
@ -203,7 +203,7 @@ LinkBattle_TrainerHuds: ; 2c10d
ld a, 10 * 8
ld [hli], a
ld [hl], 13 * 8
ld hl, Sprites + PARTY_LENGTH * 4
ld hl, Sprite07
jp LoadTrainerHudOAM
; 2c143
@ -212,13 +212,13 @@ LoadTrainerHudOAM: ; 2c143
ld c, PARTY_LENGTH
.loop
ld a, [wPlaceBallsY]
ld [hli], a
ld [hli], a ; y
ld a, [wPlaceBallsX]
ld [hli], a
ld [hli], a ; x
ld a, [de]
ld [hli], a
ld a, $3
ld [hli], a
ld [hli], a ; tile id
ld a, PAL_BATTLE_OB_YELLOW
ld [hli], a ; attributes
ld a, [wPlaceBallsX]
ld b, a
ld a, [wPlaceBallsDirection]

View File

@ -258,15 +258,15 @@ BattleAnim_ClearCGB_OAMFlags: ; cc23d
bit 3, a
jr z, .delete
ld hl, Sprites + 3
ld c, (SpritesEnd - Sprites) / 4
ld hl, Sprite01Attributes
ld c, NUM_SPRITE_OAM_STRUCTS
.loop
ld a, [hl]
and $f0
ld [hli], a
rept SPRITEOAMSTRUCT_LENGTH +- 1
inc hl
inc hl
inc hl
endr
dec c
jr nz, .loop
ret

View File

@ -1502,7 +1502,7 @@ BillsPC_UpdateSelectionCursor: ; e2e01 (38:6e01)
.place_cursor
ld hl, .OAM
ld de, Sprites
ld de, Sprite01
.loop
ld a, [hl]
cp -1
@ -1512,9 +1512,9 @@ BillsPC_UpdateSelectionCursor: ; e2e01 (38:6e01)
swap a
add [hl]
inc hl
ld [de], a
ld [de], a ; y
inc de
rept 3
rept SPRITEOAMSTRUCT_LENGTH +- 1
ld a, [hli]
ld [de], a
inc de
@ -1552,7 +1552,7 @@ endr
BillsPC_UpdateInsertCursor: ; e2e8c
ld hl, .OAM
ld de, Sprites
ld de, Sprite01
.loop
ld a, [hl]
cp -1
@ -1562,9 +1562,9 @@ BillsPC_UpdateInsertCursor: ; e2e8c
swap a
add [hl]
inc hl
ld [de], a
ld [de], a ; y
inc de
rept 3
rept SPRITEOAMSTRUCT_LENGTH +- 1
ld a, [hli]
ld [de], a
inc de

View File

@ -594,23 +594,23 @@ CardFlip_CopyToBox: ; e04f7 (38:44f7)
; e0509 (38:4509)
CardFlip_CopyOAM: ; e0509
ld de, Sprites
ld de, Sprite01
ld a, [hli]
.loop
push af
ld a, [hli]
add b
ld [de], a
ld [de], a ; y
inc de
ld a, [hli]
add c
ld [de], a
ld [de], a ; x
inc de
ld a, [hli]
ld [de], a
ld [de], a ; tile id
inc de
ld a, [hli]
ld [de], a
ld [de], a ; attributes
inc de
pop af
dec a
@ -619,11 +619,11 @@ CardFlip_CopyOAM: ; e0509
; e0521
CardFlip_ShiftDigitsLeftTwoPixels: ; e0521 (38:4521)
ld de, vTiles1 tile ("0" & $7f)
ld hl, vTiles1 tile ("0" & $7f) + 2
ld de, vTiles0 tile "0"
ld hl, vTiles0 tile "0" + 2
ld bc, 10 tiles - 2
call CopyBytes
ld hl, vTiles1 tile $7f + 1 tiles - 2
ld hl, vTiles0 tile "9" + 1 tiles - 2
xor a
ld [hli], a
ld [hl], a

View File

@ -1016,17 +1016,17 @@ Function81f5e: ; 81f5e
.asm_81fb7
ld a, b
ld [hli], a
ld [hli], a ; y
ld a, [de]
add a
add a
add $18
ld [hli], a
add 3 * TILE_WIDTH
ld [hli], a ; x
xor a
ld [hli], a
ld [hli], a ; tile id
ld a, c
ld [hli], a
ld a, $10
ld [hli], a ; attributes
ld a, 2 * TILE_WIDTH
add b
ld b, a
inc c

View File

@ -43,26 +43,26 @@ Special_CelebiShrineEvent: ; 4989a
.done
pop af
ld [VramState], a
call .RefreshPlayerSprite_ClearAllOthers
call .RestorePlayerSprite_DespawnLeaves
call CelebiEvent_SetBattleType
ret
; 498f9
.RefreshPlayerSprite_ClearAllOthers: ; 498f9
ld hl, Sprites + 2
.RestorePlayerSprite_DespawnLeaves: ; 498f9
ld hl, Sprite01TileID
xor a
ld c, $4
ld c, 4
.OAMloop:
ld [hli], a
inc hl
inc hl
ld [hli], a ; tile id
rept SPRITEOAMSTRUCT_LENGTH +- 1
inc hl
endr
inc a
dec c
jr nz, .OAMloop
ld hl, Sprites + 4 * 4
ld bc, 36 * 4
ld hl, Sprite05
ld bc, SpritesEnd - Sprite05
xor a
call ByteFill
ret

View File

@ -62,8 +62,8 @@ ShakeHeadbuttTree: ; 8c80a
xor a
ld [hBGMapMode], a
farcall ClearSpriteAnims
ld hl, Sprites + 36 * 4
ld bc, SpritesEnd - (Sprites + 36 * 4)
ld hl, Sprite37
ld bc, SpritesEnd - Sprite37
xor a
call ByteFill
ld de, Font
@ -393,19 +393,19 @@ FlyToAnim: ; 8cb33
ret
.RestorePlayerSprite_DespawnLeaves: ; 8cb82 (23:4b82)
ld hl, Sprites + 2 ; Tile ID
ld hl, Sprite01TileID
xor a
ld c, $4
.loop2
ld [hli], a
inc hl
inc hl
ld c, 4
.OAMloop
ld [hli], a ; tile id
rept SPRITEOAMSTRUCT_LENGTH +- 1
inc hl
endr
inc a
dec c
jr nz, .loop2
ld hl, Sprites + 4 * 4
ld bc, SpritesEnd - (Sprites + 4 * 4)
jr nz, .OAMloop
ld hl, Sprite05
ld bc, SpritesEnd - Sprite05
xor a
call ByteFill
ret

View File

@ -73,20 +73,20 @@ HealMachineAnim: ; 12324
call .LoadPalettes
ld de, .HealMachineGFX
ld hl, vTiles0 tile $7c
lb bc, BANK(.HealMachineGFX), $2
lb bc, BANK(.HealMachineGFX), 2
call Request2bpp
ret
; 12393
.PC_LoadBallsOntoMachine: ; 12393
ld hl, Sprites + $80
ld hl, Sprite33
ld de, .PC_ElmsLab_OAM
call .PlaceHealingMachineTile
call .PlaceHealingMachineTile
jr .LoadBallsOntoMachine
.HOF_LoadBallsOntoMachine: ; 123a1
ld hl, Sprites + $80
ld hl, Sprite33
ld de, .HOF_OAM
.LoadBallsOntoMachine: ; 123a7
@ -249,17 +249,17 @@ INCBIN "gfx/overworld/heal_machine.2bpp"
ld a, [de]
add c
inc de
ld [hli], a
ld [hli], a ; y
ld a, [de]
add b
inc de
ld [hli], a
ld [hli], a ; x
ld a, [de]
inc de
ld [hli], a
ld [hli], a ; tile id
ld a, [de]
inc de
ld [hli], a
ld [hli], a ; attributes
pop bc
ret
; 124c1

View File

@ -346,15 +346,15 @@ EvolutionAnimation: ; 4e5e1
inc a
and $7
ld b, a
ld hl, Sprites + 3 ; attributes
ld c, 40
ld hl, Sprite01Attributes
ld c, NUM_SPRITE_OAM_STRUCTS
.loop6
ld a, [hl]
or b
ld [hli], a
inc hl
inc hl
ld [hli], a ; attributes
rept SPRITEOAMSTRUCT_LENGTH +- 1
inc hl
endr
dec c
jr nz, .loop6
pop bc

View File

@ -971,7 +971,7 @@ Intro_PlacePlayerSprite: ; 61cd
ld hl, vTiles0
call Request2bpp
ld hl, Sprites
ld hl, Sprite01
ld de, .sprites
ld a, [de]
inc de
@ -980,19 +980,19 @@ Intro_PlacePlayerSprite: ; 61cd
.loop
ld a, [de]
inc de
ld [hli], a
ld [hli], a ; y
ld a, [de]
inc de
ld [hli], a
ld [hli], a ; x
ld a, [de]
inc de
ld [hli], a
ld [hli], a ; tile id
ld b, 0
ld b, PAL_OW_RED
ld a, [wPlayerGender]
bit 0, a
jr z, .male
ld b, 1
ld b, PAL_OW_BLUE
.male
ld a, b
@ -1004,6 +1004,7 @@ Intro_PlacePlayerSprite: ; 61cd
.sprites ; 61fe
db 4
; y pxl, x pxl, tile offset
db 9 * 8 + 4, 9 * 8, 0
db 9 * 8 + 4, 10 * 8, 1
db 10 * 8 + 4, 9 * 8, 2

View File

@ -2793,6 +2793,7 @@ Function5903: ; 5903
db SPRITEMOVEDATA_STANDING_LEFT
db SPRITEMOVEDATA_STANDING_RIGHT
; 5920
_UpdateSprites:: ; 5920
ld a, [VramState]
bit 0, a
@ -2814,18 +2815,18 @@ _UpdateSprites:: ; 5920
bit 1, a
ld b, LOW(SpritesEnd)
jr z, .ok
ld b, 28 * 4
ld b, 28 * SPRITEOAMSTRUCT_LENGTH
.ok
ld a, [hUsedSpriteIndex]
cp b
ret nc
ld l, a
ld h, HIGH(Sprites)
ld de, 4
ld de, SPRITEOAMSTRUCT_LENGTH
ld a, b
ld c, SCREEN_HEIGHT_PX + 16
ld c, SCREEN_HEIGHT_PX + 2 * TILE_WIDTH
.loop
ld [hl], c
ld [hl], c ; y
add hl, de
cp l
jr nz, .loop
@ -3042,12 +3043,12 @@ PRIORITY_HIGH EQU $30
ld a, [hFFC0]
add [hl]
inc hl
ld [bc], a
ld [bc], a ; y
inc c
ld a, [hFFBF]
add [hl]
inc hl
ld [bc], a
ld [bc], a ; x
inc c
ld e, [hl]
inc hl
@ -3058,7 +3059,7 @@ PRIORITY_HIGH EQU $30
.nope1
add [hl]
inc hl
ld [bc], a
ld [bc], a ; tile id
inc c
ld a, e
bit 1, a
@ -3068,7 +3069,7 @@ PRIORITY_HIGH EQU $30
.nope2
and %11110000
or d
ld [bc], a
ld [bc], a ; attributes
inc c
ld a, [hUsedSpriteTile]
dec a

View File

@ -1456,33 +1456,33 @@ Function105688: ; 105688 (41:5688)
jr asm_105726
Function1056eb: ; 1056eb (41:56eb)
ld c, $10
.asm_1056ed
ld hl, Sprites
ld b, $8
.asm_1056f2
ld c, 16
.loop
ld hl, Sprite01YCoord
ld b, 8
.dec_y_loop
dec [hl]
rept 4
rept SPRITEOAMSTRUCT_LENGTH
inc hl
endr
dec b
jr nz, .asm_1056f2
ld hl, Sprites + $20
ld b, $8
.asm_1056ff
jr nz, .dec_y_loop
ld hl, Sprite09YCoord
ld b, 8
.inc_y_loop
inc [hl]
rept 4
rept SPRITEOAMSTRUCT_LENGTH
inc hl
endr
dec b
jr nz, .asm_1056ff
jr nz, .inc_y_loop
dec c
ret z
push bc
ld c, 4
call DelayFrames
pop bc
jr .asm_1056ed
jr .loop
Function105712: ; 105712 (41:5712)
call Function105777
@ -1580,7 +1580,7 @@ Function1057d7: ; 1057d7 (41:57d7)
ld a, BANK(MysteryGiftJP_GFX)
lb bc, 4, 0
call FarCopyBytes
ld hl, MysteryGiftJP_GFX + $400
ld hl, MysteryGiftJP_GFX + $40 tiles
ld de, vTiles0 tile $00
ld a, BANK(MysteryGiftJP_GFX)
ld bc, $80
@ -1656,9 +1656,9 @@ Function1057d7: ; 1057d7 (41:57d7)
ld [hl], $3c
hlcoord 17, 15
ld [hl], $3e
ld de, Sprites
ld de, Sprite01
ld hl, .OAM_data
ld bc, $40
ld bc, 16 * SPRITEOAMSTRUCT_LENGTH
call CopyBytes
call EnableLCD
call WaitBGMap

View File

@ -2050,7 +2050,7 @@ Pokedex_PutOldModeCursorOAM: ; 41157 (10:5157)
dsprite 5, 0, 19, -2, $32, 7 | X_FLIP | Y_FLIP
dsprite 5, 0, 20, -2, $31, 7 | X_FLIP | Y_FLIP
dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP
db $ff
db -1
.CursorAtTopOAM: ; 411c8
; OAM data for when the cursor is at the top of the list. The tiles at the top
@ -2079,7 +2079,7 @@ Pokedex_PutOldModeCursorOAM: ; 41157 (10:5157)
dsprite 5, 0, 19, -2, $32, 7 | X_FLIP | Y_FLIP
dsprite 5, 0, 20, -2, $31, 7 | X_FLIP | Y_FLIP
dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP
db $ff
db -1
Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229)
ld hl, .CursorOAM
@ -2107,7 +2107,7 @@ Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229)
dsprite 5, 3, 18, 0, $32, 7 | X_FLIP | Y_FLIP
dsprite 5, 3, 19, 0, $31, 7 | X_FLIP | Y_FLIP
dsprite 4, 3, 19, 0, $30, 7 | X_FLIP | Y_FLIP
db $ff
db -1
Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281)
ld a, [wCurrentDexMode]
@ -2142,28 +2142,28 @@ Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281)
dsprite 5, 3, 19, -2, $32, 7 | X_FLIP | Y_FLIP
dsprite 5, 3, 20, -2, $31, 7 | X_FLIP | Y_FLIP
dsprite 4, 3, 20, -2, $30, 7 | X_FLIP | Y_FLIP
db $ff
db -1
Pokedex_LoadCursorOAM: ; 412f1 (10:52f1)
ld de, Sprites
ld de, Sprite01
.loop
ld a, [hl]
cp $ff
cp -1
ret z
ld a, [wDexListingCursor]
and $7
swap a
add [hl]
add [hl] ; y
inc hl
ld [de], a
inc de
ld a, [hli]
ld a, [hli] ; x
ld [de], a
inc de
ld a, [hli]
ld a, [hli] ; tile id
ld [de], a
inc de
ld a, [hli]
ld a, [hli] ; attributes
ld [de], a
inc de
jr .loop

View File

@ -41,15 +41,15 @@ AnimateDexSearchSlowpoke: ; 441cf
DoDexSearchSlowpokeFrame: ; 44207
ld a, [wDexSearchSlowpokeFrame]
ld hl, .SlowpokeSpriteData
ld de, Sprites
ld de, Sprite01
.loop
ld a, [hli]
cp -1
ret z
ld [de], a
ld [de], a ; y
inc de
ld a, [hli]
ld [de], a
ld [de], a ; x
inc de
ld a, [wDexSearchSlowpokeFrame]
ld b, a
@ -57,10 +57,10 @@ DoDexSearchSlowpokeFrame: ; 44207
add b
add [hl]
inc hl
ld [de], a
ld [de], a ; tile id
inc de
ld a, [hli]
ld [de], a
ld [de], a ; attributes
inc de
jr .loop

View File

@ -2596,7 +2596,7 @@ _Area: ; 91d11
ld e, a
farcall FindNest ; load nest landmarks into TileMap[0,0]
decoord 0, 0
ld hl, Sprites
ld hl, Sprite01
.nestloop
ld a, [de]
and a
@ -2609,14 +2609,14 @@ _Area: ; 91d11
; load into OAM
ld a, d
sub 4
ld [hli], a
ld [hli], a ; y
ld a, e
sub 4
ld [hli], a
ld a, $7f ; nest icon in this context
ld [hli], a
ld [hli], a ; x
ld a, $7f ; nest icon
ld [hli], a ; tile id
xor a
ld [hli], a
ld [hli], a ; attributes
; next
pop de
inc de
@ -2640,37 +2640,37 @@ _Area: ; 91d11
ld c, e
ld b, d
ld de, .PlayerOAM
ld hl, Sprites
ld hl, Sprite01
.ShowPlayerLoop:
ld a, [de]
cp $80
jr z, .clear_oam
add b
ld [hli], a
ld [hli], a ; y
inc de
ld a, [de]
add c
ld [hli], a
ld [hli], a ; x
inc de
ld a, [de]
add $78 ; where the player's sprite is loaded
ld [hli], a
ld [hli], a ; tile id
inc de
push bc
ld c, 0 ; RED
ld c, PAL_OW_RED
ld a, [wPlayerGender]
bit 0, a
jr z, .got_gender
inc c ; BLUE
.got_gender
jr z, .male
inc c ; PAL_OW_BLUE
.male
ld a, c
ld [hli], a
ld [hli], a ; attributes
pop bc
jr .ShowPlayerLoop
.clear_oam
ld hl, Sprites + 4 * 4
ld bc, SpritesEnd - (Sprites + 4 * 4)
ld hl, Sprite05
ld bc, SpritesEnd - Sprite05
xor a
call ByteFill
ret
@ -2678,6 +2678,7 @@ _Area: ; 91d11
; 91e9c
.PlayerOAM: ; 91e9c
; y pxl, x pxl, tile offset
db -1 * 8, -1 * 8, 0 ; top left
db -1 * 8, 0 * 8, 1 ; top right
db 0 * 8, -1 * 8, 2 ; bottom left

View File

@ -13,7 +13,7 @@ LoadPushOAM:: ; 4031
.PushOAM: ; 403f
ld a, HIGH(Sprites)
ld [rDMA], a
ld a, (SpritesEnd - Sprites) / 4 ; 40
ld a, NUM_SPRITE_OAM_STRUCTS
.pushoam_loop
dec a
jr nz, .pushoam_loop

View File

@ -25,13 +25,13 @@ _SwitchPartyMons:
ld a, " "
call ByteFill
pop af
ld hl, Sprites
ld bc, $10
ld hl, Sprite01
ld bc, 4 * SPRITEOAMSTRUCT_LENGTH
call AddNTimes
ld de, $4
ld c, $4
ld de, SPRITEOAMSTRUCT_LENGTH
ld c, 4
.gfx_loop
ld [hl], $a0
ld [hl], SCREEN_WIDTH_PX ; y (off-screen)
add hl, de
dec c
jr nz, .gfx_loop

View File

@ -260,15 +260,15 @@ Function9282c: ; 9282c
inc [hl]
and $7
ret nz
ld hl, Sprites + 16 * 4 + 2
ld c, 40 - 16
ld hl, Sprite17TileID
ld c, NUM_SPRITE_OAM_STRUCTS - 16
.loop
ld a, [hl]
xor $20
ld [hli], a
inc hl
inc hl
xor %00100000
ld [hli], a ; tile id
rept SPRITEOAMSTRUCT_LENGTH +- 1
inc hl
endr
dec c
jr nz, .loop
ret
@ -670,7 +670,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98)
ld bc, wReel1
ld hl, REEL_OAM_ADDR
add hl, bc
ld de, Sprites + 16 * 4
ld de, Sprite17
ld [hl], e
inc hl
ld [hl], d
@ -688,7 +688,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98)
ld bc, wReel2
ld hl, REEL_OAM_ADDR
add hl, bc
ld de, Sprites + 24 * 4
ld de, Sprite25
ld [hl], e
inc hl
ld [hl], d
@ -706,7 +706,7 @@ Slots_InitReelTiles: ; 92a98 (24:6a98)
ld bc, wReel3
ld hl, REEL_OAM_ADDR
add hl, bc
ld de, Sprites + 32 * 4
ld de, Sprite33
ld [hl], e
inc hl
ld [hl], d
@ -821,34 +821,34 @@ Slots_UpdateReelPositionAndOAM: ; 92b53 (24:6b53)
ld l, a
.loop
ld a, [wCurrReelYCoord]
ld [hli], a
ld [hli], a ; y
ld a, [wCurrReelXCoord]
ld [hli], a
ld [hli], a ; x
ld a, [de]
ld [hli], a
ld [hli], a ; tile id
srl a
srl a
set 7, a
ld [hli], a
set OAM_PRIORITY, a
ld [hli], a ; attributes
ld a, [wCurrReelYCoord]
ld [hli], a
ld [hli], a ; y
ld a, [wCurrReelXCoord]
add 1 * 8
ld [hli], a
add 1 * TILE_WIDTH
ld [hli], a ; x
ld a, [de]
inc a
inc a
ld [hli], a
ld [hli], a ; tile id
srl a
srl a
set 7, a
ld [hli], a
set OAM_PRIORITY, a
ld [hli], a ; attributes
inc de
ld a, [wCurrReelYCoord]
sub 2 * 8
sub 2 * TILE_WIDTH
ld [wCurrReelYCoord], a
cp 2 * 8
cp 2 * TILE_WIDTH
jr nz, .loop
ret

View File

@ -100,11 +100,11 @@ DoNextFrameForFirst16Sprites: ; 8cfa8 (23:4fa8)
ld a, [wCurrSpriteOAMAddr]
ld l, a
ld h, HIGH(Sprites + 16 * 4)
ld h, HIGH(Sprite17)
.loop2 ; Clear (Sprites + [wCurrSpriteOAMAddr] --> Sprites + $40)
ld a, l
cp LOW(Sprites + 16 * 4)
cp LOW(Sprite17)
jr nc, .done
xor a
ld [hli], a
@ -650,8 +650,8 @@ AnimateEndOfExpBar: ; 8e79d
; 8e7c6
.AnimateFrame: ; 8e7c6
ld hl, Sprites
ld c, $8
ld hl, Sprite01
ld c, 8 ; number of animated circles
.anim_loop
ld a, c
and a
@ -669,8 +669,8 @@ AnimateEndOfExpBar: ; 8e79d
call Sprites_Sine
pop hl
pop de
add 13 * 8
ld [hli], a
add 13 * TILE_WIDTH
ld [hli], a ; y
pop af
push de
@ -678,13 +678,13 @@ AnimateEndOfExpBar: ; 8e79d
call Sprites_Cosine
pop hl
pop de
add 10 * 8 + 4
ld [hli], a
add 10 * TILE_WIDTH + 4
ld [hli], a ; x
ld a, $0
ld [hli], a
ld [hli], a ; tile id
ld a, PAL_BATTLE_OB_BLUE
ld [hli], a
ld [hli], a ; attributes
jr .anim_loop
; 8e7f4

View File

@ -323,7 +323,7 @@ DrawTitleGraphic: ; 10eeef
; 10ef06
InitializeBackground: ; 10ef06
ld hl, Sprites
ld hl, Sprite01
ld d, -$22
ld e, $0
ld c, 5
@ -344,17 +344,17 @@ InitializeBackground: ; 10ef06
ld b, $40
.loop2
ld a, d
ld [hli], a
ld [hli], a ; y
ld a, b
ld [hli], a
ld [hli], a ; x
add $8
ld b, a
ld a, e
ld [hli], a
ld [hli], a ; tile id
inc e
inc e
ld a, $80
ld [hli], a
ld a, 0 | BEHIND_BG
ld [hli], a ; attributes
dec c
jr nz, .loop2
ret
@ -366,9 +366,9 @@ AnimateTitleCrystal: ; 10ef32
; Stop at y=6
; y is really from the bottom of the sprite, which is two tiles high
ld hl, Sprites
ld hl, Sprite01YCoord
ld a, [hl]
cp 6 + $10
cp 6 + 2 * TILE_WIDTH
ret z
; Move all 30 parts of the crystal down by 2
@ -376,10 +376,10 @@ AnimateTitleCrystal: ; 10ef32
.loop
ld a, [hl]
add 2
ld [hli], a
inc hl
inc hl
ld [hli], a ; y
rept SPRITEOAMSTRUCT_LENGTH +- 1
inc hl
endr
dec c
jr nz, .loop

View File

@ -470,8 +470,8 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448)
ld d, a
ld a, [de]
ld c, a
ld de, Sprites
ld b, 8
ld de, Sprite01
ld b, NUM_JOHTO_BADGES
.loop
srl c
push bc
@ -512,27 +512,27 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448)
ld hl, .facing2
.loop2
ld a, [hli]
cp $ff
cp -1
ret z
add b
ld [de], a
ld [de], a ; y
inc de
ld a, [hli]
add c
ld [de], a
ld [de], a ; x
inc de
ld a, [wcf65]
and $7f
add [hl]
ld [de], a
ld [de], a ; tile id
inc hl
inc de
ld a, [wcf66]
add [hl]
ld [de], a
ld [de], a ; attributes
inc hl
inc de
jr .loop2
@ -540,18 +540,17 @@ TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448)
; 254a7 (9:54a7)
.facing1 ; 254a7
; y, x, tile, OAM attributes
db 0, 0, 0, 0
db 0, 8, 1, 0
db 8, 0, 2, 0
db 8, 8, 3, 0
dsprite 0, 0, 0, 0, $00, 0
dsprite 0, 0, 1, 0, $01, 0
dsprite 1, 0, 0, 0, $02, 0
dsprite 1, 0, 1, 0, $03, 0
db -1
.facing2 ; 254b8
db 0, 0, 1, X_FLIP
db 0, 8, 0, X_FLIP
db 8, 0, 3, X_FLIP
db 8, 8, 2, X_FLIP
dsprite 0, 0, 0, 0, $01, 0 | X_FLIP
dsprite 0, 0, 1, 0, $00, 0 | X_FLIP
dsprite 1, 0, 0, 0, $03, 0 | X_FLIP
dsprite 1, 0, 1, 0, $02, 0 | X_FLIP
db -1
TrainerCard_JohtoBadgesOAM: ; 254c9

View File

@ -549,25 +549,25 @@ RedrawUnownPuzzlePieces: ; e14d9
ld hl, .OAM_NotHoldingPiece
.load
ld de, Sprites
ld de, Sprite01
.loop
ld a, [hli]
cp -1
ret z
add b
ld [de], a
ld [de], a ; y
inc de
ld a, [hli]
add c
ld [de], a
ld [de], a ; x
inc de
ld a, [wd002]
add [hl]
ld [de], a
ld [de], a ; tile id
inc hl
inc de
ld a, [hli]
ld [de], a
ld [de], a ; attributes
inc de
jr .loop
; e150f

View File

@ -32,7 +32,7 @@ UnusedTitleScreen: ; 10c000
ld hl, UnusedTitleBG_Tilemap
debgcoord 0, 0
ld bc, 32 * 32
ld bc, BG_MAP_WIDTH * BG_MAP_HEIGHT
.copy
ld a, 0
ld [rVBK], a
@ -49,8 +49,8 @@ UnusedTitleScreen: ; 10c000
jr nz, .copy
ld hl, UnusedTitleFG_OAM
ld de, Sprites
ld bc, $a0
ld de, Sprite01
ld bc, SPRITEOAMSTRUCT_LENGTH * NUM_SPRITE_OAM_STRUCTS
call CopyBytes
call EnableLCD

View File

@ -182,12 +182,12 @@ ClearSprites:: ; 300b
HideSprites:: ; 3016
; Set all OAM y-positions to 160 to hide them offscreen
ld hl, Sprites
ld de, 4 ; length of an OAM struct
ld b, (SpritesEnd - Sprites) / 4 ; number of OAM structs
ld a, 160 ; y
ld hl, Sprite01YCoord
ld de, SPRITEOAMSTRUCT_LENGTH
ld b, NUM_SPRITE_OAM_STRUCTS
ld a, SCREEN_WIDTH_PX
.loop
ld [hl], a
ld [hl], a ; y
add hl, de
dec b
jr nz, .loop

View File

@ -506,16 +506,16 @@ Function3d9f:: ; 3d9f
; Places a BCD number at the
; upper center of the screen.
; Unreferenced.
ld a, 4 * 8
ld [Sprites + 38 * 4], a
ld [Sprites + 39 * 4], a
ld a, 10 * 8
ld [Sprites + 38 * 4 + 1], a
ld a, 11 * 8
ld [Sprites + 39 * 4 + 1], a
ld a, 4 * TILE_WIDTH
ld [Sprite39YCoord], a
ld [Sprite40YCoord], a
ld a, 10 * TILE_WIDTH
ld [Sprite39XCoord], a
ld a, 11 * TILE_WIDTH
ld [Sprite40XCoord], a
xor a
ld [Sprites + 38 * 4 + 3], a
ld [Sprites + 39 * 4 + 3], a
ld [Sprite39Attributes], a
ld [Sprite40Attributes], a
ld a, [wc296]
cp 100
jr nc, .max
@ -525,17 +525,17 @@ Function3d9f:: ; 3d9f
swap a
and $f
add "0"
ld [Sprites + 38 * 4 + 2], a
ld [Sprite39TileID], a
ld a, b
and $f
add "0"
ld [Sprites + 39 * 4 + 2], a
ld [Sprite40TileID], a
ret
.max
ld a, "9"
ld [Sprites + 38 * 4 + 2], a
ld [Sprites + 39 * 4 + 2], a
ld [Sprite39TileID], a
ld [Sprite40TileID], a
ret
; 3dde

View File

@ -339,6 +339,19 @@ map_object: MACRO
ds 2
ENDM
sprite_oam_struct: MACRO
\1YCoord:: db
\1XCoord:: db
\1TileID:: db
\1Attributes:: db
; bit 7: priority
; bit 6: y flip
; bit 5: x flip
; bit 4: pal # (non-cgb)
; bit 3: vram bank (cgb only)
; bit 2-0: pal # (cgb only)
ENDM
sprite_anim_struct: MACRO
\1Index:: db
\1FramesetID:: db

View File

@ -400,7 +400,7 @@ SECTION "Move Animations", ROMX
INCLUDE "engine/events/bug_contest/display_stats.asm"
INCLUDE "engine/battle_anims/anim_commands.asm"
INCLUDE "engine/battle_anims/engine.asm"
INCLUDE "engine/battle_anims/core.asm"
INCLUDE "data/battle_anims/objects.asm"
INCLUDE "engine/battle_anims/functions.asm"
INCLUDE "engine/battle_anims/helpers.asm"

View File

@ -572,7 +572,7 @@ Function89448: ; 89448 (22:5448)
; Clears the Sprites array
push af
ld hl, Sprites
ld d, $10 * 6
ld d, 24 * SPRITEOAMSTRUCT_LENGTH
xor a
.loop
ld [hli], a
@ -1924,7 +1924,7 @@ Function89b97: ; 89b97 (22:5b97)
ld a, [hli]
ld h, [hl]
ld l, a
ld de, Sprites
ld de, Sprite01
.asm_89bb4
ld a, [hli]
cp $ff
@ -1934,19 +1934,19 @@ Function89b97: ; 89b97 (22:5b97)
.asm_89bbb
push hl
ld a, [hli]
ld [de], a
ld [de], a ; y
inc de
ld a, [hli]
add b
ld [de], a
ld [de], a ; x
inc de
ld a, $8
ld a, $08
add b
ld b, a
ld a, [hli]
ld a, [hli] ; tile id
ld [de], a
inc de
ld a, [hli]
ld a, [hli] ; attributes
ld [de], a
inc de
pop hl
@ -2014,10 +2014,10 @@ Function89c44: ; 89c44 (22:5c44)
pop de
ret
.asm_89c4f
ld hl, Sprites
ld hl, Sprite01
push de
ld a, b
ld [hli], a
ld [hli], a ; y
ld d, $8
ld a, e
and a
@ -2029,11 +2029,11 @@ Function89c44: ; 89c44 (22:5c44)
jr nz, .asm_89c5c
.asm_89c60
pop de
ld [hli], a
ld [hli], a ; x
ld a, d
ld [hli], a
ld [hli], a ; tile id
xor a
ld [hli], a
ld [hli], a ; attributes
ret
Function89c67: ; 89c67 (22:5c67)
@ -2124,20 +2124,20 @@ Function89cdf: ; 89cdf (22:5cdf)
ld c, a
ld e, $2
ld a, $2
ld hl, Sprites
ld hl, Sprite01
.asm_89cee
push af
push bc
ld d, $4
.asm_89cf2
ld a, b
ld [hli], a
ld [hli], a ; y
ld a, c
ld [hli], a
ld [hli], a ; x
ld a, e
ld [hli], a
ld [hli], a ; tile id
ld a, $1
ld [hli], a
ld [hli], a ; attributes
ld a, $8
add c
ld c, a
@ -3301,7 +3301,7 @@ asm_8a529: ; 8a529 (22:6529)
ld [hli], a
ld hl, Sprites
xor a
ld bc, $20
ld bc, 8 * SPRITEOAMSTRUCT_LENGTH
call ByteFill
ret

View File

@ -22,8 +22,8 @@ Function115dc3: ; 115dc3
xor a
ld [wc305], a
ld a, $a0
ld hl, Sprites + 31 * 4
ld bc, 8 * 4
ld hl, Sprite32
ld bc, 8 * SPRITEOAMSTRUCT_LENGTH
call ByteFill
ret
@ -34,8 +34,8 @@ Function115dd3: ; 115dd3
and a
ret z
ld a, $a0
ld hl, Sprites + 31 * 4
ld bc, 8 * 4
ld hl, Sprite32
ld bc, 8 * SPRITEOAMSTRUCT_LENGTH
call ByteFill
call Function115e22
ld a, [wc309]
@ -50,7 +50,7 @@ Function115dd3: ; 115dd3
ld d, a
push de
pop hl
ld de, Sprites + 31 * 4
ld de, Sprite32
ld a, [wc307]
ld c, a
ld a, [wc308]
@ -60,17 +60,17 @@ Function115dd3: ; 115dd3
push af
ld a, [hli]
add b
ld [de], a
ld [de], a ; y
inc de
ld a, [hli]
add c
ld [de], a
ld [de], a ; x
inc de
ld a, [hli]
ld [de], a
ld [de], a ; tile id
inc de
ld a, [hli]
ld [de], a
ld [de], a ; attributes
inc de
pop af
dec a
@ -361,7 +361,7 @@ Function11619d: ; 11619d
jr c, .asm_1161b4
ld a, $a0
ld hl, Sprites
ld bc, $0064
ld bc, 25 * SPRITEOAMSTRUCT_LENGTH
call ByteFill
.asm_1161b4
@ -586,22 +586,22 @@ Function1162f2: ; 1162f2
ld e, a
ld a, [hli]
sub e
ld de, Sprites + $24
ld de, Sprite10
.asm_116321
push af
ld a, [hli]
add b
ld [de], a
ld [de], a ; y
inc de
ld a, [hli]
add c
ld [de], a
ld [de], a ; x
inc de
ld a, [hli]
ld [de], a
ld [de], a ; tile id
inc de
ld a, [hli]
ld [de], a
ld [de], a ; attributes
inc de
pop af
dec a
@ -627,22 +627,22 @@ Function1162f2: ; 1162f2
ld e, a
ld a, [hli]
sub e
ld de, Sprites
ld de, Sprite01
.asm_11635a
push af
ld a, [hli]
add b
ld [de], a
ld [de], a ; y
inc de
ld a, [hli]
add c
ld [de], a
ld [de], a ; x
inc de
ld a, [hli]
ld [de], a
ld [de], a ; tile id
inc de
ld a, [hli]
ld [de], a
ld [de], a ; attributes
inc de
pop af
dec a
@ -669,7 +669,7 @@ Function11636e: ; 11636e
ld [rSVBK], a
ld a, $a0
ld hl, Sprites
ld bc, 16 * 4
ld bc, 16 * SPRITEOAMSTRUCT_LENGTH
call ByteFill
ld a, $90
ld [hWY], a
@ -697,7 +697,7 @@ Function1163c0: ; 1163c0
ld [rSVBK], a
ld a, $a0
ld hl, Sprites
ld bc, 16 * 4
ld bc, 16 * SPRITEOAMSTRUCT_LENGTH
call ByteFill
call DelayFrame
farcall Function14146

View File

@ -6930,7 +6930,7 @@ Function11b31b: ; 11b31b
db $39 ; 13
Function11b397: ; 11b397
ld de, Sprites
ld de, Sprite01
.loop
ld a, [hl]
cp $ff
@ -6939,20 +6939,20 @@ Function11b397: ; 11b397
and $7
swap a
add [hl]
inc hl ; 1
ld [de], a
inc hl
ld [de], a ; y
inc de
ld a, [hli] ; 2
ld [de], a
ld a, [hli]
ld [de], a ; x
inc de
ld a, [bc]
inc bc
ld [de], a
ld [de], a ; tile id
inc de
ld a, $5 ; OBPal 5
ld [de], a
ld a, $5
ld [de], a ; attributes
inc de
jr .loop
; 11b3b6
@ -6989,7 +6989,7 @@ Function11b3b6: ; 11b3b6
; 11b3d9
Function11b3d9: ; 11b3d9
ld de, Sprites + 28 * 4
ld de, Sprite29
push de
ld a, [wc7d2]
dec a

View File

@ -303,20 +303,46 @@ wc3fc:: ds 1
SECTION "Sprites", WRAM0
Sprites:: ; c400
; 4 bytes per sprite
; 40 sprites
; struct:
; y (px)
; x (px)
; tile id
; attributes:
; bit 7: priority
; bit 6: y flip
; bit 5: x flip
; bit 4: pal # (non-cgb)
; bit 3: vram bank (cgb only)
; bit 2-0: pal # (cgb only)
ds 4 * 40
Sprite01:: sprite_oam_struct Sprite01
Sprite02:: sprite_oam_struct Sprite02
Sprite03:: sprite_oam_struct Sprite03
Sprite04:: sprite_oam_struct Sprite04
Sprite05:: sprite_oam_struct Sprite05
Sprite06:: sprite_oam_struct Sprite06
Sprite07:: sprite_oam_struct Sprite07
Sprite08:: sprite_oam_struct Sprite08
Sprite09:: sprite_oam_struct Sprite09
Sprite10:: sprite_oam_struct Sprite10
Sprite11:: sprite_oam_struct Sprite11
Sprite12:: sprite_oam_struct Sprite12
Sprite13:: sprite_oam_struct Sprite13
Sprite14:: sprite_oam_struct Sprite14
Sprite15:: sprite_oam_struct Sprite15
Sprite16:: sprite_oam_struct Sprite16
Sprite17:: sprite_oam_struct Sprite17
Sprite18:: sprite_oam_struct Sprite18
Sprite19:: sprite_oam_struct Sprite19
Sprite20:: sprite_oam_struct Sprite20
Sprite21:: sprite_oam_struct Sprite21
Sprite22:: sprite_oam_struct Sprite22
Sprite23:: sprite_oam_struct Sprite23
Sprite24:: sprite_oam_struct Sprite24
Sprite25:: sprite_oam_struct Sprite25
Sprite26:: sprite_oam_struct Sprite26
Sprite27:: sprite_oam_struct Sprite27
Sprite28:: sprite_oam_struct Sprite28
Sprite29:: sprite_oam_struct Sprite29
Sprite30:: sprite_oam_struct Sprite30
Sprite31:: sprite_oam_struct Sprite31
Sprite32:: sprite_oam_struct Sprite32
Sprite33:: sprite_oam_struct Sprite33
Sprite34:: sprite_oam_struct Sprite34
Sprite35:: sprite_oam_struct Sprite35
Sprite36:: sprite_oam_struct Sprite36
Sprite37:: sprite_oam_struct Sprite37
Sprite38:: sprite_oam_struct Sprite38
Sprite39:: sprite_oam_struct Sprite39
Sprite40:: sprite_oam_struct Sprite40
SpritesEnd::