Board menu: die roll input and animation (#11)

This commit is contained in:
xCrystal
2023-09-25 21:57:47 +02:00
parent 2cbe0e1764
commit db7d9c7063
11 changed files with 134 additions and 9 deletions

View File

@@ -807,7 +807,6 @@ PlayerMovementPointers:
CheckMenuOW:
xor a
ldh [hMenuReturn], a
ldh [hUnusedByte], a
ldh a, [hJoyPressed]
bit SELECT_F, a

View File

@@ -3074,10 +3074,12 @@ InitSprites:
InitSecondarySprites:
ld a, [wDisplaySecondarySprites]
bit SECONDARYSPRITES_BOARD_MENU_F, a
call nz, .InitBoardMenuSprites
call nz, InitBoardMenuSprites
bit SECONDARYSPRITES_DIE_ROLL_F, a
call nz, InitRollDieSprites
ret
.InitBoardMenuSprites:
InitBoardMenuSprites:
push af
ld hl, BoardMenuOAM
@@ -3102,4 +3104,30 @@ InitSecondarySprites:
pop af
ret
InitRollDieSprites:
push af
ld hl, DieRollOAM
ld a, [wDieRoll]
dec a
ld bc, DIE_SIZE * SPRITEOAMSTRUCT_LENGTH
call AddNTimes
; find the beginning of free space in OAM, and assure there's space for a DIE_SIZE object
ldh a, [hUsedSpriteIndex]
cp (NUM_SPRITE_OAM_STRUCTS * SPRITEOAMSTRUCT_LENGTH) - (DIE_SIZE * SPRITEOAMSTRUCT_LENGTH) + 1
jr nc, .oam_full
; copy the sprite data (DIE_SIZE objects) of that item to the available space in OAM
ld e, a
ld d, HIGH(wShadowOAM)
ld bc, DIE_SIZE * SPRITEOAMSTRUCT_LENGTH
call CopyBytes
ldh a, [hUsedSpriteIndex]
add (DIE_SIZE * SPRITEOAMSTRUCT_LENGTH)
ldh [hUsedSpriteIndex], a
.oam_full
pop af
ret
INCLUDE "data/sprites/secondary_sprites.asm"