mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Level selection menu: print landmark level and name (#12)
This commit is contained in:
parent
2e5546f828
commit
ce2f5f3822
@ -175,6 +175,9 @@
|
|||||||
charmap "└", $f4
|
charmap "└", $f4
|
||||||
charmap "┘", $f5
|
charmap "┘", $f5
|
||||||
|
|
||||||
|
; level selection menu
|
||||||
|
charmap "<LSMTEXTBOX_BLACK_TILE>", $1f
|
||||||
|
|
||||||
; ASCII charmap, for mobile functions
|
; ASCII charmap, for mobile functions
|
||||||
pushc
|
pushc
|
||||||
newcharmap ascii
|
newcharmap ascii
|
||||||
|
@ -11,6 +11,16 @@ endc
|
|||||||
DEF NUM_LANDMARKS EQU const_value
|
DEF NUM_LANDMARKS EQU const_value
|
||||||
assert NUM_LANDMARKS <= 254
|
assert NUM_LANDMARKS <= 254
|
||||||
|
|
||||||
|
; constants used in Level Selection Menu
|
||||||
|
DEF LSMTEXTBOX_WIDTH EQU 18
|
||||||
|
DEF LSMTEXTBOX_HEIGHT EQU 2
|
||||||
|
DEF LSMTEXTBOX_X_COORD EQU 1
|
||||||
|
DEF LSMTEXTBOX_Y_COORD EQU 15
|
||||||
|
DEF LSMTEXTBOX_MAX_TEXT_ROW_LENGTH EQU LSMTEXTBOX_WIDTH - 5
|
||||||
|
DEF LSMTEXTBOX_BLACK_TILE EQU "<LSMTEXTBOX_BLACK_TILE>"
|
||||||
|
DEF LSMTEXTBOX_LEVEL_INDICATOR_TILE EQU $30
|
||||||
|
DEF LSMTEXTBOX_LEVEL_NUMBERS_FIRST_TILE EQU $31
|
||||||
|
|
||||||
; used in CaughtData (legacy)
|
; used in CaughtData (legacy)
|
||||||
const_def $7f, -1
|
const_def $7f, -1
|
||||||
const LANDMARK_EVENT ; $7f
|
const LANDMARK_EVENT ; $7f
|
||||||
|
@ -16,6 +16,12 @@ MACRO level_selection_menu_landmark
|
|||||||
db \5
|
db \5
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
MACRO level_selection_menu_landmark_name
|
||||||
|
assert STRLEN(\1) == LSMTEXTBOX_MAX_TEXT_ROW_LENGTH
|
||||||
|
assert STRLEN(\2) == LSMTEXTBOX_MAX_TEXT_ROW_LENGTH
|
||||||
|
db STRRPL(\1, " ", "<LSMTEXTBOX_BLACK_TILE>"), STRRPL(\2, " ", "<LSMTEXTBOX_BLACK_TILE>"),
|
||||||
|
ENDM
|
||||||
|
|
||||||
LevelSelectionMenu_Landmarks:
|
LevelSelectionMenu_Landmarks:
|
||||||
table_width 6, LevelSelectionMenu_Landmarks
|
table_width 6, LevelSelectionMenu_Landmarks
|
||||||
.landmark1
|
.landmark1
|
||||||
@ -30,13 +36,13 @@ if DEF(_DEBUG)
|
|||||||
endc
|
endc
|
||||||
assert_table_length NUM_LANDMARKS
|
assert_table_length NUM_LANDMARKS
|
||||||
|
|
||||||
.Level1LandmarkName: db "LEVEL 1@"
|
.Level1LandmarkName: level_selection_menu_landmark_name " THE FIRST ", " LEVEL "
|
||||||
if DEF(_DEBUG)
|
if DEF(_DEBUG)
|
||||||
.DebugLevel1LandmarkName: db "DEBUG LEVEL 1@"
|
.DebugLevel1LandmarkName: level_selection_menu_landmark_name " DEBUG ", " DUMMY "
|
||||||
.DebugLevel2LandmarkName: db "DEBUG LEVEL 2@"
|
.DebugLevel2LandmarkName: level_selection_menu_landmark_name " DEBUG ", " CAVE "
|
||||||
.DebugLevel3LandmarkName: db "DEBUG LEVEL 3@"
|
.DebugLevel3LandmarkName: level_selection_menu_landmark_name " DEBUG ", " FOREST "
|
||||||
.DebugLevel4LandmarkName: db "DEBUG LEVEL 4@"
|
.DebugLevel4LandmarkName: level_selection_menu_landmark_name " DEBUG ", " TEST2 "
|
||||||
.DebugLevel5LandmarkName: db "DEBUG LEVEL 5@"
|
.DebugLevel5LandmarkName: level_selection_menu_landmark_name " DEBUG ", " TEST1 "
|
||||||
endc
|
endc
|
||||||
|
|
||||||
MACRO level_selection_menu_landmark_transition
|
MACRO level_selection_menu_landmark_transition
|
||||||
|
@ -100,3 +100,29 @@ LoadStatsScreenPageTilesGFX:
|
|||||||
lb bc, BANK(StatsScreenPageTilesGFX), 17
|
lb bc, BANK(StatsScreenPageTilesGFX), 17
|
||||||
call Get2bppViaHDMA
|
call Get2bppViaHDMA
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
LoadInversedFont::
|
||||||
|
ld de, FontInversed
|
||||||
|
ld hl, vTiles1
|
||||||
|
lb bc, BANK(FontInversed), 112 ; "A" to "9"
|
||||||
|
ldh a, [rLCDC]
|
||||||
|
bit rLCDC_ENABLE, a
|
||||||
|
jp z, Copy1bpp
|
||||||
|
|
||||||
|
ld de, FontInversed
|
||||||
|
ld hl, vTiles1
|
||||||
|
lb bc, BANK(FontInversed), 32 ; "A" to...
|
||||||
|
call Get1bppViaHDMA
|
||||||
|
ld de, FontInversed + 32 * LEN_1BPP_TILE
|
||||||
|
ld hl, vTiles1 tile $20
|
||||||
|
lb bc, BANK(FontInversed), 32
|
||||||
|
call Get1bppViaHDMA
|
||||||
|
ld de, FontInversed + 64 * LEN_1BPP_TILE
|
||||||
|
ld hl, vTiles1 tile $40
|
||||||
|
lb bc, BANK(FontInversed), 32
|
||||||
|
call Get1bppViaHDMA
|
||||||
|
ld de, FontInversed + 96 * LEN_1BPP_TILE
|
||||||
|
ld hl, vTiles1 tile $60
|
||||||
|
lb bc, BANK(FontInversed), 16 ; ..."9"
|
||||||
|
call Get1bppViaHDMA
|
||||||
|
ret
|
||||||
|
@ -40,6 +40,7 @@ LevelSelectionMenu::
|
|||||||
ld a, [wLevelSelectionMenuCurrentLandmark]
|
ld a, [wLevelSelectionMenuCurrentLandmark]
|
||||||
call LevelSelectionMenu_InitPlayerSprite
|
call LevelSelectionMenu_InitPlayerSprite
|
||||||
call LevelSelectionMenu_InitLandmark
|
call LevelSelectionMenu_InitLandmark
|
||||||
|
call LevelSelectionMenu_PrintLevelAndLandmarkName
|
||||||
call LevelSelectionMenu_DrawDirectionalArrows
|
call LevelSelectionMenu_DrawDirectionalArrows
|
||||||
|
|
||||||
.main_loop
|
.main_loop
|
||||||
@ -78,8 +79,8 @@ LevelSelectionMenu::
|
|||||||
jr .start_movement
|
jr .start_movement
|
||||||
|
|
||||||
.start_movement
|
.start_movement
|
||||||
|
ld e, c ; copy direction to e for later (for LevelSelectionMenu_SetAnimSeqAndFrameset)
|
||||||
; make hl point to the beginning of the transition data for the chosen direction at c
|
; make hl point to the beginning of the transition data for the chosen direction at c
|
||||||
ld e, c ; also copy direction to e for later
|
|
||||||
ld hl, wLevelSelectionMenuLandmarkTransitionsPointer
|
ld hl, wLevelSelectionMenuLandmarkTransitionsPointer
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld h, [hl]
|
ld h, [hl]
|
||||||
@ -93,8 +94,10 @@ LevelSelectionMenu::
|
|||||||
ld a, h
|
ld a, h
|
||||||
ld [bc], a
|
ld [bc], a
|
||||||
|
|
||||||
; begin transition
|
; clear textbox as we are about to move out of current landmark
|
||||||
call LevelSelectionMenu_Delay10Frames
|
call LevelSelectionMenu_Delay10Frames
|
||||||
|
call LevelSelectionMenu_ClearTextbox ; preserves e
|
||||||
|
; 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
|
||||||
@ -114,8 +117,9 @@ LevelSelectionMenu::
|
|||||||
jr z, .wait_transition_loop
|
jr z, .wait_transition_loop
|
||||||
|
|
||||||
call LevelSelectionMenu_InitLandmark
|
call LevelSelectionMenu_InitLandmark
|
||||||
|
call LevelSelectionMenu_PrintLevelAndLandmarkName
|
||||||
call LevelSelectionMenu_DrawDirectionalArrows
|
call LevelSelectionMenu_DrawDirectionalArrows
|
||||||
jr .main_loop
|
jp .main_loop
|
||||||
|
|
||||||
.enter_level
|
.enter_level
|
||||||
ld a, [wLevelSelectionMenuCurrentLandmark]
|
ld a, [wLevelSelectionMenuCurrentLandmark]
|
||||||
@ -151,6 +155,8 @@ LevelSelectionMenu::
|
|||||||
ret ; nc
|
ret ; nc
|
||||||
|
|
||||||
LevelSelectionMenu_LoadGFX:
|
LevelSelectionMenu_LoadGFX:
|
||||||
|
; load inverted font
|
||||||
|
farcall LoadInversedFont
|
||||||
; load gfx for the background tiles, and for the player and directional arrow sprites
|
; load gfx for the background tiles, and for the player and directional arrow sprites
|
||||||
ld hl, LevelSelectionMenuGFX
|
ld hl, LevelSelectionMenuGFX
|
||||||
ld de, vTiles2
|
ld de, vTiles2
|
||||||
@ -262,6 +268,71 @@ endr
|
|||||||
ld [de], a
|
ld [de], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
LevelSelectionMenu_PrintLevelAndLandmarkName:
|
||||||
|
; level indicator and level numbers are 8x16.
|
||||||
|
; botton half of their graphics are $10 tiles after the top half.
|
||||||
|
hlcoord LSMTEXTBOX_X_COORD, LSMTEXTBOX_Y_COORD
|
||||||
|
ld a, LSMTEXTBOX_LEVEL_INDICATOR_TILE
|
||||||
|
ld [hl], a
|
||||||
|
add $10
|
||||||
|
ld bc, SCREEN_WIDTH
|
||||||
|
add hl, bc
|
||||||
|
ld [hl], a
|
||||||
|
ld a, [wLevelSelectionMenuCurrentLandmark]
|
||||||
|
ld e, a
|
||||||
|
ld d, 0
|
||||||
|
ld hl, LandmarkToLevelTable
|
||||||
|
add hl, de
|
||||||
|
ld a, [hl]
|
||||||
|
ld c, 0
|
||||||
|
.loop1
|
||||||
|
ld e, a
|
||||||
|
sub 10
|
||||||
|
jr c, .next1
|
||||||
|
inc c
|
||||||
|
jr .loop1
|
||||||
|
.next1
|
||||||
|
; c = first digit ; e = second digit
|
||||||
|
hlcoord LSMTEXTBOX_X_COORD + 1, LSMTEXTBOX_Y_COORD
|
||||||
|
ld a, LSMTEXTBOX_LEVEL_NUMBERS_FIRST_TILE
|
||||||
|
add c
|
||||||
|
ld [hli], a
|
||||||
|
ld a, LSMTEXTBOX_LEVEL_NUMBERS_FIRST_TILE
|
||||||
|
add e
|
||||||
|
ld [hl], a
|
||||||
|
hlcoord LSMTEXTBOX_X_COORD + 1, LSMTEXTBOX_Y_COORD + 1
|
||||||
|
ld a, LSMTEXTBOX_LEVEL_NUMBERS_FIRST_TILE + $10
|
||||||
|
add c
|
||||||
|
ld [hli], a
|
||||||
|
ld a, LSMTEXTBOX_LEVEL_NUMBERS_FIRST_TILE + $10
|
||||||
|
add e
|
||||||
|
ld [hl], a
|
||||||
|
|
||||||
|
call LevelSelectionMenu_GetLandmarkName
|
||||||
|
ld hl, wStringBuffer1
|
||||||
|
decoord LSMTEXTBOX_X_COORD + 4, LSMTEXTBOX_Y_COORD
|
||||||
|
ld bc, LSMTEXTBOX_MAX_TEXT_ROW_LENGTH
|
||||||
|
call CopyBytes
|
||||||
|
ld hl, wStringBuffer2
|
||||||
|
decoord LSMTEXTBOX_X_COORD + 4, LSMTEXTBOX_Y_COORD + 1
|
||||||
|
ld bc, LSMTEXTBOX_MAX_TEXT_ROW_LENGTH
|
||||||
|
call CopyBytes
|
||||||
|
|
||||||
|
call WaitBGMap
|
||||||
|
xor a
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
ret
|
||||||
|
|
||||||
|
LevelSelectionMenu_ClearTextbox:
|
||||||
|
hlcoord LSMTEXTBOX_X_COORD, LSMTEXTBOX_Y_COORD
|
||||||
|
ld a, LSMTEXTBOX_BLACK_TILE
|
||||||
|
lb bc, LSMTEXTBOX_HEIGHT, LSMTEXTBOX_WIDTH
|
||||||
|
call FillBoxWithByte
|
||||||
|
call WaitBGMap
|
||||||
|
xor a
|
||||||
|
ld [hBGMapMode], a
|
||||||
|
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.
|
||||||
@ -499,7 +570,7 @@ LevelSelectionMenu_GetLandmarkCoords::
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
LevelSelectionMenu_GetLandmarkName::
|
LevelSelectionMenu_GetLandmarkName::
|
||||||
; Copy the name of landmark e to wStringBuffer1.
|
; Copy the name of landmark e to wStringBuffer1 (tow row) and wStringBuffer2 (bottom row).
|
||||||
push hl
|
push hl
|
||||||
push de
|
push de
|
||||||
push bc
|
push bc
|
||||||
@ -513,19 +584,25 @@ LevelSelectionMenu_GetLandmarkName::
|
|||||||
ld l, a
|
ld l, a
|
||||||
|
|
||||||
ld de, wStringBuffer1
|
ld de, wStringBuffer1
|
||||||
ld c, 18
|
call .copy
|
||||||
.copy
|
ld de, wStringBuffer2
|
||||||
ld a, [hli]
|
call .copy
|
||||||
ld [de], a
|
|
||||||
inc de
|
|
||||||
dec c
|
|
||||||
jr nz, .copy
|
|
||||||
|
|
||||||
pop bc
|
pop bc
|
||||||
pop de
|
pop de
|
||||||
pop hl
|
pop hl
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.copy
|
||||||
|
ld c, LSMTEXTBOX_MAX_TEXT_ROW_LENGTH
|
||||||
|
.copy_loop
|
||||||
|
ld a, [hli]
|
||||||
|
ld [de], a
|
||||||
|
inc de
|
||||||
|
dec c
|
||||||
|
jr nz, .copy_loop
|
||||||
|
ret
|
||||||
|
|
||||||
LevelSelectionMenu_GetLandmarkSpawnPoint:
|
LevelSelectionMenu_GetLandmarkSpawnPoint:
|
||||||
; Return SPAWN_* (a) of landmark a.
|
; Return SPAWN_* (a) of landmark a.
|
||||||
ld hl, LevelSelectionMenu_Landmarks + $5
|
ld hl, LevelSelectionMenu_Landmarks + $5
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 885 B After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user