From fe4b54cecef32d701e334b422687c4b5e4dd3229 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Fri, 18 Aug 2023 20:19:34 +0200 Subject: [PATCH] Level selection menu: placeholder grahpics and cgb layout (#12) --- charmap.asm | 2 +- constants/cgb_pal_constants.asm | 2 +- engine/gfx/cgb_layouts.asm | 60 +++++++- engine/gfx/color.asm | 13 ++ engine/menus/intro_menu.asm | 2 - engine/menus/level_selection_menu.asm | 14 ++ gfx/level_selection_menu/attrmap.asm | 22 +++ gfx/level_selection_menu/background.png | Bin 0 -> 885 bytes .../background_female.pal | 131 ++++++++++++++++++ gfx/level_selection_menu/background_male.pal | 131 ++++++++++++++++++ gfx/level_selection_menu/page_1.tilemap | Bin 0 -> 361 bytes gfx/level_selection_menu/page_2.tilemap | Bin 0 -> 361 bytes gfx/level_selection_menu/page_3.tilemap | Bin 0 -> 361 bytes gfx/level_selection_menu/page_4.tilemap | Bin 0 -> 361 bytes layout.link | 2 + main.asm | 6 + ram/wram.asm | 3 +- 17 files changed, 377 insertions(+), 11 deletions(-) create mode 100755 engine/menus/level_selection_menu.asm create mode 100755 gfx/level_selection_menu/attrmap.asm create mode 100755 gfx/level_selection_menu/background.png create mode 100755 gfx/level_selection_menu/background_female.pal create mode 100755 gfx/level_selection_menu/background_male.pal create mode 100755 gfx/level_selection_menu/page_1.tilemap create mode 100755 gfx/level_selection_menu/page_2.tilemap create mode 100755 gfx/level_selection_menu/page_3.tilemap create mode 100755 gfx/level_selection_menu/page_4.tilemap diff --git a/charmap.asm b/charmap.asm index 86e9fa6ca..1c3156abb 100644 --- a/charmap.asm +++ b/charmap.asm @@ -181,7 +181,7 @@ pushc charmap "\r", $0d popc -; Special tiles +; Significant tile equivalences DEF OVERWORLD_FRAME_FIRST_TILE EQU "┌" DEF BOARD_MENU_BG_FIRST_TILE EQU "A" DEF BOARD_MENU_OAM_FIRST_TILE EQU BOARD_MENU_BG_FIRST_TILE + 18 * 3 diff --git a/constants/cgb_pal_constants.asm b/constants/cgb_pal_constants.asm index a760cc7f9..820533088 100644 --- a/constants/cgb_pal_constants.asm +++ b/constants/cgb_pal_constants.asm @@ -13,7 +13,7 @@ const CGB_PARTY_MENU const CGB_EVOLUTION const CGB_GS_TITLE_SCREEN - const CGB_0D + const CGB_LEVEL_SELECTION_MENU const CGB_MOVE_LIST const CGB_BETA_PIKACHU_MINIGAME const CGB_POKEDEX_SEARCH_OPTION diff --git a/engine/gfx/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm index d0591e637..eb3dc5597 100644 --- a/engine/gfx/cgb_layouts.asm +++ b/engine/gfx/cgb_layouts.asm @@ -38,7 +38,7 @@ CGBLayoutJumptable: dw _CGB_PartyMenu dw _CGB_Evolution dw _CGB_GSTitleScreen - dw _CGB_Unused0D + dw _CGB_LevelSelectionMenu dw _CGB_MoveList dw _CGB_BetaPikachuMinigame dw _CGB_PokedexSearchOption @@ -570,11 +570,61 @@ _CGB_GSTitleScreen: ldh [hCGBPalUpdate], a ret -_CGB_Unused0D: - ld hl, FourPals_Diploma - call CopyFourPalettes - call WipeAttrmap +_CGB_LevelSelectionMenu: +; load daytime-based player sprite pals (male and female) + ld a, [wTimeOfDay] + maskbits NUM_DAYTIMES + ld bc, 8 palettes + ld hl, MapObjectPals + call AddNTimes + ld de, wOBPals1 + ld bc, 2 palettes + ld a, BANK(wOBPals1) + call FarCopyWRAM +; load daytime and gender-based background pals + ld a, [wPlayerGender] + bit PLAYERGENDER_FEMALE_F, a + jr z, .male + ld hl, LevelSelectionMenuFemalePals + jr .got_pals +.male + ld hl, LevelSelectionMenuMalePals +.got_pals + ld a, [wTimeOfDay] + maskbits NUM_DAYTIMES + ld bc, 6 palettes + call AddNTimes + ld de, wBGPals1 + ld bc, 6 palettes + ld a, BANK(wBGPals1) + call FarCopyWRAM +; assign attrs based on tile ids according to LevelSelectionMenuAttrmap + hlcoord 0, 0 + decoord 0, 0, wAttrmap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT +.loop + push hl + ld a, [hl] ; tile id + ld hl, LevelSelectionMenuAttrmap + add l + ld l, a + ld a, h + adc 0 + ld h, a + ld a, [hl] ; attr value + ld [de], a + pop hl + inc hl + inc de + dec bc + ld a, b + or c + jr nz, .loop +; apply pals and attrmap call ApplyAttrmap + call ApplyPals + ld a, TRUE + ldh [hCGBPalUpdate], a ret _CGB_UnownPuzzle: diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index 178fed496..a2799366a 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -811,3 +811,16 @@ INCLUDE "gfx/beta_poker/beta_poker.pal" SlotMachinePals: INCLUDE "gfx/slots/slots.pal" + +LevelSelectionMenuMalePals: + table_width PAL_COLOR_SIZE * 4 * 6, LevelSelectionMenuMalePals +INCLUDE "gfx/level_selection_menu/background_male.pal" + assert_table_length NUM_DAYTIMES + +LevelSelectionMenuFemalePals: + table_width PAL_COLOR_SIZE * 4 * 6, LevelSelectionMenuFemalePals +INCLUDE "gfx/level_selection_menu/background_female.pal" + assert_table_length NUM_DAYTIMES + +LevelSelectionMenuAttrmap: +INCLUDE "gfx/level_selection_menu/attrmap.asm" diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm index 21415e7ef..9ad8e7c1c 100644 --- a/engine/menus/intro_menu.asm +++ b/engine/menus/intro_menu.asm @@ -376,8 +376,6 @@ FinishContinueFunction: ld hl, wGameTimerPaused set GAME_TIMER_PAUSED_F, [hl] res GAME_TIMER_MOBILE_F, [hl] - ld hl, wEnteredMapFromContinue - set 1, [hl] farcall OverworldLoop ld a, [wSpawnAfterChampion] cp SPAWN_LEVEL_1 diff --git a/engine/menus/level_selection_menu.asm b/engine/menus/level_selection_menu.asm new file mode 100755 index 000000000..704ca2fe3 --- /dev/null +++ b/engine/menus/level_selection_menu.asm @@ -0,0 +1,14 @@ +LevelSelectionMenuGFX: +INCBIN "gfx/level_selection_menu/background.2bpp.lz" + +LevelSelectionMenuPage1Tilemap: +INCBIN "gfx/level_selection_menu/page_1.tilemap" + +LevelSelectionMenuPage2Tilemap: +INCBIN "gfx/level_selection_menu/page_2.tilemap" + +LevelSelectionMenuPage3Tilemap: +INCBIN "gfx/level_selection_menu/page_3.tilemap" + +LevelSelectionMenuPage4Tilemap: +INCBIN "gfx/level_selection_menu/page_4.tilemap" diff --git a/gfx/level_selection_menu/attrmap.asm b/gfx/level_selection_menu/attrmap.asm new file mode 100755 index 000000000..1654e47a1 --- /dev/null +++ b/gfx/level_selection_menu/attrmap.asm @@ -0,0 +1,22 @@ +DEF PAL_LEVELSELECTIONMENU_BORDER EQU 0 | 1 << OAM_PRIORITY + const_def 1 + const PAL_LEVELSELECTIONMENU_EARTH ; 1 + const PAL_LEVELSELECTIONMENU_MOUNTAIN ; 2 + const PAL_LEVELSELECTIONMENU_CITY ; 3 + const PAL_LEVELSELECTIONMENU_POI ; 4 + const PAL_LEVELSELECTIONMENU_POI_MTN ; 5 + +MACRO levelselectionmenupals +rept _NARG + db PAL_LEVELSELECTIONMENU_\1 + shift +endr +ENDM + +; gfx/level_selection_menu/background.png + levelselectionmenupals EARTH, EARTH, EARTH, MOUNTAIN, MOUNTAIN, MOUNTAIN, BORDER, BORDER + levelselectionmenupals EARTH, EARTH, CITY, EARTH, POI, POI_MTN, POI, POI_MTN + levelselectionmenupals EARTH, EARTH, EARTH, MOUNTAIN, MOUNTAIN, MOUNTAIN, BORDER, BORDER + levelselectionmenupals EARTH, EARTH, EARTH, EARTH, EARTH, BORDER, BORDER, BORDER + levelselectionmenupals EARTH, EARTH, EARTH, MOUNTAIN, MOUNTAIN, MOUNTAIN, BORDER, BORDER + levelselectionmenupals BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER, BORDER diff --git a/gfx/level_selection_menu/background.png b/gfx/level_selection_menu/background.png new file mode 100755 index 0000000000000000000000000000000000000000..a73d71d6b5631685ea452d2a7bc4b09d74b353c7 GIT binary patch literal 885 zcmV-*1B(2KP)Px#32;bRa{vGmbN~PnbOGLGA9w%&0}4q*K~!i%?V5{j z!Y~X)DcUc>N5V&TyAc-|&yU1yhJYQZ%EO7{*iI;H%jtAl4-VJswUs|(TA8&am&>J< z9HWu_nSNlc0nX?1tyW`QS5pV=2a$YPmR3ecT^es+Wb6Ji{l{DR3pyXhqmBo4-3A=1 z={27Eh;Gj$vJtXO4(J#C00f}d4@jmcp)$W@a%(?dxAFlf;Rb-L14{;>dYva`7gz#irCmDGC#7ZiRw{8mw*4D^A&lZx& zt>k52`xXGB_s(!SayE20?Uw=2!LX2ywgM&nV#y=l(FfW_>Ooujh^N%EiF!Q0T5?&J z>k_QkR`WJdg^PK{?uB+P+blD9@;#t8l4tA4{p$dsZJmBev~~}f|62m=9ee`gUo`=w zPcnIg7eGC~cii3_5g>2zEkGx9&rE<1T%O5*%gvVFu25RskiO#bS8#5+JXE<5>@&%V)~!Q1^1)C=v~ zy6-4)B=iGIJ+Ep%;e7f-C%w0Rdk2`sOx^#)NZ&_sXzu_RfQ;zP<_PNHq9`K+s?5?m z3hnToXVPQC{UvZuW1qe8PbTucCAwcbpRX0Q3}20%kAl!l^?hvQ@$aBLOoBf9<1EDncngi@1E3tmjs00000 LNkvXXu0mjf=a#1@ literal 0 HcmV?d00001 diff --git a/gfx/level_selection_menu/background_female.pal b/gfx/level_selection_menu/background_female.pal new file mode 100755 index 000000000..db8e0eb37 --- /dev/null +++ b/gfx/level_selection_menu/background_female.pal @@ -0,0 +1,131 @@ +; morn + +; border + RGB 28, 31, 20 + RGB 21, 21, 21 + RGB 13, 13, 13 + RGB 00, 00, 00 +; earth + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 00, 00, 00 +; mountain + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 00, 00, 00 +; city (girl) + RGB 28, 31, 20 + RGB 10, 18, 31 + RGB 13, 06, 31 + RGB 00, 00, 00 +; point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 31, 00, 00 +; mountain point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 31, 00, 00 + +; day (original) + +; border + RGB 28, 31, 20 + RGB 21, 21, 21 + RGB 13, 13, 13 + RGB 00, 00, 00 +; earth + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 00, 00, 00 +; mountain + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 00, 00, 00 +; city (girl) + RGB 28, 31, 20 + RGB 10, 18, 31 + RGB 13, 06, 31 + RGB 00, 00, 00 +; point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 31, 00, 00 +; mountain point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 31, 00, 00 + +; nite + +; border + RGB 28, 31, 20 + RGB 21, 21, 21 + RGB 13, 13, 13 + RGB 00, 00, 00 +; earth + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 00, 00, 00 +; mountain + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 00, 00, 00 +; city (girl) + RGB 28, 31, 20 + RGB 10, 18, 31 + RGB 13, 06, 31 + RGB 00, 00, 00 +; point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 31, 00, 00 +; mountain point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 31, 00, 00 + +; eve + +; border + RGB 28, 31, 20 + RGB 21, 21, 21 + RGB 13, 13, 13 + RGB 00, 00, 00 +; earth + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 00, 00, 00 +; mountain + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 00, 00, 00 +; city (girl) + RGB 28, 31, 20 + RGB 10, 18, 31 + RGB 13, 06, 31 + RGB 00, 00, 00 +; point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 31, 00, 00 +; mountain point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 31, 00, 00 \ No newline at end of file diff --git a/gfx/level_selection_menu/background_male.pal b/gfx/level_selection_menu/background_male.pal new file mode 100755 index 000000000..c8007208a --- /dev/null +++ b/gfx/level_selection_menu/background_male.pal @@ -0,0 +1,131 @@ +; morn + +; border + RGB 28, 31, 20 + RGB 21, 21, 21 + RGB 13, 13, 13 + RGB 00, 00, 00 +; earth + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 00, 00, 00 +; mountain + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 00, 00, 00 +; city (boy) + RGB 28, 31, 20 + RGB 31, 15, 00 + RGB 15, 07, 00 + RGB 00, 00, 00 +; point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 31, 00, 00 +; mountain point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 31, 00, 00 + +; day (original) + +; border + RGB 28, 31, 20 + RGB 21, 21, 21 + RGB 13, 13, 13 + RGB 00, 00, 00 +; earth + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 00, 00, 00 +; mountain + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 00, 00, 00 +; city (boy) + RGB 28, 31, 20 + RGB 31, 15, 00 + RGB 15, 07, 00 + RGB 00, 00, 00 +; point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 31, 00, 00 +; mountain point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 31, 00, 00 + +; nite + +; border + RGB 28, 31, 20 + RGB 21, 21, 21 + RGB 13, 13, 13 + RGB 00, 00, 00 +; earth + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 00, 00, 00 +; mountain + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 00, 00, 00 +; city (boy) + RGB 28, 31, 20 + RGB 31, 15, 00 + RGB 15, 07, 00 + RGB 00, 00, 00 +; point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 31, 00, 00 +; mountain point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 31, 00, 00 + +; eve + +; border + RGB 28, 31, 20 + RGB 21, 21, 21 + RGB 13, 13, 13 + RGB 00, 00, 00 +; earth + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 00, 00, 00 +; mountain + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 00, 00, 00 +; city (boy) + RGB 28, 31, 20 + RGB 31, 15, 00 + RGB 15, 07, 00 + RGB 00, 00, 00 +; point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 00, 00, 31 + RGB 31, 00, 00 +; mountain point of interest + RGB 28, 31, 20 + RGB 00, 31, 00 + RGB 15, 07, 00 + RGB 31, 00, 00 \ No newline at end of file diff --git a/gfx/level_selection_menu/page_1.tilemap b/gfx/level_selection_menu/page_1.tilemap new file mode 100755 index 0000000000000000000000000000000000000000..891631fd753eb720dcd7b2af924e2eba700b7048 GIT binary patch literal 361 zcmZXN%MyYx3`Idv$0CdwYK_^I7GL%8|6iv!g<->8w8@#1WV>7B?Cgf-glLiEtgWhQ z;@*de;Ty8rw*_^hXYFa6E``=jW-$t4qaeChus*qR)iN8s;+3IDj?7+X(K4>+DX^Zo$ZW+mk?%P Us@5)jo{M~6_eI{<$0E1iA6`2n1poj5 literal 0 HcmV?d00001 diff --git a/gfx/level_selection_menu/page_2.tilemap b/gfx/level_selection_menu/page_2.tilemap new file mode 100755 index 0000000000000000000000000000000000000000..693ad4f66abd8ce23ae4113bdbc5da0154418f8d GIT binary patch literal 361 zcmZXP+X})k5JYW2g*0HN)Vl7IO&f3Z^8a6_v(bk_22#lB*-Wz87CH3YB2z*XnHP-2 z(30%|v_xcS48Q3;RMlk$=r|co&~A;&(E|eDRf8(O8sLm+R$0J-6wuB+|1mJhJim*7 z&qIg72B0yYrzh@Iq&APu*^?$Sk%nGN#y(ePwyNxg#yAtjM