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,10 +2678,11 @@ _Area: ; 91d11
; 91e9c
.PlayerOAM: ; 91e9c
db -1 * 8, -1 * 8, 0 ; top left
db -1 * 8, 0 * 8, 1 ; top right
db 0 * 8, -1 * 8, 2 ; bottom left
db 0 * 8, 0 * 8, 3 ; bottom right
; 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
db 0 * 8, 0 * 8, 3 ; bottom right
db $80 ; terminator
; 91ea9

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

Some files were not shown because too many files have changed in this diff Show More