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 EXP_BAR_LENGTH_PX EQU EXP_BAR_LENGTH * TILE_WIDTH ; pixels
PALPACKET_LENGTH EQU $10 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 ; 3fc5b
.LoadTrainerBackpicAsOAM: ; 3fc5b .LoadTrainerBackpicAsOAM: ; 3fc5b
ld hl, Sprites ld hl, Sprite01
xor a xor a
ld [hMapObjectIndexBuffer], a ld [hMapObjectIndexBuffer], a
ld b, $6 ld b, 6
ld e, 21 * 8 ld e, (SCREEN_WIDTH + 1) * TILE_WIDTH
.outer_loop .outer_loop
ld c, $3 ld c, 3
ld d, 8 * 8 ld d, 8 * TILE_WIDTH
.inner_loop .inner_loop
ld [hl], d ld [hl], d ; y
inc hl inc hl
ld [hl], e ld [hl], e ; x
inc hl inc hl
ld a, [hMapObjectIndexBuffer] ld a, [hMapObjectIndexBuffer]
ld [hli], a ld [hli], a ; tile id
inc a inc a
ld [hMapObjectIndexBuffer], a ld [hMapObjectIndexBuffer], a
ld a, $1 ld a, PAL_BATTLE_OB_PLAYER
ld [hli], a ld [hli], a ; attributes
ld a, d ld a, d
add $8 add 1 * TILE_WIDTH
ld d, a ld d, a
dec c dec c
jr nz, .inner_loop jr nz, .inner_loop
@ -9357,7 +9357,7 @@ CopyBackpic: ; 3fc30
add $3 add $3
ld [hMapObjectIndexBuffer], a ld [hMapObjectIndexBuffer], a
ld a, e ld a, e
add $8 add 1 * TILE_WIDTH
ld e, a ld e, a
dec b dec b
jr nz, .outer_loop jr nz, .outer_loop

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1456,33 +1456,33 @@ Function105688: ; 105688 (41:5688)
jr asm_105726 jr asm_105726
Function1056eb: ; 1056eb (41:56eb) Function1056eb: ; 1056eb (41:56eb)
ld c, $10 ld c, 16
.asm_1056ed .loop
ld hl, Sprites ld hl, Sprite01YCoord
ld b, $8 ld b, 8
.asm_1056f2 .dec_y_loop
dec [hl] dec [hl]
rept 4 rept SPRITEOAMSTRUCT_LENGTH
inc hl inc hl
endr endr
dec b dec b
jr nz, .asm_1056f2 jr nz, .dec_y_loop
ld hl, Sprites + $20 ld hl, Sprite09YCoord
ld b, $8 ld b, 8
.asm_1056ff .inc_y_loop
inc [hl] inc [hl]
rept 4 rept SPRITEOAMSTRUCT_LENGTH
inc hl inc hl
endr endr
dec b dec b
jr nz, .asm_1056ff jr nz, .inc_y_loop
dec c dec c
ret z ret z
push bc push bc
ld c, 4 ld c, 4
call DelayFrames call DelayFrames
pop bc pop bc
jr .asm_1056ed jr .loop
Function105712: ; 105712 (41:5712) Function105712: ; 105712 (41:5712)
call Function105777 call Function105777
@ -1580,7 +1580,7 @@ Function1057d7: ; 1057d7 (41:57d7)
ld a, BANK(MysteryGiftJP_GFX) ld a, BANK(MysteryGiftJP_GFX)
lb bc, 4, 0 lb bc, 4, 0
call FarCopyBytes call FarCopyBytes
ld hl, MysteryGiftJP_GFX + $400 ld hl, MysteryGiftJP_GFX + $40 tiles
ld de, vTiles0 tile $00 ld de, vTiles0 tile $00
ld a, BANK(MysteryGiftJP_GFX) ld a, BANK(MysteryGiftJP_GFX)
ld bc, $80 ld bc, $80
@ -1656,9 +1656,9 @@ Function1057d7: ; 1057d7 (41:57d7)
ld [hl], $3c ld [hl], $3c
hlcoord 17, 15 hlcoord 17, 15
ld [hl], $3e ld [hl], $3e
ld de, Sprites ld de, Sprite01
ld hl, .OAM_data ld hl, .OAM_data
ld bc, $40 ld bc, 16 * SPRITEOAMSTRUCT_LENGTH
call CopyBytes call CopyBytes
call EnableLCD call EnableLCD
call WaitBGMap 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, 19, -2, $32, 7 | X_FLIP | Y_FLIP
dsprite 5, 0, 20, -2, $31, 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 dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP
db $ff db -1
.CursorAtTopOAM: ; 411c8 .CursorAtTopOAM: ; 411c8
; OAM data for when the cursor is at the top of the list. The tiles at the top ; 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, 19, -2, $32, 7 | X_FLIP | Y_FLIP
dsprite 5, 0, 20, -2, $31, 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 dsprite 4, 0, 20, -2, $30, 7 | X_FLIP | Y_FLIP
db $ff db -1
Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229) Pokedex_PutNewModeABCModeCursorOAM: ; 41229 (10:5229)
ld hl, .CursorOAM 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, 18, 0, $32, 7 | X_FLIP | Y_FLIP
dsprite 5, 3, 19, 0, $31, 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 dsprite 4, 3, 19, 0, $30, 7 | X_FLIP | Y_FLIP
db $ff db -1
Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281) Pokedex_UpdateSearchResultsCursorOAM: ; 41281 (10:5281)
ld a, [wCurrentDexMode] 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, 19, -2, $32, 7 | X_FLIP | Y_FLIP
dsprite 5, 3, 20, -2, $31, 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 dsprite 4, 3, 20, -2, $30, 7 | X_FLIP | Y_FLIP
db $ff db -1
Pokedex_LoadCursorOAM: ; 412f1 (10:52f1) Pokedex_LoadCursorOAM: ; 412f1 (10:52f1)
ld de, Sprites ld de, Sprite01
.loop .loop
ld a, [hl] ld a, [hl]
cp $ff cp -1
ret z ret z
ld a, [wDexListingCursor] ld a, [wDexListingCursor]
and $7 and $7
swap a swap a
add [hl] add [hl] ; y
inc hl inc hl
ld [de], a ld [de], a
inc de inc de
ld a, [hli] ld a, [hli] ; x
ld [de], a ld [de], a
inc de inc de
ld a, [hli] ld a, [hli] ; tile id
ld [de], a ld [de], a
inc de inc de
ld a, [hli] ld a, [hli] ; attributes
ld [de], a ld [de], a
inc de inc de
jr .loop jr .loop

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -339,6 +339,19 @@ map_object: MACRO
ds 2 ds 2
ENDM 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 sprite_anim_struct: MACRO
\1Index:: db \1Index:: db
\1FramesetID:: db \1FramesetID:: db

View File

@ -400,7 +400,7 @@ SECTION "Move Animations", ROMX
INCLUDE "engine/events/bug_contest/display_stats.asm" INCLUDE "engine/events/bug_contest/display_stats.asm"
INCLUDE "engine/battle_anims/anim_commands.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 "data/battle_anims/objects.asm"
INCLUDE "engine/battle_anims/functions.asm" INCLUDE "engine/battle_anims/functions.asm"
INCLUDE "engine/battle_anims/helpers.asm" INCLUDE "engine/battle_anims/helpers.asm"

View File

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

View File

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

View File

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

View File

@ -303,20 +303,46 @@ wc3fc:: ds 1
SECTION "Sprites", WRAM0 SECTION "Sprites", WRAM0
Sprites:: ; c400 Sprites:: ; c400
; 4 bytes per sprite Sprite01:: sprite_oam_struct Sprite01
; 40 sprites Sprite02:: sprite_oam_struct Sprite02
; struct: Sprite03:: sprite_oam_struct Sprite03
; y (px) Sprite04:: sprite_oam_struct Sprite04
; x (px) Sprite05:: sprite_oam_struct Sprite05
; tile id Sprite06:: sprite_oam_struct Sprite06
; attributes: Sprite07:: sprite_oam_struct Sprite07
; bit 7: priority Sprite08:: sprite_oam_struct Sprite08
; bit 6: y flip Sprite09:: sprite_oam_struct Sprite09
; bit 5: x flip Sprite10:: sprite_oam_struct Sprite10
; bit 4: pal # (non-cgb) Sprite11:: sprite_oam_struct Sprite11
; bit 3: vram bank (cgb only) Sprite12:: sprite_oam_struct Sprite12
; bit 2-0: pal # (cgb only) Sprite13:: sprite_oam_struct Sprite13
ds 4 * 40 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:: SpritesEnd::