Level selection menu: sprite anim data (#12)

This commit is contained in:
xCrystal
2023-08-20 13:03:33 +02:00
parent fc2e757c57
commit 84d5bdb55d
8 changed files with 229 additions and 3 deletions

View File

@@ -620,7 +620,7 @@ _CGB_LevelSelectionMenu:
ld a, b
or c
jr nz, .loop
; apply pals and attrmap
; apply and commit pals and attrmap
call ApplyAttrmap
call ApplyPals
ld a, TRUE

View File

@@ -49,6 +49,10 @@ DoAnimFrame:
dw AnimSeq_IntroUnown
dw AnimSeq_IntroUnownF
dw AnimSeq_IntroSuicuneAway
dw AnimSeq_LevelSelectionMenuWalkDown
dw AnimSeq_LevelSelectionMenuWalkUp
dw AnimSeq_LevelSelectionMenuWalkLeft
dw AnimSeq_LevelSelectionMenuWalkRight
assert_table_length NUM_SPRITE_ANIM_SEQS
AnimSeq_Null:
@@ -841,6 +845,45 @@ AnimSeq_Celebi:
farcall UpdateCelebiPosition
ret
AnimSeq_LevelSelectionMenuWalkDown:
call LevelSelectionMenuHandleMovement
ret nc
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
inc [hl]
ret
AnimSeq_LevelSelectionMenuWalkUp:
call LevelSelectionMenuHandleMovement
ret nc
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
dec [hl]
ret
AnimSeq_LevelSelectionMenuWalkLeft:
call LevelSelectionMenuHandleMovement
ret nc
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
dec [hl]
ret
AnimSeq_LevelSelectionMenuWalkRight:
call LevelSelectionMenuHandleMovement
ret nc
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
inc [hl]
ret
LevelSelectionMenuHandleMovement:
ld a, [wLevelSelectionMenuStandingStill]
and a
ret nz ; nc
scf
ret ; c
AnimSeqs_AnonJumptable:
ld hl, sp+0
ld e, [hl]

View File

@@ -22,11 +22,14 @@ LevelSelectionMenu::
ld [wLevelSelectionMenuCurrentLandmark], a
call LevelSelectionMenu_GetLandmarkPage
ld [wLevelSelectionMenuCurrentPage], a
ld a, TRUE
ld [wLevelSelectionMenuStandingStill], a
call LevelSelectionMenu_InitTilemap
ld b, CGB_LEVEL_SELECTION_MENU
call GetCGBLayout
call GetCGBLayout ; apply and commit attrmap (takes 4 frames) and pals
call SetPalettes
call LevelSelectionMenu_InitPlayerSprite
ld de, MUSIC_GAME_CORNER
call PlayMusic
@@ -64,7 +67,7 @@ LevelSelectionMenu_InitTilemap:
.loop
ld a, [de]
cp $ff ; tilemaps are $ff-terminated
jp z, WaitBGMap2 ; takes 8 frames to commit tilemap and attrmap
jp z, WaitBGMap ; commit tilemap (4 frames)
ld a, [de]
ld [hli], a
inc de
@@ -76,6 +79,9 @@ LevelSelectionMenu_InitTilemap:
dw LevelSelectionMenuPage3Tilemap
dw LevelSelectionMenuPage4Tilemap
LevelSelectionMenu_InitPlayerSprite:
ret
LevelSelectionMenu_GetLandmarkPage:
; Return page number (a) of landmark a.
push hl