You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
Level selection menu: init screen and bg layout, and preliminary landmarks data (#12)
This commit is contained in:
@@ -1,3 +1,108 @@
|
||||
LevelSelectionMenu::
|
||||
ldh a, [hInMenu]
|
||||
push af
|
||||
xor a
|
||||
ldh [hInMenu], a
|
||||
xor a
|
||||
ld [wVramState], a
|
||||
|
||||
call ClearBGPalettes
|
||||
call ClearTilemap
|
||||
call ClearSprites
|
||||
ld de, MUSIC_NONE
|
||||
call PlayMusic
|
||||
call DelayFrame
|
||||
call DisableLCD
|
||||
call LevelSelectionMenu_LoadGFX
|
||||
farcall ClearSpriteAnims
|
||||
ld a, LCDC_DEFAULT
|
||||
ldh [rLCDC], a
|
||||
|
||||
xor a
|
||||
ld [wLevelSelectionMenuCurrentLandmark], a
|
||||
call LevelSelectionMenu_GetLandmarkPage
|
||||
ld [wLevelSelectionMenuCurrentPage], a
|
||||
|
||||
call LevelSelectionMenu_InitTilemap
|
||||
ld b, CGB_LEVEL_SELECTION_MENU
|
||||
call GetCGBLayout
|
||||
call SetPalettes
|
||||
|
||||
ld de, MUSIC_GAME_CORNER
|
||||
call PlayMusic
|
||||
.loop
|
||||
call DelayFrame
|
||||
jr .loop
|
||||
|
||||
pop af
|
||||
ldh [hInMenu], a
|
||||
ret
|
||||
|
||||
LevelSelectionMenu_LoadGFX:
|
||||
ld hl, LevelSelectionMenuGFX
|
||||
ld de, vTiles2
|
||||
call Decompress
|
||||
farcall GetPlayerIcon
|
||||
ld h, d
|
||||
ld l, e
|
||||
ld a, b
|
||||
ld de, vTiles0
|
||||
ld bc, 24 tiles
|
||||
call FarCopyBytes
|
||||
ret
|
||||
|
||||
LevelSelectionMenu_InitTilemap:
|
||||
; init tilemap of page at wLevelSelectionMenuCurrentPage
|
||||
ld hl, .Tilemaps
|
||||
ld bc, 2
|
||||
ld a, [wLevelSelectionMenuCurrentPage]
|
||||
call AddNTimes
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
hlcoord 0, 0
|
||||
.loop
|
||||
ld a, [de]
|
||||
cp $ff ; tilemaps are $ff-terminated
|
||||
jp z, WaitBGMap2 ; takes 8 frames to commit tilemap and attrmap
|
||||
ld a, [de]
|
||||
ld [hli], a
|
||||
inc de
|
||||
jr .loop
|
||||
|
||||
.Tilemaps:
|
||||
dw LevelSelectionMenuPage1Tilemap
|
||||
dw LevelSelectionMenuPage2Tilemap
|
||||
dw LevelSelectionMenuPage3Tilemap
|
||||
dw LevelSelectionMenuPage4Tilemap
|
||||
|
||||
LevelSelectionMenu_GetLandmarkPage:
|
||||
; Return page number (a) of landmark a.
|
||||
push hl
|
||||
ld hl, LevelSelectionMenu_Landmarks
|
||||
ld bc, LevelSelectionMenu_Landmarks.landmark2 - LevelSelectionMenu_Landmarks.landmark1
|
||||
call AddNTimes
|
||||
ld a, [hl]
|
||||
pop hl
|
||||
ret
|
||||
|
||||
LevelSelectionMenu_GetLandmarkCoords:
|
||||
; Return coordinates (d, e) of landmark e.
|
||||
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
|
||||
ld d, [hl]
|
||||
pop bc
|
||||
pop hl
|
||||
ret
|
||||
|
||||
INCLUDE "data/level_selection_menu.asm"
|
||||
|
||||
LevelSelectionMenuGFX:
|
||||
INCBIN "gfx/level_selection_menu/background.2bpp.lz"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user