From e300f1d89c0d877ab0ed8af832a4070ff0bea002 Mon Sep 17 00:00:00 2001 From: NobodySociety <43542553+NobodySociety@users.noreply.github.com> Date: Tue, 8 Jun 2021 16:33:37 -0400 Subject: Updated with a slight optimization --- "Customizable-Pok\303\251dex-Color.md" | 38 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git "a/Customizable-Pok\303\251dex-Color.md" "b/Customizable-Pok\303\251dex-Color.md" index 6290d37..7be8aef 100644 --- "a/Customizable-Pok\303\251dex-Color.md" +++ "b/Customizable-Pok\303\251dex-Color.md" @@ -168,7 +168,7 @@ Here we're adding the color option to the cursor jumptable. You may notice that + call Pokedex_BlackOutBG + ld a, DEXSTATE_COLOR_OPTION + ld [wJumptableIndex], a -+ ret ++ ret .MenuAction_UnownMode: call Pokedex_BlackOutBG @@ -368,7 +368,7 @@ Pokedex_UpdateColorOption: call Pokedex_BlackOutBG ld a, DEXSTATE_MAIN_SCR ld [wJumptableIndex], a - ret + ret .MenuActionJumptable: dw .MenuAction_Red @@ -500,7 +500,18 @@ Searching the file for the default Pokédex color (`PREDEFPAL_POKEDEX`) will sho ```diff _CGB_Pokedex: ld de, wBGPals1 -- ld a, PREDEFPAL_POKEDEX ++ call CheckPokedexColor + call GetPredefPal + call LoadHLPaletteIntoDE ; dex interface palette + ld a, [wCurPartySpecies] + cp $ff + jr nz, .is_pokemon + ld hl, PokedexQuestionMarkPalette + call LoadHLPaletteIntoDE ; green question mark palette + jr .got_palette + ... + ++CheckPokedexColor: + ld a, [wCurPokedexColor] + cp DEXCOLOR_BLUE + jr nz, .Purple @@ -538,28 +549,19 @@ _CGB_Pokedex: + jr .setColor +.Gray + cp DEXCOLOR_GRAY -+ jr nz, .Mewtwo ++ jr nz, .Red + ld a, PREDEFPAL_CGB_BADGE + jr .setColor -+.Mewtwo -+ cp DEXCOLOR_MEWTWO -+ jr nz, .Red -+ ld a, PREDEFPAL_DIPLOMA -+ jr .setColor +.Red + ld a, PREDEFPAL_POKEDEX +.setColor - call GetPredefPal - call LoadHLPaletteIntoDE ; dex interface palette - ld a, [wCurPartySpecies] - cp $ff - jr nz, .is_pokemon - ld hl, .PokedexQuestionMarkPalette - call LoadHLPaletteIntoDE ; green question mark palette - jr .got_palette ++ ret + +PokedexQuestionMarkPalette: +INCLUDE "gfx/pokedex/question_mark.pal" ``` -We replaced the inital load of `PREDEFPAL_POKEDEX` with a chain comparison that finds the correct color and sets it. Do this for the other two mentioned locations and your done. +We replaced the inital load of `PREDEFPAL_POKEDEX` with `CheckPokedexColor` that finds the correct color and sets it. Do this for the other two mentioned locations and your done. ## 5. Closing -- cgit v1.2.3