From 98110eddc82ff056a0c8420dc96fe5d9bbd9cb79 Mon Sep 17 00:00:00 2001 From: Llinos Evans <36418502+PlagueVonKarma@users.noreply.github.com> Date: Sun, 11 Jun 2023 07:25:45 +0100 Subject: [PATCH] DV / Stat Exp display in stat menu Imported from Shin Pokered. Required a little bit of refactoring but all in all very straightforward. I changed the WRAM associations to be easier for me to work with should I ever need to. I am not a 100% fan of the way this works - requiring hold inputs - but I am also not sure how to make it just be something you can easily input... --- README.md | 12 ++-- engine/pokemon/status_screen.asm | 110 ++++++++++++++++++++++++++++++- ram/wram.asm | 9 ++- 3 files changed, 121 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f750492d..0efb3c05 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,12 @@ New Pokemon: The Kanto Expansion Pak's ethos is to add every "Kanto-related" Pokemon to RBY without fundamentally changing the grander metagame. What's defined as "Kanto-related" is a Pokemon that evolves from an existing Kanto Pokemon, made an appearance in a Kanto-based game (LGPE), is a regional variant, or was a Kanto-related Pokemon cut during the development of an official game. With this criteria, we get: -- The 34 known beta Pokemon that were cut from RBY; eg. Gorochu, Deer +- The 34 known beta Pokemon that were cut from Red and Green; eg. Gorochu, Deer - Evolutions or pre-evolutions of a Kanto Pokemon found in a future generation eg. Kleavor, Glaceon, Annihilape -- Evolutions of Kanto Pokemon found in the SpaceWorld '97 demo; eg. Madaamu, Purakkusu +- Evolutions of Kanto Pokemon found in the SpaceWorld '97 demo of Gold and Silver; eg. Madaamu, Purakkusu - All fully-evolved regional variants of Kanto Pokemon; eg. Hisuian Arcanine, Galarian Slowbro, Paldean Tauros, Alolan Muk -- Meltan and Melmetal from LGPE. -- Paradox Pokemon from SV; Scream Tail and Sandy Shocks. +- Meltan and Melmetal from Let's Go Pikachu and Let's Go Eevee. +- Paradox Pokemon from Scarlet & Violet; Scream Tail and Sandy Shocks. Johto baby Pokemon and regional pre-evolutions were omitted due to RBY using an 8-bit register. This hack as-is just barely manages to fit everything. A refactor to a 16-bit register is possible and has been done before, but only on a really old pokered version that would require a ton of its own refactoring to be modernised. It's just not feasible at this current time. @@ -119,6 +119,7 @@ QoL Enhancements - New Pokedex entries for most Pokemon are available, sourced from the original 1996 Pokedex book by Creatures Inc., restoring a ton of old Kanto lore. Thanks to [Dr. Lava and Nob Ogasawara](http://lavacutcontent.com/1996-creatures-pokedex-translation-1/) for their incredible work translating and writing about it! - Pikachu and Eevee are now starters, featuring fully functional Rival lineups. If you pick Pikachu, he picks Eevee, and if you pick Eevee, he picks Pikachu! Their growth rates have been changed to Medium Slow to give them the early-game power spike the other starters have. - Item Descriptions are available! +- DVs and Stat Exp can be viewed on the status screen by holding start or select when opening the menu, respectively. Feature ported to modern Pokered from Shin Pokered. - Press A beside surfable water, strength boulders, or cut trees to use the HMs without needing to go into the Party menu. - Running Shoes activate by holding B. Also works with the bike and Surf. - Fast text has no frame delay between text scrolling, doubling the scroll speed. It's also been made the default option, so you don't need to go into the Options menu for it. @@ -208,6 +209,7 @@ Known Bugs - Meltan spawned via the Mystery Box will use the moves of the Pokemon they are replacing. - GiveMonName doesn't work properly for the Vermilion Beauty after receiving the Pokemon, jank ensues. - Text scrolls immediately when receiving the Pokemon from the Vermilion Beauty. +- HP DV does not appear to display correctly. Evolution Methods for new Pokemon ==== @@ -336,7 +338,7 @@ Credits * Helix Chamber, RacieBeep, loumilouminosus, Orchid, GBCRetro, & catstorm26 - Prototype Pokémon sprites * Vortiene - Reused a bit of code from their pureRGB hack. Assisted in bug fixes. * Pigu-A, RevoSucks, walle303 - Contributors to Pokemon Anniversary Red, which we used as reference points for the Girl sprites and the Battle Tent. -* jojobear13 & Mateo - Move deleter & move relearner functionality from Shin Pokered, followed [this guide](https://github.com/jojobear13/shinpokered/blob/master/how%20to%20guides/how%20to%20add%20the%20move%20relearner%26deleter.txt). Tweaks were made to make it compatible with the pokered version we worked off of. +* jojobear13 & Mateo - HP/StatExp display, move deleter, & move relearner functionality from Shin Pokered, followed [this guide](https://github.com/jojobear13/shinpokered/blob/master/how%20to%20guides/how%20to%20add%20the%20move%20relearner%26deleter.txt). Tweaks were made to make it compatible with the pokered version we worked off of. * Rangi - Reused a bit of code from their Red* / Blue* hack to make HMs usable in the overworld! * wrulfy - Technical advice * 大吟醸 (Daiginjo) - Assistance in translating the Tamamushi University Student Book, allowing for an accurate adaptation of the location. diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index 27928b3b..d85308d9 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -33,6 +33,7 @@ DrawHP_: ld a, $6 ld d, a ld c, a + ; shin pokered status screen func .drawHPBarAndPrintFraction pop hl push de @@ -40,7 +41,7 @@ DrawHP_: push hl call DrawHPBar pop hl - ldh a, [hUILayoutFlags] + ld a, [hUILayoutFlags] ; wass hFlags_0xFFF6, translated into modern pokered-ese it's this bit 0, a jr z, .printFractionBelowBar ld bc, $9 ; right of bar @@ -49,6 +50,24 @@ DrawHP_: ld bc, SCREEN_WIDTH + 1 ; below bar .printFraction add hl, bc + +;joenote - print stat exp if select is held + ;parse dv stats here so they can be grabbed later + call DVParse + call Joypad + ld a, [hJoyHeld] + bit 2, a + jr z, .checkstart + ld de, wLoadedMonHPExp + lb bc, 2, 5 + jr .printnum +.checkstart ;print DVs if start is held + bit 3, a + jr z, .doregular + ld de, wDVCalcVar1 + lb bc, 1, 2 + jr .printnum +.doregular ld de, wLoadedMonHP lb bc, 2, 3 call PrintNumber @@ -56,6 +75,8 @@ DrawHP_: ld [hli], a ld de, wLoadedMonMaxHP lb bc, 2, 3 + +.printnum call PrintNumber pop hl pop de @@ -272,6 +293,36 @@ PrintStatsBox: pop hl pop bc add hl, bc +; New Stat Exp / DVs display functionality, from shin pokered. +;joenote - print stat exp if select is held + call Joypad + ld a, [hJoyHeld] + bit 2, a + jr z, .checkstart + dec l ;shift alignment 2 tiles to the left + dec l + ld de, wLoadedMonAttackExp + lb bc, 2, 5 + call PrintStat + ld de, wLoadedMonDefenseExp + call PrintStat + ld de, wLoadedMonSpeedExp + call PrintStat + ld de, wLoadedMonSpecialExp + jp PrintNumber +.checkstart ;joenote - print DVs if start is held + bit 3, a + jr z, .doregular + ld de, wDVCalcVar2 + lb bc, 1, 2 + call PrintStat + ld de, wDVCalcVar2 + 1 + call PrintStat + ld de, wDVCalcVar2 + 2 + call PrintStat + ld de, wDVCalcVar2 + 3 + jp PrintNumber +.doregular ld de, wLoadedMonAttack lb bc, 2, 3 call PrintStat @@ -279,7 +330,7 @@ PrintStatsBox: call PrintStat ld de, wLoadedMonSpeed call PrintStat - ld de, wLoadedMonSpecial + ld de, wLoadedMonSpecial jp PrintNumber PrintStat: push hl @@ -480,3 +531,58 @@ StatusScreen_PrintPP: dec c jr nz, StatusScreen_PrintPP ret + +; DV parsing from shin pokered +;joenote - parse DV scores +DVParse: + push hl + push bc + ld hl, wDVCalcVar2 + ld b, $00 + + ld a, [wLoadedMonDVs] ;get attack dv + swap a + and $0F + ld [hl], a + inc hl + and $01 + sla a + sla a + sla a + or b + ld b, a + + + ld a, [wLoadedMonDVs] ;get defense dv + and $0F + ld [hl], a + inc hl + and $01 + sla a + sla a + or b + ld b, a + + ld a, [wLoadedMonDVs + 1] ;get speed dv + swap a + and $0F + ld [hl], a + inc hl + and $01 + sla a + or b + ld b, a + + ld a, [wLoadedMonDVs + 1] ;get special dv + and $0F + ld [hl], a + inc hl + and $01 + or b + ld b, a + + ld [hl], b ;load hp dv + + pop bc + pop hl + ret diff --git a/ram/wram.asm b/ram/wram.asm index 753186cf..e00ee0a9 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1797,8 +1797,6 @@ wOptions:: db wObtainedBadges:: flag_array NUM_BADGES - ds 1 - ; bit 0: If 0, limit the delay to 1 frame. Note that this has no effect if ; the delay has been disabled entirely through bit 1 of this variable ; or bit 6 of wd730. @@ -1854,8 +1852,13 @@ wSpriteSetID:: db wObjectDataPointerTemp:: dw +; Used on the new status screen +wDVCalcVar1:: ds 2 +wDVCalcVar2:: + ds 4 + ; the tile shown outside the boundaries of the map wMapBackgroundTile:: db @@ -1871,7 +1874,7 @@ wDestinationWarpID:: db ;;;;;;;;;; note: CHANGED: this empty space is now used for bigger bag space - TY Vortiene UNION ; original size of this empty space -ds 128 +ds 124 NEXTU wNumBagItems:: db