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

This commit is contained in:
xCrystal 2024-01-22 19:32:19 +01:00
parent ce2f5f3822
commit fa42b14e29
10 changed files with 228 additions and 49 deletions

View File

@ -20,6 +20,12 @@ 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
DEF LSMTEXTBOX_LEVEL_NUMBERS_FIRST_TILE EQU $31 DEF LSMTEXTBOX_LEVEL_NUMBERS_FIRST_TILE EQU $31
const_def $3b ; $31 + 10
; these must be consecutive
const LSMTEXTBOX_STAGE_1_INDICATOR_TILE ; $3b
const LSMTEXTBOX_STAGE_2_INDICATOR_TILE ; $3c
const LSMTEXTBOX_STAGE_3_INDICATOR_TILE ; $3d
const LSMTEXTBOX_STAGE_4_INDICATOR_TILE ; $3e
; used in CaughtData (legacy) ; used in CaughtData (legacy)
const_def $7f, -1 const_def $7f, -1

View File

@ -13,10 +13,16 @@ assert NUM_LEVELS <= 254
; Level stages ; Level stages
const_def const_def
const STAGE_1 ; 00 const STAGE_1_F ; 00
const STAGE_2 ; 01 const STAGE_2_F ; 01
const STAGE_3 ; 02 const STAGE_3_F ; 02
const STAGE_4 ; 03 const STAGE_4_F ; 03
DEF NUM_LEVEL_STAGES EQU const_value
DEF STAGE_1 EQU 1 << STAGE_1_F
DEF STAGE_2 EQU 1 << STAGE_2_F
DEF STAGE_3 EQU 1 << STAGE_3_F
DEF STAGE_4 EQU 1 << STAGE_4_F
; requirement types to unlock a given level ; requirement types to unlock a given level
const_def const_def

View File

@ -3,7 +3,7 @@ DEF FIRST_SPACE_METATILE EQU $80
DEF FIRST_GREY_SPACE_METATILE EQU $e0 DEF FIRST_GREY_SPACE_METATILE EQU $e0
DEF UNIQUE_SPACE_METATILES_MASK EQU %11111 DEF UNIQUE_SPACE_METATILES_MASK EQU %11111
; End Space effect constants (denotes which stage of the level is cleared by this space; equivalent to STAGE_* constants) ; End Space effect constants (denotes which stage of the level is cleared by this space; equivalent to STAGE_*_F constants)
const_def const_def
const ES1 ; 0 const ES1 ; 0
const ES2 ; 1 const ES2 ; 1

View File

@ -4,7 +4,7 @@ DEF LEVELSELECTIONMENU_LANDMARK_OFFSET_X EQU TILE_WIDTH + $8 + 4
DEF LEVELSELECTIONMENU_LANDMARK_OFFSET_Y EQU TILE_WIDTH + $10 + 4 DEF LEVELSELECTIONMENU_LANDMARK_OFFSET_Y EQU TILE_WIDTH + $10 + 4
MACRO level_selection_menu_landmark MACRO level_selection_menu_landmark
; page number, xcoord (in tiles), ycoord (in tiles), ptr to name, spawn point (SPAWN_*) ; page number, xcoord (in tiles), ycoord (in tiles), ptr to name, spawn point (SPAWN_*), level stages
; xcoord ranges between 0 and 17 (SCREEN_WIDTH points minus two) ; xcoord ranges between 0 and 17 (SCREEN_WIDTH points minus two)
; when crossing pages, x=17 and x=0 are adjacent (one tile apart) ; when crossing pages, x=17 and x=0 are adjacent (one tile apart)
; ycoord ranges between 0 and 13 (SCREEN_HEIGH points minus four) ; ycoord ranges between 0 and 13 (SCREEN_HEIGH points minus four)
@ -14,6 +14,7 @@ MACRO level_selection_menu_landmark
db LEVELSELECTIONMENU_LANDMARK_OFFSET_Y + \3 * TILE_WIDTH db LEVELSELECTIONMENU_LANDMARK_OFFSET_Y + \3 * TILE_WIDTH
dw \4 dw \4
db \5 db \5
db \6 ; note: level stages are inherent to level rather than landmark, but they are shown as part of a landmark.
ENDM ENDM
MACRO level_selection_menu_landmark_name MACRO level_selection_menu_landmark_name
@ -23,16 +24,16 @@ MACRO level_selection_menu_landmark_name
ENDM ENDM
LevelSelectionMenu_Landmarks: LevelSelectionMenu_Landmarks:
table_width 6, LevelSelectionMenu_Landmarks table_width 7, LevelSelectionMenu_Landmarks
.landmark1 .landmark1
level_selection_menu_landmark 0, 16, 11, .Level1LandmarkName, SPAWN_LEVEL_1 ; LANDMARK_LEVEL_1 level_selection_menu_landmark 0, 16, 11, .Level1LandmarkName, SPAWN_LEVEL_1, STAGE_1 ; LANDMARK_LEVEL_1
.landmark2 .landmark2
if DEF(_DEBUG) if DEF(_DEBUG)
level_selection_menu_landmark 0, 16, 10, .DebugLevel1LandmarkName, SPAWN_DEBUGLEVEL_1 ; LANDMARK_DEBUGLEVEL_1 level_selection_menu_landmark 0, 16, 10, .DebugLevel1LandmarkName, SPAWN_DEBUGLEVEL_1, STAGE_1 | STAGE_3 | STAGE_4 ; LANDMARK_DEBUGLEVEL_1
level_selection_menu_landmark 0, 11, 8, .DebugLevel2LandmarkName, SPAWN_DEBUGLEVEL_2 ; LANDMARK_DEBUGLEVEL_2 level_selection_menu_landmark 0, 11, 8, .DebugLevel2LandmarkName, SPAWN_DEBUGLEVEL_2, STAGE_1 | STAGE_2 ; LANDMARK_DEBUGLEVEL_2
level_selection_menu_landmark 0, 9, 10, .DebugLevel3LandmarkName, SPAWN_DEBUGLEVEL_3 ; LANDMARK_DEBUGLEVEL_3 level_selection_menu_landmark 0, 9, 10, .DebugLevel3LandmarkName, SPAWN_DEBUGLEVEL_3, STAGE_1 | STAGE_2 | STAGE_3 | STAGE_4 ; LANDMARK_DEBUGLEVEL_3
level_selection_menu_landmark 1, 16, 10, .DebugLevel4LandmarkName, SPAWN_DEBUGLEVEL_4 ; LANDMARK_DEBUGLEVEL_4 level_selection_menu_landmark 1, 16, 10, .DebugLevel4LandmarkName, SPAWN_DEBUGLEVEL_4, STAGE_1 ; LANDMARK_DEBUGLEVEL_4
level_selection_menu_landmark 2, 9, 4, .DebugLevel5LandmarkName, SPAWN_DEBUGLEVEL_5 ; LANDMARK_DEBUGLEVEL_5 level_selection_menu_landmark 2, 9, 4, .DebugLevel5LandmarkName, SPAWN_DEBUGLEVEL_5, STAGE_1 ; LANDMARK_DEBUGLEVEL_5
endc endc
assert_table_length NUM_LANDMARKS assert_table_length NUM_LANDMARKS

View File

@ -1,6 +1,6 @@
MACRO level_unlock_req MACRO level_unlock_req
; a list of levels that must be cleared (each must be in the form of: <Level>, STAGE_*) ; a list of levels that must be cleared (each must be in the form of: <Level>, STAGE_*_F)
if !STRCMP("\1", "LEVELS_CLEARED") if !STRCMP("\1", "LEVELS_CLEARED")
db UNLOCK_WHEN_\1 db UNLOCK_WHEN_\1
rept (_NARG - 1) / 2 rept (_NARG - 1) / 2
@ -34,10 +34,10 @@ DEF x = 0
level_unlock_req NONE ; LEVEL_1 (irrelevant) level_unlock_req NONE ; LEVEL_1 (irrelevant)
if DEF(_DEBUG) if DEF(_DEBUG)
level_unlock_req NONE ; DEBUGLEVEL_1 level_unlock_req NONE ; DEBUGLEVEL_1
level_unlock_req LEVELS_CLEARED, DEBUGLEVEL_1, STAGE_1 ; DEBUGLEVEL_2 level_unlock_req LEVELS_CLEARED, DEBUGLEVEL_1, STAGE_1_F ; DEBUGLEVEL_2
level_unlock_req LEVELS_CLEARED, DEBUGLEVEL_2, STAGE_1 ; DEBUGLEVEL_3 level_unlock_req LEVELS_CLEARED, DEBUGLEVEL_2, STAGE_1_F ; DEBUGLEVEL_3
; level_unlock_req LEVELS_CLEARED, DEBUGLEVEL_3, STAGE_1 ; DEBUGLEVEL_4 ; level_unlock_req LEVELS_CLEARED, DEBUGLEVEL_3, STAGE_1_F ; DEBUGLEVEL_4
; level_unlock_req LEVELS_CLEARED, DEBUGLEVEL_4, STAGE_1 ; DEBUGLEVEL_5 ; level_unlock_req LEVELS_CLEARED, DEBUGLEVEL_4, STAGE_1_F ; DEBUGLEVEL_5
level_unlock_req NUMBER_OF_LEVELS_CLEARED, 3 ; DEBUGLEVEL_4 level_unlock_req NUMBER_OF_LEVELS_CLEARED, 3 ; DEBUGLEVEL_4
level_unlock_req TECHNIQUES_CLEARED, TECHNIQUE_FLASH | TECHNIQUE_WATERFALL ; DEBUGLEVEL_5 level_unlock_req TECHNIQUES_CLEARED, TECHNIQUE_FLASH | TECHNIQUE_WATERFALL ; DEBUGLEVEL_5
endc endc

View File

@ -83,7 +83,7 @@
- **wSpacesLeft** - **wSpacesLeft**
- Addresses within *wCurMapData* ~ *wCurMapDataEnd*: preserved on save. Initialized when entering a level (in StartMap), and updated accordingly throughout the level. Includes: - Addresses within *wCurMapData* ~ *wCurMapDataEnd*: preserved on save. Initialized when entering a level (in StartMap), and updated accordingly throughout the level. Includes:
- **wCurLevel**: this one is not initialized in StartMap, but in LevelSelectionMenu, and stays static during the level. - **wCurLevel**: this one is not initialized in StartMap, but in LevelSelectionMenu (where it is also used), and stays static during the level.
- **wCurTurn** - **wCurTurn**
- **wCurSpace** - **wCurSpace**
- **wCurLevelCoins** - **wCurLevelCoins**

View File

@ -66,7 +66,7 @@ AddLevelCoinsToBalance:
ret ret
ClearLevel: ClearLevel:
ld a, [wCurSpaceEffect] ; End Space effect byte contains STAGE_* ld a, [wCurSpaceEffect] ; End Space effect byte contains STAGE_*_F
call GetClearedLevelsStageAddress call GetClearedLevelsStageAddress
ld b, SET_FLAG ld b, SET_FLAG
ld d, 0 ld d, 0
@ -193,20 +193,6 @@ ComputeLevelsToUnlock:
pop de pop de
ret ret
; return hl = wClearedLevelsStage* given STAGE_ constant in a
GetClearedLevelsStageAddress:
ld hl, wClearedLevelsStage1
cp ES1
ret z
ld hl, wClearedLevelsStage2
cp ES2
ret z
ld hl, wClearedLevelsStage3
cp ES3
ret z
ld hl, wClearedLevelsStage4
ret
SaveUnlockedLevels: SaveUnlockedLevels:
ld hl, wTempUnlockedLevels ld hl, wTempUnlockedLevels
.loop .loop

View File

@ -40,8 +40,9 @@ LevelSelectionMenu::
ld a, [wLevelSelectionMenuCurrentLandmark] ld a, [wLevelSelectionMenuCurrentLandmark]
call LevelSelectionMenu_InitPlayerSprite call LevelSelectionMenu_InitPlayerSprite
call LevelSelectionMenu_InitLandmark call LevelSelectionMenu_InitLandmark
call LevelSelectionMenu_PrintLevelAndLandmarkName call LevelSelectionMenu_PrintLevelAndLandmarkNameAndStageIndicators
call LevelSelectionMenu_DrawDirectionalArrows call LevelSelectionMenu_DrawDirectionalArrows
call LevelSelectionMenu_DrawStageTrophies
.main_loop .main_loop
farcall PlaySpriteAnimations farcall PlaySpriteAnimations
@ -94,16 +95,16 @@ LevelSelectionMenu::
ld a, h ld a, h
ld [bc], a ld [bc], a
; clear textbox 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_ClearTextbox ; preserves e
call LevelSelectionMenu_ClearNonPlayerSpriteOAM ; preserves e
; begin transition ; begin transition
xor a ; FALSE xor a ; FALSE
ld [wLevelSelectionMenuStandingStill], a ld [wLevelSelectionMenuStandingStill], a
ld a, 1 << 7 ; "first step of movement" flag ld a, 1 << 7 ; "first step of movement" flag
ld [wLevelSelectionMenuMovementStepsLeft], a ld [wLevelSelectionMenuMovementStepsLeft], a
call LevelSelectionMenu_SetAnimSeqAndFrameset call LevelSelectionMenu_SetAnimSeqAndFrameset
call LevelSelectionMenu_ClearNonPlayerSpriteOAM
; perform all movements to transition to the new landmark ; perform all movements to transition to the new landmark
.wait_transition_loop .wait_transition_loop
@ -117,18 +118,12 @@ LevelSelectionMenu::
jr z, .wait_transition_loop jr z, .wait_transition_loop
call LevelSelectionMenu_InitLandmark call LevelSelectionMenu_InitLandmark
call LevelSelectionMenu_PrintLevelAndLandmarkName call LevelSelectionMenu_PrintLevelAndLandmarkNameAndStageIndicators
call LevelSelectionMenu_DrawDirectionalArrows call LevelSelectionMenu_DrawDirectionalArrows
call LevelSelectionMenu_DrawStageTrophies
jp .main_loop jp .main_loop
.enter_level .enter_level
ld a, [wLevelSelectionMenuCurrentLandmark]
ld e, a
ld d, 0
ld hl, LandmarkToLevelTable
add hl, de
ld a, [hl]
ld [wCurLevel], a
ld a, [wLevelSelectionMenuCurrentLandmark] ld a, [wLevelSelectionMenuCurrentLandmark]
call LevelSelectionMenu_GetLandmarkSpawnPoint call LevelSelectionMenu_GetLandmarkSpawnPoint
ld [wDefaultSpawnpoint], a ld [wDefaultSpawnpoint], a
@ -170,7 +165,11 @@ LevelSelectionMenu_LoadGFX:
call FarCopyBytes call FarCopyBytes
ld hl, LevelSelectionMenuDirectionalArrowsGFX ld hl, LevelSelectionMenuDirectionalArrowsGFX
; ld de, vTiles0 + 24 tiles ; ld de, vTiles0 + 24 tiles
ld bc, 4 tiles ld bc, NUM_DIRECTIONS tiles
call FarCopyBytes
ld hl, LevelSelectionMenuStageTrophiesGFX
; ld de, vTiles0 + (24 + NUM_DIRECTIONS) tiles
ld bc, NUM_LEVEL_STAGES * 2 tiles
call FarCopyBytes call FarCopyBytes
ret ret
@ -268,7 +267,7 @@ endr
ld [de], a ld [de], a
ret ret
LevelSelectionMenu_PrintLevelAndLandmarkName: LevelSelectionMenu_PrintLevelAndLandmarkNameAndStageIndicators:
; level indicator and level numbers are 8x16. ; level indicator and level numbers are 8x16.
; botton half of their graphics are $10 tiles after the top half. ; botton half of their graphics are $10 tiles after the top half.
hlcoord LSMTEXTBOX_X_COORD, LSMTEXTBOX_Y_COORD hlcoord LSMTEXTBOX_X_COORD, LSMTEXTBOX_Y_COORD
@ -278,12 +277,14 @@ LevelSelectionMenu_PrintLevelAndLandmarkName:
ld bc, SCREEN_WIDTH ld bc, SCREEN_WIDTH
add hl, bc add hl, bc
ld [hl], a ld [hl], a
; get level from landmark and copy it to wCurLevel
ld a, [wLevelSelectionMenuCurrentLandmark] ld a, [wLevelSelectionMenuCurrentLandmark]
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, LandmarkToLevelTable ld hl, LandmarkToLevelTable
add hl, de add hl, de
ld a, [hl] ld a, [hl]
ld [wCurLevel], a
ld c, 0 ld c, 0
.loop1 .loop1
ld e, a ld e, a
@ -308,6 +309,7 @@ LevelSelectionMenu_PrintLevelAndLandmarkName:
add e add e
ld [hl], a ld [hl], a
ld a, [wLevelSelectionMenuCurrentLandmark]
call LevelSelectionMenu_GetLandmarkName call LevelSelectionMenu_GetLandmarkName
ld hl, wStringBuffer1 ld hl, wStringBuffer1
decoord LSMTEXTBOX_X_COORD + 4, LSMTEXTBOX_Y_COORD decoord LSMTEXTBOX_X_COORD + 4, LSMTEXTBOX_Y_COORD
@ -318,11 +320,44 @@ LevelSelectionMenu_PrintLevelAndLandmarkName:
ld bc, LSMTEXTBOX_MAX_TEXT_ROW_LENGTH ld bc, LSMTEXTBOX_MAX_TEXT_ROW_LENGTH
call CopyBytes call CopyBytes
ld de, 0 ; e tracks number of already printed stages, to know where to print current one (in descending order)
ld a, [wLevelSelectionMenuCurrentLandmark]
call LevelSelectionMenu_GetLandmarkLevelStages
bit STAGE_4_F, a
push af
ld a, LSMTEXTBOX_STAGE_4_INDICATOR_TILE
call nz, .PrintStageTile
pop af
bit STAGE_3_F, a
push af
ld a, LSMTEXTBOX_STAGE_3_INDICATOR_TILE
call nz, .PrintStageTile
pop af
bit STAGE_2_F, a
push af
ld a, LSMTEXTBOX_STAGE_2_INDICATOR_TILE
call nz, .PrintStageTile
pop af
bit STAGE_1_F, a
ld a, LSMTEXTBOX_STAGE_1_INDICATOR_TILE
call nz, .PrintStageTile
call WaitBGMap call WaitBGMap
xor a xor a
ld [hBGMapMode], a ld [hBGMapMode], a
ret ret
.PrintStageTile:
hlcoord LSMTEXTBOX_X_COORD + (LSMTEXTBOX_WIDTH - 1), LSMTEXTBOX_Y_COORD
add hl, de
ld [hl], a
ld bc, SCREEN_WIDTH
add hl, bc
add $10
ld [hl], a
dec de
ret
LevelSelectionMenu_ClearTextbox: LevelSelectionMenu_ClearTextbox:
hlcoord LSMTEXTBOX_X_COORD, LSMTEXTBOX_Y_COORD hlcoord LSMTEXTBOX_X_COORD, LSMTEXTBOX_Y_COORD
ld a, LSMTEXTBOX_BLACK_TILE ld a, LSMTEXTBOX_BLACK_TILE
@ -386,6 +421,127 @@ LevelSelectionMenu_DrawDirectionalArrows:
db -4, -16, 24 + LEFT db -4, -16, 24 + LEFT
db -4, 8, 24 + RIGHT db -4, 8, 24 + RIGHT
LevelSelectionMenu_DrawStageTrophies:
; Draw stage trophies OAM of cleared level stages.
; These objects go after player sprite and arrows in OAM.
ld de, wShadowOAM + ($4 + NUM_DIRECTIONS + $0) * SPRITEOAMSTRUCT_LENGTH
bccoord LSMTEXTBOX_X_COORD + (LSMTEXTBOX_WIDTH - 1), LSMTEXTBOX_Y_COORD
ld a, 6
call .draw_stage_trophy
ret c
ld de, wShadowOAM + ($4 + NUM_DIRECTIONS + $2) * SPRITEOAMSTRUCT_LENGTH
bccoord LSMTEXTBOX_X_COORD + (LSMTEXTBOX_WIDTH - 2), LSMTEXTBOX_Y_COORD
ld a, 4
call .draw_stage_trophy
ret c
ld de, wShadowOAM + ($4 + NUM_DIRECTIONS + $4) * SPRITEOAMSTRUCT_LENGTH
bccoord LSMTEXTBOX_X_COORD + (LSMTEXTBOX_WIDTH - 3), LSMTEXTBOX_Y_COORD
ld a, 2
call .draw_stage_trophy
ret c
ld de, wShadowOAM + ($4 + NUM_DIRECTIONS + $6) * SPRITEOAMSTRUCT_LENGTH
bccoord LSMTEXTBOX_X_COORD + (LSMTEXTBOX_WIDTH - 4), LSMTEXTBOX_Y_COORD
xor a
call .draw_stage_trophy
ret
.draw_stage_trophy:
; input:
; - de: wShadowOAM address
; - bc: current tile address in wTilemap
; - a: .BaseOAMCoords entry to use
; if current tile is not a stage indicator tile, return carry to signal to not keep going
push af
ld a, [bc]
sub LSMTEXTBOX_STAGE_1_INDICATOR_TILE
jr c, .ret_c
cp STAGE_4_F + 1
jr nc, .ret_c
call .IsLevelStageCleared
jr z, .ret_nc ; this level has not been cleared, but there are more levels yet to check, so return nc
add a
add a
ld c, a
ld b, 0
ld hl, .BaseOAMTilesAttrs
add hl, bc
pop af
push hl
add a
ld c, a
ld b, 0
ld hl, .BaseOAMCoords
add hl, bc
pop bc
call .CopyOAM
call .CopyOAM
xor a
ret ; nc
.ret_c:
pop af
scf
ret
.ret_nc
pop af
xor a
ret
.IsLevelStageCleared:
; return nz if [wCurLevel]'s stage in a has been cleared, z otherwise.
; preserve a and de.
ld c, a
push bc
push de
call GetClearedLevelsStageAddress
ld b, CHECK_FLAG
ld d, 0
ld a, [wCurLevel]
ld e, a
call FlagAction
pop de
pop bc
ld a, c
ret
.CopyOAM:
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
inc de
ld a, [bc]
ld [de], a
inc bc
inc de
ld a, [bc]
ld [de], a
inc bc
inc de
ret
.BaseOAMCoords:
db 17 * TILE_WIDTH, 16 * TILE_WIDTH
db 18 * TILE_WIDTH, 16 * TILE_WIDTH
db 17 * TILE_WIDTH, 17 * TILE_WIDTH
db 18 * TILE_WIDTH, 17 * TILE_WIDTH
db 17 * TILE_WIDTH, 18 * TILE_WIDTH
db 18 * TILE_WIDTH, 18 * TILE_WIDTH
db 17 * TILE_WIDTH, 19 * TILE_WIDTH
db 18 * TILE_WIDTH, 19 * TILE_WIDTH
.BaseOAMTilesAttrs:
db 24 + NUM_DIRECTIONS + 0, 2
db 24 + NUM_DIRECTIONS + 1, 2
db 24 + NUM_DIRECTIONS + 2, 3
db 24 + NUM_DIRECTIONS + 3, 3
db 24 + NUM_DIRECTIONS + 4, 4
db 24 + NUM_DIRECTIONS + 5, 4
db 24 + NUM_DIRECTIONS + 6, 5
db 24 + NUM_DIRECTIONS + 7, 5
LevelSelectionMenu_ClearNonPlayerSpriteOAM: LevelSelectionMenu_ClearNonPlayerSpriteOAM:
ld hl, wShadowOAM + $4 * SPRITEOAMSTRUCT_LENGTH ld hl, wShadowOAM + $4 * SPRITEOAMSTRUCT_LENGTH
ld bc, wShadowOAMEnd - (wShadowOAM + $4 * SPRITEOAMSTRUCT_LENGTH) ld bc, wShadowOAMEnd - (wShadowOAM + $4 * SPRITEOAMSTRUCT_LENGTH)
@ -570,14 +726,13 @@ LevelSelectionMenu_GetLandmarkCoords::
ret ret
LevelSelectionMenu_GetLandmarkName:: LevelSelectionMenu_GetLandmarkName::
; Copy the name of landmark e to wStringBuffer1 (tow row) and wStringBuffer2 (bottom row). ; Copy the name of landmark a to wStringBuffer1 (tow row) and wStringBuffer2 (bottom row).
push hl push hl
push de push de
push bc push bc
ld hl, LevelSelectionMenu_Landmarks + $3 ld hl, LevelSelectionMenu_Landmarks + $3
ld bc, LevelSelectionMenu_Landmarks.landmark2 - LevelSelectionMenu_Landmarks.landmark1 ld bc, LevelSelectionMenu_Landmarks.landmark2 - LevelSelectionMenu_Landmarks.landmark1
ld a, e
call AddNTimes call AddNTimes
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
@ -611,6 +766,14 @@ LevelSelectionMenu_GetLandmarkSpawnPoint:
ld a, [hl] ld a, [hl]
ret ret
LevelSelectionMenu_GetLandmarkLevelStages:
; Return STAGE_* flags (a) of landmark a.
ld hl, LevelSelectionMenu_Landmarks + $6
ld bc, LevelSelectionMenu_Landmarks.landmark2 - LevelSelectionMenu_Landmarks.landmark1
call AddNTimes
ld a, [hl]
ret
LevelSelectionMenu_GetValidKeys: LevelSelectionMenu_GetValidKeys:
call LevelSelectionMenu_GetValidDirections call LevelSelectionMenu_GetValidDirections
ld a, c ld a, c
@ -848,3 +1011,6 @@ INCLUDE "gfx/level_selection_menu/attrmap.asm"
LevelSelectionMenuDirectionalArrowsGFX: LevelSelectionMenuDirectionalArrowsGFX:
INCBIN "gfx/level_selection_menu/directional_arrows.2bpp" INCBIN "gfx/level_selection_menu/directional_arrows.2bpp"
LevelSelectionMenuStageTrophiesGFX:
;INCBIN "gfx/level_selection_menu/stage_trophies.2bpp"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -21,6 +21,20 @@ ResetFlashIfOutOfCave::
res STATUSFLAGS_FLASH_F, [hl] res STATUSFLAGS_FLASH_F, [hl]
ret ret
GetClearedLevelsStageAddress::
; Return hl = wClearedLevelsStage* given STAGE_*_F constant in a
ld hl, wClearedLevelsStage1
cp ES1 ; cp STAGE_1_F
ret z
ld hl, wClearedLevelsStage2
cp ES2 ; cp STAGE_2_F
ret z
ld hl, wClearedLevelsStage3
cp ES3 ; cp STAGE_3_F
ret z
ld hl, wClearedLevelsStage4
ret
UnlockedLevelsFlagAction:: UnlockedLevelsFlagAction::
; Perform action b on bit e in flag array wUnlockedLevels. ; Perform action b on bit e in flag array wUnlockedLevels.
ld hl, wUnlockedLevels ld hl, wUnlockedLevels