diff --git a/Makefile b/Makefile index 7ca4dbeef9..ec51d3b03d 100755 --- a/Makefile +++ b/Makefile @@ -235,7 +235,6 @@ gfx/slots/slots_2.2bpp: tools/gfx += --interleave --png=$< gfx/slots/slots_3.2bpp: tools/gfx += --interleave --png=$< --remove-duplicates --keep-whitespace --remove-xflip gfx/stats/judge.2bpp: tools/gfx += --trim-whitespace -gfx/stats/stats_balls.2bpp: gfx/stats/stats.2bpp gfx/stats/balls.2bpp ; $Qcat $^ > $@ gfx/title/crystal.2bpp: tools/gfx += --interleave --png=$< gfx/title/logo_version.2bpp: gfx/title/logo.2bpp gfx/title/version.2bpp ; $Qcat $^ > $@ diff --git a/constants/cgb_constants.asm b/constants/cgb_constants.asm index 29a3e8de44..add1dbe4f0 100755 --- a/constants/cgb_constants.asm +++ b/constants/cgb_constants.asm @@ -4,7 +4,7 @@ const CGB_BATTLE_GRAYSCALE const CGB_BATTLE_COLORS const CGB_POKEGEAR_PALS - const CGB_STATS_SCREEN_HP_PALS + const CGB_SUMMARY_SCREEN_HP_PALS const CGB_POKEDEX const CGB_POKEDEX_PREPARE_ONLY const CGB_SLOT_MACHINE diff --git a/constants/menu_constants.asm b/constants/menu_constants.asm index 360de391a3..99e3e5d8c0 100644 --- a/constants/menu_constants.asm +++ b/constants/menu_constants.asm @@ -55,7 +55,7 @@ const MONMENUITEM_HEADBUTT ; 11 const MONMENUITEM_ROCKSMASH ; 12 ; options - const MONMENUITEM_STATS ; 13 + const MONMENUITEM_SUMMARY ; 13 const MONMENUITEM_SWITCH ; 14 const MONMENUITEM_ITEM ; 15 const MONMENUITEM_CANCEL ; 16 diff --git a/constants/summary_constants.asm b/constants/summary_constants.asm new file mode 100644 index 0000000000..bbe14be6b2 --- /dev/null +++ b/constants/summary_constants.asm @@ -0,0 +1,11 @@ + const_def + const SUMMARY_PINK_PAGE + const SUMMARY_BLUE_PAGE + const SUMMARY_GREEN_PAGE + const SUMMARY_ORANGE_PAGE +DEF NUM_SUMMARY_PAGES EQU const_value + +; Routines for hblank (see home/lcd.asm) +DEF SUMMARY_LCD_HIDE_WINDOW EQU 0 +DEF SUMMARY_LCD_SHOW_WINDOW EQU 1 +DEF SUMMARY_LCD_SCROLL_BACKGROUND EQU 2 diff --git a/data/abilities/descriptions.asm b/data/abilities/descriptions.asm index c1e152ca92..05d5eebc24 100644 --- a/data/abilities/descriptions.asm +++ b/data/abilities/descriptions.asm @@ -157,755 +157,755 @@ AbilityDescriptions: assert_table_length NUM_ABILITIES NoAbilityDescription: - text "Abilities are" - next1 "disabled." + text "Abilities are" + next "disabled." done StenchDescription: - text "May cause the foe" - next1 "to flinch." + text "May cause the foe" + next "to flinch." done DrizzleDescription: - text "Summons rain when" - next1 "switched in." + text "Summons rain when" + next "switched in." done SpeedBoostDescription: - text "Its Speed stat is" - next1 "gradually boosted." + text "Its Speed stat is" + next "gradually boosted." done BattleArmorDescription: ShellArmorDescription: - text "Protects from" - next1 "critical hits." + text "Protects from" + next "critical hits." done SturdyDescription: - text "Cannot be knocked" - next1 "out with one hit." + text "Cannot be knocked" + next "out with one hit." done DampDescription: - text "Prevents self-" - next1 "destructing moves." + text "Prevents self-" + next "destructing moves." done LimberDescription: - text "Protects from" - next1 "paralysis." + text "Protects from" + next "paralysis." done SandVeilDescription: - text "Boosts evasion in" - next1 "a sandstorm." + text "Boosts evasion in" + next "a sandstorm." done StaticDescription: - text "Contact may cause" - next1 "paralysis." + text "Contact may cause" + next "paralysis." done VoltAbsorbDescription: - text "Restores HP if hit" - next1 "by Electric moves." + text "Restores HP if hit" + next "by Electric moves." done WaterAbsorbDescription: - text "Restores HP if hit" - next1 "by Water moves." + text "Restores HP if hit" + next "by Water moves." done ObliviousDescription: - text "Prevents it from" - next1 "being infatuated." + text "Prevents it from" + next "being infatuated." done CloudNineDescription: - text "Eliminates effects" - next1 "of weather." + text "Eliminates effects" + next "of weather." done CompoundEyesDescription: - text "Boosts the Poké-" - next1 "mon's accuracy." + text "Boosts the Poké-" + next "mon's accuracy." done InsomniaDescription: VitalSpiritDescription: - text "Prevents it from" - next1 "falling asleep." + text "Prevents it from" + next "falling asleep." done ImmunityDescription: PastelVeilDescription: - text "Prevents it from" - next1 "getting poisoned." + text "Prevents it from" + next "getting poisoned." done FlashFireDescription: - text "Boosts Fire moves" - next1 "if hit by one." + text "Boosts Fire moves" + next "if hit by one." done ShieldDustDescription: - text "Blocks additional" - next1 "attack effects." + text "Blocks additional" + next "attack effects." done OwnTempoDescription: - text "Prevents it from" - next1 "becoming confused." + text "Prevents it from" + next "becoming confused." done SuctionCupsDescription: - text "Negates forced" - next1 "switch-outs." + text "Negates forced" + next "switch-outs." done IntimidateDescription: - text "Lowers the foe's" - next1 "Attack stat." + text "Lowers the foe's" + next "Attack stat." done ShadowTagDescription: - text "Prevents the foe" - next1 "from escaping." + text "Prevents the foe" + next "from escaping." done LevitateDescription: - text "Gives immunity to" - next1 "Ground-type moves." + text "Gives immunity to" + next "Ground-type moves." done EffectSporeDescription: - text "Contact may cause" - next1 "Par, Psn, or Slp." + text "Contact may cause" + next "Par, Psn, or Slp." done SynchronizeDescription: - text "Passes Psn, Par," - next1 "or Brn to foes." + text "Passes Psn, Par," + next "or Brn to foes." done ClearBodyDescription: WhiteSmokeDescription: - text "Prevents foes from" - next1 "lowering stats." + text "Prevents foes from" + next "lowering stats." done NaturalCureDescription: - text "Switch-outs heal" - next1 "status problems." + text "Switch-outs heal" + next "status problems." done LightningRodDescription: - text "Electric moves" - next1 "boost Sp.Atk." + text "Electric moves" + next "boost Sp.Atk." done SereneGraceDescription: - text "Boosts the rate of" - next1 "added effects." + text "Boosts the rate of" + next "added effects." done SwiftSwimDescription: - text "Boosts its Speed" - next1 "in rain." + text "Boosts its Speed" + next "in rain." done ChlorophyllDescription: - text "Boosts its Speed" - next1 "in sunshine." + text "Boosts its Speed" + next "in sunshine." done IlluminateDescription: - text "Raises the rate" - next1 "of wild #mon." + text "Raises the rate" + next "of wild #mon." done TraceDescription: - text "Copies the foe's" - next1 "Ability." + text "Copies the foe's" + next "Ability." done HugePowerDescription: - text "Boosts its Attack" - next1 "stat." + text "Boosts its Attack" + next "stat." done PoisonPointDescription: - text "Contact may poison" - next1 "the foe." + text "Contact may poison" + next "the foe." done InnerFocusDescription: - text "Protects it from" - next1 "flinching." + text "Protects it from" + next "flinching." done MagmaArmorDescription: - text "Prevents it from" - next1 "becoming frozen." + text "Prevents it from" + next "becoming frozen." done WaterVeilDescription: - text "Prevents it from" - next1 "getting a burn." + text "Prevents it from" + next "getting a burn." done MagnetPullDescription: - text "Prevents escape by" - next1 "Steel-type foes." + text "Prevents escape by" + next "Steel-type foes." done SoundproofDescription: - text "Gives immunity to" - next1 "sound-based moves." + text "Gives immunity to" + next "sound-based moves." done RainDishDescription: - text "Gradually regains" - next1 "HP in rain." + text "Gradually regains" + next "HP in rain." done SandStreamDescription: - text "Summons sandstorm" - next1 "when switched in." + text "Summons sandstorm" + next "when switched in." done PressureDescription: - text "Raises the foe's" - next1 "PP usage." + text "Raises the foe's" + next "PP usage." done ThickFatDescription: - text "Ups resistance to" - next1 "Fire and Ice." + text "Ups resistance to" + next "Fire and Ice." done EarlyBirdDescription: - text "Awakens quickly" - next1 "from sleep." + text "Awakens quickly" + next "from sleep." done FlameBodyDescription: - text "Contact may burn" - next1 "the foe." + text "Contact may burn" + next "the foe." done RunAwayDescription: - text "Sure getaway from" - next1 "wild #mon." + text "Sure getaway from" + next "wild #mon." done KeenEyeDescription: - text "Prevents foes from" - next1 "lowering accuracy." + text "Prevents foes from" + next "lowering accuracy." done HyperCutterDescription: - text "Prevents foes from" - next1 "lowering Attack." + text "Prevents foes from" + next "lowering Attack." done PickupDescription: - text "The #mon may" - next1 "pick up items." + text "The #mon may" + next "pick up items." done HustleDescription: - text "Boosts Attack, but" - next1 "lowers accuracy." + text "Boosts Attack, but" + next "lowers accuracy." done CuteCharmDescription: - text "Contact may cause" - next1 "infatuation." + text "Contact may cause" + next "infatuation." done StickyHoldDescription: - text "Protects it from" - next1 "item theft." + text "Protects it from" + next "item theft." done ShedSkinDescription: - text "May heal its own" - next1 "status problems." + text "May heal its own" + next "status problems." done GutsDescription: - text "Boosts Attack on" - next1 "status problems." + text "Boosts Attack on" + next "status problems." done MarvelScaleDescription: - text "Boosts Defense on" - next1 "status problems." + text "Boosts Defense on" + next "status problems." done LiquidOozeDescription: - text "Damages foes using" - next1 "draining moves." + text "Damages foes using" + next "draining moves." done OvergrowDescription: - text "Boosts Grass moves" - next1 "in a pinch." + text "Boosts Grass moves" + next "in a pinch." done BlazeDescription: - text "Boosts Fire moves" - next1 "in a pinch." + text "Boosts Fire moves" + next "in a pinch." done TorrentDescription: - text "Boosts Water moves" - next1 "in a pinch." + text "Boosts Water moves" + next "in a pinch." done SwarmDescription: - text "Boosts Bug moves" - next1 "in a pinch." + text "Boosts Bug moves" + next "in a pinch." done RockHeadDescription: - text "Protects it from" - next1 "recoil damage." + text "Protects it from" + next "recoil damage." done DroughtDescription: - text "Summons sunlight" - next1 "when switched in." + text "Summons sunlight" + next "when switched in." done ArenaTrapDescription: - text "Prevents the foe" - next1 "from fleeing." + text "Prevents the foe" + next "from fleeing." done TangledFeetDescription: - text "Boosts evasion if" - next1 "it is confused." + text "Boosts evasion if" + next "it is confused." done MotorDriveDescription: - text "Electric moves" - next1 "boost Speed." + text "Electric moves" + next "boost Speed." done RivalryDescription: - text "Boosts damage to" - next1 "same-gender foes." + text "Boosts damage to" + next "same-gender foes." done SteadfastDescription: - text "Boosts Speed when" - next1 "it flinches." + text "Boosts Speed when" + next "it flinches." done SnowCloakDescription: - text "Boosts evasion in" - next1 "hailstorms." + text "Boosts evasion in" + next "hailstorms." done GluttonyDescription: - text "Encourages early" - next1 "Berry use." + text "Encourages early" + next "Berry use." done AngerPointDescription: - text "Maxes Attack after" - next1 "a critical hit." + text "Maxes Attack after" + next "a critical hit." done UnburdenDescription: - text "Boosts Speed when" - next1 "held item is lost." + text "Boosts Speed when" + next "held item is lost." done DrySkinDescription: - text "Reduces HP in sun." - next1 "Water restores HP." + text "Reduces HP in sun." + next "Water restores HP." done DownloadDescription: - text "Adjusts stats based" - next1 "on foe's defenses." + text "Adjusts stats based" + next "on foe's defenses." done IronFistDescription: - text "Boosts power of" - next1 "punching moves." + text "Boosts power of" + next "punching moves." done PoisonHealDescription: - text "Restores HP if" - next1 "it is poisoned." + text "Restores HP if" + next "it is poisoned." done AdaptabilityDescription: - text "Powers up same-" - next1 "type moves." + text "Powers up same-" + next "type moves." done SkillLinkDescription: - text "Increases multi-" - next1 "strike move hits." + text "Increases multi-" + next "strike move hits." done HydrationDescription: - text "Heals status" - next1 "problems in rain." + text "Heals status" + next "problems in rain." done SolarPowerDescription: - text "Boosts Sp.Atk but" - next1 "lowers HP in sun." + text "Boosts Sp.Atk but" + next "lowers HP in sun." done QuickFeetDescription: - text "Boosts Speed with" - next1 "status problems." + text "Boosts Speed with" + next "status problems." done SniperDescription: - text "Powers up critical" - next1 "hits." + text "Powers up critical" + next "hits." done MagicGuardDescription: - text "Only takes damage" - next1 "from attacks." + text "Only takes damage" + next "from attacks." done NoGuardDescription: - text "Ensures attacks by" - next1 "or against it hit." + text "Ensures attacks by" + next "or against it hit." done TechnicianDescription: - text "Powers up its" - next1 "weaker moves." + text "Powers up its" + next "weaker moves." done LeafGuardDescription: - text "Prevents status" - next1 "problems in sun." + text "Prevents status" + next "problems in sun." done MoldBreakerDescription: - text "Moves disregard" - next1 "the foe's ability." + text "Moves disregard" + next "the foe's ability." done SuperLuckDescription: - text "Boosts the rate" - next1 "of critical hits." + text "Boosts the rate" + next "of critical hits." done AftermathDescription: - text "Damages the foe on" - next1 "fainting." + text "Damages the foe on" + next "fainting." done AnticipationDescription: - text "Senses the foe's" - next1 "dangerous moves." + text "Senses the foe's" + next "dangerous moves." done ForewarnDescription: - text "Determines the" - next1 "foe's moves." + text "Determines the" + next "foe's moves." done UnawareDescription: - text "Ignores the foe's" - next1 "stat changes." + text "Ignores the foe's" + next "stat changes." done TintedLensDescription: - text "Powers up not very" - next1 "effective moves." + text "Powers up not very" + next "effective moves." done FilterDescription: SolidRockDescription: - text "Reduces super" - next1 "effective damage." + text "Reduces super" + next "effective damage." done ScrappyDescription: - text "Enables moves to" - next1 "hit Ghost-types." + text "Enables moves to" + next "hit Ghost-types." done IceBodyDescription: - text "Gradually regains" - next1 "HP in hail." + text "Gradually regains" + next "HP in hail." done SnowWarningDescription: - text "Summons hailstorm" - next1 "when switched in." + text "Summons hailstorm" + next "when switched in." done HoneyGatherDescription: - text "The #mon may" + text "The #mon may" if DEF(FAITHFUL) - next1 "gather Honey." + next "gather Honey." else - next1 "find Sweet Honey." + next "find Sweet Honey." endc done FriskDescription: - text "Checks the foe's" - next1 "held item." + text "Checks the foe's" + next "held item." done RecklessDescription: - text "Powers up moves" - next1 "that recoil." + text "Powers up moves" + next "that recoil." done PickpocketDescription: - text "Steals foe's item" - next1 "when contacted." + text "Steals foe's item" + next "when contacted." done SheerForceDescription: - text "Removes effects to" - next1 "increase damage." + text "Removes effects to" + next "increase damage." done ContraryDescription: - text "Inverts the effect" - next1 "of stat changes." + text "Inverts the effect" + next "of stat changes." done UnnerveDescription: - text "Prevents foes from" - next1 "eating Berries." + text "Prevents foes from" + next "eating Berries." done DefiantDescription: - text "Boosts Attack when" - next1 "stats are lowered." + text "Boosts Attack when" + next "stats are lowered." done CursedBodyDescription: - text "May disable a move" - next1 "used on it." + text "May disable a move" + next "used on it." done WeakArmorDescription: - text "Physical attacks" - next1 "trade Def for Spe." + text "Physical attacks" + next "trade Def for Spe." done LightMetalDescription: - text "Halves the Poké-" - next1 "mon's weight." + text "Halves the Poké-" + next "mon's weight." done MultiscaleDescription: - text "Reduces damage" - next1 "when HP is full." + text "Reduces damage" + next "when HP is full." done HarvestDescription: - text "May recreate a" - next1 "Berry after use." + text "May recreate a" + next "Berry after use." done MoodyDescription: - text "Raises a stat and" - next1 "lowers another." + text "Raises a stat and" + next "lowers another." done OvercoatDescription: - text "Protects it from" - next1 "weather damage." + text "Protects it from" + next "weather damage." done PoisonTouchDescription: - text "May poison the foe" - next1 "on contact." + text "May poison the foe" + next "on contact." done RegeneratorDescription: - text "Restores HP when" - next1 "withdrawn." + text "Restores HP when" + next "withdrawn." done BigPecksDescription: - text "Prevents foes from" - next1 "lowering Defense." + text "Prevents foes from" + next "lowering Defense." done SandRushDescription: - text "Boosts Speed in" - next1 "a sandstorm." + text "Boosts Speed in" + next "a sandstorm." done WonderSkinDescription: - text "Makes status moves" - next1 "miss more often." + text "Makes status moves" + next "miss more often." done AnalyticDescription: - text "Boosts move power" - next1 "when moving last." + text "Boosts move power" + next "when moving last." done ImposterDescription: - text "Transforms itself" - next1 "into the foe." + text "Transforms itself" + next "into the foe." done InfiltratorDescription: - text "Attacks bypass the" - next1 "foe's barriers." + text "Attacks bypass the" + next "foe's barriers." done MoxieDescription: - text "Boosts Attack when" - next1 "knocking out foes." + text "Boosts Attack when" + next "knocking out foes." done JustifiedDescription: - text "Boosts Attack when" - next1 "hit by Dark moves." + text "Boosts Attack when" + next "hit by Dark moves." done RattledDescription: - text "Dark, Ghost or Bug" - next1 "moves boost Speed." + text "Dark, Ghost or Bug" + next "moves boost Speed." done MagicBounceDescription: - text "Reflects status-" - next1 "changing moves." + text "Reflects status-" + next "changing moves." done SapSipperDescription: - text "Boosts Attack when" - next1 "hit by Grass." + text "Boosts Attack when" + next "hit by Grass." done PranksterDescription: - text "Gives priority to" - next1 "a status move." + text "Gives priority to" + next "a status move." done SandForceDescription: - text "Boosts some moves" - next1 "in a sandstorm." + text "Boosts some moves" + next "in a sandstorm." done FurCoatDescription: - text "Halves damage from" - next1 "physical moves." + text "Halves damage from" + next "physical moves." done BulletproofDescription: - text "Protects from ball" - next1 "and bomb moves." + text "Protects from ball" + next "and bomb moves." done CompetitiveDescription: - text "Boosts Sp.Atk on" - next1 "stat reduction." + text "Boosts Sp.Atk on" + next "stat reduction." done MegaLauncherDescription: - text "Powers up aura" - next1 "and pulse moves." + text "Powers up aura" + next "and pulse moves." done ToughClawsDescription: - text "Boosts moves that" - next1 "makes contact." + text "Boosts moves that" + next "makes contact." done PixilateDescription: - text "Normal-type moves" - next1 "become Fairy-type." + text "Normal-type moves" + next "become Fairy-type." done ParentalBondDescription: - text "Parent and child" - next1 "attack together." + text "Parent and child" + next "attack together." done BerserkDescription: - text "Boosts Sp.Atk when" - next1 "damaged over half." + text "Boosts Sp.Atk when" + next "damaged over half." done SlushRushDescription: - text "Boosts Speed in" - next1 "a hailstorm." + text "Boosts Speed in" + next "a hailstorm." done GalvanizeDescription: - text "Normal-type moves" - next1 "become Electric." + text "Normal-type moves" + next "become Electric." done CorrosionDescription: - text "Foes of any type" - next1 "can be poisoned." + text "Foes of any type" + next "can be poisoned." done TanglingHairDescription: - text "Contact may lower" - next1 "the foe's Speed." + text "Contact may lower" + next "the foe's Speed." done GorillaTacticsDescription: - text "Boosts Attack, but" - next1 "allows one move." + text "Boosts Attack, but" + next "allows one move." done NeutralizingGasDescription: - text "Suppresses all" - next1 "other Abilities." + text "Suppresses all" + next "other Abilities." done QuickDrawDescription: - text "Moves first" - next1 "occasionally." + text "Moves first" + next "occasionally." done SteelySpiritDescription: - text "Boosts Steel-type" - next1 "moves." + text "Boosts Steel-type" + next "moves." done PerishBodyDescription: - text "Contact causes Pe-" - next1 "rish Song status." + text "Contact causes Pe-" + next "rish Song status." done ScreenCleanerDescription: - text "Removes screens" - next1 "when switched in." + text "Removes screens" + next "when switched in." done CudChewDescription: - text "Eats a Berry again" - next1 "after first use." + text "Eats a Berry again" + next "after first use." done SharpnessDescription: - text "Boosts power of" - next1 "slicing moves." + text "Boosts power of" + next "slicing moves." done ArmorTailDescription: - text "Stops foes using" - next1 "priority moves." + text "Stops foes using" + next "priority moves." done diff --git a/data/mon_menu.asm b/data/mon_menu.asm index 5af5c629a3..69141a2eea 100644 --- a/data/mon_menu.asm +++ b/data/mon_menu.asm @@ -1,17 +1,17 @@ ; MonMenuOptionStrings indexes const_def 1 - const MONMENUVALUE_STATS ; 1 - const MONMENUVALUE_SWITCH ; 2 - const MONMENUVALUE_ITEM ; 3 - const MONMENUVALUE_CANCEL ; 4 - const MONMENUVALUE_MOVE ; 5 - const MONMENUVALUE_MAIL ; 6 - const MONMENUVALUE_ERROR ; 7 + const MONMENUVALUE_SUMMARY ; 1 + const MONMENUVALUE_SWITCH ; 2 + const MONMENUVALUE_ITEM ; 3 + const MONMENUVALUE_CANCEL ; 4 + const MONMENUVALUE_MOVE ; 5 + const MONMENUVALUE_MAIL ; 6 + const MONMENUVALUE_ERROR ; 7 DEF NUM_MONMENUVALUES EQU const_value - 1 MonMenuOptionStrings: list_start MonMenuOptionStrings - li "Stats" + li "Summary" li "Switch" li "Item" li "Cancel" @@ -37,7 +37,7 @@ MonMenuOptions: db MONMENU_FIELD_MOVE, MONMENUITEM_HEADBUTT, HEADBUTT db MONMENU_FIELD_MOVE, MONMENUITEM_ROCKSMASH, ROCK_SMASH ; options - db MONMENU_MENUOPTION, MONMENUITEM_STATS, MONMENUVALUE_STATS + db MONMENU_MENUOPTION, MONMENUITEM_SUMMARY, MONMENUVALUE_SUMMARY db MONMENU_MENUOPTION, MONMENUITEM_SWITCH, MONMENUVALUE_SWITCH db MONMENU_MENUOPTION, MONMENUITEM_ITEM, MONMENUVALUE_ITEM db MONMENU_MENUOPTION, MONMENUITEM_CANCEL, MONMENUVALUE_CANCEL diff --git a/data/predef_pointers.asm b/data/predef_pointers.asm index 46724779d5..548572079d 100644 --- a/data/predef_pointers.asm +++ b/data/predef_pointers.asm @@ -19,7 +19,7 @@ PredefPointers:: add_predef ListMoves add_predef ListMovePP add_predef GetGender - add_predef StatsScreenInit + add_predef SummaryScreenInit add_predef DrawPlayerHP add_predef PlayBattleAnim add_predef PartyMonItemName diff --git a/engine/battle/core.asm b/engine/battle/core.asm index b0fd5aaed0..dade11a564 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -4484,7 +4484,7 @@ BattleMenuPKMN_Loop: .MenuHeader: db $00 ; flags - menu_coords 11, 9, 19, 17 + menu_coords 10, 9, 19, 17 dw .MenuData db 1 ; default option @@ -4492,13 +4492,13 @@ BattleMenuPKMN_Loop: db $c0 ; flags db 4 ; items db "Switch@" - db "Stats@" + db "Summary@" db "Moves@" db "Cancel@" .EggMenuHeader: db $00 ; flags - menu_coords 11, 11, 19, 17 + menu_coords 10, 11, 19, 17 dw .EggMenuData db 1 ; default option @@ -4506,7 +4506,7 @@ BattleMenuPKMN_Loop: db $c0 ; flags db 3 ; items db "Switch@" - db "Stats@" + db "Summary@" db "Cancel@" Battle_StatsScreen: @@ -4520,7 +4520,7 @@ Battle_StatsScreen: ld bc, $31 tiles rst CopyBytes call EnableLCD - farcall OpenPartyStats + farcall OpenPartySummary call DisableLCD ld hl, vTiles0 ld de, vTiles2 tile $31 diff --git a/engine/gfx/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm index cece9109d3..6cce5bc2bf 100644 --- a/engine/gfx/cgb_layouts.asm +++ b/engine/gfx/cgb_layouts.asm @@ -381,10 +381,7 @@ EnbyPokegearInterfacePalette: INCLUDE "gfx/pokegear/pokegear_x.pal" _CGB_StatsScreenHPPals: - ld de, wBGPals1 - ld hl, HPBarInteriorPals - call LoadPalette_White_Col1_Col2_Black - + ld de, wBGPals1 palette 1 ld a, [wCurPartySpecies] ld bc, wTempMonPersonality call GetPlayerOrMonPalettePointer @@ -393,61 +390,21 @@ _CGB_StatsScreenHPPals: call VaryBGPal1ByTempMonDVs pop de - ld hl, GenderAndExpBarPals - call LoadPalette_White_Col1_Col2_Black - - ld hl, StatsScreenPals - ld c, 4 palettes - call LoadPalettes - - ld hl, CaughtBallPals - ld bc, $4 - ld a, [wTempMonCaughtBall] - and CAUGHT_BALL_MASK + ld hl, ItemIconPalettes + ld bc, PAL_COLOR_SIZE * 2 + ld a, [wTempMonItem] rst AddNTimes - ld de, wBGPals1 palette 7 + ld de, wSummaryScreenPals palette 2 call LoadPalette_White_Col1_Col2_Black - call WipeAttrMap - - hlcoord 0, 0, wAttrmap - lb bc, 8, SCREEN_WIDTH - ld a, $1 - call FillBoxWithByte - - hlcoord 18, 0, wAttrmap - ld [hl], $2 - - hlcoord 11, 5, wAttrmap - lb bc, 2, 2 - ld a, $3 - call FillBoxWithByte - - hlcoord 13, 5, wAttrmap - lb bc, 2, 2 - ld a, $4 - call FillBoxWithByte - - hlcoord 15, 5, wAttrmap - lb bc, 2, 2 - ld a, $5 - call FillBoxWithByte - - hlcoord 17, 5, wAttrmap - lb bc, 2, 2 - ld a, $6 - call FillBoxWithByte + ld hl, GenderAndExpBarPals + ld de, wSummaryScreenPals palette 6 + call LoadPalette_White_Col1_Col2_Black - hlcoord 8, 6, wAttrmap - lb bc, 1, 1 - ld a, $7 - call FillBoxWithByte + farcall SummaryScreen_InitAttrmap jmp _CGB_FinishLayout -StatsScreenPals: -INCLUDE "gfx/stats/pages.pal" - _CGB_Pokedex: call _CGB_Pokedex_PrepareOnly jmp _CGB_FinishLayout diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index 0d8b92d40c..07f7518cf5 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -77,6 +77,19 @@ ApplyHPBarPals: ld a, e jmp FillBoxWithByte +LoadSummaryStatusIconPalette: + xor a + ld de, wTempMonStatus + farcall GetStatusConditionIndex + ld hl, StatusIconPals + ld c, a + ld b, 0 + add hl, bc + add hl, bc + ld de, wOBPals1 palette 5 + 4 + ld bc, 2 + jmp FarCopyColorWRAM + LoadPlayerStatusIconPalette: ld a, [wPlayerSubStatus2] ld de, wBattleMonStatus diff --git a/engine/gfx/item_icons.asm b/engine/gfx/item_icons.asm index 06d589a5cb..0435ee887f 100644 --- a/engine/gfx/item_icons.asm +++ b/engine/gfx/item_icons.asm @@ -56,6 +56,19 @@ DecompressItemIconForOverworld:: ld de, wDecompressScratch jmp Request2bppInWRA6 +LoadItemIconForSummaryScreen:: + ld hl, ItemIconPointers +_LoadItemOrKeyItemIconForSummaryScreen: + call _SetupLoadItemOrKeyItemIcon +DecompressItemIconForSummaryScreen:: + push bc + call FarDecompressWRA6InB + call WhiteOutDecompressedItemIconCorners + pop bc + ld hl, vTiles2 tile $56 + ld de, wDecompressScratch + jmp Request2bppInWRA6 + LoadTMHMIcon:: ld hl, TMHMIcon lb bc, BANK(TMHMIcon), 9 diff --git a/engine/gfx/load_font.asm b/engine/gfx/load_font.asm index 6cca725da7..b2fe5994ef 100644 --- a/engine/gfx/load_font.asm +++ b/engine/gfx/load_font.asm @@ -76,6 +76,24 @@ _LoadFrame:: LoadBattleFontsHPBar: call _LoadFontsBattleExtra +LoadSummaryStatusIcon: + push de + xor a + ld de, wTempMonStatus + farcall GetStatusConditionIndex + ld hl, SummaryStatusIconGFX + ld bc, 2 tiles + rst AddNTimes + ld d, h + ld e, l + ld hl, vTiles0 tile 92 + lb bc, BANK(SummaryStatusIconGFX), 2 + call Request2bpp + farcall LoadSummaryStatusIconPalette + farcall ApplyOBPals + pop de + ret + LoadPlayerStatusIcon: push de ld a, [wPlayerSubStatus2] diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm index 2e6ee602e3..9f24d637f2 100644 --- a/engine/gfx/mon_icons.asm +++ b/engine/gfx/mon_icons.asm @@ -440,7 +440,7 @@ SetPartyMonMiniAnimSpeed: ld hl, wPartyMon1Happiness call GetPartyLocation ld a, [hl] -; same happiness thresholds as EggStatsScreen +; same happiness thresholds as EggSummaryScreen ld d, 0 cp $6 jr c, .gotindex diff --git a/engine/link/link.asm b/engine/link/link.asm index b680a95b10..49bc0655a9 100755 --- a/engine/link/link.asm +++ b/engine/link/link.asm @@ -792,7 +792,7 @@ LinkMonStatsScreen: ld [wCurPartyMon], a ld a, [wMonType] push af - farcall OpenPartyStats + farcall OpenPartySummary pop af ld [wMonType], a ld a, [wCurPartyMon] diff --git a/engine/pc/bills_pc_ui.asm b/engine/pc/bills_pc_ui.asm index c81e947b7a..deaae2e53d 100644 --- a/engine/pc/bills_pc_ui.asm +++ b/engine/pc/bills_pc_ui.asm @@ -1508,7 +1508,7 @@ BillsPC_MenuStrings: ; pokémon management options db "Withdraw@" db "Deposit@" - db "Stats@" + db "Summary@" db "Switch@" db "Moves@" db "Item@" @@ -1548,7 +1548,7 @@ BillsPC_MenuJumptable: BillsPC_Stats: call BillsPC_PrepareTransistion - farcall _OpenPartyStats + farcall _OpenPartySummary call BillsPC_MoveCursorAfterStatScreen jmp BillsPC_ReturnFromTransistion diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm index ffbd130bab..0f8f5a505c 100644 --- a/engine/pokedex/pokedex.asm +++ b/engine/pokedex/pokedex.asm @@ -1922,11 +1922,8 @@ _Pokedex_Stats: sub l ld h, a ld b, [hl] - push bc hlcoord 1, 13 - farcall PrintAbility - pop bc - farcall PrintAbilityDescription + call Pokedex_PrintAbilityWithDescription ; use correct vram bank for types and footprint ld a, [wPokedex_MonInfoBank] @@ -2026,10 +2023,7 @@ _Pokedex_Stats: ld h, a ld b, [hl] pop hl - push bc - farcall PrintAbility - pop bc - farcall PrintAbilityDescription + call Pokedex_PrintAbilityWithDescription call Pokedex_ScheduleScreenUpdate jr .joypad_loop @@ -2040,6 +2034,19 @@ _Pokedex_Stats: ld [hl], a ret +Pokedex_PrintAbilityWithDescription: + push bc + farcall PrintAbility + pop bc + ld a, [wTextboxFlags] + push af + set NO_LINE_SPACING_F, a + ld [wTextboxFlags], a + farcall PrintAbilityDescription + pop af + ld [wTextboxFlags], a + ret + Pokedex_SetModeSearchPals: ld a, BANK(wBGPals1) call StackCallInWRAMBankA diff --git a/engine/pokemon/mon_menu.asm b/engine/pokemon/mon_menu.asm index 746f1eb5db..22ed540834 100644 --- a/engine/pokemon/mon_menu.asm +++ b/engine/pokemon/mon_menu.asm @@ -114,7 +114,7 @@ PokemonActionSubmenu: dbw MONMENUITEM_HEADBUTT, MonMenu_Headbutt dbw MONMENUITEM_WATERFALL, MonMenu_Waterfall dbw MONMENUITEM_ROCKSMASH, MonMenu_RockSmash - dbw MONMENUITEM_STATS, OpenPartyStats + dbw MONMENUITEM_SUMMARY, OpenPartySummary dbw MONMENUITEM_SWITCH, SwitchPartyMons dbw MONMENUITEM_ITEM, GiveTakePartyMonItem dbw MONMENUITEM_CANCEL, CancelPokemonAction @@ -721,18 +721,18 @@ TakeMail: text_far _MailSentToPCText text_end -OpenPartyStats: +OpenPartySummary: ; Stats screen for partymon in wCurPartyMon. call PreparePartyTempMon ; fallthrough -_OpenPartyStats: +_OpenPartySummary: ; Stats screen for any mon, as supplied by wTempMonBox+wTempMonSlot call LoadStandardMenuHeader call ClearSprites call LowVolume ld a, TEMPMON ld [wMonType], a - predef StatsScreenInit + predef SummaryScreenInit ; This ensures that MaxVolume works as it should if we're in the middle of ; playing a cry. ld a, MAX_VOLUME diff --git a/engine/pokemon/mon_stats.asm b/engine/pokemon/mon_stats.asm index b7ae4900a9..bd2237dc0c 100644 --- a/engine/pokemon/mon_stats.asm +++ b/engine/pokemon/mon_stats.asm @@ -98,8 +98,6 @@ endr pop hl pop bc - add hl, bc - ld bc, SCREEN_WIDTH add hl, bc ld de, wTempMonAttack lb bc, 2, 3 @@ -117,7 +115,7 @@ endr push hl call PrintNum pop hl - ld de, SCREEN_WIDTH * 2 + ld de, BG_MAP_WIDTH add hl, de ret diff --git a/engine/pokemon/mon_submenu.asm b/engine/pokemon/mon_submenu.asm index d6fee8a135..e117c25eb3 100644 --- a/engine/pokemon/mon_submenu.asm +++ b/engine/pokemon/mon_submenu.asm @@ -140,7 +140,7 @@ GetMonSubmenuItems: jr nz, .loop .skip_moves - ld a, MONMENUITEM_STATS + ld a, MONMENUITEM_SUMMARY call AddMonMenuItem ld a, MONMENUITEM_SWITCH call AddMonMenuItem @@ -170,7 +170,7 @@ GetMonSubmenuItems: jr TerminateMonSubmenu .egg - ld a, MONMENUITEM_STATS + ld a, MONMENUITEM_SUMMARY call AddMonMenuItem ld a, MONMENUITEM_SWITCH call AddMonMenuItem diff --git a/engine/pokemon/party_menu.asm b/engine/pokemon/party_menu.asm index 4f86865519..a66c506109 100644 --- a/engine/pokemon/party_menu.asm +++ b/engine/pokemon/party_menu.asm @@ -281,7 +281,7 @@ BT_PartySelect: prompt .Stats: - farcall OpenPartyStats + farcall OpenPartySummary jmp .loop .Moves: @@ -297,19 +297,19 @@ BT_PartySelect: .EggMenuHeader: db $00 ; flags - menu_coords 11, 13, 19, 17 + menu_coords 10, 13, 19, 17 dw .EggMenuData db 1 ; default option .EggMenuData: db $c0 ; flags db 2 ; items - db "Stats@" + db "Summary@" db "Cancel@" .MenuHeader: db $00 ; flags - menu_coords 11, 9, 19, 17 + menu_coords 10, 9, 19, 17 dw .MenuData db 1 ; default option @@ -317,20 +317,20 @@ BT_PartySelect: db $c0 ; flags db 4 ; items db "Enter@" - db "Stats@" + db "Summary@" db "Moves@" db "Cancel@" .BannedMenuHeader: db $00 ; flags - menu_coords 11, 11, 19, 17 + menu_coords 10, 11, 19, 17 dw .BannedMenuData db 1 ; default option .BannedMenuData: db $c0 ; flags db 3 ; items - db "Stats@" + db "Summary@" db "Moves@" db "Cancel@" diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm deleted file mode 100644 index 252c023715..0000000000 --- a/engine/pokemon/stats_screen.asm +++ /dev/null @@ -1,1114 +0,0 @@ -StatsScreenInit: - ldh a, [hMapAnims] - push af - xor a - ldh [hMapAnims], a ; disable overworld tile animations - ld a, [wBoxAlignment] ; whether sprite is to be mirrorred - push af - ld a, [wJumptableIndex] - ld b, a - ld a, [wStatsScreenFlags] - ld c, a - - push bc - call ClearBGPalettes - call ClearTileMap - call UpdateSprites - call LoadFontsBattleExtra - ld hl, GFX_Stats - ld de, vTiles2 tile $31 - lb bc, BANK(GFX_Stats), 41 - call DecompressRequest2bpp - ld a, [wTempMonBox] - ld b, a - ld a, [wTempMonSlot] - ld c, a - farcall GetStorageBoxMon - call StatsScreenMain - call ClearBGPalettes - call ClearTileMap - pop bc - - ; restore old values - ld a, b - ld [wJumptableIndex], a - ld a, c - ld [wStatsScreenFlags], a - pop af - ld [wBoxAlignment], a - pop af - ldh [hMapAnims], a - ret - -StatsScreenMain: - xor a - ld [wJumptableIndex], a - ld [wStatsScreenFlags], a -.loop - ld a, [wJumptableIndex] - and $7f - ld hl, StatsScreenPointerTable - call JumpTable - call StatsScreen_WaitAnim ; check for keys? - ld a, [wJumptableIndex] - bit 7, a - jr z, .loop - ret - -StatsScreenPointerTable: - dw MonStatsInit ; regular pokémon - dw EggStatsInit ; egg - dw EggStatsJoypad - dw StatsScreen_LoadPage - dw MonStatsJoypad - -StatsScreen_WaitAnim: - ld hl, wStatsScreenFlags - bit 6, [hl] - jr nz, .try_anim - bit 5, [hl] - jr nz, .finish - jmp DelayFrame - -.try_anim - farcall SetUpPokeAnim - jr nc, .finish - ld hl, wStatsScreenFlags - res 6, [hl] -.finish - ld hl, wStatsScreenFlags - res 5, [hl] - farjp HDMATransferTileMapToWRAMBank3 - -MonStatsInit: - ld hl, wStatsScreenFlags - res 6, [hl] - call ClearBGPalettes - call ClearTileMap - farcall HDMATransferTileMapToWRAMBank3 - ld a, [wTempMonSlot] - ld [wPartyMenuCursor], a - dec a - ld [wCurPartyMon], a - ld a, [wTempMonSpecies] - ld [wCurSpecies], a - ld [wCurPartySpecies], a - ld a, [wTempMonForm] - ld [wCurForm], a - ld a, [wTempMonIsEgg] - bit MON_IS_EGG_F, a - jr nz, .egg - call StatsScreen_InitUpperHalf - ld hl, wStatsScreenFlags - set 4, [hl] - ld h, 3 - jr StatsScreen_SetJumptableIndex - -.egg - ld h, 1 - jr StatsScreen_SetJumptableIndex - -EggStatsInit: - ld a, [wCurPartySpecies] - push af - ld a, EGG - ld [wCurPartySpecies], a - call EggStatsScreen - pop af - ld [wCurPartySpecies], a - ld hl, wJumptableIndex - inc [hl] - ret - -EggStatsJoypad: - call StatsScreen_GetJoypad - jr nc, .check - ld h, 0 - jr StatsScreen_SetJumptableIndex - -.check - bit A_BUTTON_F, a - jr nz, .quit - and D_DOWN | D_UP | A_BUTTON | B_BUTTON - jr StatsScreen_JoypadAction - -.quit - ld h, 1 << 7 ; exit - ; fallthrough - -StatsScreen_SetJumptableIndex: - ld a, [wJumptableIndex] - and $80 - or h - ld [wJumptableIndex], a - ret - -StatsScreen_LoadPage: - call StatsScreen_LoadGFX - ld hl, wStatsScreenFlags - res 4, [hl] - ld hl, wJumptableIndex - inc [hl] - ret - -StatsScreen_GetJoypad: - call GetJoypad - ldh a, [hJoyPressed] - and a - ret - -MonStatsJoypad: - call StatsScreen_GetJoypad - jr nc, .next - ld h, 0 - jr StatsScreen_SetJumptableIndex - -.next - and D_DOWN | D_UP | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON - ; fallthrough - -StatsScreen_JoypadAction: - push af - ld a, [wStatsScreenFlags] - and $3 - ld c, a - pop af - bit B_BUTTON_F, a - jr nz, EggStatsJoypad.quit - bit D_LEFT_F, a - jr nz, .d_left - bit D_RIGHT_F, a - jr nz, .d_right - bit A_BUTTON_F, a - jr nz, .a_button - bit D_UP_F, a - jr nz, .d_up - bit D_DOWN_F, a - ret z -; d_down - farcall NextStorageBoxMon - jr .load_mon - -.d_up - farcall PrevStorageBoxMon - ; fallthrough -.load_mon - ret z - ld h, 0 - jr StatsScreen_SetJumptableIndex - -.a_button - ld a, c - cp $3 - jr z, EggStatsJoypad.quit -.d_right - inc c - ld a, $3 - cp c - jr nc, .set_page - ld c, 0 - jr .set_page - -.d_left - ld a, c - dec c - and a - jr nz, .set_page - ld c, $3 - ; fallthrough - -.set_page - ld a, [wStatsScreenFlags] - and %11111100 - or c - ld [wStatsScreenFlags], a - ld h, 3 - jr StatsScreen_SetJumptableIndex - -StatsScreen_InitUpperHalf: - call .PlaceHPBar - xor a - ldh [hBGMapMode], a - ld a, [wCurPartySpecies] - ld [wTempSpecies], a - ld [wCurSpecies], a - ld c, a - ld a, [wCurForm] - ld b, a - call GetPokedexNumber - ld d, b - ld e, c - hlcoord 8, 0 - ld a, "№" - ld [hli], a - ld a, "." - ld [hli], a - lb bc, PRINTNUM_LEADINGZEROS | 2, 3 - call PrintNumFromReg ; sets de - hlcoord 14, 0 - call PrintLevel - ld hl, wTempMonNickname - call CopyNickname - hlcoord 8, 2 - rst PlaceString - hlcoord 18, 0 - call .PlaceGenderChar - hlcoord 9, 4 - ld a, "/" - ld [hli], a - push hl - call GetPartyPokemonName - pop hl - rst PlaceString - call StatsScreen_PlacePageSwitchArrows - jr StatsScreen_PlaceShinyIcon - -.PlaceHPBar: - ld hl, wTempMonHP - ld a, [hli] - ld b, a - ld c, [hl] - ld hl, wTempMonMaxHP - ld a, [hli] - ld d, a - ld e, [hl] - farcall ComputeHPBarPixels - ld hl, wCurHPPal - call SetHPPal - ld a, CGB_STATS_SCREEN_HP_PALS - call GetCGBLayout - jmp DelayFrame - -.PlaceGenderChar: - push hl - farcall GetGender - pop hl - ret c - ld a, "" - jr nz, .got_gender - inc a ; "" -.got_gender - ld [hl], a - ret - -StatsScreen_PlaceHorizontalDivider: - hlcoord 0, 7 - ld b, SCREEN_WIDTH - ld a, $36 -.loop - ld [hli], a - dec b - jr nz, .loop - - ; Place T divider - ld a, [wStatsScreenFlags] - and $3 - ld c, a - rrca - jr c, .skip_t_divider - and a - hlcoord 9, 7 - jr z, .got_vertical_pos - inc hl -.got_vertical_pos - ld [hl], $37 -.skip_t_divider - hlcoord 0, 7, wAttrmap - ld a, c - add $3 - ld b, SCREEN_WIDTH -.loop2 - ld [hli], a - dec b - jr nz, .loop2 - ld b, 0 - ret - -StatsScreen_PlaceEggDivider: - hlcoord 0, 7 - ld b, SCREEN_WIDTH - ld a, $3e -.loop - ld [hli], a - dec b - jr nz, .loop - ret - -StatsScreen_PlacePageSwitchArrows: - hlcoord 10, 6 - ld [hl], "◀" - hlcoord 19, 6 - ld [hl], "▶" - ret - -StatsScreen_PlaceShinyIcon: - ld bc, wTempMonShiny - farcall CheckShininess - ret nc - hlcoord 19, 0 - ld [hl], "★" - ret - -StatsScreen_LoadGFX: - ld a, [wCurPartySpecies] - ld [wTempSpecies], a - ld [wCurSpecies], a - xor a - ldh [hBGMapMode], a - call .ClearBox - call .LoadPokeBall - call .PageTilemap - call .LoadPals - ld hl, wStatsScreenFlags - bit 4, [hl] - call nz, StatsScreen_PlaceFrontpic - ld b, 2 - jmp SafeCopyTilemapAtOnce - -.ClearBox: - ld a, [wStatsScreenFlags] - and $3 - ld c, a - call StatsScreen_LoadPageIndicators - call StatsScreen_PlaceHorizontalDivider - hlcoord 0, 8 - lb bc, 10, 20 - jmp ClearBox - -.LoadPokeBall: - ; draw border - hlcoord 8, 5 - ld [hl], $32 ; top - hlcoord 7, 6 - ld [hl], $33 ; left - hlcoord 9, 6 - ld [hl], $34 ; right - hlcoord 8, 7 - ld [hl], $35 ; bottom - ; draw center - ; index = $41 + [wTempMonCaughtBall] - ld a, [wTempMonCaughtBall] - and CAUGHT_BALL_MASK - add $41 - hlcoord 8, 6 - ld [hl], a ; center - ret - -.LoadPals: - ld a, [wStatsScreenFlags] - and $3 - ld c, a - farcall LoadStatsScreenPals - call DelayFrame - ld hl, wStatsScreenFlags - set 5, [hl] - ret - -.PageTilemap: - ld a, [wStatsScreenFlags] - and $3 - call StackJumpTable - -.Jumptable: - dw .PinkPage - dw .GreenPage - dw .BluePage - dw .OrangePage - -.PinkPage: - ld de, .Status_Type - hlcoord 0, 9 - rst PlaceString - ld a, [wTempMonPokerusStatus] - and POKERUS_MASK - jr z, .NotImmuneToPkrs - cp POKERUS_CURED - jr nz, .HasPokerus - hlcoord 8, 8 - ld [hl], "." -.NotImmuneToPkrs: - hlcoord 5, 10 - push hl - ld de, wTempMonStatus - farcall PlaceStatusString - pop hl - jr nz, .done_status - jr .StatusOK -.HasPokerus: - ld de, .PkrsStr - hlcoord 1, 10 - rst PlaceString - jr .done_status -.StatusOK: - ld de, .OK_str - rst PlaceString -.done_status - hlcoord 1, 12 - farcall PrintMonTypes - call .PlaceOTInfo - hlcoord 9, 8 - ld de, SCREEN_WIDTH - ld b, 10 - ld a, $31 ; vertical divider -.vertical_divider - ld [hl], a - add hl, de - dec b - jr nz, .vertical_divider - ld de, .ExpPointStr - hlcoord 10, 9 - rst PlaceString - hlcoord 17, 14 - call .PrintNextLevel - hlcoord 13, 10 - lb bc, 3, 7 - ld de, wTempMonExp - call PrintNum - call .CalcExpToNextLevel - hlcoord 13, 13 - lb bc, 3, 7 - ld de, wBuffer1 - call PrintNum - ld de, .LevelUpStr - hlcoord 10, 12 - rst PlaceString - ld de, .ToStr - hlcoord 14, 14 - rst PlaceString - hlcoord 12, 16 - ld a, [wTempMonLevel] - ld b, a - ld de, wTempMonExp + 2 - farcall FillInExpBar - hlcoord 10, 16 - ld a, "" - ld [hli], a - ld [hl], "" - hlcoord 19, 16 - ld [hl], "" - ret - -.PrintNextLevel: - ld a, [wTempMonLevel] - push af - cp MAX_LEVEL - jr z, .AtMaxLevel - inc a - ld [wTempMonLevel], a -.AtMaxLevel: - call PrintLevel - pop af - ld [wTempMonLevel], a - ret - -.CalcExpToNextLevel: - ld a, [wTempMonLevel] - cp MAX_LEVEL - jr z, .AlreadyAtMaxLevel - inc a - ld d, a - farcall CalcExpAtLevel - ld hl, wTempMonExp + 2 - ldh a, [hQuotient + 2] - sub [hl] - dec hl - ld [wBuffer3], a - ldh a, [hQuotient + 1] - sbc [hl] - dec hl - ld [wBuffer2], a - ldh a, [hQuotient] - sbc [hl] - ld [wBuffer1], a - ret - -.AlreadyAtMaxLevel: - ld hl, wBuffer1 - xor a - ld [hli], a - ld [hli], a - ld [hl], a - ret - -.PlaceOTInfo: - ; for rental mons, replace the whole thing with "Rental #mon" - farcall BT_InRentalMode - jr nz, .not_rental_mon - hlcoord 0, 15 - ld de, .Rental_OT - rst PlaceString - ret - -.not_rental_mon - ld de, .OT_ID_str - hlcoord 0, 14 - rst PlaceString - hlcoord 3, 16 - lb bc, PRINTNUM_LEADINGZEROS | 2, 5 - ld de, wTempMonID - call PrintNum - ld hl, wTempMonOT - call CopyNickname - hlcoord 1, 15 - rst PlaceString - ret - -.Status_Type: - text "Status/" - next "Type/" - done - -.OK_str: - text " OK" - done - -.OT_ID_str: - text "OT/" - next "№." - done - -.Rental_OT: - text "Rental" - next1 "#mon" - done - -.ExpPointStr: - db "Exp.Points@" - -.LevelUpStr: - db "Level Up@" - -.ToStr: - db "to@" - -.PkrsStr: - db "#rus@" - -.GreenPage: - ld de, .Item - hlcoord 0, 8 - rst PlaceString - call .GetItemName - hlcoord 8, 8 - rst PlaceString - ld de, .Move - hlcoord 0, 10 - rst PlaceString - ld hl, wTempMonMoves - ld de, wListMoves_MoveIndicesBuffer - ld bc, NUM_MOVES - rst CopyBytes - hlcoord 8, 10 - ld a, SCREEN_WIDTH * 2 - ld [wBuffer1], a - predef ListMoves - hlcoord 12, 11 - ld a, SCREEN_WIDTH * 2 - ld [wBuffer1], a - predef_jump ListMovePP - -.GetItemName: - ld de, .ThreeDashes - ld a, [wTempMonItem] - and a - ret z - ld [wNamedObjectIndex], a - jmp GetItemName - -.Item: - db "Item@" - -.ThreeDashes: - db "---@" - -.Move: - db "Moves@" - -.BluePage: - hlcoord 0, 9 - predef DrawPlayerHP - call .PlaceNatureInfo - call TN_PrintCharacteristics - hlcoord 10, 8 - ld de, SCREEN_WIDTH - ld b, 10 - ld a, $31 ; vertical divider -.BluePageVerticalDivider: - ld [hl], a - add hl, de - dec b - jr nz, .BluePageVerticalDivider - hlcoord 11, 8 - ld bc, 6 - farcall PrintTempMonStats - - ; Print Hyper Training statistics - ld hl, wTempMonHyperTraining - ld a, [hl] - - ; Handle display one by one since Sp.Atk/Sp.Def/Speed is displayed in a - ; different order. - hlcoord 0, 10 - ld de, -4 - call .CheckHyper ; HP - ld de, SCREEN_WIDTH * 2 - call .CheckHyper ; Attack - call .CheckHyper ; Defense - rlca ; skips the speed one for now - call .CheckHyper ; Sp.Atk - call .CheckHyper ; Sp.Def - rlca - swap a - ; fallthrough -.CheckHyper: - rlca - jr nc, .no_hyper_training - ld [hl], $40 ; hyper training indicator -.no_hyper_training - add hl, de - ret - -.PlaceNatureInfo: - ld de, .NatureString - hlcoord 0, 12 - rst PlaceString - ld a, [wTempMonNature] - ld b, a - call GetNature - hlcoord 1, 13 - farjp PrintNature - -.NatureString: - db "Nature/@" - -.OrangePage: -; Fourth stats page code by TPP Anniversary Crystal 251 -; Ported by FIQ - call TN_PrintToD - call TN_PrintLV - call TN_PrintLocation - hlcoord 0, 11 - ld bc, SCREEN_WIDTH - ld a, $3e - rst ByteFill - hlcoord 1, 12 - ld de, .AbilityString - rst PlaceString - ld a, [wTempMonAbility] - and ABILITY_MASK - swap a - rrca - ld e, a - ld d, 0 - ld hl, .AbilityTiles - add hl, de - ld a, [hl] - hlcoord 9, 12 - ld [hl], a - ld hl, wTempMonPersonality - ld a, [wTempMonSpecies] - ld c, a - call GetAbility - ; PlaceString as used in PrintAbility doesn't preserve any register, so push it. - push bc - hlcoord 3, 13 - farcall PrintAbility - pop bc - farjp PrintAbilityDescription - -.AbilityString: - db "Ability/@" - -.AbilityTiles: - ; $3f = bold H - db $3f, "1", "2", $3f - -TN_PrintToD: - ld de, .caughtat - hlcoord 1, 8 - rst PlaceString - hlcoord 3, 9 - ld a, [wTempMonCaughtTime] - farjp PlaceCaughtTimeOfDayString - -.caughtat - db "Met/@" - -TN_PrintLocation: - farcall BT_InRentalMode - ld de, .battle_factory - jr z, .print - ld a, [wTempMonCaughtLocation] - and a - ret z - ld de, .event - cp LANDMARK_EVENT - jr z, .print - ld e, a - farcall GetLandmarkName - ld de, wStringBuffer1 -.print - hlcoord 3, 10 - rst PlaceString - ret - -.battle_factory - db "Battle Factory@" - -.event - db "Event #mon@" - -TN_PrintLV: - ld a, [wTempMonCaughtLevel] -; inherit coordinate from TN_PrintToD - ld h, b - ld l, c - inc hl -; hlcoord 11, 9 - inc a - jr z, .hatched - dec a - jr z, .traded - ld [wBuffer2], a - ld de, .str_level - rst PlaceString - ld h, b - ld l, c -; hlcoord 15, 9 - ld de, wBuffer2 - lb bc, PRINTNUM_LEFTALIGN | 1, 3 - jmp PrintNum -.hatched - ld de, .str_hatched - rst PlaceString - ret -.traded - ld de, .str_traded - rst PlaceString - ret - -.str_level - db "at @" - -.str_hatched - db "from Egg@" - -.str_traded - db "by trade@" - -TN_PrintCharacteristics: - ; b = value of best DV, c = index of best DV - ld hl, wTempMonDVs - ; Atk - ld c, 1 - ld a, [hl] - and $f - ld b, a - ; HP - ld a, [hli] - swap a - and $f - cp b - jr z, .atk_beats_hp ; tie - jr c, .atk_beats_hp - ld c, 0 - ld b, a -.atk_beats_hp - ; Spe - ld a, [hl] - and $f - cp b - jr z, .last_beats_spe ; tie - jr c, .last_beats_spe - ld c, 5 - ld b, a -.last_beats_spe - ; Def - ld a, [hli] - swap a - and $f - cp b - jr z, .last_beats_def ; tie - jr c, .last_beats_def - ld c, 2 - ld b, a -.last_beats_def - ; SDf - ld a, [hl] - and $f - cp b - jr z, .last_beats_sdf ; tie - jr c, .last_beats_sdf - ld c, 4 - ld b, a -.last_beats_sdf - ; SAt - ld a, [hl] - swap a - and $f - cp b - jr z, .last_beats_sat ; tie - jr c, .last_beats_sat - ld c, 3 - ld b, a -.last_beats_sat - -; DVs are 0-15, but Gen 3+ IVs are 0-31. -; Stats are calculated so that a DV of N acts like an IV of 2*N+1. -; To keep characteristics consistent with the apparent IV values, -; this conversion is actually done. - ld a, b - add b - inc a - ld b, a - ; a = 5 * c + b % 5 -.mod_5 - cp 5 - jr c, .modded_5 - sub 5 - jr .mod_5 -.modded_5 - ld b, a - ld a, 5 - call SimpleMultiply - add b - - ld l, a - ld h, 0 - ld bc, Characteristics - add hl, hl - add hl, bc - ld a, [hli] - ld d, [hl] - ld e, a - hlcoord 0, 15 - rst PlaceString - ret - -INCLUDE "data/characteristics.asm" - -StatsScreen_PlaceFrontpic: - ld a, [wTempMonForm] - ld [wCurForm], a - call StatsScreen_GetAnimationParam - jr nc, .no_cry - call .Animate - jmp SetDefaultBGPAndOBP - -.no_cry - call .DontAnimate - jmp SetDefaultBGPAndOBP - -.DontAnimate: - ld hl, wStatsScreenFlags - set 5, [hl] - hlcoord 0, 0 - ld a, [wCurPartySpecies] - cp UNOWN - jmp z, PrepMonFrontpicFlipped - jmp PrepMonFrontpic - -.Animate: - ld a, [wCurPartySpecies] - sub UNOWN - jr z, .got_align - ld a, TRUE -.got_align - ld [wBoxAlignment], a - ld a, [wCurPartySpecies] - call IsAPokemon - ret c - call StatsScreen_LoadTextboxSpaceGFX - ld de, vTiles2 tile $00 - predef FrontpicPredef - hlcoord 0, 0 - lb de, $0, $2 - predef LoadMonAnimation - ld hl, wStatsScreenFlags - set 6, [hl] - ret - -StatsScreen_GetAnimationParam: - ld bc, wTempMon - ld a, [wTempMonIsEgg] - bit MON_IS_EGG_F, a - scf - ret nz - call CheckFaintedFrzSlp - ccf - ret - -CheckFaintedFrzSlp: - ld hl, MON_HP - add hl, bc - ld a, [hli] - or [hl] - jr z, .fainted_frz_slp - ld hl, MON_STATUS - add hl, bc - ld a, [hl] - and (1 << FRZ) | SLP_MASK - ret z -.fainted_frz_slp - scf - ret - -StatsScreen_LoadTextboxSpaceGFX: - push hl - push de - push bc - push af - call DelayFrame - ldh a, [rVBK] - push af - ld a, $1 - ldh [rVBK], a - ld de, TextboxSpaceGFX - lb bc, BANK(TextboxSpaceGFX), 1 - ld hl, vTiles2 tile $7f - call Get1bpp - pop af - ldh [rVBK], a - jmp PopAFBCDEHL - -EggStatsScreen: - xor a - ldh [hBGMapMode], a - ld hl, wCurHPPal - call SetHPPal - ld a, CGB_STATS_SCREEN_HP_PALS - call GetCGBLayout - call StatsScreen_PlaceEggDivider - ld de, EggString - hlcoord 8, 1 - rst PlaceString - ld a, [wTempMonHappiness] ; egg status - ld de, EggSoonString - cp $6 - jr c, .picked - ld de, EggCloseString - cp $b - jr c, .picked - ld de, EggMoreTimeString - cp $29 - jr c, .picked - ld de, EggALotMoreTimeString -.picked - hlcoord 1, 9 - rst PlaceString - ld hl, wStatsScreenFlags - set 5, [hl] - call SetDefaultBGPAndOBP ; pals - call DelayFrame - hlcoord 0, 0 - call PrepMonFrontpic - farcall HDMATransferTileMapToWRAMBank3 - call StatsScreen_AnimateEgg - - ld a, [wTempMonHappiness] - cp 6 - ret nc - ld de, SFX_2_BOOPS - jmp PlaySFX - -EggString: - text "Egg" - next "OT/?????" - next "№.?????" - done - -EggSoonString: - text "It's making sounds" - next "inside. It's going" - next "to hatch soon!" - done - -EggCloseString: - text "It moves around" - next "inside sometimes." - next "It must be close" - next "to hatching." - done - -EggMoreTimeString: - text "Wonder what's" - next "inside? It needs" - next "more time, though." - done - -EggALotMoreTimeString: - text "This Egg needs a" - next "lot more time to" - next "hatch." - done - -StatsScreen_AnimateEgg: - call StatsScreen_GetAnimationParam - ret nc - ld a, [wTempMonHappiness] - ld e, $7 - cp 6 - jr c, .animate - ld e, $8 - cp 11 - ret nc -.animate - push de - ld a, $1 - ld [wBoxAlignment], a - call StatsScreen_LoadTextboxSpaceGFX - ld de, vTiles2 tile $00 - predef FrontpicPredef - pop de - hlcoord 0, 0 - ld d, $0 - predef LoadMonAnimation - ld hl, wStatsScreenFlags - set 6, [hl] - ret - -StatsScreen_LoadPageIndicators: - ; Write the smaller squares for page display. - hlcoord 11, 5 - ld a, $7f - ld b, 8 -.loop - ld [hli], a - dec b - jr nz, .loop - - hlcoord 11, 6 - ld a, $38 - ld b, 4 -.loop2 - ld [hli], a - inc a - ld [hli], a - dec a - dec b - jr nz, .loop2 - - ; Write the bigger (selected) square for selected page. - ; c contains current page (0-3) - sla c - hlcoord 11, 5 - add hl, bc - ld a, $3a - ld [hli], a - inc a - ld [hld], a - ld bc, SCREEN_WIDTH - add hl, bc - inc a - ld [hli], a - inc a - ld [hl], a - ret - -CopyNickname: - ld de, wStringBuffer1 - ld bc, MON_NAME_LENGTH - push de - rst CopyBytes - pop de - ret diff --git a/engine/pokemon/summary/blue_page.asm b/engine/pokemon/summary/blue_page.asm new file mode 100644 index 0000000000..0d5242655a --- /dev/null +++ b/engine/pokemon/summary/blue_page.asm @@ -0,0 +1,259 @@ +SummaryScreen_BluePage: + ld a, SUMMARY_TILE_OAM_ABILITY_TITLE + call SummaryScreen_UpdateTabTitle + hlbgcoord 3, 1, wSummaryScreenWindowBuffer + call SummaryScreen_DrawPlayerHP + hlbgcoord 19, 1, wSummaryScreenWindowBuffer + ld a, 5 + ld bc, 10 + rst ByteFill + ld a, [wTextboxFlags] + set USE_BG_MAP_WIDTH_F, a + set NO_LINE_SPACING_F, a + ld [wTextboxFlags], a + hlbgcoord 0, 0, wSummaryScreenWindowBuffer + ld de, .HPString + call PlaceString + hlbgcoord 0, 2, wSummaryScreenWindowBuffer + ld bc, 8 + farcall PrintTempMonStats + ld a, [wTextboxFlags] + res USE_BG_MAP_WIDTH_F, a + res NO_LINE_SPACING_F, a + ld [wTextboxFlags], a + + ld a, [wTempMonAbility] + and ABILITY_MASK + swap a + rrca + ld e, a + ld d, 0 + ld hl, .AbilityTiles + add hl, de + ld a, [hl] + hlcoord 18, 13 + ld [hl], a + + ld hl, wTempMonPersonality + ld a, [wTempMonSpecies] + ld c, a + call GetAbility + + push bc + hlcoord 1, 13 + farcall PrintAbility + pop bc + farcall PrintAbilityDescription + + ; Print Hyper Training statistics + ld hl, wTempMonHyperTraining + ld a, [hl] + + ; Handle display one by one since Sp.Atk/Sp.Def/Speed is displayed in a + ; different order. + hlcoord 0, 10 + ld de, -4 + call .CheckHyper ; HP + ld de, SCREEN_WIDTH * 2 + call .CheckHyper ; Attack + call .CheckHyper ; Defense + rlca ; skips the speed one for now + call .CheckHyper ; Sp.Atk + call .CheckHyper ; Sp.Def + rlca + swap a + call .CheckHyper ; Spe + + call SummaryScreen_ColorNatures + + ld hl, .BluePalettes + ld bc, 1 palettes + ld de, wSummaryScreenPals palette SUMMARY_PAL_LOWER_WINDOW + rst CopyBytes + ld bc, 1 palettes + ld de, wSummaryScreenPals palette SUMMARY_PAL_SIDE_WINDOW + rst CopyBytes + ld bc, 1 palettes + ld de, wSummaryScreenPals palette SUMMARY_PAL_NATURE_UP + rst CopyBytes + ld bc, 1 palettes + ld de, wSummaryScreenPals palette SUMMARY_PAL_NATURE_DOWN + rst CopyBytes + + ld a, [wCurHPPal] + add a + add a + add a + add LOW(.HPPalettes) + ld l, a + adc HIGH(.HPPalettes) + sub l + ld h, a + ld bc, 1 palettes + ld de, wSummaryScreenPals + 5 palettes + rst CopyBytes + + ret + +.CheckHyper: + rlca + jr nc, .no_hyper_training + ld [hl], SUMMARY_TILE_HYPER_TRAINING +.no_hyper_training + add hl, de + ret + +.BluePalettes: + RGB 17, 31, 31 + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 00, 00, 00 + + RGB 29, 31, 31 + RGB 17, 31, 31 + RGB 31, 31, 31 + RGB 00, 00, 00 + + RGB 29, 31, 31 + RGB 17, 31, 31 + RGB 31, 31, 31 + RGB 23, 07, 03 + + RGB 29, 31, 31 + RGB 17, 31, 31 + RGB 31, 31, 31 + RGB 03, 15, 29 + +.HPPalettes: + RGB 29, 31, 31 + RGB 31, 25, 02 + RGB 00, 23, 00 + RGB 00, 00, 00 + + RGB 29, 31, 31 + RGB 31, 25, 02 + RGB 31, 21, 00 + RGB 00, 00, 00 + + RGB 29, 31, 31 + RGB 31, 25, 02 + RGB 31, 00, 00 + RGB 00, 00, 00 + +.HPString: + db "HP@" + +.AbilityTiles: + db SUMMARY_TILE_HIDDEN_H, "1", "2", SUMMARY_TILE_HIDDEN_H + +SummaryScreen_ColorNatures: + ld c, STAT_ATK + hlbgcoord 16 + 8, 2, wSummaryScreenWindowBuffer + call .ColorNature + ld c, STAT_DEF + hlbgcoord 16 + 8, 3, wSummaryScreenWindowBuffer + call .ColorNature + ld c, STAT_SATK + hlbgcoord 16 + 8, 4, wSummaryScreenWindowBuffer + call .ColorNature + ld c, STAT_SDEF + hlbgcoord 16 + 8, 5, wSummaryScreenWindowBuffer + call .ColorNature + ld c, STAT_SPE + hlbgcoord 16 + 8, 6, wSummaryScreenWindowBuffer + ; fallthrough +; c = stat +; hl = output attr coords +.ColorNature: + ld a, [wTempMonNature] + push hl + farcall GetNatureStatMultiplier + pop hl + cp a, 10 + ret z + ld a, SUMMARY_PAL_NATURE_UP + jr nc, .got_pal + ld a, SUMMARY_PAL_NATURE_DOWN +.got_pal + ld [hli], a + ld [hli], a + ld [hl], a + ret + +; Copy of DrawPlayerHP that works on the window buffer +SummaryScreen_DrawPlayerHP: + ld a, $1 + ld [wWhichHPBar], a + push hl + push bc + ld a, [wMonType] + cp BOXMON + jr z, .at_least_1_hp + + ld a, [wTempMonHP] + ld b, a + ld a, [wTempMonHP + 1] + ld c, a + +; Any HP? + or b + jr nz, .at_least_1_hp + + xor a + ld c, a + ld e, a + ld a, 6 + ld d, a + jr .fainted + +.at_least_1_hp + ld a, [wTempMonMaxHP] + ld d, a + ld a, [wTempMonMaxHP + 1] + ld e, a + ld a, [wMonType] + cp BOXMON + jr nz, .not_boxmon + + ld b, d + ld c, e + +.not_boxmon + predef ComputeHPBarPixels + ld a, 6 + ld d, a + ld c, a + +.fainted + ld a, c + pop bc + ld c, a + pop hl + push de + push hl + push hl + call DrawBattleHPBar + pop hl + +; Print HP + ld bc, -31 + add hl, bc + ld de, wTempMonHP + ld a, [wMonType] + cp BOXMON + jr nz, .not_boxmon_2 + ld de, wTempMonMaxHP +.not_boxmon_2 + lb bc, 2, 3 + call PrintNum + + ld a, "/" + ld [hli], a + +; Print max HP + ld de, wTempMonMaxHP + lb bc, 2, 3 + call PrintNum + pop hl + pop de + ret diff --git a/engine/pokemon/summary/egg_page.asm b/engine/pokemon/summary/egg_page.asm new file mode 100644 index 0000000000..c7d929699d --- /dev/null +++ b/engine/pokemon/summary/egg_page.asm @@ -0,0 +1,106 @@ +; TODO redo the entire egg screen +EggSummaryScreen: + xor a + ldh [hBGMapMode], a + ld hl, wCurHPPal + call SetHPPal + ld a, CGB_SUMMARY_SCREEN_HP_PALS + call GetCGBLayout + call SummaryScreen_PlaceEggDivider + ld de, EggString + hlcoord 8, 1 + rst PlaceString + ld a, [wTempMonHappiness] ; egg status + ld de, EggSoonString + cp $6 + jr c, .picked + ld de, EggCloseString + cp $b + jr c, .picked + ld de, EggMoreTimeString + cp $29 + jr c, .picked + ld de, EggALotMoreTimeString +.picked + hlcoord 1, 9 + rst PlaceString + ld hl, wSummaryScreenFlags + set 5, [hl] + call SetDefaultBGPAndOBP ; pals + call DelayFrame + hlcoord 0, 0 + call PrepMonFrontpic + farcall HDMATransferTileMapToWRAMBank3 + call SummaryScreen_AnimateEgg + + ld a, [wTempMonHappiness] + cp 6 + ret nc + ld de, SFX_2_BOOPS + jmp PlaySFX + +SummaryScreen_PlaceEggDivider: + hlcoord 0, 7 + ld b, SCREEN_WIDTH + ld a, $3e +.loop + ld [hli], a + dec b + jr nz, .loop + ret + +EggString: + text "Egg" + next "OT/?????" + next "№.?????" + done + +EggSoonString: + text "It's making sounds" + next "inside. It's going" + next "to hatch soon!" + done + +EggCloseString: + text "It moves around" + next "inside sometimes." + next "It must be close" + next "to hatching." + done + +EggMoreTimeString: + text "Wonder what's" + next "inside? It needs" + next "more time, though." + done + +EggALotMoreTimeString: + text "This Egg needs a" + next "lot more time to" + next "hatch." + done + +SummaryScreen_AnimateEgg: + call SummaryScreen_GetAnimationParam + ret nc + ld a, [wTempMonHappiness] + ld e, $7 + cp 6 + jr c, .animate + ld e, $8 + cp 11 + ret nc +.animate + push de + ld a, $1 + ld [wBoxAlignment], a + call SummaryScreen_LoadTextboxSpaceGFX + ld de, vTiles2 tile $00 + predef FrontpicPredef + pop de + hlcoord 0, 0 + ld d, $0 + predef LoadMonAnimation + ld hl, wSummaryScreenFlags + set 6, [hl] + ret diff --git a/engine/pokemon/summary/green_page.asm b/engine/pokemon/summary/green_page.asm new file mode 100644 index 0000000000..f1ea271e46 --- /dev/null +++ b/engine/pokemon/summary/green_page.asm @@ -0,0 +1,295 @@ +SummaryScreen_GreenPage: + ld a, SUMMARY_TILE_OAM_ITEM_TITLE + call SummaryScreen_UpdateTabTitle + ld hl, .GreenPalettes + ld bc, 1 palettes + ld de, wSummaryScreenPals palette SUMMARY_PAL_LOWER_WINDOW + rst CopyBytes + ld bc, 1 palettes + ld de, wSummaryScreenPals palette SUMMARY_PAL_SIDE_WINDOW + rst CopyBytes + call .PlaceItemText + hlcoord 2, 8 + call .PlaceItemIcon + ld a, " " + hlcoord 1, 9 + ld [hl], a + hlcoord 5, 9 + ld [hl], a + + ld hl, wTempMonMoves + ld de, wListMoves_MoveIndicesBuffer + ld bc, NUM_MOVES + rst CopyBytes + hlbgcoord 0, 0, wSummaryScreenWindowBuffer + ld a, BG_MAP_WIDTH * 2 + ld [wBuffer1], a + predef ListMoves + hlbgcoord 4, 1, wSummaryScreenWindowBuffer + ld a, BG_MAP_WIDTH * 2 + ld [wBuffer1], a + predef ListMovePP + +for n, 4 + ld a, [wTempMonMoves + n] + and a + jr z, .moves_done + ld a, [wSummaryScreenTypes + 2 + n] + ld d, (2 + n) | 8 + lb bc, 72, 41 + n * 20 + ld hl, wSummaryScreenOAMSprite04 + n * 4 * 4 + call SummaryScreen_PlaceTypeOBJ + debgcoord 0, 1 + n * 2, wSummaryScreenWindowBuffer + call SummaryScreen_PlaceTypeBG +endr +.moves_done +.PlaceAInfo: + lb bc, 132, SUMMARY_TILE_OAM_A_INFO + ld hl, wSummaryScreenOAMSprite20 +.aInfoLoop + ld a, 108 + ld [hli], a + ld a, b + ld [hli], a + ld a, c + ld [hli], a + ld a, $4 + ld [hli], a + ld a, 8 + add a, b + ld b, a + inc c + cp a, 132 + 8 * 4 + jr nz, .aInfoLoop + ret + +.PlaceItemIcon: + ld de, 17 + lb bc, 3, 3 + ld a, SUMMARY_TILE_ITEM +.item_icon_loop + ld [hli], a + inc a + dec c + jr nz, .item_icon_loop + ld c, 3 + add hl, de + dec b + jr nz, .item_icon_loop + ret + +.PlaceItemText: + hlcoord 0, 13 + lb bc, 5, 20 + call ClearBox + ld a, [wTempMonItem] + ld [wCurItem], a + call .GetItemName + hlcoord 1, 13 + rst PlaceString + call .PrintItemDescription + +.GetItemName: + ld de, .ThreeDashes + ld a, [wTempMonItem] + and a + ret z + ld [wNamedObjectIndex], a + jmp GetItemName + +.PrintItemDescription: + ld a, [wTempMonItem] + and a + ret z + decoord 1, 15 + farjp PrintItemDescription + +.GreenPalettes: + RGB 21, 31, 14 + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 00, 00, 00 + + RGB 30, 31, 29 + RGB 21, 31, 14 + RGB 31, 31, 31 + RGB 00, 00, 00 + +.ThreeDashes: + db "---@" + +; a = move +.ShowMove: + push af + ld e, a + ld hl, 0 + ld bc, 20 + call AddNTimes + ld a, 31 + add a, l + ld c, a + ld b, 58 + call SummaryScreen_PlaceArrow + hlcoord 0, 13 + lb bc, 5, 20 + call ClearBox + pop af + ld b, 0 + ld c, a + ld hl, wTempMonMoves + add hl, bc + ld a, [hl] + ld [wCurMove], a + hlcoord 4, 13 + ld de, .String_PowAcc + rst PlaceString + + ld hl, Moves + MOVE_CATEGORY + call GetCurMoveProperty + add a, a + push af ; keep doubled category for later + add a, a + ld b, 0 + ld c, a + ld hl, CategoryIconPals + add hl, bc + + ldh a, [rSVBK] + push af + ld a, BANK(wBGPals1) + ldh [rSVBK], a + + ld de, wBGPals1 + 2 + farcall LoadOneColor + farcall LoadOneColor + call SetDefaultBGPAndOBP + + pop af + ldh [rSVBK], a + + pop af ; get category back + add a, SUMMARY_TILE_CATEGORY_START + hlcoord 1, 13 + ld [hli], a + inc a + ld [hl], a + + ld hl, Moves + MOVE_POWER + call GetCurMoveProperty + hlcoord 3, 13 + cp 2 + jr c, .no_power + ld [wTextDecimalByte], a + ld de, wTextDecimalByte + lb bc, 1, 3 + call PrintNum + jr .place_accuracy +.no_power + ld de, .String_na + rst PlaceString + +.place_accuracy + ld hl, Moves + MOVE_ACC + call GetCurMoveProperty + hlcoord 8, 13 + cp 255 + jr z, .no_acc + ld [wTextDecimalByte], a + ld de, wTextDecimalByte + lb bc, 1, 3 + call PrintNum + jr .description +.no_acc + ld de, .String_na + rst PlaceString + +.description + hlcoord 1, 15 + predef PrintMoveDesc + ret + +.String_na: + db "---@" + +.String_PowAcc: + db " / %@" + +SummaryScreen_MoveInfoLoop: + ld a, SUMMARY_TILE_OAM_MOVE_TITLE + call SummaryScreen_UpdateTabTitle + ld a, [wSummaryScreenPage] + and %11100011 + ld [wSummaryScreenPage], a + xor a + call SummaryScreen_GreenPage.ShowMove + call SummaryScreen_UpdateGFX +.loop + call SummaryScreen_MoveInfoJoypad + call SummaryScreen_DoAnim + jr .loop + +SummaryScreen_MoveInfoJoypad: + ld a, [wSummaryScreenPage] + srl a + srl a + and %00000111 + ld c, a + + call GetJoypad + ldh a, [hJoyPressed] + bit B_BUTTON_F, a + jr nz, .b_button + bit A_BUTTON_F, a + jr nz, .a_button + bit D_UP_F, a + jr nz, .d_up + bit D_DOWN_F, a + ret z +.d_down + inc c + ld b, 0 + jr .adjust_move_index +.a_button +.b_button + ld a, SUMMARY_TILE_OAM_ITEM_TITLE + call SummaryScreen_UpdateTabTitle + call SummaryScreen_GreenPage.PlaceItemText + call SummaryScreen_GreenPage.PlaceAInfo + call SummaryScreen_UpdateGFX + inc sp + inc sp + ret +.d_up + dec c + ld a, [wSummaryScreenMoveCount] + dec a + ld b, a +.adjust_move_index + ld a, [wSummaryScreenMoveCount] + dec a + cp a, c + jr nc, .set_move_index + ld c, b +.set_move_index + ld a, c + push af + call SummaryScreen_GreenPage.ShowMove + call SummaryScreen_UpdateGFX + pop af + sla a + sla a + and %00011100 + ld c, a + ld a, [wSummaryScreenPage] + and %11100011 + or a, c + ld [wSummaryScreenPage], a + ret + +SummaryScreen_UpdateGFX: + ld hl, wSummaryScreenOAM + ld de, wShadowOAM + ld bc, wShadowOAMEnd - wShadowOAM + rst CopyBytes + farcall HDMATransferTileMapToWRAMBank3 + ret diff --git a/engine/pokemon/summary/orange_page.asm b/engine/pokemon/summary/orange_page.asm new file mode 100644 index 0000000000..aa1401d6cf --- /dev/null +++ b/engine/pokemon/summary/orange_page.asm @@ -0,0 +1,218 @@ +SummaryScreen_OrangePage: + ld a, $54 + call SummaryScreen_UpdateTabTitle +; Fourth stats page code by TPP Anniversary Crystal 251 +; Ported by FIQ + call .TN_PrintToD + call .TN_PrintLV + call .TN_PrintLocation + ld a, [wTextboxFlags] + set USE_BG_MAP_WIDTH_F, a + ld [wTextboxFlags], a + call .PlaceNatureInfo + call .TN_PrintCharacteristics + ld a, [wTextboxFlags] + res USE_BG_MAP_WIDTH_F, a + ld [wTextboxFlags], a + ld hl, wTempMonPersonality + ld a, [wTempMonSpecies] + ld c, a + call GetAbility + +.PlaceNatureInfo: + ld de, .NatureString + hlbgcoord 0, 0, wSummaryScreenWindowBuffer + call PlaceString + ld de, .CharacterString + hlbgcoord 0, 2, wSummaryScreenWindowBuffer + call PlaceString + ld a, [wTempMonNature] + ld b, a + call GetNature + hlbgcoord 1, 1, wSummaryScreenWindowBuffer + farcall PrintNature + + ld hl, .OrangePalettes + ld bc, 1 palettes + ld de, wSummaryScreenPals palette SUMMARY_PAL_LOWER_WINDOW + rst CopyBytes + ld bc, 1 palettes + ld de, wSummaryScreenPals palette SUMMARY_PAL_SIDE_WINDOW + rst CopyBytes + + ret + +.OrangePalettes: + RGB 30, 24, 16 + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 00, 00, 00 + + RGB 31, 30, 29 + RGB 30, 24, 16 + RGB 31, 31, 31 + RGB 00, 00, 00 + +.NatureString: + db "Nature/@" + +.CharacterString: + db "Character/@" + +.TN_PrintToD: + hlcoord 1, 14 + ld a, [wTempMonCaughtTime] + farjp PlaceCaughtTimeOfDayString + +.TN_PrintLocation: + farcall BT_InRentalMode + ld de, .battle_factory + jr z, .print + ld a, [wTempMonCaughtLocation] + and a + ret z + ld de, .event + cp LANDMARK_EVENT + jr z, .print + ld e, a + farcall GetLandmarkName + ld de, wStringBuffer1 +.print + hlcoord 1, 17 + rst PlaceString + ret + +.battle_factory + db "Battle Factory@" + +.event + db "Event #mon@" + +.TN_PrintLV: + ld a, [wTempMonCaughtLevel] +; inherit coordinate from TN_PrintToD + ld h, b + ld l, c + inc hl +; hlcoord 11, 9 + inc a + jr z, .hatched + dec a + jr z, .traded + ld [wBuffer2], a + ld de, .str_level + rst PlaceString + ld h, b + ld l, c +; hlcoord 15, 9 + ld de, wBuffer2 + lb bc, PRINTNUM_LEFTALIGN | 1, 3 + jmp PrintNum +.hatched + ld de, .str_hatched + rst PlaceString + ret +.traded + ld de, .str_traded + rst PlaceString + ret + +.str_level + db "at @" + +.str_hatched + db "from Egg@" + +.str_traded + db "by trade@" + +.TN_PrintCharacteristics: + ; b = value of best DV, c = index of best DV + ld hl, wTempMonDVs + ; Atk + ld c, 1 + ld a, [hl] + and $f + ld b, a + ; HP + ld a, [hli] + swap a + and $f + cp b + jr z, .atk_beats_hp ; tie + jr c, .atk_beats_hp + ld c, 0 + ld b, a +.atk_beats_hp + ; Spe + ld a, [hl] + and $f + cp b + jr z, .last_beats_spe ; tie + jr c, .last_beats_spe + ld c, 5 + ld b, a +.last_beats_spe + ; Def + ld a, [hli] + swap a + and $f + cp b + jr z, .last_beats_def ; tie + jr c, .last_beats_def + ld c, 2 + ld b, a +.last_beats_def + ; SDf + ld a, [hl] + and $f + cp b + jr z, .last_beats_sdf ; tie + jr c, .last_beats_sdf + ld c, 4 + ld b, a +.last_beats_sdf + ; SAt + ld a, [hl] + swap a + and $f + cp b + jr z, .last_beats_sat ; tie + jr c, .last_beats_sat + ld c, 3 + ld b, a +.last_beats_sat + +; DVs are 0-15, but Gen 3+ IVs are 0-31. +; Stats are calculated so that a DV of N acts like an IV of 2*N+1. +; To keep characteristics consistent with the apparent IV values, +; this conversion is actually done. + ld a, b + add b + inc a + ld b, a + ; a = 5 * c + b % 5 +.mod_5 + cp 5 + jr c, .modded_5 + sub 5 + jr .mod_5 +.modded_5 + ld b, a + ld a, 5 + call SimpleMultiply + add b + + ld l, a + ld h, 0 + ld bc, Characteristics + add hl, hl + add hl, bc + ld a, [hli] + ld d, [hl] + ld e, a + hlbgcoord 1, 3, wSummaryScreenWindowBuffer + rst PlaceString + ret + +INCLUDE "data/characteristics.asm" diff --git a/engine/pokemon/summary/pink_page.asm b/engine/pokemon/summary/pink_page.asm new file mode 100644 index 0000000000..a6749b4e3a --- /dev/null +++ b/engine/pokemon/summary/pink_page.asm @@ -0,0 +1,296 @@ +SummaryScreen_PinkPage: + ld a, SUMMARY_TILE_OAM_EXP_TITLE + call SummaryScreen_UpdateTabTitle + ; Place pokerus + ld a, [wTempMonPokerusStatus] + and POKERUS_MASK + jr z, .pokerusDone + ld e, SUMMARY_TILE_POKERUS + cp POKERUS_CURED + jr nz, .placePokerus + assert SUMMARY_TILE_POKERUS + 1 == SUMMARY_TILE_POKERUS_CURED + inc e +.placePokerus + hlbgcoord 0, 5, wSummaryScreenWindowBuffer + ld [hl], e + hlbgcoord 16, 5, wSummaryScreenWindowBuffer + ld a, SUMMARY_PAL_SHINY_POKERUS + ld [hl], a +.pokerusDone + ; Place shiny + ld bc, wTempMonShiny + farcall CheckShininess + jr nc, .shinyDone + hlbgcoord 10, 0, wSummaryScreenWindowBuffer + ld [hl], "★" + hlbgcoord 16 + 10, 0, wSummaryScreenWindowBuffer + ld [hl], SUMMARY_PAL_SHINY_POKERUS +.shinyDone + ld a, [wTextboxFlags] + set USE_BG_MAP_WIDTH_F, a + ld [wTextboxFlags], a + + ; Place dex number + ld a, [wCurPartySpecies] + ld [wTempSpecies], a + ld [wCurSpecies], a + ld c, a + ld a, [wCurForm] + ld b, a + call GetPokedexNumber + ld d, b + ld e, c + hlbgcoord 0, 0, wSummaryScreenWindowBuffer + ld a, "№" + ld [hli], a + ld a, "." + ld [hli], a + lb bc, PRINTNUM_LEADINGZEROS | 2, 3 + call PrintNumFromReg ; sets de + + ; Place name + ld hl, wTempMonNickname + call CopyNickname + hlbgcoord 0, 1, wSummaryScreenWindowBuffer + rst PlaceString + hlbgcoord 1, 2, wSummaryScreenWindowBuffer + ld a, "/" + ld [hli], a + push hl + call GetPartyPokemonName + pop hl + rst PlaceString + + ; Place ball + hlbgcoord 8, 3, wSummaryScreenWindowBuffer + ld a, SUMMARY_TILE_BALL_SIDE_BORDER + ld [hli], a + ld a, SUMMARY_TILE_BALL + ld [hli], a + ld a, SUMMARY_TILE_BALL_SIDE_BORDER + ld [hli], a + + hlbgcoord 25, 3, wSummaryScreenWindowBuffer + ld a, SUMMARY_PAL_POKEBALL + ld [hli], a + + hlbgcoord 26, 3, wSummaryScreenWindowBuffer + ld [hl], X_FLIP | SUMMARY_PAL_SIDE_WINDOW + + ld hl, .BallSprites + ld bc, 8 + ld de, wSummaryScreenOAMSprite12 + rst CopyBytes + + ld hl, .StatusSprites + ld bc, 8 + ld de, wSummaryScreenOAMSprite14 + rst CopyBytes + + ld c, 4 + call DelayFrames + + ld d, 0 | 8 + ld a, [wBaseType1] + lb bc, 72, 76 + ld hl, wSummaryScreenOAMSprite04 + call SummaryScreen_PlaceTypeOBJ + debgcoord 0, 3, wSummaryScreenWindowBuffer + call SummaryScreen_PlaceTypeBG + + ; Place types + ld a, [wBaseType1] + ld e, a + ld a, [wBaseType2] + cp a, e + jr z, .doneTypes + ld d, 1 | 8 + lb bc, 104, 76 + ld hl, wSummaryScreenOAMSprite08 + call SummaryScreen_PlaceTypeOBJ + debgcoord 4, 3, wSummaryScreenWindowBuffer + call SummaryScreen_PlaceTypeBG +.doneTypes + + call .PlaceOTInfo + ld a, [wTextboxFlags] + res USE_BG_MAP_WIDTH_F, a + ld [wTextboxFlags], a + hlcoord 9, 8 + ld de, SCREEN_WIDTH + ld b, 10 + + ld de, .ExpPointStr + hlcoord 1, 13 + rst PlaceString + hlcoord 12, 13 + lb bc, 3, 7 + ld de, wTempMonExp + call PrintNum + call .CalcExpToNextLevel + hlcoord 12, 15 + lb bc, 3, 7 + ld de, wBuffer1 + call PrintNum + ld de, .LevelUpStr + hlcoord 1, 15 + rst PlaceString + ld de, .ToStr + hlcoord 13, 17 + rst PlaceString + hlcoord 16, 17 + call .PrintNextLevel + hlcoord 2, 17 + ld a, [wTempMonLevel] + ld b, a + ld de, wTempMonExp + 2 + farcall FillInExpBar + hlcoord 1, 17 + ld a, "" + ld [hli], a + ld [hl], "" + hlcoord 9, 17 + ld [hl], "" + + ld hl, .PinkPalettes + ld bc, 1 palettes + ld de, wSummaryScreenPals palette SUMMARY_PAL_LOWER_WINDOW + rst CopyBytes + ld bc, 1 palettes + ld de, wSummaryScreenPals palette SUMMARY_PAL_SIDE_WINDOW + rst CopyBytes + ld bc, 1 palettes + ld de, wSummaryScreenPals palette SUMMARY_PAL_SHINY_POKERUS + rst CopyBytes + + ld hl, CaughtBallPals + ld bc, $4 + ld a, [wTempMonCaughtBall] + and CAUGHT_BALL_MASK + rst AddNTimes + ld de, wSummaryScreenPals palette SUMMARY_PAL_POKEBALL + farcall LoadPalette_White_Col1_Col2_Black + + ret + +.PrintNextLevel: + ld a, [wTempMonLevel] + push af + cp MAX_LEVEL + jr z, .atMaxLevel + inc a + ld [wTempMonLevel], a +.atMaxLevel + call PrintLevel + pop af + ld [wTempMonLevel], a + ret + +.CalcExpToNextLevel: + ld a, [wTempMonLevel] + cp MAX_LEVEL + jr z, .AlreadyAtMaxLevel + inc a + ld d, a + farcall CalcExpAtLevel + ld hl, wTempMonExp + 2 + ldh a, [hQuotient + 2] + sub [hl] + dec hl + ld [wBuffer3], a + ldh a, [hQuotient + 1] + sbc [hl] + dec hl + ld [wBuffer2], a + ldh a, [hQuotient] + sbc [hl] + ld [wBuffer1], a + ret + +.AlreadyAtMaxLevel: + ld hl, wBuffer1 + xor a + ld [hli], a + ld [hli], a + ld [hl], a + ret + +.PlaceOTInfo: + ; for rental mons, replace the whole thing with "Rental #mon" + farcall BT_InRentalMode + jr nz, .not_rental_mon + hlcoord 0, 15 + ld de, .Rental_OT + rst PlaceString + ret + +.not_rental_mon + ld de, .OTStr + hlbgcoord 0, 4, wSummaryScreenWindowBuffer + rst PlaceString + ld de, .IDStr + hlbgcoord 2, 5, wSummaryScreenWindowBuffer + rst PlaceString + hlbgcoord 5, 5, wSummaryScreenWindowBuffer + lb bc, PRINTNUM_LEADINGZEROS | 2, 5 + ld de, wTempMonID + call PrintNum + ld hl, wTempMonOT + call CopyNickname + hlbgcoord 4, 4, wSummaryScreenWindowBuffer + rst PlaceString + ret + +.PinkPalettes: + RGB 31, 19, 31 + RGB 31, 25, 02 + RGB 04, 17, 31 + RGB 00, 00, 00 + + RGB 31, 29, 31 + RGB 31, 19, 31 + RGB 31, 31, 31 + RGB 00, 00, 00 + + RGB 31, 29, 31 + RGB 31, 19, 31 + RGB 27, 11, 27 + RGB 31, 25, 02 + +.BallSprites: + db 68, 144, SUMMARY_TILE_OAM_BALL_TOP_BORDER, Y_FLIP + db 84, 144, SUMMARY_TILE_OAM_BALL_TOP_BORDER, 0 + +.StatusSprites: + db 31, 120, SUMMARY_TILE_OAM_STATUS + 0, 5 + db 31, 128, SUMMARY_TILE_OAM_STATUS + 1, 5 + +.OTStr: + text "OT/" + done + +.IDStr + text "№." + done + +.Rental_OT: + text "Rental" + next1 " #mon" + done + +.ExpPointStr: + db "Exp.Points@" + +.LevelUpStr: + db "Level Up@" + +.ToStr: + db "to@" + +CopyNickname: + ld de, wStringBuffer1 + ld bc, MON_NAME_LENGTH + push de + rst CopyBytes + pop de + ret diff --git a/engine/pokemon/summary_screen.asm b/engine/pokemon/summary_screen.asm new file mode 100644 index 0000000000..4e125d6c73 --- /dev/null +++ b/engine/pokemon/summary_screen.asm @@ -0,0 +1,1162 @@ +; GSC summary screen by Emi +; Organized into ordered colored pages, similar to vanilla Crystal +; Every page has one panel on the right and one panel on the bottom +; All pages display an animated pokepic on the left, all pages except green also show level and gender below pokepic +; * Pink page: Mon overview, nick, ball, and OT on right, experience on bottom +; * Blue page: Stats on right, ability on bottom +; * Green page: Moves on right, item on bottom (item icon replacing level and gender on left), can be toggled for detailed move info +; * Orange page: Nature and character on right, met info on bottom + +; TODO entire egg page +; TODO allow swapping move order +; TODO replace move learning page +; TODO remove moves screen (by replacing it properly) +; TODO fix artifacts when exiting PC or in battle summary + +; vTiles0 +DEF SUMMARY_TILE_OAM_START EQU $3C +DEF SUMMARY_TILE_OAM_PAGE EQU $3C +DEF SUMMARY_TILE_OAM_SELECTED_PAGE EQU $3D +DEF SUMMARY_TILE_OAM_BALL_TOP_BORDER EQU $3E +DEF SUMMARY_TILE_OAM_A_INFO EQU $40 +DEF SUMMARY_TILE_OAM_TITLES EQU $44 +DEF SUMMARY_TILE_OAM_EXP_TITLE EQU $44 +DEF SUMMARY_TILE_OAM_ABILITY_TITLE EQU $48 +DEF SUMMARY_TILE_OAM_ITEM_TITLE EQU $4C +DEF SUMMARY_TILE_OAM_MOVE_TITLE EQU $50 +DEF SUMMARY_TILE_OAM_MET_TITLE EQU $54 +DEF SUMMARY_TILE_OAM_ARROW EQU $58 +DEF SUMMARY_TILE_OAM_STATUS EQU $5C + +; vTiles2 +DEF SUMMARY_TILE_START EQU $31 +DEF SUMMARY_TILE_SIDE_WINDOW_TL EQU $31 +DEF SUMMARY_TILE_SIDE_WINDOW_L EQU $32 +DEF SUMMARY_TILE_SIDE_WINDOW_T EQU $34 +DEF SUMMARY_TILE_SIDE_WINDOW_BL EQU $33 +DEF SUMMARY_TILE_SIDE_WINDOW_B EQU $35 +DEF SUMMARY_TILE_BOTTOM_WINDOW_T EQU $38 +DEF SUMMARY_TILE_BOTTOM_WINDOW_B EQU SUMMARY_TILE_SIDE_WINDOW_B +DEF SUMMARY_TILE_BOTTOM_WINDOW_CORNER EQU $36 +DEF SUMMARY_TILE_BOTTOM_WINDOW_INNER_CORNER EQU $37 +DEF SUMMARY_TILE_BALL_SIDE_BORDER EQU $39 +DEF SUMMARY_TILE_TYPE_BG_LEFT EQU $3A +DEF SUMMARY_TILE_TYPE_BG_MIDDLE EQU $3B +DEF SUMMARY_TILE_TYPE_BG_RIGHT EQU $3C +DEF SUMMARY_TILE_POKERUS EQU $3D +DEF SUMMARY_TILE_POKERUS_CURED EQU $3E +DEF SUMMARY_TILE_HIDDEN_H EQU $3F +DEF SUMMARY_TILE_HYPER_TRAINING EQU $40 +DEF SUMMARY_TILE_LEFT_ARROW EQU $41 +DEF SUMMARY_TILE_RIGHT_ARROW EQU $42 +DEF SUMMARY_TILE_BALL EQU $4F +DEF SUMMARY_TILE_CATEGORY_START EQU $50 +DEF SUMMARY_TILE_ITEM EQU $56 + +; vTiles3 +DEF SUMMARY_TILE_TYPE_START EQU $00 + +; bg palettes +DEF SUMMARY_PAL_LOWER_WINDOW EQU $00 +DEF SUMMARY_PAL_POKEMON EQU $01 +DEF SUMMARY_PAL_ITEM EQU $02 +DEF SUMMARY_PAL_SIDE_WINDOW EQU $03 +DEF SUMMARY_PAL_SHINY_POKERUS EQU $04 +DEF SUMMARY_PAL_NATURE_UP EQU $04 +DEF SUMMARY_PAL_HP_BAR EQU $05 +DEF SUMMARY_PAL_GENDER_MARKER EQU $06 +DEF SUMMARY_PAL_POKEBALL EQU $07 +DEF SUMMARY_PAL_NATURE_DOWN EQU $07 + +SummaryScreenInit: + ldh a, [hMapAnims] + push af + xor a + ldh [hMapAnims], a ; disable overworld tile animations + ld a, [wBoxAlignment] ; whether sprite is to be mirrorred + push af + ld a, [wJumptableIndex] + ld b, a + ld a, [wSummaryScreenFlags] + ld c, a + + push bc + call ClearBGPalettes + call ClearTileMap + farcall WipeAttrMap + + ; "Scroll" the tilemap destination to write a 19th row of blank tiles below the generally visible area + ; This portion is visible due to hblank rWY scrolling + ; Presumes the low byte of hBGMapAddress is 00 + ld a, 32 + ldh [hBGMapAddress], a + call ApplyTilemapInVBlank + call ApplyAttrmapInVBlank + xor a + ldh [hBGMapAddress], a + + call UpdateSprites + call LoadFontsBattleExtra + call SummaryScreen_InitTiles + + ldh a, [rSVBK] + push af + ld a, BANK(wOBPals1) + ldh [rSVBK], a + ld hl, .SummaryScreenObjPalettes + ld bc, 8 palettes + ld de, wOBPals1 + rst CopyBytes + farcall ApplyOBPals + pop af + ldh [rSVBK], a + + ld a, 1 + ldh [hCGBPalUpdate], a + + ld a, [wTempMonBox] + ld b, a + ld a, [wTempMonSlot] + ld c, a + farcall GetStorageBoxMon + + ld hl, wSummaryScreenInterrupts + ld a, 143 + ld [hli], a + ld [hli], a + ld bc, 2 * 15 + ld a, -1 + rst ByteFill + ; Set up for HBlank + + ld hl, hFunctionTarget + ld b, [hl] + ld a, LOW(LCDSummaryScreenHideWindow) + ld [hli], a + ld c, [hl] + push bc + ld a, HIGH(LCDSummaryScreenHideWindow) + ld [hl], a + ld hl, rIE + ld a, [hl] + push af + set LCD_STAT, [hl] + ; save old window position + ldh a, [hWX] + ld b, a + ldh a, [hWY] + ld c, a + push bc + + ; Load initial mon + xor a + ld [wSummaryScreenFlags], a + call SummaryScreen_InitMon + call DelayFrame + call SummaryScreen_LoadPage + + ; Enter loop + call SummaryScreenLoop + ; Clean up + + call ClearBGPalettes + call ClearTileMap + + ; restore old values + pop bc + ld a, b + ldh [hWX], a + ld a, c + ldh [hWY], a + + pop af + ld [rIE], a + + pop bc + ld hl, hFunctionTarget + ld [hl], b + inc hl + ld [hl], c + + pop bc + ld a, b + ld [wJumptableIndex], a + ld a, c + ld [wSummaryScreenFlags], a + pop af + ld [wBoxAlignment], a + pop af + ldh [hMapAnims], a + ret + +.SummaryScreenObjPalettes: +; pink + RGB 31, 31, 31 + RGB 31, 15, 31 + RGB 00, 00, 00 + RGB 00, 00, 00 ; placeholder +; blue + RGB 31, 31, 31 + RGB 17, 31, 31 + RGB 00, 00, 00 + RGB 00, 00, 00 ; placeholder +; green + RGB 31, 31, 31 + RGB 17, 31, 00 + RGB 00, 00, 00 + RGB 00, 00, 00 ; placeholder +; orange + RGB 31, 31, 31 + RGB 30, 22, 12 + RGB 00, 00, 00 + RGB 00, 00, 00 ; placeholder +; green info button + RGB 31, 31, 31 + RGB 16, 24, 10 + RGB 31, 31, 31 + RGB 00, 00, 00 ; placeholder +; unused + RGB 31, 31, 31 + RGB 31, 31, 31 ; unused + RGB 31, 31, 31 ; unused + RGB 00, 00, 00 ; placeholder +; arrow dark + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 10, 06 + RGB 00, 00, 00 ; placeholder +; arrow light + RGB 31, 31, 31 + RGB 31, 31, 31 + RGB 31, 20, 20 + RGB 00, 00, 00 ; placeholder + +SummaryScreen_InitTiles: + ld hl, GFX_Summary + ld de, vTiles2 tile SUMMARY_TILE_START + lb bc, BANK(GFX_Summary), 18 + call DecompressRequest2bpp + + ld a, 1 + ldh [rVBK], a + ld de, TypeIconGFX + ld hl, vTiles3 tile SUMMARY_TILE_TYPE_START + lb bc, BANK(TypeIconGFX), 19 * 4 + call Request1bpp + xor a + ldh [rVBK], a + + ld de, CategoryIconGFX + ld hl, vTiles2 tile SUMMARY_TILE_CATEGORY_START + lb bc, BANK(CategoryIconGFX), 2 * NUM_CATEGORIES + call Request2bpp + + ld hl, GFX_Summary_Sprites + ld de, vTiles0 tile SUMMARY_TILE_OAM_START + lb bc, BANK(GFX_Summary_Sprites), 8 * 4 + jmp DecompressRequest2bpp + +; Main summary screen event loop +SummaryScreenLoop: + call SummaryScreen_DoAnim + call .Joypad + jr SummaryScreenLoop + +.Joypad: + ld a, [wSummaryScreenFlags] + and $3 + ld c, a ; page + + call GetJoypad + ldh a, [hJoyPressed] + and D_DOWN | D_UP | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON + + bit B_BUTTON_F, a + jr nz, .quit + bit D_LEFT_F, a + jr nz, .d_left + bit D_RIGHT_F, a + jr nz, .d_right + bit A_BUTTON_F, a + jr nz, .a_button + bit D_UP_F, a + jr nz, .d_up + bit D_DOWN_F, a + ret z + ; fallthrough + +.d_down + farcall NextStorageBoxMon + ret z + jr .load_mon + +.d_up + farcall PrevStorageBoxMon + ret z + ; fallthrough + +.load_mon + call SummaryScreen_InitMon + call DelayFrame + jmp SummaryScreen_LoadPage + +.a_button + ld a, c + cp a, SUMMARY_GREEN_PAGE + ret nz + jmp SummaryScreen_MoveInfoLoop + +.d_right + inc c + ld a, NUM_SUMMARY_PAGES - 1 + cp c + jr nc, .set_page + ld c, 0 + jr .set_page + +.d_left + ld a, c + dec c + and a + jr nz, .set_page + ld c, NUM_SUMMARY_PAGES - 1 + ; fallthrough + +.set_page + ld a, [wSummaryScreenFlags] + and %11111100 + or c + ld [wSummaryScreenFlags], a + ld hl, wSummaryScreenFlags + res 4, [hl] + jmp SummaryScreen_LoadPage + +.quit + pop af + ret + +SummaryScreen_DoAnim: + ld hl, wSummaryScreenFlags + bit 6, [hl] + jr nz, .try_anim + bit 5, [hl] + jr nz, .finish + jmp DelayFrame + +.try_anim + farcall SetUpPokeAnim + jr nc, .finish + ld hl, wSummaryScreenFlags + res 6, [hl] +.finish + ld hl, wSummaryScreenFlags + res 5, [hl] + farjp HDMATransferTileMapToWRAMBank3 + +SummaryScreen_InitMon: + ld hl, wSummaryScreenFlags + res 6, [hl] + + ; Clear sprites except page icons + ld hl, wShadowOAM + 4 * 4 + ld bc, wShadowOAMEnd - (wShadowOAM + 4 * 4) + xor a + rst ByteFill + + ; Clear content portions of summary screen + hlcoord 0, 1 + lb bc, 10, 7 + call ClearBox + hlcoord 0, 13 + lb bc, 5, 20 + call ClearBox + + farcall HDMATransferTileMapToWRAMBank3 + + ; Disable window rendering + ldh a, [rLCDC] + res rLCDC_WINDOW_ENABLE, a + ldh [rLCDC], a + ldh a, [rIE] + res LCD_STAT, a + ldh [rIE], a + + ld a, 255 + ld [rLYC], a + + ld a, [wTempMonSlot] + ld [wPartyMenuCursor], a + dec a + ld [wCurPartyMon], a + ld a, [wTempMonSpecies] + ld [wCurSpecies], a + ld [wCurPartySpecies], a + ld a, [wTempMonForm] + ld [wCurForm], a + ld a, [wTempMonIsEgg] + bit MON_IS_EGG_F, a + jr nz, EggSummaryInit + + ; count the number of moves the current mon has + xor a + ld [wSummaryScreenPage], a + lb bc, 0, NUM_MOVES + ld hl, wTempMonMoves + 1 +.moves_loop + inc b + ld a, [hli] + and a + jr z, .moves_loop_end + dec c + jr nz, .moves_loop +.moves_loop_end + ld a, b + ld [wSummaryScreenMoveCount], a + + call SummaryScreen_InitLayout + + xor a + ldh [rVBK], a + + ld hl, GFX_Balls + ld de, vTiles2 tile SUMMARY_TILE_BALL + lb bc, BANK(GFX_Balls), 1 + call DecompressRequest2bpp + ld a, [wTempMonCaughtBall] + and CAUGHT_BALL_MASK + ld h, 0 + ld l, a + add hl, hl + add hl, hl + add hl, hl + add hl, hl + ld de, wDecompressScratch + add hl, de + push hl + pop de + ld hl, vTiles2 tile SUMMARY_TILE_BALL + ld c, 1 + call Request2bppInWRA6 + + farcall LoadSummaryStatusIcon + ld a, [wTempMonItem] + farcall LoadItemIconForSummaryScreen + farcall _CGB_StatsScreenHPPals + ld hl, wSummaryScreenFlags + set 4, [hl] + ret + +EggSummaryInit: + ld a, [wCurPartySpecies] + push af + ld a, EGG + ld [wCurPartySpecies], a + call EggSummaryScreen + pop af + ld [wCurPartySpecies], a + ld hl, wJumptableIndex + inc [hl] + ret + +SummaryScreen_InitLayout: + call .PlaceHPBar + + ld hl, .PageSprites + ld de, wSummaryScreenOAMSprite00 + ld bc, 4 * 4 + rst CopyBytes + + ld hl, .TabTitleSprites + ld de, wSummaryScreenOAMSprite36 + ld bc, 4 * 4 + rst CopyBytes + + ; Right window + hlcoord 7, 1 + ld a, SUMMARY_TILE_SIDE_WINDOW_TL + ld [hli], a + ; hlcoord 8, 1 + ld bc, 12 + ld a, SUMMARY_TILE_SIDE_WINDOW_T + rst ByteFill + + hlcoord 7, 2 + ld a, SUMMARY_TILE_SIDE_WINDOW_L + lb bc, 9, 1 + call FillBoxWithByte + hlcoord 7, 11 + ld a, SUMMARY_TILE_SIDE_WINDOW_BL + ld [hli], a + ; hlcoord 7, 12 + ld bc, 12 + ld a, SUMMARY_TILE_SIDE_WINDOW_B + rst ByteFill + + ; Bottom window + hlcoord 0, 12 + ld bc, SCREEN_WIDTH + ld a, SUMMARY_TILE_BOTTOM_WINDOW_T + rst ByteFill + + hlcoord 1, 11 + ld a, SUMMARY_TILE_BOTTOM_WINDOW_CORNER + ld [hli], a + ld a, SUMMARY_TILE_BOTTOM_WINDOW_B + ld bc, 3 + rst ByteFill + ld [hl], SUMMARY_TILE_BOTTOM_WINDOW_CORNER + + hlcoord 1, 12 + ld a, SUMMARY_TILE_BOTTOM_WINDOW_INNER_CORNER + ld [hli], a + ld a, " " + ld c, 3 + rst ByteFill + ld [hl], SUMMARY_TILE_BOTTOM_WINDOW_INNER_CORNER + + ld hl, wSummaryScreenTypes + ld a, [wBaseType1] + ld [hli], a + ld a, [wBaseType2] + ld [hl], a + + lb bc, 0, 252 +.moveTypes + ld hl, wTempMonMoves - 252 + add hl, bc + ld a, [hl] + and a + jr z, .moveTypesEnd + ld [wCurMove], a + ld hl, Moves + MOVE_TYPE + call GetCurMoveProperty + ld hl, wSummaryScreenTypes - 252 + 2 + add hl, bc + ld [hl], a + inc c + jr nz, .moveTypes +.moveTypesEnd + + call .ApplySummaryPalettes + + hlcoord 19 - NUM_SUMMARY_PAGES * 2, 0 + ld [hl], SUMMARY_TILE_LEFT_ARROW + hlcoord 19, 0 + ld [hl], SUMMARY_TILE_RIGHT_ARROW + ret + +.PlaceHPBar: + ld hl, wTempMonHP + ld a, [hli] + ld b, a + ld c, [hl] + ld hl, wTempMonMaxHP + ld a, [hli] + ld d, a + ld e, [hl] + farcall ComputeHPBarPixels + ld hl, wCurHPPal + call SetHPPal + jmp DelayFrame + +.ApplySummaryPalettes: + ldh a, [rSVBK] + push af + ld a, BANK(wOBPals1) + ldh [rSVBK], a + ld c, 0 +.objPalettes + ld d, 0 + ld hl, wSummaryScreenTypes + add hl, bc + ld e, [hl] + sla e + ld hl, TypeIconPals + add hl, de + push hl + ld hl, wOBPals1 + 6 + add hl, bc + add hl, bc + add hl, bc + add hl, bc + add hl, bc + add hl, bc + add hl, bc + add hl, bc + ld d, h + ld e, l + pop hl + push bc + farcall LoadOneColor + pop bc + inc c + ld a, 5 + cp a, c + jr nc, .objPalettes + + farcall ApplyOBPals + pop af + ldh [rSVBK], a + ret + +.PageSprites: + db 17, 104, SUMMARY_TILE_OAM_PAGE, $0 + db 17, 120, SUMMARY_TILE_OAM_PAGE, $1 + db 17, 136, SUMMARY_TILE_OAM_PAGE, $2 + db 17, 152, SUMMARY_TILE_OAM_PAGE, $3 + +.TabTitleSprites: + db 108, 20, SUMMARY_TILE_OAM_TITLES + 0, $0 + db 108, 28, SUMMARY_TILE_OAM_TITLES + 1, $0 + db 108, 36, SUMMARY_TILE_OAM_TITLES + 2, $0 + db 108, 44, SUMMARY_TILE_OAM_TITLES + 3, $0 + +SummaryScreen_InitAttrmap: + farcall WipeAttrMap + + hlcoord 0, 0, wAttrmap + lb bc, 12, 8 + ld a, SUMMARY_PAL_POKEMON + call FillBoxWithByte + + hlcoord 8, 0, wAttrmap + lb bc, 1, 14 + ; a == SUMMARY_PAL_POKEMON + call FillBoxWithByte + + hlcoord 0, 12, wAttrmap + lb bc, 1, 20 + ld a, SUMMARY_PAL_SIDE_WINDOW + call FillBoxWithByte + + hlcoord 2, 12, wAttrmap + lb bc, 1, 3 + xor a + assert SUMMARY_PAL_LOWER_WINDOW == 0 + call FillBoxWithByte + + hlcoord 1, 11, wAttrmap + ld a, SUMMARY_PAL_SIDE_WINDOW + ld [hli], a + ld a, Y_FLIP | SUMMARY_PAL_LOWER_WINDOW + ld bc, 3 + rst ByteFill + ld a, X_FLIP | SUMMARY_PAL_SIDE_WINDOW + ld [hl], a + hlcoord 5, 12, wAttrmap + ld [hl], a + + hlcoord 7, 1, wAttrmap + lb bc, 11, 13 + ld a, SUMMARY_PAL_SIDE_WINDOW + call FillBoxWithByte + + hlcoord 5, 9, wAttrmap + ld [hl], SUMMARY_PAL_GENDER_MARKER + + hlcoord 2, 8, wAttrmap + lb bc, 3, 3 + ld a, SUMMARY_PAL_ITEM + call FillBoxWithByte + ret + +SummaryScreen_LoadPage: + ld a, [wCurPartySpecies] + ld [wTempSpecies], a + ld [wCurSpecies], a + xor a + ldh [hBGMapMode], a + ldh [hOAMUpdate], a + ldh [hCGBPalUpdate], a + call .ClearBox + call .PlaceLevelAndGender + hlbgcoord 0, 0, wSummaryScreenWindowBuffer + ld a, 10 + ld e, a + ld b, 0 +.loop + ld c, $10 + ld a, " " + rst ByteFill + ld c, $10 + ld a, 3 + rst ByteFill + dec e + jr nz, .loop + + ld c, 4 * 20 + ld a, 0 + ld hl, wSummaryScreenOAMSprite04 + rst ByteFill + call .PageTilemap + ld hl, wSummaryScreenFlags + bit 4, [hl] + call nz, SummaryScreen_PlaceFrontpic + call SummaryScreen_SwitchPage + farcall HDMATransferTileMapToWRAMBank3 + ld a, 7 + 64 + ldh [hWX], a + ld a, 16 + ldh [hWY], a + + ldh a, [rSVBK] + push af + ld a, BANK(wBGPals1) + ldh [rSVBK], a + ld hl, wSummaryScreenPals + ld de, wBGPals1 + ld bc, 1 palettes + rst CopyBytes + ld hl, wSummaryScreenPals palette 2 + ld de, wBGPals1 palette 2 + ld bc, 6 palettes + rst CopyBytes + pop af + ldh [rSVBK], a + + ;jmp SafeCopyTilemapAtOnce + ret + +.ClearBox: + ld a, [wSummaryScreenFlags] + and $3 + ld c, a + hlcoord 0, 13 + lb bc, 5, 20 + jmp ClearBox + +.PlaceLevelAndGender: + ; Clear item tiles + hlcoord 2, 8 + lb bc, 3, 3 + call ClearBox + + hlcoord 1, 9 + call PrintLevel + hlcoord 5, 9 + push hl + farcall GetGender + pop hl + ret c + ld a, "" + jr nz, .got_gender + inc a ; "" +.got_gender + ld [hl], a + ret + +.PageTilemap: + ld a, [wSummaryScreenFlags] + and $3 + call StackJumpTable + +.Jumptable: + dw SummaryScreen_PinkPage + dw SummaryScreen_BluePage + dw SummaryScreen_GreenPage + dw SummaryScreen_OrangePage + +INCLUDE "engine/pokemon/summary/pink_page.asm" +INCLUDE "engine/pokemon/summary/blue_page.asm" +INCLUDE "engine/pokemon/summary/green_page.asm" +INCLUDE "engine/pokemon/summary/orange_page.asm" +INCLUDE "engine/pokemon/summary/egg_page.asm" + +; The semi-precisely timed routine responsible for updating the graphics during a page transition. +; Utilizes hblank over 2 frames to mostly seemlessly copy data before/after scanlines. +; +; Starting on rLY == 84, an HDMA is triggered to run over the next 19 hblanks. +; 19 blocks of 16 tiles are copied from wSummaryScreenWindowBuffer into the window tilemap. +; This represents 9.5 rows of tiles, however, only the leftmost 12 of 32 are ever visible. +; By the time of the hblank at rLY == 91, the lowest pixels of the window buffer will have been drawn. +; This will occur just before the HDMA copies in tile data affecting these tiles on all pages. +; The tilemap HDMA will conclude around rLY == 102 +; +; At around rLY == 103, an HDMA is triggered to run over the next 19 hblanks. +; 19 blocks of 16 tiles are copied from wSummaryScreenWindowBuffer into the window attribute map. +; Like before, this is 9.5 rows of attributes, unlike before, this HDMA starts on the 16th attribute. +; +; wSummaryScreenWindowBuffer is a staggered buffer, 32 bytes per row, half tiles half attributes. +; It is simply much easier and faster to write garbage to the parts of the window that are invisible. +; After the HDMAs, a row of the tilemap will look like this: +; TTTT_TTTT_TTTT_TTTT_AAAA_AAAA_AAAA_AAAA +; ^ last visible tile +; After the HDMAs, a row of the attribute map will look like this: +; AAAA_AAAA_AAAA_AAAA_TTTT_TTTT_TTTT_TTTT +; ^ last visible attribute +; +; At rLY == 128, the new hblank routine is set up for toggling the window and scrolling the background. +; See home/lcd.asm +SummaryScreen_SwitchPage: + xor a + ld [rVBK], a + ld a, HIGH(wSummaryScreenWindowBuffer) + ld [rHDMA1], a + ld a, LOW(wSummaryScreenWindowBuffer) + ld [rHDMA2], a + ld a, HIGH(vBGMap1) + ld [rHDMA3], a + ld a, LOW(vBGMap1) + ld [rHDMA4], a + +.lineWait + ld a, [rLY] + cp a, 84 + jr nz, .lineWait + ld a, $80 | 18 + ld [rHDMA5], a ; HDMA 19 blocks of tiles + + ld hl, wSummaryScreenOAMSprite00TileID + ld [hl], SUMMARY_TILE_OAM_PAGE + ld hl, wSummaryScreenOAMSprite01TileID + ld [hl], SUMMARY_TILE_OAM_PAGE + ld hl, wSummaryScreenOAMSprite02TileID + ld [hl], SUMMARY_TILE_OAM_PAGE + ld hl, wSummaryScreenOAMSprite03TileID + ld [hl], SUMMARY_TILE_OAM_PAGE + ld a, [wSummaryScreenFlags] + and $3 + add a, a + add a, a + ld d, 0 + ld e, a + ld hl, wSummaryScreenOAMSprite00TileID + add hl, de + ld [hl], SUMMARY_TILE_OAM_SELECTED_PAGE + ld hl, wSummaryScreenOAM + ld de, wShadowOAM + ld bc, wShadowOAMEnd - wShadowOAM + rst CopyBytes + +.copyWait + ld a, [rHDMA5] + inc a + jr nz, .copyWait + inc a ; 1 + ld [rVBK], a + ld a, HIGH(wSummaryScreenWindowBuffer + $10) + ld [rHDMA1], a + ld a, LOW(wSummaryScreenWindowBuffer + $10) + ld [rHDMA2], a + ld a, HIGH(vBGMap3) + ld [rHDMA3], a + ld a, LOW(vBGMap3) + ld [rHDMA4], a + + call .WaitUntilHBlank + ld a, $80 | 18 + ld [rHDMA5], a ; HDMA 19 blocks of attributes + +.l128 + ld a, [rLY] + cp a, 128 + jr nz, .l128 + + ld a, 10 + ld [rLYC], a + ld a, 2 + ld [wSummaryScreenStep], a + ld a, LOW(LCDSummaryScreenShowWindow) + ldh [hFunctionTargetLo], a + ld a, HIGH(LCDSummaryScreenShowWindow) + ldh [hFunctionTargetHi], a + + ldh a, [rLCDC] + set rLCDC_WINDOW_ENABLE, a + ldh [rLCDC], a + ldh a, [rIE] + set LCD_STAT, a + ldh [rIE], a + + ld hl, .InterruptTable + ld b, 0 + ld a, [wSummaryScreenFlags] + and $3 + sla a + ld c, a + add hl, bc + ld a, [hli] + ld b, a + ld h, [hl] + ld l, b + ld de, wSummaryScreenInterrupts + ld bc, 16 * 2 + rst CopyBytes + + xor a + ldh [hCGBPalUpdate], a + + ld c, 6 * 2 + ld hl, wSummaryScreenPals + 2 palettes + call .WaitUntilHBlank + ld a, (2 palettes) | (1 << rBGPI_AUTO_INCREMENT) + ldh [rBGPI], a + call .CopyPalettes + +.l60 + ld a, [rLY] + cp a, 62 + jr nc, .l60 + + ld c, 1 * 2 + ld hl, wSummaryScreenPals + call .WaitUntilHBlank + ld a, 1 << rBGPI_AUTO_INCREMENT + ldh [rBGPI], a + jr .CopyPalettes + +; copies c palettes during hblanks +; assumed to be called durring hblank +.CopyPalettes: +rept 4 + ld a, [hli] + ldh [rBGPD], a +endr + dec c + ret z + call .WaitUntilHBlank + jr .CopyPalettes + +.WaitUntilHBlank: + ldh a, [rSTAT] + and rSTAT_MODE_MASK ; wait until mode 1-3 + jr z, .WaitUntilHBlank +.mode0 + ldh a, [rSTAT] + and rSTAT_MODE_MASK ; wait until mode 0 + ret z + jr .mode0 + +.InterruptTable: + dw .PinkInterrupts + dw .BlueInterrupts + dw .GreenInterrupts + dw .OrangeInterrupts + +.PinkInterrupts: + db 22, SUMMARY_LCD_SHOW_WINDOW + db 23, SUMMARY_LCD_HIDE_WINDOW + db 31, SUMMARY_LCD_SHOW_WINDOW + db 39, SUMMARY_LCD_HIDE_WINDOW + db 43, SUMMARY_LCD_SHOW_WINDOW + db 51, SUMMARY_LCD_HIDE_WINDOW + db 59, SUMMARY_LCD_SHOW_WINDOW + db 67, SUMMARY_LCD_HIDE_WINDOW + db 71, SUMMARY_LCD_SHOW_WINDOW + db 79, SUMMARY_LCD_HIDE_WINDOW + db 83, SUMMARY_LCD_SHOW_WINDOW + db 91, SUMMARY_LCD_HIDE_WINDOW + db 127, SUMMARY_LCD_SCROLL_BACKGROUND + db -1 +.BlueInterrupts: + db 22, SUMMARY_LCD_SHOW_WINDOW + db 31, SUMMARY_LCD_HIDE_WINDOW + db 35, SUMMARY_LCD_SHOW_WINDOW + db 43, SUMMARY_LCD_HIDE_WINDOW + db 47, SUMMARY_LCD_SHOW_WINDOW + db 55, SUMMARY_LCD_HIDE_WINDOW + db 59, SUMMARY_LCD_SHOW_WINDOW + db 67, SUMMARY_LCD_HIDE_WINDOW + db 71, SUMMARY_LCD_SHOW_WINDOW + db 79, SUMMARY_LCD_HIDE_WINDOW + db 83, SUMMARY_LCD_SHOW_WINDOW + db 91, SUMMARY_LCD_HIDE_WINDOW + db 127, SUMMARY_LCD_SCROLL_BACKGROUND + db -1 +.GreenInterrupts: + db 22, SUMMARY_LCD_SHOW_WINDOW + db 31, SUMMARY_LCD_HIDE_WINDOW + db 35, SUMMARY_LCD_SHOW_WINDOW + db 51, SUMMARY_LCD_HIDE_WINDOW + db 55, SUMMARY_LCD_SHOW_WINDOW + db 71, SUMMARY_LCD_HIDE_WINDOW + db 75, SUMMARY_LCD_SHOW_WINDOW + db 91, SUMMARY_LCD_HIDE_WINDOW + db 127, SUMMARY_LCD_SCROLL_BACKGROUND + db -1 +.OrangeInterrupts: + db 22, SUMMARY_LCD_SHOW_WINDOW + db 23, SUMMARY_LCD_HIDE_WINDOW + db 27, SUMMARY_LCD_SHOW_WINDOW + db 35, SUMMARY_LCD_HIDE_WINDOW + db 47, SUMMARY_LCD_SHOW_WINDOW + db 55, SUMMARY_LCD_HIDE_WINDOW + db 59, SUMMARY_LCD_SHOW_WINDOW + db 67, SUMMARY_LCD_HIDE_WINDOW + db 71, SUMMARY_LCD_SHOW_WINDOW + db 79, SUMMARY_LCD_HIDE_WINDOW + db 83, SUMMARY_LCD_SHOW_WINDOW + db 91, SUMMARY_LCD_HIDE_WINDOW + db 127, SUMMARY_LCD_SCROLL_BACKGROUND + db -1 + +; Animated PokePic + +SummaryScreen_PlaceFrontpic: + ld a, [wTempMonForm] + ld [wCurForm], a + call SummaryScreen_GetAnimationParam + jr nc, .no_cry + call .Animate + jmp SetDefaultBGPAndOBP + +.no_cry + call .DontAnimate + jmp SetDefaultBGPAndOBP + +.DontAnimate: + ld hl, wSummaryScreenFlags + set 5, [hl] + hlcoord 0, 1 + ld a, [wCurPartySpecies] + cp UNOWN + jmp z, PrepMonFrontpicFlipped + jmp PrepMonFrontpic + +.Animate: + ld a, [wCurPartySpecies] + sub UNOWN + jr z, .got_align + ld a, TRUE +.got_align + ld [wBoxAlignment], a + ld a, [wCurPartySpecies] + call IsAPokemon + ret c + call SummaryScreen_LoadTextboxSpaceGFX + ld de, vTiles2 tile $00 + predef FrontpicPredef + hlcoord 0, 1 + lb de, $0, $2 + predef LoadMonAnimation + ld hl, wSummaryScreenFlags + set 6, [hl] + ret + +SummaryScreen_GetAnimationParam: + ld bc, wTempMon + ld a, [wTempMonIsEgg] + bit MON_IS_EGG_F, a + scf + ret nz + call CheckFaintedFrzSlp + ccf + ret + +; TODO this routine is used elsewhere, move somewhere else? +CheckFaintedFrzSlp: + ld hl, MON_HP + add hl, bc + ld a, [hli] + or [hl] + jr z, .fainted_frz_slp + ld hl, MON_STATUS + add hl, bc + ld a, [hl] + and (1 << FRZ) | SLP_MASK + ret z +.fainted_frz_slp + scf + ret + +SummaryScreen_LoadTextboxSpaceGFX: + push hl + push de + push bc + push af + call DelayFrame + ldh a, [rVBK] + push af + ld a, $1 + ldh [rVBK], a + ld de, TextboxSpaceGFX + lb bc, BANK(TextboxSpaceGFX), 1 + ld hl, vTiles2 tile $7f + call Get1bpp + pop af + ldh [rVBK], a + jmp PopAFBCDEHL + +; Other utilities + +; a = first tile +SummaryScreen_UpdateTabTitle: + ld [wSummaryScreenOAMSprite36TileID], a + inc a + ld [wSummaryScreenOAMSprite37TileID], a + inc a + ld [wSummaryScreenOAMSprite38TileID], a + inc a + ld [wSummaryScreenOAMSprite39TileID], a + ret + +; a = type +; b = x +; c = y +; d = attributes +; hl = destination +SummaryScreen_PlaceTypeOBJ: + sla a + sla a + ld e, a +rept 4 + ld a, c + ld [hli], a + ld a, b + ld [hli], a + add a, 8 + ld b, a + ld a, e + inc e + ld [hli], a + inc a + ld a, d + ld [hli], a +endr + ret + +; de = destination +SummaryScreen_PlaceTypeBG: + ld hl, .TypeBG + ld bc, 4 + rst CopyBytes + ret +.TypeBG: + db SUMMARY_TILE_TYPE_BG_LEFT + db SUMMARY_TILE_TYPE_BG_MIDDLE + db SUMMARY_TILE_TYPE_BG_MIDDLE + db SUMMARY_TILE_TYPE_BG_RIGHT + +; b = x +; c = y +SummaryScreen_PlaceArrow: + ld hl, wSummaryScreenOAMSprite20 + ld d, SUMMARY_TILE_OAM_ARROW + ld e, $6 +.arrowLoop + ld a, c + ld [hli], a ; y + ld a, b + ld [hli], a ; x + ld a, d + ld [hli], a ; tile + ld a, e + ld [hli], a ; attr + ld a, 8 + add a, b + ld b, a + inc d + ld a, SUMMARY_TILE_OAM_ARROW + 4 + cp a, d + ret z + ld a, SUMMARY_TILE_OAM_ARROW + 2 + cp a, d + jr nz, .arrowLoop + ld a, b + sub a, 16 + ld b, a + ld a, 8 + add a, c + ld c, a + inc e + jr .arrowLoop diff --git a/gfx/font.asm b/gfx/font.asm index f38288e47b..c5d7adfc8c 100755 --- a/gfx/font.asm +++ b/gfx/font.asm @@ -61,6 +61,9 @@ INCBIN "gfx/signs/building.2bpp" BattleExtrasGFX: INCBIN "gfx/battle/hpexpbars.2bpp.lz" +SummaryStatusIconGFX: +INCBIN "gfx/stats/status.2bpp" + StatusIconGFX: INCBIN "gfx/battle/status.2bpp" diff --git a/gfx/misc.asm b/gfx/misc.asm index 165bba11bd..0694a11db0 100644 --- a/gfx/misc.asm +++ b/gfx/misc.asm @@ -50,7 +50,9 @@ TradeScreenGFX:: INCBIN "gfx/trade/trade_screen.2bpp.lz" SECTION "Stats Graphics", ROMX -GFX_Stats:: INCBIN "gfx/stats/stats_balls.2bpp.lz" +GFX_Summary:: INCBIN "gfx/stats/summary.2bpp.lz" +GFX_Summary_Sprites:: INCBIN "gfx/stats/summary_sprites.2bpp.lz" +GFX_Balls:: INCBIN "gfx/stats/balls.2bpp.lz" SECTION "Town Map Graphics", ROMX diff --git a/gfx/stats/pages.pal b/gfx/stats/pages.pal deleted file mode 100644 index 7257d67f72..0000000000 --- a/gfx/stats/pages.pal +++ /dev/null @@ -1,29 +0,0 @@ -if !DEF(MONOCHROME) -; pink - RGB 31, 31, 31 - RGB 31, 19, 31 - RGB 31, 15, 31 - RGB 00, 00, 00 -; green - RGB 31, 31, 31 - RGB 21, 31, 14 - RGB 17, 31, 00 - RGB 00, 00, 00 -; blue - RGB 31, 31, 31 - 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 -else -rept 4 - RGB_MONOCHROME_WHITE - RGB_MONOCHROME_WHITE - RGB_MONOCHROME_DARK - RGB_MONOCHROME_BLACK -endr -endc diff --git a/gfx/stats/stats.png b/gfx/stats/stats.png deleted file mode 100644 index d7c1501ddc..0000000000 Binary files a/gfx/stats/stats.png and /dev/null differ diff --git a/gfx/stats/status.png b/gfx/stats/status.png new file mode 100644 index 0000000000..c46ae46f05 Binary files /dev/null and b/gfx/stats/status.png differ diff --git a/gfx/stats/summary.png b/gfx/stats/summary.png new file mode 100644 index 0000000000..c78d7888d0 Binary files /dev/null and b/gfx/stats/summary.png differ diff --git a/gfx/stats/summary_sprites.png b/gfx/stats/summary_sprites.png new file mode 100644 index 0000000000..4cf796cf76 Binary files /dev/null and b/gfx/stats/summary_sprites.png differ diff --git a/home/lcd.asm b/home/lcd.asm index e6788a0a1b..25c0c4e13e 100644 --- a/home/lcd.asm +++ b/home/lcd.asm @@ -55,6 +55,85 @@ LCDMusicPlayer:: pop af reti +LCDSummaryScreenHideWindow:: + ldh a, [rSTAT] + bit rSTAT_LYC_CMP, a + jr z, LCDSummaryScreenDone + ldh a, [rSTAT] + and 3 + jr nz, LCDSummaryScreenDone + ld a, 200 + ldh [rWX], a + jr LCDSummaryScreenProgress + +LCDSummaryScreenShowWindow:: + ldh a, [rSTAT] + bit rSTAT_LYC_CMP, a + jr z, LCDSummaryScreenDone + ldh a, [hWX] + ldh [rWX], a + jr LCDSummaryScreenProgress + +LCDSummaryScreenScrollBackground:: + ldh a, [rSTAT] + bit rSTAT_LYC_CMP, a + jr z, LCDSummaryScreenDone + ldh a, [rSCY] + add a, 4 + ldh [rSCY], a + jr LCDSummaryScreenProgress + +LCDSummaryScreen:: +LCDSummaryScreenProgress:: + push hl + push bc + ld b, 0 + ld a, [wSummaryScreenStep] + ld c, a + ld hl, wSummaryScreenInterrupts + add hl, bc + ld a, [hli] + inc a + jr nz, .continue + ; return to start of list + ld [wSummaryScreenStep], a + ld hl, wSummaryScreenInterrupts + ld a, [hli] + inc a +.continue + dec a + ldh [rLYC], a + ld a, [hl] + assert SUMMARY_LCD_SHOW_WINDOW == 1 + dec a + jr z, .show + assert SUMMARY_LCD_SCROLL_BACKGROUND == 2 + dec a + jr z, .nudge + ld hl, LCDSummaryScreenHideWindow + jr .setupNext +.show + ld hl, LCDSummaryScreenShowWindow + jr .setupNext +.nudge + ld hl, LCDSummaryScreenScrollBackground + ; fallthrough +.setupNext + ld a, l + ldh [hFunctionTargetLo], a + ld a, h + ldh [hFunctionTargetHi], a + + ; procede to next step + ld hl, wSummaryScreenStep + inc [hl] + inc [hl] + pop bc + pop hl +LCDSummaryScreenDone:: + pop af + reti + DisableLCD:: ; Turn the LCD off diff --git a/home/vblank.asm b/home/vblank.asm index 3faee2acde..8f1c14dc72 100644 --- a/home/vblank.asm +++ b/home/vblank.asm @@ -169,6 +169,7 @@ VBlank0:: ld [wTextDelayFrames], a .noDelay2 call Joypad + ei ; fallthrough VBlank2:: diff --git a/includes.asm b/includes.asm index 7e568554da..2853bdd60b 100644 --- a/includes.asm +++ b/includes.asm @@ -75,6 +75,7 @@ INCLUDE "constants/sprite_anim_constants.asm" INCLUDE "constants/sprite_constants.asm" INCLUDE "constants/sprite_data_constants.asm" INCLUDE "constants/std_constants.asm" +INCLUDE "constants/summary_constants.asm" INCLUDE "constants/tileset_constants.asm" INCLUDE "constants/trainer_constants.asm" INCLUDE "constants/trainer_data_constants.asm" diff --git a/main.asm b/main.asm index ddeff85649..4db1ab7348 100644 --- a/main.asm +++ b/main.asm @@ -268,7 +268,7 @@ INCLUDE "engine/events/pokerus/check_pokerus.asm" INCLUDE "engine/events/lucky_number.asm" INCLUDE "engine/pokemon/caught_data.asm" INCLUDE "engine/pokemon/search2.asm" -INCLUDE "engine/pokemon/stats_screen.asm" +INCLUDE "engine/pokemon/summary_screen.asm" INCLUDE "engine/events/catch_tutorial.asm" INCLUDE "engine/movie/evolution_animation.asm" INCLUDE "engine/movie/init_hof_credits.asm" diff --git a/maps/PlayersHouse2F.asm b/maps/PlayersHouse2F.asm index 0be725020a..ab3b8e3c24 100644 --- a/maps/PlayersHouse2F.asm +++ b/maps/PlayersHouse2F.asm @@ -244,9 +244,11 @@ endr loadmem wPartyMon2PP+1, 15 loadmem wPartyMon2PP+2, 10 loadmem wPartyMon2PP+3, 10 + loadmem wPartyMon2PokerusStatus, 1 ; variant form test givepoke TYPHLOSION, HISUIAN_FORM, 50 loadmem wPartyMon3Shiny, SHINY_MASK + loadmem wPartyMon3PokerusStatus, POKERUS_CURED ; ext species test givepoke WYRDEER, 50 givepoke DUDUNSPARCE, DUDUNSPARCE_THREE_SEGMENT_FORM, 50 diff --git a/ram/wram0.asm b/ram/wram0.asm index be85b04602..a675c372b6 100644 --- a/ram/wram0.asm +++ b/ram/wram0.asm @@ -981,6 +981,24 @@ wBillsPC_QuickFrames:: db wBillsPC_ApplyThemePals:: db ; used by _CGB_BillsPC +wSummaryScreenPals:: ds 8 palettes + +wSummaryScreenOAM:: +for n, NUM_SPRITE_OAM_STRUCTS +wSummaryScreenOAMSprite{02d:n}:: sprite_oam_struct wSummaryScreenOAMSprite{02d:n} +endr +wSummaryScreenTypes:: ds 6 +wSummaryScreenStep:: db +wSummaryScreenInterrupts:: ds 2 * 16 +wSummaryScreenPage:: db +wSummaryScreenMoveCount:: db + +; Used to align window buffer for DMA copying +; Feel free to use or move data, an assert will fail if the memory becomes misaligned +ds 14 +assert (@ - STARTOF("Misc 1326")) % 16 == 0 + +wSummaryScreenWindowBuffer:: ds 32 * 10 SECTION UNION "Misc 1326", WRAM0 ; raw link data @@ -1165,7 +1183,7 @@ wBattleTransitionSpinQuadrant:: db NEXTU ; stats screen -wStatsScreenFlags:: db +wSummaryScreenFlags:: db NEXTU ; miscellaneous