Level selection menu: entry transition events (#12) (#35) [commit 3]

This commit is contained in:
xCrystal 2024-02-03 14:22:00 +01:00
parent 403d2aee7e
commit 435d441d58
8 changed files with 64 additions and 56 deletions

View File

@ -20,7 +20,6 @@ DEF SPRITEANIMSTRUCT_LENGTH EQU _RS
DEF NUM_SPRITE_ANIM_STRUCTS EQU 10 ; see wSpriteAnimationStructs
; wSpriteAnimDict keys (see wram.asm)
; UnusedSpriteAnimGFX indexes (see data/sprite_anims/unused_gfx.asm)
const_def
const SPRITE_ANIM_DICT_DEFAULT ; 0
const SPRITE_ANIM_DICT_BOARD_MENU ; 1
@ -92,6 +91,7 @@ DEF NUM_SPRITEANIMDICT_ENTRIES EQU 10
const SPRITE_ANIM_OBJ_BOARD_MENU_BREAK_DIE ; 35
const SPRITE_ANIM_OBJ_BOARD_MENU_APPEAR_DIE_NUMBER ; 36
const SPRITE_ANIM_OBJ_BOARD_MENU_MOVE_DIE_NUMBER ; 37
const SPRITE_ANIM_OBJ_LEVEL_SELECTION_MENU_HIGHLIGHT_LEVEL ; 38
DEF NUM_SPRITE_ANIM_OBJS EQU const_value
; DoSpriteAnimFrame.Jumptable indexes (see engine/sprite_anims/functions.asm)
@ -217,6 +217,7 @@ DEF NUM_SPRITE_ANIM_FUNCS EQU const_value
const SPRITE_ANIM_FRAMESET_BOARD_MENU_BREAK_DIE ; 50
const SPRITE_ANIM_FRAMESET_BOARD_MENU_APPEAR_DIE_NUMBER ; 51
const SPRITE_ANIM_FRAMESET_BOARD_MENU_MOVE_DIE_NUMBER ; 52
const SPRITE_ANIM_FRAMESET_LEVEL_SELECTION_MENU_HIGHLIGHT_LEVEL ; 53
DEF NUM_SPRITE_ANIM_FRAMESETS EQU const_value
; SpriteAnimOAMData indexes (see data/sprite_anims/oam.asm)
@ -382,6 +383,8 @@ DEF NUM_SPRITE_ANIM_FRAMESETS EQU const_value
const SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_3 ; 9e
const SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_4 ; 9f
const SPRITE_ANIM_OAMSET_BOARD_MENU_DIE_NUMBER ; a0
const SPRITE_ANIM_OAMSET_LSM_HIGHLIGHT_LEVEL_1 ; a1
const SPRITE_ANIM_OAMSET_LSM_HIGHLIGHT_LEVEL_2 ; a2
DEF NUM_SPRITE_ANIM_OAMSETS EQU const_value
assert NUM_SPRITE_ANIM_OAMSETS <= FIRST_OAM_CMD, \

View File

@ -78,6 +78,7 @@ SpriteAnimFrameData:
dw .Frameset_BoardMenuBreakDie
dw .Frameset_BoardMenuAppearDieNumber
dw .Frameset_BoardMenuMoveDieNumber
dw .Frameset_LevelSelectionMenuHighlightLevel
assert_table_length NUM_SPRITE_ANIM_FRAMESETS
.Frameset_00:
@ -586,3 +587,12 @@ SpriteAnimFrameData:
.Frameset_BoardMenuMoveDieNumber:
oamframe SPRITE_ANIM_OAMSET_BOARD_MENU_DIE_NUMBER, 42
oamdelete
.Frameset_LevelSelectionMenuHighlightLevel:
oamframe SPRITE_ANIM_OAMSET_LSM_HIGHLIGHT_LEVEL_1, 15
oamframe SPRITE_ANIM_OAMSET_LSM_HIGHLIGHT_LEVEL_2, 15
oamframe SPRITE_ANIM_OAMSET_LSM_HIGHLIGHT_LEVEL_1, 15
oamframe SPRITE_ANIM_OAMSET_LSM_HIGHLIGHT_LEVEL_2, 15
oamframe SPRITE_ANIM_OAMSET_LSM_HIGHLIGHT_LEVEL_1, 15
oamframe SPRITE_ANIM_OAMSET_LSM_HIGHLIGHT_LEVEL_2, 15
oamdelete

View File

@ -168,6 +168,8 @@ SpriteAnimOAMData:
spriteanimoam $00, .OAMData_BreakDie3 ; SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_3
spriteanimoam $00, .OAMData_BreakDie4 ; SPRITE_ANIM_OAMSET_BOARD_MENU_BREAK_DIE_4
spriteanimoam $00, .OAMData_DieNumber ; SPRITE_ANIM_OAMSET_BOARD_MENU_DIE_NUMBER
spriteanimoam $00, .OAMData_HighlightLevel1 ; SPRITE_ANIM_OAMSET_LSM_HIGHLIGHT_LEVEL_1
spriteanimoam $00, .OAMData_HighlightLevel2 ; SPRITE_ANIM_OAMSET_LSM_HIGHLIGHT_LEVEL_2
assert_table_length NUM_SPRITE_ANIM_OAMSETS
@ -1186,3 +1188,17 @@ SpriteAnimOAMData:
dbsprite -1, 0, 4, 0, $51, 1
dbsprite 0, 0, 4, 0, $52, 1
dbsprite 1, 0, 4, 0, $53, 1
.OAMData_HighlightLevel1:
db 4
dbsprite -1, -1, 0, 0, 24 + NUM_DIRECTIONS + NUM_LEVEL_STAGES * 2 + NUM_DAYTIMES * 4 + 0, 0
dbsprite 0, -1, 0, 0, 24 + NUM_DIRECTIONS + NUM_LEVEL_STAGES * 2 + NUM_DAYTIMES * 4 + 1, 0
dbsprite -1, 0, 0, 0, 24 + NUM_DIRECTIONS + NUM_LEVEL_STAGES * 2 + NUM_DAYTIMES * 4 + 2, 0
dbsprite 0, 0, 0, 0, 24 + NUM_DIRECTIONS + NUM_LEVEL_STAGES * 2 + NUM_DAYTIMES * 4 + 3, 0
.OAMData_HighlightLevel2:
db 4
dbsprite -1, -1, 0, 0, 24 + NUM_DIRECTIONS + NUM_LEVEL_STAGES * 2 + NUM_DAYTIMES * 4 + 4, 0
dbsprite 0, -1, 0, 0, 24 + NUM_DIRECTIONS + NUM_LEVEL_STAGES * 2 + NUM_DAYTIMES * 4 + 5, 0
dbsprite -1, 0, 0, 0, 24 + NUM_DIRECTIONS + NUM_LEVEL_STAGES * 2 + NUM_DAYTIMES * 4 + 6, 0
dbsprite 0, 0, 0, 0, 24 + NUM_DIRECTIONS + NUM_LEVEL_STAGES * 2 + NUM_DAYTIMES * 4 + 7, 0

View File

@ -114,5 +114,7 @@ SpriteAnimObjects:
db SPRITE_ANIM_FRAMESET_BOARD_MENU_APPEAR_DIE_NUMBER, SPRITE_ANIM_FUNC_NULL, SPRITE_ANIM_DICT_DEFAULT
; SPRITE_ANIM_OBJ_BOARD_MENU_MOVE_DIE_NUMBER
db SPRITE_ANIM_FRAMESET_BOARD_MENU_MOVE_DIE_NUMBER, SPRITE_ANIM_FUNC_BOARD_MENU_MOVE_DIE_NUMBER, SPRITE_ANIM_DICT_DEFAULT
; SPRITE_ANIM_OBJ_LEVEL_SELECTION_MENU_HIGHLIGHT_LEVEL
db SPRITE_ANIM_FRAMESET_LEVEL_SELECTION_MENU_HIGHLIGHT_LEVEL, SPRITE_ANIM_FUNC_NULL, SPRITE_ANIM_DICT_DEFAULT
assert_table_length NUM_SPRITE_ANIM_OBJS

View File

@ -1,23 +0,0 @@
MACRO sprite_anim_obj_gfx
; # tiles, gfx pointer
db \1
dbw \2, \3
ENDM
UnusedSpriteAnimGFX:
; entries correspond to SPRITE_ANIM_DICT_* constants
table_width 4, UnusedSpriteAnimGFX
; # tiles, gfx bank, gfx pointer
; (all pointers were dummied out to .DeletedGFX)
sprite_anim_obj_gfx 128, $01, .DeletedGFX ; SPRITE_ANIM_DICT_DEFAULT
sprite_anim_obj_gfx 128, $01, .DeletedGFX ; unused
sprite_anim_obj_gfx 128, $01, .DeletedGFX ; unused
sprite_anim_obj_gfx 128, $01, .DeletedGFX ; unused
sprite_anim_obj_gfx 16, $37, .DeletedGFX ; unused
sprite_anim_obj_gfx 16, $11, .DeletedGFX ; SPRITE_ANIM_DICT_TEXT_CURSOR
sprite_anim_obj_gfx 16, $39, .DeletedGFX ; SPRITE_ANIM_DICT_GS_SPLASH (the bank includes engine/movie/splash.asm)
sprite_anim_obj_gfx 16, $24, .DeletedGFX ; SPRITE_ANIM_DICT_SLOTS (the bank includes engine/games/slot_machine.asm)
sprite_anim_obj_gfx 16, $21, .DeletedGFX ; SPRITE_ANIM_DICT_ARROW_CURSOR
assert_table_length NUM_SPRITE_ANIM_GFX
.DeletedGFX

View File

@ -21,17 +21,17 @@ LevelSelectionMenu::
ld a, [wLevelSelectionMenuEntryEventQueue]
bit LSMEVENT_SHOW_UNLOCKED_LEVELS, a
jr z, .load_default_landmark
jp z, .load_default_landmark
ld a, [wLastUnlockedLevelsCount]
and a
jr z, .load_default_landmark
jp z, .load_default_landmark
ld hl, wLastUnlockedLevels
.show_unlocked_levels_loop
ld a, [hli]
cp $ff
jr z, .load_default_landmark
jp z, .load_default_landmark
push hl
; perform level-to-landmark lookup of wLastUnlockedLevels[i] in $ff-terminated LandmarkToLevelTable.
@ -53,6 +53,7 @@ LevelSelectionMenu::
call LevelSelectionMenu_GetLandmarkPage
ld [wLevelSelectionMenuCurrentPage], a
; load and draw gfx involved in the show unlocked levels event
call LevelSelectionMenu_DrawTilemapAndAttrmap
call LevelSelectionMenu_DrawTimeOfDaySymbol
ld b, CGB_LEVEL_SELECTION_MENU
@ -65,15 +66,32 @@ LevelSelectionMenu::
call LevelSelectionMenu_DrawStageTrophies
call LevelSelectionMenu_RefreshTextboxAttrs
ld c, 60
call DelayFrames
; play animation that highlights landmark of unlocked level
ld a, [wLevelSelectionMenuCurrentLandmark]
call LevelSelectionMenu_GetLandmarkCoords
ld a, SPRITE_ANIM_OBJ_LEVEL_SELECTION_MENU_HIGHLIGHT_LEVEL
call InitSpriteAnimStruct
ld a, (15 + 1) * 6 ; %01100000
.highlight_level_anim_loop
ld [wFrameCounter], a
ld a, [wFrameCounter]
and %11111
ld de, SFX_POKEBALLS_PLACED_ON_TABLE
call z, PlaySFX
farcall PlaySpriteAnimationsAndDelayFrame
ld a, [wFrameCounter]
dec a
jr nz, .highlight_level_anim_loop
farcall ClearSpriteAnims
; fade to the next unlocked level, or to the regular level selection menu
ld b, RGBFADE_TO_BLACK_6BGP_1OBP2
call DoRGBFadeEffect
ld c, 30 ;
call DelayFrames ; black screen --> next landmark shown
.invalid_level
pop hl
jr .show_unlocked_levels_loop
jp .show_unlocked_levels_loop
.load_default_landmark
ld a, [wDefaultLevelSelectionMenuLandmark]
@ -234,6 +252,10 @@ LevelSelectionMenu_LoadGFX:
; ld de, vTiles0 + (24 + NUM_DIRECTIONS + NUM_LEVEL_STAGES * 2) tiles
ld bc, NUM_DAYTIMES * 4 tiles
call FarCopyBytes
ld hl, LevelSelectionMenuLevelHighlighterGFX
; ld de, vTiles0 + (24 + NUM_DIRECTIONS + NUM_LEVEL_STAGES * 2 + NUM_DAYTIMES * 4) tiles
ld bc, 8 tiles
call FarCopyBytes
ret
LevelSelectionMenu_InitTilemap:
@ -307,7 +329,6 @@ LevelSelectionMenu_InitPlayerSprite:
add hl, bc
ld [hl], $00
ld a, [wLevelSelectionMenuCurrentLandmark]
ld e, a
call LevelSelectionMenu_GetLandmarkCoords
; wSpriteAnim1*Coord contain the coord of the bottom right object of the player sprite
ld hl, SPRITEANIMSTRUCT_XCOORD
@ -837,12 +858,11 @@ LevelSelectionMenu_GetLandmarkPage:
ret
LevelSelectionMenu_GetLandmarkCoords::
; Return coordinates (d, e) of landmark e.
; Return coordinates (d, e) of landmark a.
push hl
push bc
ld hl, LevelSelectionMenu_Landmarks + $1
ld bc, LevelSelectionMenu_Landmarks.landmark2 - LevelSelectionMenu_Landmarks.landmark1
ld a, e
call AddNTimes
ld a, [hli]
ld e, a
@ -1144,3 +1164,6 @@ INCBIN "gfx/level_selection_menu/stage_trophies.2bpp"
LevelSelectionMenuTimeOfDaySymbolsGFX:
INCBIN "gfx/level_selection_menu/time_of_day_symbols.2bpp"
LevelSelectionMenuLevelHighlighterGFX:
INCBIN "gfx/level_selection_menu/level_highlighter.2bpp"

View File

@ -510,27 +510,6 @@ GetFrameOAMPointer:
add hl, de
ret
UnusedLoadSpriteAnimGFX: ; unreferenced
push hl
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld de, UnusedSpriteAnimGFX
add hl, de
ld c, [hl]
inc hl
ld b, [hl]
inc hl
ld e, [hl]
inc hl
ld d, [hl]
pop hl
push bc
call Request2bpp
pop bc
ret
INCLUDE "data/sprite_anims/objects.asm"
INCLUDE "engine/sprite_anims/functions.asm"
@ -539,8 +518,6 @@ INCLUDE "data/sprite_anims/framesets.asm"
INCLUDE "data/sprite_anims/oam.asm"
INCLUDE "data/sprite_anims/unused_gfx.asm"
Sprites_Cosine:
; a = d * cos(a * pi/32)
add %010000 ; cos(x) = sin(x + pi/2)

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B