From f675c1ad9bb7eb19f1622b9265852b8ddf726335 Mon Sep 17 00:00:00 2001 From: Martha Schilling Date: Mon, 15 Apr 2024 13:01:52 +0100 Subject: [PATCH 1/4] Gen 5 Repel system Also used in PureRGB. Gives the player the option to use another Repel after the last one runs out. I had to remove some debug features in order to fit it in, but it won't have an effect on the regular game. Hopefully. --- data/predef_pointers.asm | 1 + data/text/text_4.asm | 4 +++ engine/items/get_bag_item_quantity.asm | 20 +++++++++++++ engine/overworld/use_another_repel.asm | 41 ++++++++++++++++++++++++++ home/npc_movement.asm | 10 ------- home/text_script.asm | 1 + home/trainers.asm | 4 --- main.asm | 1 + 8 files changed, 68 insertions(+), 14 deletions(-) create mode 100644 engine/overworld/use_another_repel.asm diff --git a/data/predef_pointers.asm b/data/predef_pointers.asm index eba3a0e4..1f0e290f 100644 --- a/data/predef_pointers.asm +++ b/data/predef_pointers.asm @@ -39,6 +39,7 @@ PredefPointers:: add_predef LearnMoveFromLevelUp add_predef LearnMove add_predef GetQuantityOfItemInBag + add_predef GetIndexOfItemInBag add_predef CheckForHiddenObjectOrBookshelfOrCardKeyDoor, $03 ; home bank add_predef GiveItem, $03 ; home bank add_predef ChangeBGPalColor0_4Frames diff --git a/data/text/text_4.asm b/data/text/text_4.asm index 39c7ab91..22fbfbb6 100644 --- a/data/text/text_4.asm +++ b/data/text/text_4.asm @@ -20,6 +20,10 @@ _PlayerBlackedOutText:: _RepelWoreOffText:: text "REPEL's effect" line "wore off." + prompt + +_RepelUseAnotherText:: + text "Use another?" done _PokemartBuyingGreetingText:: diff --git a/engine/items/get_bag_item_quantity.asm b/engine/items/get_bag_item_quantity.asm index f10df1a0..030703f1 100644 --- a/engine/items/get_bag_item_quantity.asm +++ b/engine/items/get_bag_item_quantity.asm @@ -16,3 +16,23 @@ GetQuantityOfItemInBag: .notInBag ld b, 0 ret + +GetIndexOfItemInBag: +; In: b = item ID +; Out: b = index of item in bag (FF if not) + call GetPredefRegisters + ld hl, wBagItems - 1 + ld c, -1 +.loop + inc c + inc hl + ld a, [hli] + cp $ff + jr z, .notInBag + cp b + jr nz, .loop + ld b, c + ret +.notInBag + ld b, a + ret diff --git a/engine/overworld/use_another_repel.asm b/engine/overworld/use_another_repel.asm new file mode 100644 index 00000000..7e1a7b6d --- /dev/null +++ b/engine/overworld/use_another_repel.asm @@ -0,0 +1,41 @@ +UseAnotherRepel:: + ld b, REPEL + push bc + call IsItemInBag + pop bc + jr nz, .checkUse + ld b, SUPER_REPEL + push bc + call IsItemInBag + pop bc + jr nz, .checkUse + ld b, MAX_REPEL + push bc + call IsItemInBag + pop bc + jr nz, .checkUse + jr .done +.checkUse + push bc + ld hl, RepelUseAnotherText + call PrintText + call YesNoChoice + pop bc + ld a, [wCurrentMenuItem] + and a + jr nz, .done + ld a, b + ld [wcf91], a ;load item to be used + ld [wd11e], a ;load item so its name can be grabbed + predef GetIndexOfItemInBag + ld a, b + ld [wWhichPokemon], a ; load item index to be deleted when used + call GetItemName ;get the item name into de register + call CopyToStringBuffer ; copy name from de to wcf4b so it shows up in text + call UseItem ;use the item +.done + ret + +RepelUseAnotherText: + text_far _RepelUseAnotherText + text_end diff --git a/home/npc_movement.asm b/home/npc_movement.asm index a3367f9a..efa19420 100644 --- a/home/npc_movement.asm +++ b/home/npc_movement.asm @@ -51,14 +51,4 @@ EndNPCMovementScript:: farjp _EndNPCMovementScript DebugPressedOrHeldB:: -IF DEF(_DEBUG) - ld a, [wd732] - bit 1, a - ret z - ldh a, [hJoyHeld] - bit BIT_B_BUTTON, a - ret nz - ldh a, [hJoyPressed] - bit BIT_B_BUTTON, a -ENDC ret diff --git a/home/text_script.asm b/home/text_script.asm index 458bc555..21140caa 100644 --- a/home/text_script.asm +++ b/home/text_script.asm @@ -200,6 +200,7 @@ DisplayPlayerBlackedOutText:: DisplayRepelWoreOffText:: ld hl, RepelWoreOffText call PrintText + callfar UseAnotherRepel jp AfterDisplayingTextID RepelWoreOffText:: diff --git a/home/trainers.asm b/home/trainers.asm index 22f5513b..718034bc 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -127,10 +127,6 @@ TalkToTrainer:: ; checks if any trainers are seeing the player and wanting to fight CheckFightingMapTrainers:: -IF DEF(_DEBUG) - call DebugPressedOrHeldB - jr nz, .trainerNotEngaging -ENDC call CheckForEngagingTrainers ld a, [wSpriteIndex] cp $ff diff --git a/main.asm b/main.asm index 2cd8fb52..6982d4c0 100644 --- a/main.asm +++ b/main.asm @@ -346,6 +346,7 @@ SECTION "Itemfinder 2", ROMX INCLUDE "engine/items/itemfinder.asm" INCLUDE "engine/menus/league_pc.asm" INCLUDE "engine/events/hidden_items.asm" +INCLUDE "engine/overworld/use_another_repel.asm" SECTION "bank1E", ROMX From dd7130c489aa10b414404eb86d9dfe92c020b212 Mon Sep 17 00:00:00 2001 From: Llinos Evans <36418502+PlagueVonKarma@users.noreply.github.com> Date: Mon, 13 May 2024 17:30:12 +0100 Subject: [PATCH 2/4] Groundwork for Pocket Lapras This is still a bit glitchy: - For some reason, unrelated text pops up after something is printed. I don't know why. - Pocket Lapras needs to close the menu post-use. Probably very easy, something in engine\items\item_effects. - The Pocket Lapras needs to default to Lapras as the text. This is a bit difficult as the item effect is actually used by Surf itself, so you may need to add a function that the Pocket Lapras loads before jumping to the real function (basically just loading the LAPRAS species ID for the text, ask me if you need help) - Cycling Road needs to run the routine to force you onto the bike after using the Pocket Lapras, or simply have it check for if you're on a ForceBikeSurf map and yell at you. Both work. I don't have time to finish this right now but it's at least obtainable. --- constants/event_constants.asm | 1 + data/items/key_items.asm | 2 +- data/maps/objects/CinnabarIsland.asm | 11 +++-- scripts/CinnabarIsland.asm | 74 ++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 6 deletions(-) diff --git a/constants/event_constants.asm b/constants/event_constants.asm index 52ef9732..dd48672d 100644 --- a/constants/event_constants.asm +++ b/constants/event_constants.asm @@ -207,6 +207,7 @@ const EVENT_GAVE_FOSSIL_TO_LAB const EVENT_LAB_STILL_REVIVING_FOSSIL const EVENT_LAB_HANDING_OVER_FOSSIL_MON + const EVENT_GOT_POCKET_LAPRAS ; Saffron City events const_next $340 diff --git a/data/items/key_items.asm b/data/items/key_items.asm index 2eae83b1..bed00b9a 100644 --- a/data/items/key_items.asm +++ b/data/items/key_items.asm @@ -6,7 +6,7 @@ KeyItemFlags: dbit FALSE ; POKE_BALL dbit TRUE ; TOWN_MAP dbit TRUE ; BICYCLE - dbit TRUE ; SURFBOARD + dbit TRUE ; LAPRAS' BALL - SURFBOARD dbit FALSE ; SAFARI_BALL dbit TRUE ; POKEDEX dbit FALSE ; MOON_STONE diff --git a/data/maps/objects/CinnabarIsland.asm b/data/maps/objects/CinnabarIsland.asm index 66dc0c0a..2b2f3bae 100644 --- a/data/maps/objects/CinnabarIsland.asm +++ b/data/maps/objects/CinnabarIsland.asm @@ -10,14 +10,15 @@ CinnabarIsland_Object: warp_event 14, 11, CINNABAR_VOLCANO_FLOORS, 1 def_bg_events - bg_event 11, 15, 3 ; CinnabarIslandText3 - bg_event 22, 19, 4 ; MartSignText - bg_event 16, 17, 5 ; PokeCenterSignText - bg_event 9, 23, 6 ; CinnabarIslandText6 - bg_event 23, 13, 7 ; CinnabarIslandText7 + bg_event 11, 15, 4 ; CinnabarIslandText3 + bg_event 22, 19, 5 ; MartSignText + bg_event 16, 17, 6 ; PokeCenterSignText + bg_event 9, 23, 7 ; CinnabarIslandText6 + bg_event 23, 13, 8 ; CinnabarIslandText7 def_object_events object_event 11, 18, SPRITE_GIRL, WALK, LEFT_RIGHT, 1 ; person object_event 17, 20, SPRITE_GAMBLER, STAY, NONE, 2 ; person + object_event 25, 18, SPRITE_COOLTRAINER_M, WALK, UP_DOWN, 3 ; Pocket Lapras def_warps_to CINNABAR_ISLAND diff --git a/scripts/CinnabarIsland.asm b/scripts/CinnabarIsland.asm index 9a3e0e43..73eb5911 100644 --- a/scripts/CinnabarIsland.asm +++ b/scripts/CinnabarIsland.asm @@ -53,6 +53,7 @@ CinnabarIslandScript1: CinnabarIsland_TextPointers: dw CinnabarIslandText1 dw CinnabarIslandText2 + dw CinnabarPocketLapras dw CinnabarIslandText3 dw MartSignText dw PokeCenterSignText @@ -83,3 +84,76 @@ CinnabarIslandText6: CinnabarIslandText7: text_far _CinnabarIslandText7 text_end + +_CinnabarPocketLapras1: + text "Bah, this LAPRAS" + line "just doesn't" + cont "wanna fight! Can" + cont "you believe that?" + + para "All it does is" + line "SURF. My GYARADOS" + cont "can do that!" + + para "Here. Take it." + line "I can't stand" + cont "looking at its" + cont "big ol' eyes." + done + +_PocketLaprasNoRoomText: + text "You don't have" + line "room either?" + + para "Well, it's not" + line "going anywhere..." + done + +_ReceivedPocketLaprasText: + text "Take care of that" + line "LAPRAS though," + cont "yeah? They're" + cont "an endangered" + cont "species." + + para "You should stay" + line "safe, too." ; haha, llinos, you sly dog + done + +; for some reason it crashed super hard if I didn't do this. +CinnabarPocketLapras1: + text_far _CinnabarPocketLapras1 + text_end + +PocketLaprasNoRoomText: + text_far _PocketLaprasNoRoomText + text_end + +ReceivedPocketLaprasText: + text_far _ReceivedPocketLaprasText + text_end + +CinnabarPocketLapras: + text_asm + CheckEvent EVENT_GOT_POCKET_LAPRAS + jr nz, .skip + ld hl, CinnabarPocketLapras1 + call PrintText + call TheAutoskipStopinator ; it's been a while but i didnt forget how annoying this was + lb bc, SURFBOARD, 1 + call GiveItem + jr nc, .bag_full + SetEvent EVENT_GOT_POCKET_LAPRAS ; if you get here, it's done. Using this to load all three texts with one PrintText instruction + sound_get_key_item + ld hl, ReceivedPocketLaprasText + jr .end +.bag_full + ld hl, PocketLaprasNoRoomText + jr .end +.skip + ld hl, ReceivedPocketLaprasText + ; fallthrough +.end + call PrintText + call TheAutoskipStopinator + jp TextScriptEnd From 2c02483f010a497e529d9be9d64b8757a8373e8d Mon Sep 17 00:00:00 2001 From: Martha Schilling Date: Tue, 14 May 2024 21:17:36 +0100 Subject: [PATCH 3/4] Small polishing of the previous commit + Item Sorting - Fixes a few bugs from the last commit, namely: - The guy who gives you the Pocket Lapras having bugged text - Being able to use it where you shouldn't (Cycling Road, Seafoam before the boulder puzzle) - Pocket Lapras not having an item description - As well as this, automatic item sorting has been added. Just press Start in the bag menu and all your items will get assorted into a convenient list. - Changed a few item descriptions since some of them didn't terminate properly - Freed up some space in the Home bank --- constants/item_constants.asm | 2 +- data/items/key_items.asm | 2 +- data/items/names.asm | 2 +- data/items/prices.asm | 2 +- data/text/item_descriptions.asm | 61 +++---- data/text/text_4.asm | 15 ++ engine/items/item_effects.asm | 13 +- engine/menus/item_descriptions.asm | 2 +- engine/menus/start_sub_menus.asm | 6 +- engine/menus/swap_items.asm | 261 +++++++++++++++++++++++++++++ engine/overworld/field_moves.asm | 2 +- home/header.asm | 3 +- home/list_menu.asm | 8 +- macros/farcall.asm | 4 +- scripts/CinnabarIsland.asm | 62 ++++--- 15 files changed, 379 insertions(+), 66 deletions(-) diff --git a/constants/item_constants.asm b/constants/item_constants.asm index 32accfff..9e4046eb 100644 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -13,7 +13,7 @@ const POKE_BALL ; $04 const TOWN_MAP ; $05 const BICYCLE ; $06 - const SURFBOARD ; $07 buggy? + const POCKET_LAPRAS ; $07 const SAFARI_BALL ; $08 const POKEDEX ; $09 const MOON_STONE ; $0A diff --git a/data/items/key_items.asm b/data/items/key_items.asm index bed00b9a..bc07d1b8 100644 --- a/data/items/key_items.asm +++ b/data/items/key_items.asm @@ -6,7 +6,7 @@ KeyItemFlags: dbit FALSE ; POKE_BALL dbit TRUE ; TOWN_MAP dbit TRUE ; BICYCLE - dbit TRUE ; LAPRAS' BALL - SURFBOARD + dbit TRUE ; POCKET_LAPRAS dbit FALSE ; SAFARI_BALL dbit TRUE ; POKEDEX dbit FALSE ; MOON_STONE diff --git a/data/items/names.asm b/data/items/names.asm index 8f5689d8..ed5da598 100644 --- a/data/items/names.asm +++ b/data/items/names.asm @@ -6,7 +6,7 @@ ItemNames:: li "POKé BALL" li "TOWN MAP" li "BICYCLE" - li "LAPRAS' BALL" ; surfboard, ?????, etc. + li "LAPRAS' BALL" ; Pocket Lapras li "SAFARI BALL" li "POKéDEX" li "MOON STONE" diff --git a/data/items/prices.asm b/data/items/prices.asm index 115682c7..e0d13683 100644 --- a/data/items/prices.asm +++ b/data/items/prices.asm @@ -6,7 +6,7 @@ ItemPrices:: bcd3 200 ; POKE_BALL bcd3 0 ; TOWN_MAP bcd3 0 ; BICYCLE - bcd3 0 ; SURFBOARD + bcd3 0 ; POCKET_LAPRAS bcd3 1000 ; SAFARI_BALL bcd3 0 ; POKEDEX bcd3 0 ; MOON_STONE diff --git a/data/text/item_descriptions.asm b/data/text/item_descriptions.asm index 45b19468..c2b12667 100644 --- a/data/text/item_descriptions.asm +++ b/data/text/item_descriptions.asm @@ -12,8 +12,8 @@ _UltraBallDescription:: prompt _GreatBallDescription:: - text "A BALL with a de-" - next "cent success rate." + text "A BALL with a good" + next "success rate." prompt _PokeBallDescription:: @@ -31,6 +31,11 @@ _BicycleDescription:: next "for travel." prompt +_PocketLaprasDescription:: + text "A LAPRAS that lets" + next "you cross water." + prompt + _SafariBallDescription:: text "Just an ULTRA BALL" next "painted green." @@ -110,7 +115,7 @@ _EscapeRopeDescription:: _RepelDescription:: text "Repels weak #-" - next "MON for 100 steps." + next "MON. (100 steps)" prompt _OldAmberDescription:: @@ -205,18 +210,18 @@ _MaxReviveDescription:: prompt _GuardSpecDescription:: - text "Prevents stats" - next "reduction. (1 BTL)" + text "Prevents stat re-" + next "duction. (1 BTL)" prompt _SuperRepelDescription:: text "Repels weak #-" - next "MON for 200 steps." + next "MON. (200 steps)" prompt _MaxRepelDescription:: text "Repels weak #-" - next "MON for 250 steps." + next "MON. (250 steps)" prompt _DireHitDescription:: @@ -281,7 +286,7 @@ _OaksParcelDescription:: _ItemfinderDescription:: text "Checks for unseen" - next "items in the area." + next "items nearby." prompt _SilphScopeDescription:: @@ -340,8 +345,8 @@ _ElixerDescription:: prompt _MaxElixerDescription:: - text "Fully restores the" - next "PP of one #MON." + text "Fully restores PP" + next "of all moves." prompt _CitrinePassDescription:: @@ -380,13 +385,13 @@ _HM02Description:: prompt _HM03Description:: - text "A strong water-" + text "A strong WATER-" next "type attack." prompt _HM04Description:: - text "A powerful physi-" - next "cal attack." + text "A strong physical" + next "attack." prompt _HM05Description:: @@ -420,12 +425,12 @@ _TM05Description:: prompt _TM06Description:: - text "A poison move with" - next "increasing damage." + text "A POISON move with" + next "rising damage." prompt _TM07Description:: - text "A one-hit KO," + text "A one-hit KO" next "drill attack." prompt @@ -475,8 +480,8 @@ _TM16Description:: prompt _TM17Description:: - text "An attack that al-" - next "so hurts the user." + text "A move that also" + next "hurts the user." prompt _TM18Description:: @@ -520,13 +525,13 @@ _TM25Description:: prompt _TM26Description:: - text "Tough but useless" - next "vs. flying foes." + text "Tough, but useless" + next "vs. FLYING foes." prompt _TM27Description:: - text "A GROUND-type," - next "one-hit KO attack." + text "A one-hit KO" + next "GROUND attack." prompt _TM28Description:: @@ -595,8 +600,8 @@ _TM40Description:: prompt _TM41Description:: - text "Restores HP by 1/2" - next "the user's max HP." + text "Restores 1/2 the" + next "user's max HP." prompt _TM42Description:: @@ -615,8 +620,8 @@ _TM44Description:: prompt _TM45Description:: - text "A move that may" - next "cause paralysis." + text "A move that will" + next "paralyze a foe." prompt _TM46Description:: @@ -640,8 +645,8 @@ _TM49Description:: prompt _TM50Description:: - text "Makes a decoy with" - next "1/4 user's max HP." + text "Uses 1/4 max HP" + next "to make a decoy." prompt _UnusedItemDescription:: diff --git a/data/text/text_4.asm b/data/text/text_4.asm index 22fbfbb6..415c5192 100644 --- a/data/text/text_4.asm +++ b/data/text/text_4.asm @@ -233,3 +233,18 @@ ENDC line "your friend and" cont "come again!" done + +_SortItemsText:: + text "Would you like to" + next "sort items?" + done + +_SortComplete:: + text "Sorting is" + next "complete!" + prompt + +_NothingToSort:: + text "There are no items" + next "to sort." + prompt diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 4279ea21..74371b72 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -23,7 +23,7 @@ ItemUsePtrTable: dw ItemUseBall ; POKE_BALL dw ItemUseTownMap ; TOWN_MAP dw ItemUseBicycle ; BICYCLE - dw ItemUseSurfboard ; out-of-battle Surf effect + dw ItemUseLapras ; POCKET_LAPRAS dw ItemUseBall ; SAFARI_BALL dw ItemUsePokedex ; POKEDEX dw ItemUseEvoStone ; MOON_STONE @@ -759,12 +759,17 @@ ItemUseBicycle: jp PrintText ; used for Surf out-of-battle effect -ItemUseSurfboard: +ItemUseLapras: ld a, [wWalkBikeSurfState] ld [wWalkBikeSurfStateCopy], a cp 2 ; is the player already surfing? jr z, .tryToStopSurfing .tryToSurf + farcall IsSurfingAllowed + ld hl, wd728 + bit 1, [hl] + res 1, [hl] + jp z, .no call IsNextTileShoreOrWater jp c, SurfingAttemptFailed ld hl, TilePairCollisionsWater @@ -837,6 +842,10 @@ ItemUseSurfboard: inc a ld [wSimulatedJoypadStatesIndex], a ret +.no + ld a, 1 + and a + ret SurfingGotOnText: text_far _SurfingGotOnText diff --git a/engine/menus/item_descriptions.asm b/engine/menus/item_descriptions.asm index d6501d38..104dcb3c 100644 --- a/engine/menus/item_descriptions.asm +++ b/engine/menus/item_descriptions.asm @@ -26,7 +26,7 @@ ItemDescriptionPointers: text_end text_far _BicycleDescription text_end - text_far _UnusedItemDescription + text_far _PocketLaprasDescription text_end text_far _SafariBallDescription text_end diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index 2effad05..d6722d1c 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -165,7 +165,7 @@ StartMenu_Pokemon:: bit 1, [hl] res 1, [hl] jp z, .loop - ld a, SURFBOARD + ld a, POCKET_LAPRAS ld [wcf91], a ld [wPseudoItemID], a call UseItem @@ -331,6 +331,7 @@ StartMenu_Item:: ld a, [wBagSavedMenuItem] ld [wCurrentMenuItem], a call DisplayListMenuID + jp nz, .sortItems ld a, [wCurrentMenuItem] ld [wBagSavedMenuItem], a jr nc, .choseItem @@ -451,6 +452,9 @@ StartMenu_Item:: .infoItem farcall DisplayItemDescription jp ItemMenuLoop +.sortItems + farcall SortItems + jp ItemMenuLoop CannotUseItemsHereText: text_far _CannotUseItemsHereText diff --git a/engine/menus/swap_items.asm b/engine/menus/swap_items.asm index 2d506ce2..f012d1df 100644 --- a/engine/menus/swap_items.asm +++ b/engine/menus/swap_items.asm @@ -147,3 +147,264 @@ HandleItemListSwapping:: pop de pop hl jp DisplayListMenuIDLoop + +SortItems:: + push hl + push bc + ld hl, SortItemsText ; Display the text to ask to sort + call PrintText + call YesNoChoice + ld a, [wCurrentMenuItem] + and a + jp z, .beginSorting ; If yes + jr .done +.finishedSwapping + ld a, [hSwapTemp] ; If not 0, then a swap of items did occur + cp 0 + jr z, .nothingSorted + ld hl, SortComplete + jr .printResultText +.nothingSorted + ld hl, NothingToSort +.printResultText + call PrintText +.done + xor a ; Zeroes a + pop bc + pop hl + ret +.beginSorting + xor a + ld [hSwapTemp], a ; 1 if something in the bag got sorted + ld de, 0 + ld hl, ItemSortList + ld b, [hl] ; This is the first item to check for + ld hl, wBagItems + ld c, 0 ; Relative to wBagItems, this is where we'd like to begin swapping +.loopCurrItemInBag + ld a, [hl] ; Load the value of hl to a (which is an item number) and Increments to the quantity + cp -1 ; See if the item number is $ff, which is 'cancel' + jr z, .findNextItem ; If it is cancel, then move onto the next item + cp b + jr z, .hasItem ; If it's not b, then go to the next item in the bag + inc hl ; increments past the quantity to the next item to check + inc hl + jr .loopCurrItemInBag +.findNextItem + ld d, 0 + inc e + ld hl, ItemSortList + add hl, de + ld b, [hl] + ld hl, wBagItems ; Resets hl to start at the beginning of the bag + ld a, b + cp -1 ; Check if we got through all of the items, to the last one + jr z, .finishedSwapping + jr .loopCurrItemInBag +.hasItem ; c contains where to swap to relative to the start of wBagItems + ; hl contains where the item to swap is absolute. + ; b contains the item ID + push de + ld d, h + ld e, l + ld hl, wBagItems + ld a, b + ld b, 0 + add hl, bc ; hl now holds where we'd like to swap to + ld b, a + ld a, [de] + cp [hl] + jr z, .cont ; If they're the same item + ld a, 1 + ld [hSwapTemp], a + ld a, [hl] + ld [hSwapItemID],a ; [hSwapItemID] = second item ID + inc hl + ld a,[hld] + ld [hSwapItemQuantity],a ; [hSwapItemQuantity] = second item quantity + ld a,[de] + ld [hli],a ; put first item ID in second item slot + inc de + ld a,[de] + ld [hl],a ; put first item quantity in second item slot + ld a,[hSwapItemQuantity] + ld [de],a ; put second item quantity in first item slot + dec de + ld a,[hSwapItemID] + ld [de],a ; put second item ID in first item slot +.cont + inc c + inc c + ld h, d + ld l, e + pop de + jr .findNextItem + +SortItemsText:: + text_far _SortItemsText + db "@" + +SortComplete:: + text_far _SortComplete + db "@" + +NothingToSort:: + text_far _NothingToSort + db "@" + +ItemSortList:: + ; Used Key Items + db BICYCLE + db SUPER_ROD + db POCKET_LAPRAS + db ITEMFINDER + db TOWN_MAP + db MYSTERY_BOX + ; Balls + db POKE_BALL + db GREAT_BALL + db ULTRA_BALL + db SAFARI_BALL + db MASTER_BALL + ; Common Items + db REPEL + db SUPER_REPEL + db MAX_REPEL + db ESCAPE_ROPE + db POKE_DOLL + ; Health + db POTION + db SUPER_POTION + db HYPER_POTION + db MAX_POTION + db FULL_RESTORE + db FRESH_WATER + db SODA_POP + db LEMONADE + ; Revival + db REVIVE + db MAX_REVIVE + ; Status + db ANTIDOTE + db BURN_HEAL + db ICE_HEAL + db AWAKENING + db PARLYZ_HEAL + db FULL_HEAL + db POKE_FLUTE + ; PP + db ETHER + db MAX_ETHER + db ELIXER + db MAX_ELIXER + ; Battle Raises + db X_ACCURACY + db X_ATTACK + db X_DEFEND + db X_SPEED + db X_SPECIAL + db GUARD_SPEC + db DIRE_HIT + ; Permanent Raises + db RARE_CANDY + db HP_UP + db PROTEIN + db IRON + db CARBOS + db CALCIUM + db PP_UP + ; Evolution Items + db LEAF_STONE + db FIRE_STONE + db THUNDER_STONE + db WATER_STONE + db MOON_STONE + db HEART_STONE + db POISON_STONE + db ICE_STONE + db METAL_COAT + db UP_GRADE + db DUBIOUS_DISC + db BLK_AUGURITE + db PROTECTOR + db CANDY_JAR + ; Other Non-Key Items + db DOME_FOSSIL + db HELIX_FOSSIL + db WING_FOSSIL + db OLD_AMBER + db NUGGET + db BOTTLE_CAP + ; Key Items With No Use + db COIN_CASE + db SILPHLETTER + db S_S_TICKET + db OLD_SEA_MAP + db CITRINE_PASS + db SECRET_KEY + db BIKE_VOUCHER + db CARD_KEY + db GOLD_TEETH + db OAKS_PARCEL + db LIFT_KEY + db SILPH_SCOPE + db TEA + db EXP_ALL + ; TMs + db TM01 + db TM01 + 1 + db TM01 + 2 + db TM01 + 3 + db TM01 + 4 + db TM01 + 5 + db TM01 + 6 + db TM01 + 7 + db TM01 + 8 + db TM01 + 9 + db TM01 + 10 + db TM01 + 11 + db TM01 + 12 + db TM01 + 13 + db TM01 + 14 + db TM01 + 15 + db TM01 + 16 + db TM01 + 17 + db TM01 + 18 + db TM01 + 19 + db TM01 + 20 + db TM01 + 21 + db TM01 + 22 + db TM01 + 23 + db TM01 + 24 + db TM01 + 25 + db TM01 + 26 + db TM01 + 27 + db TM01 + 28 + db TM01 + 29 + db TM01 + 30 + db TM01 + 31 + db TM01 + 32 + db TM01 + 33 + db TM01 + 34 + db TM01 + 35 + db TM01 + 36 + db TM01 + 37 + db TM01 + 38 + db TM01 + 39 + db TM01 + 40 + db TM01 + 41 + db TM01 + 42 + db TM01 + 43 + db TM01 + 44 + db TM01 + 45 + db TM01 + 46 + db TM01 + 47 + db TM01 + 48 + db TM01 + 49 + ; HMs + db HM01 + db HM01 + 1 + db HM01 + 2 + db HM01 + 3 + db HM01 + 4 + db -1 ; end diff --git a/engine/overworld/field_moves.asm b/engine/overworld/field_moves.asm index 761e0aa5..9cfaf19b 100644 --- a/engine/overworld/field_moves.asm +++ b/engine/overworld/field_moves.asm @@ -33,7 +33,7 @@ TrySurf: and a jr nz, .no2 call GetPartyMonName2 - ld a, SURFBOARD + ld a, POCKET_LAPRAS ld [wcf91], a ld [wPseudoItemID], a call UseItem diff --git a/home/header.asm b/home/header.asm index b8810059..bc1b4d8d 100644 --- a/home/header.asm +++ b/home/header.asm @@ -1,7 +1,8 @@ ; rst vectors (unused) SECTION "rst0", ROM0[$0000] - rst $38 +_Bankswitch:: + jp Bankswitch ds $08 - @, 0 ; unused diff --git a/home/list_menu.asm b/home/list_menu.asm index 09c73154..ad0089cf 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -50,7 +50,7 @@ DisplayListMenuID:: ld [wTopMenuItemY], a ld a, 5 ld [wTopMenuItemX], a - ld a, A_BUTTON | B_BUTTON | SELECT + ld a, A_BUTTON | B_BUTTON | SELECT | START ld [wMenuWatchedKeys], a ld c, 10 call DelayFrames @@ -178,6 +178,8 @@ DisplayListMenuIDLoop:: jp nz, ExitListMenu ; if so, exit the menu bit BIT_SELECT, a jp nz, HandleItemListSwapping ; if so, allow the player to swap menu entries + bit 3, a ; was the start button pressed? + jp nz, .sortItems ; if so, allow the player to swap menu entries ld b, a bit BIT_D_DOWN, b ld hl, wListScrollOffset @@ -197,6 +199,10 @@ DisplayListMenuIDLoop:: jp z, DisplayListMenuIDLoop dec [hl] jp DisplayListMenuIDLoop +.sortItems + rra ; Sets the zero flag to 0 so the sorting function will happen + rla + jp BankswitchBack DisplayChooseQuantityMenu:: ; text box dimensions/coordinates for just quantity diff --git a/macros/farcall.asm b/macros/farcall.asm index a40bff36..a8262875 100644 --- a/macros/farcall.asm +++ b/macros/farcall.asm @@ -1,13 +1,13 @@ MACRO farcall ld b, BANK(\1) ld hl, \1 - call Bankswitch + rst _Bankswitch ENDM MACRO callfar ld hl, \1 ld b, BANK(\1) - call Bankswitch + rst _Bankswitch ENDM MACRO farjp diff --git a/scripts/CinnabarIsland.asm b/scripts/CinnabarIsland.asm index 73eb5911..36827390 100644 --- a/scripts/CinnabarIsland.asm +++ b/scripts/CinnabarIsland.asm @@ -87,34 +87,42 @@ CinnabarIslandText7: _CinnabarPocketLapras1: text "Bah, this LAPRAS" - line "just doesn't" - cont "wanna fight! Can" - cont "you believe that?" + line "just doesn't want" + cont "to fight! Can you" + cont "believe that?" - para "All it does is" - line "SURF. My GYARADOS" - cont "can do that!" + para "All it likes to" + line "do is SURF, but" + cont "my GYARADOS can" + cont "already do that!" - para "Here. Take it." - line "I can't stand" - cont "looking at its" - cont "big ol' eyes." - done + para "Here, take it. I" + line "can't stand its" + cont "big ol' eyes" + cont "looking at me." + prompt _PocketLaprasNoRoomText: text "You don't have" - line "room either?" + line "room, either?" para "Well, it's not" - line "going anywhere..." + line "like it's going" + cont "anywhere..." done _ReceivedPocketLaprasText: - text "Take care of that" - line "LAPRAS though," - cont "yeah? They're" - cont "an endangered" - cont "species." + text " received" + line "@" + text_ram wStringBuffer + text "!@" + text_end + +_CinnabarPocketLapras2: + text "Take care of it" + line "though, alright?" + cont "LAPRAS is very" + cont "endangered." para "You should stay" line "safe, too." ; haha, llinos, you sly dog @@ -124,6 +132,10 @@ _ReceivedPocketLaprasText: CinnabarPocketLapras1: text_far _CinnabarPocketLapras1 text_end + +CinnabarPocketLapras2: + text_far _CinnabarPocketLapras2 + text_end PocketLaprasNoRoomText: text_far _PocketLaprasNoRoomText @@ -139,21 +151,21 @@ CinnabarPocketLapras: jr nz, .skip ld hl, CinnabarPocketLapras1 call PrintText - call TheAutoskipStopinator ; it's been a while but i didnt forget how annoying this was - lb bc, SURFBOARD, 1 + lb bc, POCKET_LAPRAS, 1 call GiveItem jr nc, .bag_full - SetEvent EVENT_GOT_POCKET_LAPRAS ; if you get here, it's done. Using this to load all three texts with one PrintText instruction - sound_get_key_item ld hl, ReceivedPocketLaprasText + call PrintText + ld a, SFX_GET_KEY_ITEM + call PlaySound + SetEvent EVENT_GOT_POCKET_LAPRAS ; if you get here, it's done. jr .end .bag_full ld hl, PocketLaprasNoRoomText jr .end .skip - ld hl, ReceivedPocketLaprasText + ld hl, CinnabarPocketLapras2 + call PrintText ; fallthrough .end - call PrintText - call TheAutoskipStopinator jp TextScriptEnd From 2c6fc430112e0f39e91645c6b05a26b3f51b67eb Mon Sep 17 00:00:00 2001 From: Martha Schilling Date: Wed, 15 May 2024 20:46:36 +0100 Subject: [PATCH 4/4] Title screen + Diploma improvements - An interesting thing I decided to implement here; every time the title screen gets loaded, it loads a random choice between Red and Green, as well as Scream Tail and Sandy Shocks. This effectively gives 4 different starting title screens. - Made the EXPN. PAK text on the title screen more centered. - Green now appears on the diploma instead of Red if you're playing as her. --- data/pokemon/title_mons.asm | 12 +++---- engine/events/diploma.asm | 11 ++++++- engine/movie/title.asm | 64 ++++++++++++++++++++++++++++++++---- gfx/title/fplayer.png | Bin 0 -> 803 bytes gfx/title/kep_version.png | Bin 449 -> 489 bytes gfx/trainer_card.asm | 3 ++ ram/wram.asm | 1 + 7 files changed, 78 insertions(+), 13 deletions(-) create mode 100644 gfx/title/fplayer.png diff --git a/data/pokemon/title_mons.asm b/data/pokemon/title_mons.asm index 08a7b64f..5142abb5 100644 --- a/data/pokemon/title_mons.asm +++ b/data/pokemon/title_mons.asm @@ -1,5 +1,7 @@ TitleMons: ; mons on the title screen are randomly chosen from here + db SCREAM_TAIL ; Mascots + db SANDY_SHOCKS db TOTARTLE ; New Starters db GOROCHU db SYLVEON @@ -9,10 +11,8 @@ TitleMons: db BELLIGNAN ; GS Betas db LUXWAN db PORYGON2 ; Post-Gen 1 Evos - db MAGNEZONE - db ANNIHILAPE - db SCREAM_TAIL ; LGPE and SV - db WUGTRIO - db MELTAN - db EXEGGUTOR_A ; Regional Variants + db TANGROWTH + db ANNIHILAPE + db EXEGGUTOR_A ; Regional Variants & Convergents db TAUROS_PB + db WUGTRIO diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index e08b1f24..be211b16 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -39,9 +39,18 @@ DisplayDiploma:: hlcoord 10, 4 ld de, wPlayerName call PlaceString + ld a, [wPlayerSex] + and a ; are you playing as Red + jr z, .red ; if yes, Red appears on the diploma + jr nz, .green ; if no, Green replaces him +.green + farcall DrawFPlayerCharacter + jr .skip +.red farcall DrawPlayerCharacter +.skip -; Move the player 33 pixels right and set the priority bit so he appears +; Move the player 33 pixels right and set the priority bit so they appear ; behind the background layer. ld hl, wShadowOAMSprite00XCoord lb bc, $80, $28 diff --git a/engine/movie/title.asm b/engine/movie/title.asm index f5bab4be..9120396d 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -91,8 +91,15 @@ DisplayTitleScreen: inc a dec b jr nz, .pokemonLogoLastTileRowLoop - + call Random + ldh a, [hRandomAdd] + cp 129 + jr c, .male + call DrawFPlayerCharacter + jr .playerskip +.male call DrawPlayerCharacter +.playerskip ; put a pokeball in the player's hand ld hl, wShadowOAMSprite10 @@ -119,11 +126,19 @@ DisplayTitleScreen: call SaveScreenTilesToBuffer2 call LoadScreenTilesFromBuffer2 call EnableLCD - + call Random + ldh a, [hRandomSub] + cp 129 + jr c, .notshocks + ld a, SANDY_SHOCKS + ld [wTitleMonSpecies], a + call LoadTitleMonSprite + jr .skip +.notshocks ld a, SCREAM_TAIL ld [wTitleMonSpecies], a call LoadTitleMonSprite - +.skip ld a, HIGH(vBGMap0 + $300) call TitleScreenCopyTileMapToVRAM call SaveScreenTilesToBuffer1 @@ -347,6 +362,43 @@ DrawPlayerCharacter: jr nz, .loop ret +DrawFPlayerCharacter: + ld hl, FPlayerCharacterTitleGraphics + ld de, vSprites + ld bc, FPlayerCharacterTitleGraphicsEnd - FPlayerCharacterTitleGraphics + ld a, BANK(FPlayerCharacterTitleGraphics) + call FarCopyData2 + call ClearSprites + xor a + ld [wFPlayerCharacterOAMTile], a + ld hl, wShadowOAM + lb de, $60, $5a + ld b, 7 +.loop2 + push de + ld c, 5 +.innerLoop2 + ld a, d + ld [hli], a ; Y + ld a, e + ld [hli], a ; X + add 8 + ld e, a + ld a, [wFPlayerCharacterOAMTile] + ld [hli], a ; tile + inc a + ld [wFPlayerCharacterOAMTile], a + inc hl + dec c + jr nz, .innerLoop2 + pop de + ld a, 8 + add d + ld d, a + dec b + jr nz, .loop2 + ret + ClearBothBGMaps: ld hl, vBGMap0 ld bc, $400 * 2 @@ -387,15 +439,15 @@ CopyrightTextString: INCLUDE "data/pokemon/title_mons.asm" -; prints version text (red, blue) +; prints version text PrintGameVersionOnTitleScreen: - hlcoord 7, 8 + hlcoord 6, 8 ld de, VersionOnTitleScreenText jp PlaceString ; these point to special tiles specifically loaded for that purpose and are not usual text VersionOnTitleScreenText: - db $61,$62,$63,$64,$65,$66,$67,$68,"@" ; "Blue Version" + db $61,$62,$63,$64,$65,$66,$67,$68,"@" DebugNewGamePlayerName: db "NINTEN@" diff --git a/gfx/title/fplayer.png b/gfx/title/fplayer.png new file mode 100644 index 0000000000000000000000000000000000000000..2a9ae1848eae70d0f1faa51edb25892be3ee44ea GIT binary patch literal 803 zcmeAS@N?(olHy`uVBq!ia0vp^8bEBp1SA+9eE!=Fq!f}pf_xbms?-=58d?|_egTCV zUNA6}8Za=tN?>5Hn!&&zUNC1@pbb!hDaqU2g@M_)rKkhQ<1FxqEM{QfI}E~%$MaXD z00r4gJbhi+U$F9Xi-^8VD=-5JG3FQfg)p99R6YyHQ7v(eC`m~yNwrEYN(E93Mg~SE zx(24YhNdBghE_%fK%{M8U}a!%a>fgggAp2X^HVa@DsgMraWvo^P=f~ChLX(O)Z&uF z+yX3m3?Y_yF0X0@>WNB?@J#ddWzYh$IT%>x%B zs2X5kG6^Hp1J#0n2M_~wLumP+?iGmc`s7K(VKZL%)`_{4evtoczu2)&#Ua z`;t6Ea$aQ`gE;fQf|5rU`P@1dcxFa!aLx>!a4E;vU{dg_S95&M&5uoaHYYQx)vMSp z?xd(xx%iv;YNn5hzJECUzG%y;lHhx5F8OvH{wDP+Y}RB?ozivc8jc3WInTF+K5BgM z^TsWmJ!+dm&(-voToZ21ZfR6g)^^oUHK^-;+pHO$US5m6 zsJvUTN!LbbPGOzi3Z9rKev28c~vxSdwa0l9`)YT#}eu zz+hxxgr>&=V&ZeLsI`-s7&D_>JzX3_IIbuE;AiDwuaSEGC%?v~{o$XPmbU+&&zWS1)|fUQGx&f delta 204 zcmaFKe2{s93NK5#qpu?a!^VE@KZ&dp6&pI|g@r>) zn@Cms|>mo