Level selection menu: draw level cleared indicators [Commit 2/2] (#12)

This commit is contained in:
xCrystal 2024-01-23 17:42:24 +01:00
parent fa42b14e29
commit 2e9e298d64
7 changed files with 83 additions and 17 deletions

View File

@ -18,14 +18,14 @@ DEF LSMTEXTBOX_X_COORD EQU 1
DEF LSMTEXTBOX_Y_COORD EQU 15 DEF LSMTEXTBOX_Y_COORD EQU 15
DEF LSMTEXTBOX_MAX_TEXT_ROW_LENGTH EQU LSMTEXTBOX_WIDTH - 5 DEF LSMTEXTBOX_MAX_TEXT_ROW_LENGTH EQU LSMTEXTBOX_WIDTH - 5
DEF LSMTEXTBOX_BLACK_TILE EQU "<LSMTEXTBOX_BLACK_TILE>" DEF LSMTEXTBOX_BLACK_TILE EQU "<LSMTEXTBOX_BLACK_TILE>"
DEF LSMTEXTBOX_LEVEL_INDICATOR_TILE EQU $30 DEF LSMTEXTBOX_LEVEL_INDICATOR_TILE EQU $30 ; and $40
DEF LSMTEXTBOX_LEVEL_NUMBERS_FIRST_TILE EQU $31 DEF LSMTEXTBOX_LEVEL_NUMBERS_FIRST_TILE EQU $31 ; and $41
const_def $3b ; $31 + 10 const_def $3b ; $31 + 10
; these must be consecutive ; these must be consecutive
const LSMTEXTBOX_STAGE_1_INDICATOR_TILE ; $3b const LSMTEXTBOX_STAGE_1_INDICATOR_TILE ; $3b (and $4b)
const LSMTEXTBOX_STAGE_2_INDICATOR_TILE ; $3c const LSMTEXTBOX_STAGE_2_INDICATOR_TILE ; $3c (and $4c)
const LSMTEXTBOX_STAGE_3_INDICATOR_TILE ; $3d const LSMTEXTBOX_STAGE_3_INDICATOR_TILE ; $3d (and $4d)
const LSMTEXTBOX_STAGE_4_INDICATOR_TILE ; $3e const LSMTEXTBOX_STAGE_4_INDICATOR_TILE ; $3e (and $4e)
; used in CaughtData (legacy) ; used in CaughtData (legacy)
const_def $7f, -1 const_def $7f, -1

View File

@ -582,6 +582,11 @@ _CGB_LevelSelectionMenu:
ld bc, 2 palettes ld bc, 2 palettes
ld a, BANK(wOBPals1) ld a, BANK(wOBPals1)
call FarCopyWRAM call FarCopyWRAM
; load stage trophy pals (pal2 to pal5)
ld hl, LevelSelectionMenuStageTrophyPals
ld bc, 4 palettes
ld a, BANK(wOBPals1)
call FarCopyWRAM
; load daytime and gender-based background pals ; load daytime and gender-based background pals
ld a, [wPlayerGender] ld a, [wPlayerGender]

View File

@ -880,4 +880,7 @@ LevelSelectionMenuFemalePals:
INCLUDE "gfx/level_selection_menu/background_female.pal" INCLUDE "gfx/level_selection_menu/background_female.pal"
assert_table_length NUM_DAYTIMES assert_table_length NUM_DAYTIMES
LevelSelectionMenuStageTrophyPals:
INCLUDE "gfx/level_selection_menu/stage_trophies.pal"
INCLUDE "engine/gfx/rgb_fade.asm" INCLUDE "engine/gfx/rgb_fade.asm"

View File

@ -43,6 +43,7 @@ LevelSelectionMenu::
call LevelSelectionMenu_PrintLevelAndLandmarkNameAndStageIndicators call LevelSelectionMenu_PrintLevelAndLandmarkNameAndStageIndicators
call LevelSelectionMenu_DrawDirectionalArrows call LevelSelectionMenu_DrawDirectionalArrows
call LevelSelectionMenu_DrawStageTrophies call LevelSelectionMenu_DrawStageTrophies
call LevelSelectionMenu_RefreshTextboxAttrs
.main_loop .main_loop
farcall PlaySpriteAnimations farcall PlaySpriteAnimations
@ -97,8 +98,9 @@ LevelSelectionMenu::
; clear textbox and non-player sprites, as we are about to move out of current landmark ; clear textbox and non-player sprites, as we are about to move out of current landmark
call LevelSelectionMenu_Delay10Frames call LevelSelectionMenu_Delay10Frames
call LevelSelectionMenu_ClearTextbox ; preserves e
call LevelSelectionMenu_ClearNonPlayerSpriteOAM ; preserves e call LevelSelectionMenu_ClearNonPlayerSpriteOAM ; preserves e
call LevelSelectionMenu_ClearTextbox ; preserves e
call LevelSelectionMenu_RefreshTextboxAttrs ; preserves e
; begin transition ; begin transition
xor a ; FALSE xor a ; FALSE
ld [wLevelSelectionMenuStandingStill], a ld [wLevelSelectionMenuStandingStill], a
@ -121,6 +123,7 @@ LevelSelectionMenu::
call LevelSelectionMenu_PrintLevelAndLandmarkNameAndStageIndicators call LevelSelectionMenu_PrintLevelAndLandmarkNameAndStageIndicators
call LevelSelectionMenu_DrawDirectionalArrows call LevelSelectionMenu_DrawDirectionalArrows
call LevelSelectionMenu_DrawStageTrophies call LevelSelectionMenu_DrawStageTrophies
call LevelSelectionMenu_RefreshTextboxAttrs
jp .main_loop jp .main_loop
.enter_level .enter_level
@ -342,7 +345,11 @@ LevelSelectionMenu_PrintLevelAndLandmarkNameAndStageIndicators:
ld a, LSMTEXTBOX_STAGE_1_INDICATOR_TILE ld a, LSMTEXTBOX_STAGE_1_INDICATOR_TILE
call nz, .PrintStageTile call nz, .PrintStageTile
call WaitBGMap ld a, 2
ld [hBGMapThird], a
dec a ; ld a ,1
ld [hBGMapMode], a
call DelayFrame
xor a xor a
ld [hBGMapMode], a ld [hBGMapMode], a
ret ret
@ -363,11 +370,33 @@ LevelSelectionMenu_ClearTextbox:
ld a, LSMTEXTBOX_BLACK_TILE ld a, LSMTEXTBOX_BLACK_TILE
lb bc, LSMTEXTBOX_HEIGHT, LSMTEXTBOX_WIDTH lb bc, LSMTEXTBOX_HEIGHT, LSMTEXTBOX_WIDTH
call FillBoxWithByte call FillBoxWithByte
call WaitBGMap ld a, 2
ld [hBGMapThird], a
dec a ; ld a, 1
ld [hBGMapMode], a
call DelayFrame
xor a xor a
ld [hBGMapMode], a ld [hBGMapMode], a
ret ret
LevelSelectionMenu_RefreshTextboxAttrs:
; OAM priority changes in the textbox depending on whether a landmark is shown
; (stage trophies OAM has priority) or player is moving (all BG has priority).
; Assumes affected tiles are only in the textbox, which is in the bottom third of screen.
push de
hlcoord LSMTEXTBOX_X_COORD, LSMTEXTBOX_Y_COORD
decoord LSMTEXTBOX_X_COORD, LSMTEXTBOX_Y_COORD, wAttrmap
ld bc, SCREEN_WIDTH * (SCREEN_HEIGHT - LSMTEXTBOX_Y_COORD)
call LevelSelectionMenu_InitAttrmap.loop
ld a, 2
ld [hBGMapThird], a
ld [hBGMapMode], a
call DelayFrame
xor a
ld [hBGMapMode], a
pop de
ret
LevelSelectionMenu_DrawDirectionalArrows: LevelSelectionMenu_DrawDirectionalArrows:
; Draw directional arrows OAM around player sprite for the valid directions. ; Draw directional arrows OAM around player sprite for the valid directions.
; Objects are drawn in OAM after player sprite objects in wWalkingDirection order. ; Objects are drawn in OAM after player sprite objects in wWalkingDirection order.
@ -534,12 +563,12 @@ LevelSelectionMenu_DrawStageTrophies:
.BaseOAMTilesAttrs: .BaseOAMTilesAttrs:
db 24 + NUM_DIRECTIONS + 0, 2 db 24 + NUM_DIRECTIONS + 0, 2
db 24 + NUM_DIRECTIONS + 1, 2 db 24 + NUM_DIRECTIONS + 4, 2
db 24 + NUM_DIRECTIONS + 2, 3 db 24 + NUM_DIRECTIONS + 1, 3
db 24 + NUM_DIRECTIONS + 3, 3 db 24 + NUM_DIRECTIONS + 5, 3
db 24 + NUM_DIRECTIONS + 4, 4 db 24 + NUM_DIRECTIONS + 2, 4
db 24 + NUM_DIRECTIONS + 5, 4 db 24 + NUM_DIRECTIONS + 6, 4
db 24 + NUM_DIRECTIONS + 6, 5 db 24 + NUM_DIRECTIONS + 3, 5
db 24 + NUM_DIRECTIONS + 7, 5 db 24 + NUM_DIRECTIONS + 7, 5
LevelSelectionMenu_ClearNonPlayerSpriteOAM: LevelSelectionMenu_ClearNonPlayerSpriteOAM:
@ -1013,4 +1042,4 @@ LevelSelectionMenuDirectionalArrowsGFX:
INCBIN "gfx/level_selection_menu/directional_arrows.2bpp" INCBIN "gfx/level_selection_menu/directional_arrows.2bpp"
LevelSelectionMenuStageTrophiesGFX: LevelSelectionMenuStageTrophiesGFX:
;INCBIN "gfx/level_selection_menu/stage_trophies.2bpp" INCBIN "gfx/level_selection_menu/stage_trophies.2bpp"

View File

@ -1,5 +1,6 @@
DEF PAL_LEVELSELECTIONMENU_BORDER EQU 0 | 1 << OAM_PRIORITY DEF PAL_LEVELSELECTIONMENU_BORDER EQU 0 | 1 << OAM_PRIORITY
const_def 1 const_def 0
const PAL_LEVELSELECTIONMENU_STAGES ; 0
const PAL_LEVELSELECTIONMENU_EARTH ; 1 const PAL_LEVELSELECTIONMENU_EARTH ; 1
const PAL_LEVELSELECTIONMENU_MOUNTAIN ; 2 const PAL_LEVELSELECTIONMENU_MOUNTAIN ; 2
const PAL_LEVELSELECTIONMENU_CITY ; 3 const PAL_LEVELSELECTIONMENU_CITY ; 3
@ -14,9 +15,17 @@ endr
ENDM ENDM
; gfx/level_selection_menu/background.png ; gfx/level_selection_menu/background.png
; some are aligned to specific LSMTEXTBOX_* tile constants (constants/landmark_constants.asm)
levelselectionmenupals EARTH, EARTH, EARTH, MOUNTAIN, MOUNTAIN, MOUNTAIN, BORDER, BORDER levelselectionmenupals EARTH, EARTH, EARTH, MOUNTAIN, MOUNTAIN, MOUNTAIN, BORDER, BORDER
levelselectionmenupals EARTH, EARTH, CITY, EARTH, POI, POI_MTN, POI, POI_MTN levelselectionmenupals EARTH, EARTH, CITY, EARTH, POI, POI_MTN, POI, POI_MTN
levelselectionmenupals EARTH, EARTH, EARTH, MOUNTAIN, MOUNTAIN, MOUNTAIN, BORDER, BORDER levelselectionmenupals EARTH, EARTH, EARTH, MOUNTAIN, MOUNTAIN, MOUNTAIN, BORDER, BORDER
levelselectionmenupals EARTH, EARTH, EARTH, EARTH, EARTH, BORDER, BORDER, BORDER levelselectionmenupals EARTH, EARTH, EARTH, EARTH, EARTH, BORDER, BORDER, BORDER
levelselectionmenupals EARTH, EARTH, EARTH, MOUNTAIN, MOUNTAIN, MOUNTAIN, BORDER, BORDER levelselectionmenupals EARTH, EARTH, EARTH, MOUNTAIN, MOUNTAIN, MOUNTAIN, BORDER, BORDER
levelselectionmenupals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER levelselectionmenupals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER
levelselectionmenupals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER
levelselectionmenupals BORDER, BORDER, BORDER, STAGES, STAGES, STAGES, STAGES, BORDER
levelselectionmenupals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER
levelselectionmenupals BORDER, BORDER, BORDER, STAGES, STAGES, STAGES, STAGES, BORDER
rept 22
levelselectionmenupals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER
endr

View File

@ -0,0 +1,20 @@
; STAGE_1
RGB 31, 31, 31
RGB 21, 21, 23
RGB 10, 10, 12
RGB 00, 00, 00
; STAGE_2
RGB 31, 31, 31
RGB 31, 13, 13
RGB 18, 00, 00
RGB 00, 00, 00
; STAGE_3
RGB 31, 31, 31
RGB 11, 29, 15
RGB 02, 17, 05
RGB 00, 00, 00
; STAGE_4
RGB 31, 31, 31
RGB 05, 25, 31
RGB 01, 08, 22
RGB 00, 00, 00

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B