Board menu: move die number animation (#11)

This commit is contained in:
xCrystal
2023-09-27 19:25:47 +02:00
parent 98d69d4e04
commit 1f2be83ebc
11 changed files with 154 additions and 33 deletions

View File

@@ -3084,6 +3084,8 @@ InitSecondarySprites:
call nz, InitBoardMenuSprites
bit SECONDARYSPRITES_DIE_ROLL_F, a
call nz, InitRollDieSprites
bit SECONDARYSPRITES_SPACES_LEFT_F, a
call nz, InitSpacesLeftNumberSprites
ret
InitBoardMenuSprites:
@@ -3137,4 +3139,30 @@ InitRollDieSprites:
pop af
ret
InitSpacesLeftNumberSprites:
push af
ld hl, SpacesLeftNumberOAM
ld a, [wSpacesLeft]
dec a
ld bc, DIE_NUMBER_SIZE * SPRITEOAMSTRUCT_LENGTH
call AddNTimes
; find the beginning of free space in OAM, and assure there's space for a DIE_NUMBER_SIZE object
ldh a, [hUsedSpriteIndex]
cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (DIE_NUMBER_SIZE * SPRITEOAMSTRUCT_LENGTH) + 1
jr nc, .oam_full
; copy the sprite data (DIE_NUMBER_SIZE objects) of that item to the available space in OAM
ld e, a
ld d, HIGH(wShadowOAM)
ld bc, DIE_NUMBER_SIZE * SPRITEOAMSTRUCT_LENGTH
call CopyBytes
ldh a, [hUsedSpriteIndex]
add (DIE_NUMBER_SIZE * SPRITEOAMSTRUCT_LENGTH)
ldh [hUsedSpriteIndex], a
.oam_full
pop af
ret
INCLUDE "data/sprites/secondary_sprites.asm"