From fa1323be3ac0564ccb206dd477d76d03612fcc2a Mon Sep 17 00:00:00 2001 From: coderthegreat2 Date: Wed, 22 May 2024 22:41:51 -0400 Subject: [PATCH] Addition of colored starter sprites and met data page in pokemon stats menu --- README.md | 24 ++--- engine/battle/effect_commands.asm | 1 - engine/events/pokepic.asm | 9 +- engine/gfx/cgb_layouts.asm | 13 ++- engine/gfx/color.asm | 10 +- engine/pokemon/stats_screen.asm | 150 ++++++++++++++++++++++++------ gfx/stats/pages.pal | 5 + gfx/stats/stats.pal | 2 + 8 files changed, 162 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index dad20292232..21ed74c8ff3 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,6 @@ # Pokémon Crystal [![Build Status][ci-badge]][ci] -This is a disassembly of my Pokémon Crystal romhack based on the dissasembly by pret. - -It adds new features such as: - -- the physical/special split -- the fairy type -- a move relearner -- the removal of overworld poison damage -- colors for each type of pokeball -- much more - -This romhack is a WIP and may contain bugs. +This is a disassembly of Pokémon Crystal. It builds the following ROMs: @@ -31,3 +20,14 @@ To set up the repository, see [INSTALL.md](INSTALL.md). - [**Documentation**][docs] - [**Wiki**][wiki] (includes [tutorials][tutorials]) - [**Symbols**][symbols] + +You can find us on [Discord (pret, #pokecrystal)](https://discord.gg/d5dubZ3). + +For other pret projects, see [pret.github.io](https://pret.github.io/). + +[docs]: https://pret.github.io/pokecrystal/ +[wiki]: https://github.com/pret/pokecrystal/wiki +[tutorials]: https://github.com/pret/pokecrystal/wiki/Tutorials +[symbols]: https://github.com/pret/pokecrystal/tree/symbols +[ci]: https://github.com/pret/pokecrystal/actions +[ci-badge]: https://github.com/pret/pokecrystal/actions/workflows/main.yml/badge.svg diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index a7274a16d54..c6d83e7d1a6 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -41,7 +41,6 @@ DoMove: ; Get the user's move effect. ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar - and TYPE_MASK ld c, a ld b, 0 ld hl, MoveEffectsPointers diff --git a/engine/events/pokepic.asm b/engine/events/pokepic.asm index 7050ef1c70f..5f5f82c0274 100644 --- a/engine/events/pokepic.asm +++ b/engine/events/pokepic.asm @@ -4,8 +4,9 @@ Pokepic:: call MenuBox call UpdateSprites call ApplyTilemap - ld b, SCGB_POKEPIC - call GetSGBLayout + ld de, wBGPals1 palette PAL_BG_TEXT color 1 + farcall LoadPokemonPalette + call UpdateTimePals xor a ldh [hBGMapMode], a ld a, [wCurPartySpecies] @@ -36,7 +37,7 @@ ClosePokepic:: xor a ldh [hBGMapMode], a call LoadOverworldTilemapAndAttrmapPals - call ApplyTilemap + call CopyTilemapAtOnce call UpdateSprites call LoadStandardFont ret @@ -45,4 +46,4 @@ PokepicMenuHeader: db MENU_BACKUP_TILES ; flags menu_coords 6, 4, 14, 13 dw NULL - db 1 ; default option + db 1 ; default option \ No newline at end of file diff --git a/engine/gfx/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm index e8ea24e162b..324eee0aaa3 100644 --- a/engine/gfx/cgb_layouts.asm +++ b/engine/gfx/cgb_layouts.asm @@ -213,7 +213,7 @@ _CGB_StatsScreenHPPals: call LoadPalette_White_Col1_Col2_Black ; exp palette ld hl, StatsScreenPagePals ld de, wBGPals1 palette 3 - ld bc, 3 palettes ; pink, green, and blue page palettes + ld bc, 4 palettes ; pink, green, blue, and orange page palettes ld a, BANK(wBGPals1) call FarCopyWRAM call WipeAttrmap @@ -228,21 +228,26 @@ _CGB_StatsScreenHPPals: ld a, $2 ; exp palette call ByteFill - hlcoord 13, 5, wAttrmap + hlcoord 11, 5, wAttrmap lb bc, 2, 2 ld a, $3 ; pink page palette call FillBoxCGB - hlcoord 15, 5, wAttrmap + hlcoord 13, 5, wAttrmap lb bc, 2, 2 ld a, $4 ; green page palette call FillBoxCGB - hlcoord 17, 5, wAttrmap + hlcoord 15, 5, wAttrmap lb bc, 2, 2 ld a, $5 ; blue page palette call FillBoxCGB + hlcoord 17, 5, wAttrmap + lb bc, 2, 2 + ld a, $6 ; orange page palette + call FillBoxCGB + call ApplyAttrmap call ApplyPals ld a, TRUE diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index cd509c76967..bc5e18a8285 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -375,7 +375,6 @@ LoadStatsScreenPals: ret z ld hl, StatsScreenPals ld b, 0 - dec c add hl, bc add hl, bc ldh a, [rSVBK] @@ -1338,3 +1337,12 @@ INCLUDE "gfx/beta_poker/beta_poker.pal" SlotMachinePals: INCLUDE "gfx/slots/slots.pal" + +LoadPokemonPalette: + ld a, [wCurPartySpecies] + ; hl = palette + call GetMonPalettePointer + ; load palette into de (set by caller) + ld bc, PAL_COLOR_SIZE * 2 + ld a, BANK(wBGPals1) + jp FarCopyWRAM diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm index ef5a57b84a1..7a25672acb7 100644 --- a/engine/pokemon/stats_screen.asm +++ b/engine/pokemon/stats_screen.asm @@ -1,8 +1,9 @@ - const_def 1 - const PINK_PAGE ; 1 - const GREEN_PAGE ; 2 - const BLUE_PAGE ; 3 -DEF NUM_STAT_PAGES EQU const_value - 1 + const_def + const PINK_PAGE ; 0 + const GREEN_PAGE ; 1 + const BLUE_PAGE ; 2 + const ORANGE_PAGE ; 3 +NUM_STAT_PAGES EQU const_value DEF STAT_PAGE_MASK EQU %00000011 @@ -62,12 +63,7 @@ StatsScreenInit_gotaddress: StatsScreenMain: xor a ld [wJumptableIndex], a -; ??? - ld [wStatsScreenFlags], a - ld a, [wStatsScreenFlags] - and ~STAT_PAGE_MASK - or PINK_PAGE ; first_page - ld [wStatsScreenFlags], a + ld [wStatsScreenFlags], a ; PINK_PAGE .loop ld a, [wJumptableIndex] and ~(1 << 7) @@ -82,12 +78,7 @@ StatsScreenMain: StatsScreenMobile: xor a ld [wJumptableIndex], a -; ??? - ld [wStatsScreenFlags], a - ld a, [wStatsScreenFlags] - and ~STAT_PAGE_MASK - or PINK_PAGE ; first_page - ld [wStatsScreenFlags], a + ld [wStatsScreenFlags], a ; PINK_PAGE .loop farcall Mobile_SetOverworldDelay ld a, [wJumptableIndex] @@ -373,21 +364,23 @@ StatsScreen_JoypadAction: .a_button ld a, c - cp BLUE_PAGE ; last page + cp ORANGE_PAGE ; last page jr z, .b_button .d_right inc c - ld a, BLUE_PAGE ; last page + ld a, ORANGE_PAGE ; last page cp c jr nc, .set_page ld c, PINK_PAGE ; first page jr .set_page .d_left - dec c - jr nz, .set_page - ld c, BLUE_PAGE ; last page - jr .set_page + ld a, c + dec c + and a ; cp PINK_PAGE ; first page + jr nz, .set_page + ld c, ORANGE_PAGE ; last page + jr .set_page .done ret @@ -507,7 +500,7 @@ StatsScreen_PlaceHorizontalDivider: ret StatsScreen_PlacePageSwitchArrows: - hlcoord 12, 6 + hlcoord 10, 6 ld [hl], "◀" hlcoord 19, 6 ld [hl], "▶" @@ -563,7 +556,6 @@ StatsScreen_LoadGFX: .PageTilemap: ld a, [wStatsScreenFlags] maskbits NUM_STAT_PAGES - dec a ld hl, .Jumptable rst JumpTable ret @@ -574,6 +566,7 @@ StatsScreen_LoadGFX: dw LoadPinkPage dw LoadGreenPage dw LoadBluePage + dw LoadOrangePage assert_table_length NUM_STAT_PAGES LoadPinkPage: @@ -817,6 +810,94 @@ LoadBluePage: dw sBoxMonOTs dw wBufferMonOT +LoadOrangePage: + call .placeCaughtLocation + ld de, MetAtMapString + hlcoord 1, 9 + call PlaceString + call .placeCaughtLevel + ret + +.placeCaughtLocation + ld a, [wTempMonCaughtLocation] + and CAUGHT_LOCATION_MASK + jr z, .unknown_location + cp LANDMARK_EVENT + jr z, .unknown_location + cp LANDMARK_GIFT + jr z, .unknown_location + ld e, a + farcall GetLandmarkName + ld de, wStringBuffer1 + hlcoord 2, 10 + call PlaceString + ld a, [wTempMonCaughtTime] + and CAUGHT_TIME_MASK + ret z ; no time + rlca + rlca + dec a + ld hl, .times + call GetNthString + ld d, h + ld e, l + call CopyName1 + ld de, wStringBuffer2 + hlcoord 2, 11 + call PlaceString + ret + +.unknown_location: + ld de, MetUnknownMapString + hlcoord 2, 10 + call PlaceString + ret + +.times + db "MORN@" + db "DAY@" + db "NITE@" + +.placeCaughtLevel + ; caught level + ; Limited to between 1 and 63 since it's a 6-bit quantity. + ld a, [wTempMonCaughtLevel] + and CAUGHT_LEVEL_MASK + jr z, .unknown_level + cp CAUGHT_EGG_LEVEL ; egg marker value + jr nz, .print + ld a, EGG_LEVEL ; egg hatch level + +.print + ld [wTextDecimalByte], a + hlcoord 3, 13 + ld de, wTextDecimalByte + lb bc, PRINTNUM_LEFTALIGN | 1, 3 + call PrintNum + ld de, MetAtLevelString + hlcoord 1, 12 + call PlaceString + hlcoord 2, 13 + ld [hl], "" + ret + +.unknown_level + ld de, MetUnknownLevelString + hlcoord 2, 12 + call PlaceString + ret + +MetAtMapString: + db "MET AT:@" + +MetUnknownMapString: + db "UNKNOWN@" + +MetAtLevelString: + db "MET LEVEL:@" +MetUnknownLevelString: + db "???@" + IDNoString: db "№.@" @@ -1106,6 +1187,9 @@ StatsScreen_AnimateEgg: ret StatsScreen_LoadPageIndicators: + hlcoord 11, 5 + ld a, $36 ; " " " " + call .load_square hlcoord 13, 5 ld a, $36 ; first of 4 small square tiles call .load_square @@ -1116,13 +1200,19 @@ StatsScreen_LoadPageIndicators: ld a, $36 ; " " " " call .load_square ld a, c + cp PINK_PAGE + hlcoord 11, 5 + jr z, .load_highlighted_square cp GREEN_PAGE + hlcoord 13, 5 + jr z, .load_highlighted_square + cp BLUE_PAGE + hlcoord 15, 5 + jr z, .load_highlighted_square + ; must be ORANGE_PAGE + hlcoord 17, 5 +.load_highlighted_square ld a, $3a ; first of 4 large square tiles - hlcoord 13, 5 ; PINK_PAGE (< GREEN_PAGE) - jr c, .load_square - hlcoord 15, 5 ; GREEN_PAGE (= GREEN_PAGE) - jr z, .load_square - hlcoord 17, 5 ; BLUE_PAGE (> GREEN_PAGE) .load_square push bc ld [hli], a diff --git a/gfx/stats/pages.pal b/gfx/stats/pages.pal index 837e10cb0f6..bbdd6a3971f 100644 --- a/gfx/stats/pages.pal +++ b/gfx/stats/pages.pal @@ -13,3 +13,8 @@ RGB 17, 31, 31 RGB 17, 31, 31 RGB 00, 00, 00 +; orange + RGB 31, 31, 31 + RGB 30, 24, 16 + RGB 30, 22, 12 + RGB 00, 00, 00 \ No newline at end of file diff --git a/gfx/stats/stats.pal b/gfx/stats/stats.pal index 5b12e02b995..4fa38799ed6 100644 --- a/gfx/stats/stats.pal +++ b/gfx/stats/stats.pal @@ -4,3 +4,5 @@ RGB 21, 31, 14 ; blue RGB 17, 31, 31 +; orange + RGB 30, 24, 16 \ No newline at end of file