From 475ab464d86bd7a742774407080b2d48e7eb10e4 Mon Sep 17 00:00:00 2001 From: ElectroDeoxys Date: Tue, 11 May 2021 16:21:28 +0100 Subject: Auto Deck Machine functionalities --- src/constants/menu_constants.asm | 12 +- src/data/auto_deck_card_lists.asm | 1159 +++++++++++++++++++++++++++++++++++++ src/data/auto_deck_machines.asm | 82 +++ src/engine/bank02.asm | 1026 ++++++++++++++++++-------------- src/engine/bank03.asm | 6 +- src/engine/bank06.asm | 166 +++--- src/sram.asm | 22 + src/text/text3.asm | 202 +++---- src/text/text_offsets.asm | 202 +++---- src/wram.asm | 60 +- 10 files changed, 2198 insertions(+), 739 deletions(-) create mode 100644 src/data/auto_deck_card_lists.asm create mode 100644 src/data/auto_deck_machines.asm diff --git a/src/constants/menu_constants.asm b/src/constants/menu_constants.asm index ab60293..86df8bf 100644 --- a/src/constants/menu_constants.asm +++ b/src/constants/menu_constants.asm @@ -13,9 +13,10 @@ FILTER_ENERGY EQU $20 NUM_FILTERS EQU 9 -MAX_DECK_CONFIRMATION_VISIBLE_CARDS EQU 7 -MAX_CARD_ALBUM_VISIBLE_CARDS EQU 7 -MAX_FILTERED_LIST_VISIBLE_CARDS EQU 6 +NUM_DECK_CONFIRMATION_VISIBLE_CARDS EQU 7 +NUM_CARD_ALBUM_VISIBLE_CARDS EQU 7 +NUM_FILTERED_LIST_VISIBLE_CARDS EQU 6 +NUM_DECK_MACHINE_VISIBLE_DECKS EQU 5 ; deck flags const_def @@ -24,6 +25,11 @@ MAX_FILTERED_LIST_VISIBLE_CARDS EQU 6 const DECK_3_F ; $2 const DECK_4_F ; $3 +DECK_1 EQU 1 << DECK_1_F ; $1 +DECK_2 EQU 1 << DECK_2_F ; $2 +DECK_3 EQU 1 << DECK_3_F ; $4 +DECK_4 EQU 1 << DECK_4_F ; $8 + ALL_DECKS EQU $ff NUM_DECK_SAVE_MACHINE_SLOTS EQU 60 diff --git a/src/data/auto_deck_card_lists.asm b/src/data/auto_deck_card_lists.asm new file mode 100644 index 0000000..8dbf6e5 --- /dev/null +++ b/src/data/auto_deck_card_lists.asm @@ -0,0 +1,1159 @@ +; card lists read by AutoDeckMachineEntries +; each list entry is a card count and card ID pair + +AllFightingPokemonCardList: ; 1b0da (6:70da) + db 26, FIGHTING_ENERGY + db 2, SANDSHREW + db 1, SANDSLASH + db 2, DIGLETT + db 1, DUGTRIO + db 2, MANKEY + db 1, PRIMEAPE + db 3, MACHOP + db 2, MACHOKE + db 1, MACHAMP + db 2, GEODUDE + db 1, GRAVELER + db 1, GOLEM + db 1, ONIX + db 2, CUBONE + db 1, MAROWAK1 + db 1, HITMONLEE + db 1, HITMONCHAN + db 2, RHYHORN + db 1, RHYDON + db 1, PROFESSOR_OAK + db 2, BILL + db 1, SWITCH + db 2, POTION + db 0 ; end of list + +BenchAttackCardList: ; 1b10b (6:710b) + db 12, LIGHTNING_ENERGY + db 14, FIGHTING_ENERGY + db 4, VOLTORB + db 2, ELECTRODE2 + db 2, ZAPDOS1 + db 4, HITMONLEE + db 2, HITMONCHAN + db 4, MEOWTH1 + db 1, PROFESSOR_OAK + db 2, BILL + db 1, MR_FUJI + db 2, ENERGY_RETRIEVAL + db 2, SWITCH + db 1, SCOOP_UP + db 2, PLUSPOWER + db 2, DEFENDER + db 1, ITEM_FINDER + db 1, GUST_OF_WIND + db 1, MAINTENANCE + db 0 ; end of list + +BattleContestCardList: ; 1b132 (6:7132) + db 24, FIGHTING_ENERGY + db 2, DOUBLE_COLORLESS_ENERGY + db 3, MANKEY + db 4, MACHOP + db 3, MACHOKE + db 2, HITMONLEE + db 2, HITMONCHAN + db 3, MEOWTH1 + db 2, PERSIAN + db 3, DRATINI + db 2, DRAGONAIR + db 1, DRAGONITE2 + db 1, PROFESSOR_OAK + db 3, PLUSPOWER + db 3, DEFENDER + db 2, POTION + db 0 ; end of list + +HeatedBattleCardList: ; 1b153 (6:7153) + db 8, FIRE_ENERGY + db 4, LIGHTNING_ENERGY + db 15, FIGHTING_ENERGY + db 4, MAGMAR1 + db 2, ELECTABUZZ2 + db 3, MANKEY + db 2, PRIMEAPE + db 3, HITMONLEE + db 3, HITMONCHAN + db 2, KANGASKHAN + db 2, ENERGY_SEARCH + db 2, SCOOP_UP + db 3, PLUSPOWER + db 2, DEFENDER + db 3, POTION + db 2, FULL_HEAL + db 0 ; end of list + +FirstStrikeCardList: ; 1b174 (6:7174) + db 25, FIGHTING_ENERGY + db 4, MACHOP + db 3, MACHOKE + db 2, MACHAMP + db 2, HITMONCHAN + db 4, HITMONLEE + db 4, MANKEY + db 1, PRIMEAPE + db 2, POTION + db 2, DEFENDER + db 2, PLUSPOWER + db 2, SWITCH + db 3, GUST_OF_WIND + db 4, BILL + db 0 ; end of list + +SqueakingMouseCardList: ; 1b191 (6:7191) + db 8, LIGHTNING_ENERGY + db 15, FIGHTING_ENERGY + db 2, DOUBLE_COLORLESS_ENERGY + db 2, PIKACHU1 + db 2, PIKACHU2 + db 1, RAICHU1 + db 1, RAICHU2 + db 4, SANDSHREW + db 3, SANDSLASH + db 4, RATTATA + db 3, RATICATE + db 1, PROFESSOR_OAK + db 2, BILL + db 1, POKEMON_TRADER + db 2, ENERGY_RETRIEVAL + db 1, COMPUTER_SEARCH + db 3, PLUSPOWER + db 2, DEFENDER + db 2, POTION + db 1, SUPER_POTION + db 0 ; end of list + +GreatQuakeCardList: ; 1b1ba (6:71ba) + db 25, FIGHTING_ENERGY + db 4, DIGLETT + db 3, DUGTRIO + db 4, ONIX + db 3, RHYHORN + db 2, RHYDON + db 2, KANGASKHAN + db 1, TAUROS + db 1, SNORLAX + db 1, PROFESSOR_OAK + db 2, BILL + db 2, POKEMON_TRADER + db 3, SWITCH + db 4, DEFENDER + db 3, POTION + db 0 ; end of list + +BoneAttackCardList: ; 1b1d9 (6:71d9) + db 24, FIGHTING_ENERGY + db 3, SANDSHREW + db 2, SANDSLASH + db 3, GEODUDE + db 2, GRAVELER + db 1, GOLEM + db 4, ONIX + db 4, CUBONE + db 1, MAROWAK1 + db 2, MAROWAK2 + db 2, RHYHORN + db 1, RHYDON + db 2, BILL + db 1, MR_FUJI + db 2, POKE_BALL + db 1, POKEDEX + db 3, DEFENDER + db 2, POKEMON_FLUTE + db 0 ; end of list + +ExcavationCardList: ; 1b1fe (6:71fe) + db 15, FIGHTING_ENERGY + db 8, WATER_ENERGY + db 3, SHELLDER + db 1, CLOYSTER + db 3, OMANYTE + db 2, OMASTAR + db 4, SANDSHREW + db 2, SANDSLASH + db 3, CUBONE + db 1, MAROWAK2 + db 3, HITMONCHAN + db 2, KABUTO + db 1, KABUTOPS + db 2, AERODACTYL + db 2, PROFESSOR_OAK + db 2, BILL + db 2, POKEMON_BREEDER + db 4, MYSTERIOUS_FOSSIL + db 0 ; end of list + +RockCrusherCardList: ; 1b223 (6:7223) + db 24, FIGHTING_ENERGY + db 2, DOUBLE_COLORLESS_ENERGY + db 4, DIGLETT + db 2, DUGTRIO + db 4, GEODUDE + db 3, GRAVELER + db 2, GOLEM + db 3, ONIX + db 3, RHYHORN + db 2, PROFESSOR_OAK + db 1, POKEMON_BREEDER + db 2, ENERGY_REMOVAL + db 2, SWITCH + db 1, COMPUTER_SEARCH + db 2, DEFENDER + db 1, SUPER_POTION + db 2, POTION + db 0 ; end of list + +BlueWaterCardList: ; 1b246 (6:7246) + db 25, WATER_ENERGY + db 2, PSYDUCK + db 1, GOLDUCK + db 2, POLIWAG + db 1, POLIWHIRL + db 1, POLIWRATH + db 2, SEEL + db 1, DEWGONG + db 2, SHELLDER + db 1, CLOYSTER + db 2, KRABBY + db 1, KINGLER + db 2, HORSEA + db 1, SEADRA + db 1, MAGIKARP + db 1, GYARADOS + db 1, LAPRAS + db 1, OMANYTE + db 1, OMASTAR + db 1, ARTICUNO1 + db 1, PROFESSOR_OAK + db 2, BILL + db 1, POKEMON_TRADER + db 2, MYSTERIOUS_FOSSIL + db 1, ENERGY_SEARCH + db 1, POKE_BALL + db 1, POTION + db 1, SUPER_POTION + db 0 ; end of list + +OnTheBeachCardList: ; 1b27f (6:727f) + db 16, WATER_ENERGY + db 10, FIGHTING_ENERGY + db 2, SEEL + db 1, DEWGONG + db 3, SHELLDER + db 2, CLOYSTER + db 3, KRABBY + db 2, KINGLER + db 3, STARYU + db 2, STARMIE + db 3, SANDSHREW + db 2, SANDSLASH + db 2, BILL + db 2, ENERGY_RETRIEVAL + db 2, ENERGY_REMOVAL + db 2, GUST_OF_WIND + db 3, POTION + db 0 ; end of list + +ParalyzeCardList: ; 1b2a2 (6:72a2) + db 8, GRASS_ENERGY + db 14, WATER_ENERGY + db 4, DOUBLE_COLORLESS_ENERGY + db 3, CATERPIE + db 2, METAPOD + db 3, SQUIRTLE + db 2, WARTORTLE + db 3, SHELLDER + db 2, CLOYSTER + db 4, STARYU + db 3, STARMIE + db 2, PROFESSOR_OAK + db 2, BILL + db 2, PLUSPOWER + db 2, DEFENDER + db 4, POTION + db 0 ; end of list + +EnergyRemovalCardList: ; 1b2c3 (6:72c3) + db 15, WATER_ENERGY + db 8, PSYCHIC_ENERGY + db 3, DOUBLE_COLORLESS_ENERGY + db 3, PSYDUCK + db 2, GOLDUCK + db 4, POLIWAG + db 3, POLIWHIRL + db 2, POLIWRATH + db 4, GASTLY2 + db 3, HAUNTER1 + db 3, DRATINI + db 2, DRAGONAIR + db 1, PROFESSOR_OAK + db 1, BILL + db 1, LASS + db 2, ENERGY_SEARCH + db 2, ENERGY_REMOVAL + db 1, SUPER_ENERGY_REMOVAL + db 0 ; end of list + +RainDancerCardList: ; 1b2e8 (6:72e8) + db 24, WATER_ENERGY + db 4, SQUIRTLE + db 3, WARTORTLE + db 2, BLASTOISE + db 4, GOLDEEN + db 3, SEAKING + db 3, HORSEA + db 2, SEADRA + db 2, LAPRAS + db 2, PROFESSOR_OAK + db 1, POKEMON_BREEDER + db 1, ENERGY_RETRIEVAL + db 1, SUPER_ENERGY_RETRIEVAL + db 2, ENERGY_REMOVAL + db 1, SUPER_ENERGY_REMOVAL + db 2, SWITCH + db 2, POTION + db 1, GAMBLER + db 0 ; end of list + +CutePokemonCardList: ; 1b30d (6:730d) + db 4, FIRE_ENERGY + db 6, WATER_ENERGY + db 8, LIGHTNING_ENERGY + db 2, DOUBLE_COLORLESS_ENERGY + db 1, FLAREON2 + db 1, VAPOREON2 + db 1, PIKACHU1 + db 1, PIKACHU2 + db 1, PIKACHU3 + db 1, PIKACHU4 + db 1, FLYING_PIKACHU + db 1, SURFING_PIKACHU1 + db 1, SURFING_PIKACHU2 + db 1, RAICHU1 + db 1, RAICHU2 + db 1, JOLTEON2 + db 2, CLEFAIRY + db 1, CLEFABLE + db 1, JIGGLYPUFF1 + db 2, JIGGLYPUFF2 + db 1, JIGGLYPUFF3 + db 2, WIGGLYTUFF + db 4, EEVEE + db 2, PROFESSOR_OAK + db 3, BILL + db 2, CLEFAIRY_DOLL + db 2, SCOOP_UP + db 1, COMPUTER_SEARCH + db 1, PLUSPOWER + db 1, DEFENDER + db 3, POTION + db 0 ; end of list + +PokemonFluteCardList: ; 1b34c (6:734c) + db 9, WATER_ENERGY + db 12, LIGHTNING_ENERGY + db 2, STARYU + db 2, LAPRAS + db 3, PIKACHU1 + db 1, RAICHU1 + db 2, MAGNEMITE1 + db 3, ELECTABUZZ2 + db 2, RATTATA + db 1, RATICATE + db 2, PROFESSOR_OAK + db 4, BILL + db 3, ENERGY_REMOVAL + db 1, COMPUTER_SEARCH + db 3, PLUSPOWER + db 2, ITEM_FINDER + db 4, GUST_OF_WIND + db 4, POKEMON_FLUTE + db 0 ; end of list + +YellowFlashCardList: ; 1b371 (6:7371) + db 26, LIGHTNING_ENERGY + db 2, PIKACHU1 + db 1, PIKACHU2 + db 1, RAICHU1 + db 1, RAICHU2 + db 2, MAGNEMITE1 + db 1, MAGNEMITE2 + db 1, MAGNETON1 + db 1, MAGNETON2 + db 3, VOLTORB + db 1, ELECTRODE1 + db 1, ELECTRODE2 + db 1, ELECTABUZZ1 + db 1, ELECTABUZZ2 + db 1, JOLTEON1 + db 1, JOLTEON2 + db 1, ZAPDOS1 + db 1, ZAPDOS2 + db 3, EEVEE + db 1, ENERGY_RETRIEVAL + db 2, ENERGY_REMOVAL + db 2, POKE_BALL + db 2, PLUSPOWER + db 2, DEFENDER + db 1, GUST_OF_WIND + db 0 ; end of list + +ElectricShockCardList: ; 1b3a4 (6:73a4) + db 24, LIGHTNING_ENERGY + db 1, DOUBLE_COLORLESS_ENERGY + db 2, PIKACHU2 + db 1, PIKACHU3 + db 1, PIKACHU4 + db 2, RAICHU1 + db 2, MAGNEMITE1 + db 2, MAGNEMITE2 + db 2, MAGNETON1 + db 4, VOLTORB + db 3, ELECTRODE2 + db 1, ZAPDOS2 + db 3, PORYGON + db 2, ENERGY_RETRIEVAL + db 2, PLUSPOWER + db 3, DEFENDER + db 2, ITEM_FINDER + db 3, GUST_OF_WIND + db 0 ; end of list + +ZappingSelfdestructCardList: ; 1b3c9 (6:73c9) + db 24, LIGHTNING_ENERGY + db 2, DOUBLE_COLORLESS_ENERGY + db 4, MAGNEMITE1 + db 3, MAGNETON1 + db 4, VOLTORB + db 2, ELECTRODE1 + db 4, ELECTABUZZ2 + db 2, KANGASKHAN + db 1, TAUROS + db 1, PROFESSOR_OAK + db 2, BILL + db 2, SWITCH + db 4, DEFENDER + db 1, GUST_OF_WIND + db 4, POTION + db 0 ; end of list + +InsectCollectionCardList: ; 1b3e8 (6:73e8) + db 24, GRASS_ENERGY + db 3, CATERPIE + db 2, METAPOD + db 1, BUTTERFREE + db 3, WEEDLE + db 2, KAKUNA + db 1, BEEDRILL + db 4, PARAS + db 3, PARASECT + db 2, VENONAT + db 1, VENOMOTH + db 1, SCYTHER + db 1, PINSIR + db 2, BILL + db 2, POKEMON_BREEDER + db 2, SWITCH + db 2, POKE_BALL + db 2, POKEDEX + db 2, POTION + db 0 ; end of list + +JungleCardList: ; 1b40f (6:740f) + db 25, GRASS_ENERGY + db 1, DOUBLE_COLORLESS_ENERGY + db 2, EKANS + db 1, ARBOK + db 2, ZUBAT + db 1, GOLBAT + db 2, ODDISH + db 1, GLOOM + db 1, VILEPLUME + db 2, PARAS + db 1, PARASECT + db 2, VENONAT + db 1, VENOMOTH + db 2, BELLSPROUT + db 1, WEEPINBELL + db 1, VICTREEBEL + db 1, PINSIR + db 1, LICKITUNG + db 1, KANGASKHAN + db 2, BILL + db 1, SWITCH + db 1, POKE_BALL + db 2, PLUSPOWER + db 2, DEFENDER + db 2, POTION + db 1, FULL_HEAL + db 0 ; end of list + +FlowerGardenCardList: ; 1b444 (6:7444) + db 24, GRASS_ENERGY + db 2, DOUBLE_COLORLESS_ENERGY + db 3, BULBASAUR + db 2, IVYSAUR + db 2, VENUSAUR2 + db 3, ODDISH + db 2, GLOOM + db 2, VILEPLUME + db 2, BELLSPROUT + db 1, WEEPINBELL + db 1, VICTREEBEL + db 2, TANGELA1 + db 1, TANGELA2 + db 2, LICKITUNG + db 2, POKEMON_TRADER + db 3, POKEMON_BREEDER + db 1, ENERGY_SEARCH + db 2, SWITCH + db 2, POTION + db 1, FULL_HEAL + db 0 ; end of list + +KaleidoscopeCardList: ; 1b46d (6:746d) + db 10, GRASS_ENERGY + db 4, FIRE_ENERGY + db 4, WATER_ENERGY + db 4, LIGHTNING_ENERGY + db 3, DOUBLE_COLORLESS_ENERGY + db 3, VENONAT + db 2, VENOMOTH + db 1, FLAREON1 + db 1, FLAREON2 + db 1, VAPOREON1 + db 1, VAPOREON2 + db 1, JOLTEON1 + db 1, JOLTEON2 + db 4, DITTO + db 4, EEVEE + db 4, PORYGON + db 2, BILL + db 2, MR_FUJI + db 2, ENERGY_SEARCH + db 4, SWITCH + db 2, GUST_OF_WIND + db 0 ; end of list + +FlowerPowerCardList: ; 1b498 (6:7498) + db 18, GRASS_ENERGY + db 4, PSYCHIC_ENERGY + db 4, BULBASAUR + db 3, IVYSAUR + db 2, VENUSAUR2 + db 4, ODDISH + db 3, GLOOM + db 2, VILEPLUME + db 4, EXEGGCUTE + db 3, EXEGGUTOR + db 2, PROFESSOR_OAK + db 3, BILL + db 2, POKEMON_BREEDER + db 2, ENERGY_RETRIEVAL + db 2, SWITCH + db 2, POTION + db 0 ; end of list + +PsychicPowerCardList: ; 1b4b9 (6:74b9) + db 25, PSYCHIC_ENERGY + db 3, ABRA + db 2, KADABRA + db 1, ALAKAZAM + db 2, SLOWPOKE2 + db 1, SLOWBRO + db 1, GASTLY1 + db 2, GASTLY2 + db 1, HAUNTER1 + db 1, HAUNTER2 + db 1, GENGAR + db 2, DROWZEE + db 1, HYPNO + db 1, MR_MIME + db 1, JYNX + db 1, MEWTWO1 + db 1, MEW3 + db 1, CLEFAIRY + db 1, CLEFABLE + db 1, SNORLAX + db 2, PROFESSOR_OAK + db 1, POKEMON_TRADER + db 1, POKEMON_BREEDER + db 2, SWITCH + db 1, POKEMON_CENTER + db 2, PLUSPOWER + db 1, DEVOLUTION_SPRAY + db 0 ; end of list + +DreamEaterHaunterCardList: ; 1b40f (6:740f) + db 7, GRASS_ENERGY + db 17, PSYCHIC_ENERGY + db 3, ZUBAT + db 2, GOLBAT + db 4, GASTLY1 + db 1, HAUNTER1 + db 2, HAUNTER2 + db 2, GENGAR + db 3, DROWZEE + db 2, HYPNO + db 2, JIGGLYPUFF3 + db 2, MEOWTH2 + db 2, PROFESSOR_OAK + db 2, BILL + db 2, ENERGY_RETRIEVAL + db 1, SUPER_ENERGY_RETRIEVAL + db 2, SWITCH + db 1, COMPUTER_SEARCH + db 3, REVIVE + db 0 ; end of list + +ScavengingSlowbroCardList: ; 1b517 (6:7517) + db 23, PSYCHIC_ENERGY + db 4, SLOWPOKE2 + db 3, SLOWBRO + db 3, JYNX + db 2, MEWTWO1 + db 2, MEW3 + db 2, JIGGLYPUFF2 + db 2, JIGGLYPUFF3 + db 2, EEVEE + db 2, ENERGY_RETRIEVAL + db 3, ENERGY_REMOVAL + db 2, PLUSPOWER + db 3, DEFENDER + db 3, POTION + db 4, RECYCLE + db 0 ; end of list + +StrangePowerCardList: ; 1b536 (6:7536) + db 25, PSYCHIC_ENERGY + db 1, DOUBLE_COLORLESS_ENERGY + db 3, SLOWPOKE1 + db 2, SLOWBRO + db 4, DROWZEE + db 3, HYPNO + db 2, MR_MIME + db 2, JYNX + db 1, MEW1 + db 2, MEW3 + db 2, LICKITUNG + db 1, SNORLAX + db 2, POKEMON_TRADER + db 2, ENERGY_RETRIEVAL + db 2, ENERGY_REMOVAL + db 1, SUPER_ENERGY_REMOVAL + db 2, PLUSPOWER + db 1, ITEM_FINDER + db 1, GUST_OF_WIND + db 1, FULL_HEAL + db 0 ; end of list + +StrangePsyshockCardList: ; 1b55f (6:755f) + db 22, PSYCHIC_ENERGY + db 4, ABRA + db 3, KADABRA + db 2, ALAKAZAM + db 2, MR_MIME + db 3, CHANSEY + db 3, KANGASKHAN + db 2, SNORLAX + db 2, PROFESSOR_OAK + db 2, POKEMON_CENTER + db 3, ENERGY_REMOVAL + db 3, GUST_OF_WIND + db 4, SCOOP_UP + db 4, SWITCH + db 1, GAMBLER + db 0 ; end of list + +LovelyNidoranCardList: ; 1b57e (6:757e) + db 20, GRASS_ENERGY + db 4, NIDORANF + db 3, NIDORINA + db 2, NIDOQUEEN + db 4, NIDORANM + db 4, NIDORINO + db 4, NIDOKING + db 3, LICKITUNG + db 2, PROFESSOR_OAK + db 3, POKEMON_TRADER + db 3, POKEMON_BREEDER + db 2, ENERGY_RETRIEVAL + db 3, SWITCH + db 1, COMPUTER_SEARCH + db 2, ITEM_FINDER + db 0 ; end of list + +ScienceCorpsCardList: ; 1b59d (6:759d) + db 26, GRASS_ENERGY + db 2, EKANS + db 1, ARBOK + db 2, NIDORANF + db 1, NIDORINA + db 1, NIDOQUEEN + db 3, NIDORANM + db 2, NIDORINO + db 1, NIDOKING + db 2, ZUBAT + db 1, GOLBAT + db 2, GRIMER + db 1, MUK + db 2, KOFFING + db 1, WEEZING + db 2, MEOWTH2 + db 1, PERSIAN + db 1, PROFESSOR_OAK + db 1, BILL + db 1, POKEMON_TRADER + db 1, POKEMON_BREEDER + db 1, POTION + db 1, FULL_HEAL + db 1, MAINTENANCE + db 1, GAMBLER + db 1, RECYCLE + db 0 ; end of list + +FlyinPokemonCardList: ; 1b5d2 (6:75d2) + db 13, GRASS_ENERGY + db 10, LIGHTNING_ENERGY + db 2, DOUBLE_COLORLESS_ENERGY + db 4, ZUBAT + db 3, GOLBAT + db 2, FLYING_PIKACHU + db 4, PIDGEY + db 3, PIDGEOTTO + db 1, PIDGEOT1 + db 1, PIDGEOT2 + db 4, SPEAROW + db 3, FEAROW + db 2, IMPOSTER_PROFESSOR_OAK + db 2, LASS + db 2, BILL + db 4, POTION + db 0 ; end of list + +PoisonCardList: ; 1b5f3 (6:75f3) + db 24, GRASS_ENERGY + db 3, WEEDLE + db 2, KAKUNA + db 1, BEEDRILL + db 4, EKANS + db 3, ARBOK + db 4, NIDORANM + db 3, NIDORINO + db 2, NIDOKING + db 3, KOFFING + db 2, WEEZING + db 1, PROFESSOR_OAK + db 2, IMPOSTER_PROFESSOR_OAK + db 1, POKEMON_BREEDER + db 2, POTION + db 2, FULL_HEAL + db 1, GAMBLER + db 0 ; end of list + +WondersOfScienceCardList: ; 1b616 (6:7616) + db 15, GRASS_ENERGY + db 8, PSYCHIC_ENERGY + db 4, GRIMER + db 3, MUK + db 4, KOFFING + db 3, WEEZING + db 2, MEWTWO1 + db 1, MEWTWO3 + db 1, MEWTWO2 + db 2, PORYGON + db 1, IMPOSTER_PROFESSOR_OAK + db 2, PROFESSOR_OAK + db 2, BILL + db 2, ENERGY_SEARCH + db 2, SWITCH + db 2, COMPUTER_SEARCH + db 2, POKEDEX + db 2, MAINTENANCE + db 2, FULL_HEAL + db 0 ; end of list + +ReplaceEmAllCardList: ; 1b63d (6:763d) + db 24, FIRE_ENERGY + db 4, VULPIX + db 2, NINETAILS1 + db 1, NINETAILS2 + db 4, GROWLITHE + db 1, ARCANINE1 + db 1, ARCANINE2 + db 4, PIDGEY + db 3, PIDGEOTTO + db 1, PIDGEOT1 + db 1, PIDGEOT2 + db 3, DODUO + db 2, DODRIO + db 2, PROFESSOR_OAK + db 2, IMPOSTER_PROFESSOR_OAK + db 2, LASS + db 3, GUST_OF_WIND + db 0 ; end of list + +ChariSaurCardList: ; 1b660 (6:7660) + db 12, GRASS_ENERGY + db 10, FIRE_ENERGY + db 4, BULBASAUR + db 3, IVYSAUR + db 2, VENUSAUR2 + db 4, CHARMANDER + db 3, CHARMELEON + db 2, CHARIZARD + db 3, FLAREON1 + db 4, EEVEE + db 2, BILL + db 3, POKEMON_TRADER + db 3, POKEMON_BREEDER + db 2, ENERGY_RETRIEVAL + db 1, ENERGY_REMOVAL + db 2, POTION + db 0 ; end of list + +TrafficLightCardList: ; 1b681 (6:7681) + db 10, FIRE_ENERGY + db 8, WATER_ENERGY + db 8, LIGHTNING_ENERGY + db 3, CHARMANDER + db 2, CHARMELEON + db 3, PONYTA + db 2, RAPIDASH + db 2, FLAREON1 + db 2, VAPOREON1 + db 2, PIKACHU1 + db 3, VOLTORB + db 2, ELECTRODE2 + db 2, JOLTEON1 + db 4, EEVEE + db 2, ENERGY_SEARCH + db 2, SWITCH + db 3, PLUSPOWER + db 0 ; end of list + +FirePokemonCardList: ; 1b6a4 (6:76a4) + db 24, FIRE_ENERGY + db 2, DOUBLE_COLORLESS_ENERGY + db 3, CHARMANDER + db 2, CHARMELEON + db 1, CHARIZARD + db 3, VULPIX + db 1, NINETAILS1 + db 1, NINETAILS2 + db 2, GROWLITHE + db 1, ARCANINE2 + db 2, PONYTA + db 1, RAPIDASH + db 1, MAGMAR1 + db 1, MAGMAR2 + db 1, FLAREON1 + db 1, FLAREON2 + db 1, MOLTRES1 + db 3, EEVEE + db 1, PROFESSOR_OAK + db 2, BILL + db 1, POKEMON_TRADER + db 1, POKEMON_BREEDER + db 1, ENERGY_RETRIEVAL + db 1, SUPER_ENERGY_RETRIEVAL + db 1, SWITCH + db 1, GUST_OF_WIND + db 0 ; end of list + +FireChargeCardList: ; 1b6d9 (6:76d9) + db 21, FIRE_ENERGY + db 4, DOUBLE_COLORLESS_ENERGY + db 4, GROWLITHE + db 3, ARCANINE2 + db 2, MAGMAR1 + db 3, JIGGLYPUFF1 + db 1, JIGGLYPUFF3 + db 1, WIGGLYTUFF + db 2, CHANSEY + db 2, TAUROS + db 1, PROFESSOR_OAK + db 2, BILL + db 2, ENERGY_RETRIEVAL + db 1, POKE_BALL + db 1, COMPUTER_SEARCH + db 2, DEFENDER + db 3, POTION + db 1, FULL_HEAL + db 3, RECYCLE + db 1, GAMBLER + db 0 ; end of list + +CharmanderAndFriendsCardList: ; 1b702 (6:7702) + db 8, GRASS_ENERGY + db 10, FIRE_ENERGY + db 6, WATER_ENERGY + db 2, CATERPIE + db 1, METAPOD + db 2, NIDORANF + db 1, NIDORANM + db 1, PINSIR + db 2, CHARMANDER + db 1, CHARMELEON + db 1, CHARIZARD + db 2, GROWLITHE + db 1, ARCANINE2 + db 2, PONYTA + db 1, MAGMAR1 + db 2, SEEL + db 1, DEWGONG + db 2, GOLDEEN + db 1, SEAKING + db 2, RATTATA + db 1, RATICATE + db 1, MEOWTH1 + db 1, PROFESSOR_OAK + db 2, BILL + db 1, SWITCH + db 1, COMPUTER_SEARCH + db 1, PLUSPOWER + db 2, POTION + db 2, FULL_HEAL + db 0 ; end of list + +SquirtleAndFriendsCardList: ; 1b73d (6:773d) + db 8, FIRE_ENERGY + db 11, WATER_ENERGY + db 6, LIGHTNING_ENERGY + db 2, CHARMANDER + db 1, CHARMELEON + db 1, GROWLITHE + db 1, ARCANINE2 + db 1, MAGMAR1 + db 2, SQUIRTLE + db 1, WARTORTLE + db 1, BLASTOISE + db 2, SEEL + db 1, DEWGONG + db 1, GOLDEEN + db 1, SEAKING + db 1, STARYU + db 1, STARMIE + db 1, LAPRAS + db 2, PIKACHU1 + db 1, MAGNEMITE1 + db 1, MAGNETON1 + db 1, ELECTABUZZ2 + db 2, RATTATA + db 1, RATICATE + db 1, MEOWTH1 + db 1, PROFESSOR_OAK + db 1, BILL + db 1, SWITCH + db 1, POKE_BALL + db 1, SCOOP_UP + db 1, ITEM_FINDER + db 1, POTION + db 1, FULL_HEAL + db 0 ; end of list + +BulbasaurAndFriendsCardList: ; 1b780 (6:7780) + db 9, GRASS_ENERGY + db 8, LIGHTNING_ENERGY + db 6, PSYCHIC_ENERGY + db 2, BULBASAUR + db 1, IVYSAUR + db 1, VENUSAUR2 + db 2, NIDORANF + db 2, NIDORANM + db 1, NIDORINO + db 1, TANGELA2 + db 2, PIKACHU1 + db 1, RAICHU1 + db 1, MAGNEMITE1 + db 1, ELECTABUZZ2 + db 2, ABRA + db 1, KADABRA + db 2, GASTLY1 + db 1, HAUNTER2 + db 1, JYNX + db 1, JIGGLYPUFF3 + db 1, MEOWTH1 + db 1, KANGASKHAN + db 1, PROFESSOR_OAK + db 1, BILL + db 1, SWITCH + db 1, POKE_BALL + db 2, PLUSPOWER + db 1, DEFENDER + db 1, GUST_OF_WIND + db 2, POTION + db 2, FULL_HEAL + db 0 ; end of list + +PsychicMachampCardList: ; 1b7b (6:77b) + db 12, FIGHTING_ENERGY + db 12, PSYCHIC_ENERGY + db 2, DIGLETT + db 1, DUGTRIO + db 2, MACHOP + db 1, MACHOKE + db 1, MACHAMP + db 1, ONIX + db 1, HITMONLEE + db 1, HITMONCHAN + db 2, ABRA + db 1, KADABRA + db 1, ALAKAZAM + db 2, GASTLY1 + db 1, HAUNTER2 + db 1, GENGAR + db 1, MR_MIME + db 1, JYNX + db 1, MEW3 + db 2, PIDGEY + db 1, PIDGEOTTO + db 1, PIDGEOT2 + db 2, RATTATA + db 1, RATICATE + db 1, PROFESSOR_OAK + db 2, BILL + db 1, SWITCH + db 1, GUST_OF_WIND + db 2, POTION + db 1, FULL_HEAL + db 0 ; end of list + +WaterBeetleCardList: ; 1b7fc (6:77fc) + db 14, GRASS_ENERGY + db 10, WATER_ENERGY + db 2, WEEDLE + db 1, KAKUNA + db 1, BEEDRILL + db 2, NIDORANM + db 1, NIDORINO + db 1, NIDOKING + db 2, BELLSPROUT + db 1, WEEPINBELL + db 1, VICTREEBEL + db 1, SCYTHER + db 2, POLIWAG + db 1, POLIWHIRL + db 1, POLIWRATH + db 2, KRABBY + db 1, KINGLER + db 2, MAGIKARP + db 1, GYARADOS + db 1, LAPRAS + db 1, ARTICUNO1 + db 1, LICKITUNG + db 1, KANGASKHAN + db 1, TAUROS + db 1, PROFESSOR_OAK + db 2, BILL + db 1, ENERGY_RETRIEVAL + db 1, ENERGY_SEARCH + db 1, SWITCH + db 1, PLUSPOWER + db 1, FULL_HEAL + db 0 ; end of list + +LegendaryMoltresCardList: ; 1b83b (6:783b) + db 25, FIRE_ENERGY + db 4, VULPIX + db 3, NINETAILS2 + db 4, GROWLITHE + db 2, ARCANINE2 + db 2, MAGMAR1 + db 2, MAGMAR2 + db 2, MOLTRES1 + db 2, MOLTRES2 + db 3, BILL + db 2, LASS + db 1, POKEMON_TRADER + db 1, ENERGY_RETRIEVAL + db 1, SUPER_ENERGY_RETRIEVAL + db 2, ENERGY_REMOVAL + db 2, SWITCH + db 1, POTION + db 1, SUPER_POTION + db 0 ; end of list + +LegendaryZapdosCardList: ; 1b860 (6:7860) + db 25, LIGHTNING_ENERGY + db 4, VOLTORB + db 3, ELECTRODE1 + db 4, ELECTABUZZ2 + db 2, JOLTEON2 + db 1, ZAPDOS1 + db 1, ZAPDOS2 + db 2, ZAPDOS3 + db 3, EEVEE + db 4, BILL + db 2, ENERGY_RETRIEVAL + db 2, SWITCH + db 3, PLUSPOWER + db 3, POTION + db 1, GAMBLER + db 0 ; end of list + +LegendaryArticunoCardList: ; 1b87f (6:787f) + db 25, WATER_ENERGY + db 4, SEEL + db 3, DEWGONG + db 4, LAPRAS + db 2, ARTICUNO2 + db 2, ARTICUNO1 + db 3, CHANSEY + db 2, DITTO + db 2, PROFESSOR_OAK + db 2, POKEMON_TRADER + db 3, ENERGY_RETRIEVAL + db 3, SWITCH + db 4, SCOOP_UP + db 1, GAMBLER + db 0 ; end of list + +LegendaryDragoniteCardList: ; 1b89c (6:789c) + db 20, WATER_ENERGY + db 4, DOUBLE_COLORLESS_ENERGY + db 3, CHARMANDER + db 2, CHARMELEON + db 2, CHARIZARD + db 3, MAGIKARP + db 2, GYARADOS + db 2, LAPRAS + db 2, KANGASKHAN + db 4, DRATINI + db 3, DRAGONAIR + db 2, DRAGONITE1 + db 2, PROFESSOR_OAK + db 2, POKEMON_TRADER + db 2, POKEMON_BREEDER + db 1, ENERGY_RETRIEVAL + db 1, SUPER_ENERGY_RETRIEVAL + db 2, SWITCH + db 1, GAMBLER + db 0 ; end of list + +MysteriousPokemonCardList: ; 1b8c3 (6:78c3) + db 12, GRASS_ENERGY + db 14, PSYCHIC_ENERGY + db 4, BULBASAUR + db 3, IVYSAUR + db 2, VENUSAUR1 + db 2, SCYTHER + db 4, ABRA + db 3, KADABRA + db 2, ALAKAZAM + db 2, MR_MIME + db 1, MEW1 + db 2, MEW2 + db 1, PROFESSOR_OAK + db 2, BILL + db 2, POKEMON_BREEDER + db 1, ENERGY_REMOVAL + db 2, SWITCH + db 1, POKEMON_CENTER + db 0 ; end of list +; 0x1b8e8 diff --git a/src/data/auto_deck_machines.asm b/src/data/auto_deck_machines.asm new file mode 100644 index 0000000..17ca823 --- /dev/null +++ b/src/data/auto_deck_machines.asm @@ -0,0 +1,82 @@ +; each Auto Deck Machine has 5 slots for deck configurations +; each entry in an Auto Deck Machine consists of a card list +; (see data/auto_deck_card_lists.asm) and two text IDs +; for the corresponding deck name and description/flavor text + +auto_deck: MACRO + dw \1 ; deck card list + tx \2 ; deck name text ID + tx \3 ; deck description text ID +ENDM + +AutoDeckMachineEntries: ; 1b8e8 (6:78e8) +; Fighting Auto Deck Machine + auto_deck AllFightingPokemonCardList, AllFightingPokemonText, AllFightingPokemonDescriptionText + auto_deck BenchAttackCardList, BenchAttackText, BenchAttackDescriptionText + auto_deck BattleContestCardList, BattleContestText, BattleContestDescriptionText + auto_deck HeatedBattleCardList, HeatedBattleText, HeatedBattleDescriptionText + auto_deck FirstStrikeCardList, FirstStrikeText, FirstStrikeDescriptionText + +; Rock Auto Deck Machine + auto_deck SqueakingMouseCardList, SqueakingMouseText, SqueakingMouseDescriptionText + auto_deck GreatQuakeCardList, GreatQuakeText, GreatQuakeDescriptionText + auto_deck BoneAttackCardList, BoneAttackText, BoneAttackDescriptionText + auto_deck ExcavationCardList, ExcavationText, ExcavationDescriptionText + auto_deck RockCrusherCardList, RockCrusherText, RockCrusherDescriptionText + +; Water Auto Deck Machine + auto_deck BlueWaterCardList, BlueWaterText, BlueWaterDescriptionText + auto_deck OnTheBeachCardList, OnTheBeachText, OnTheBeachDescriptionText + auto_deck ParalyzeCardList, ParalyzeText, ParalyzeDescriptionText + auto_deck EnergyRemovalCardList, EnergyRemovalText, EnergyRemovalDescriptionText + auto_deck RainDancerCardList, RainDancerText, RainDancerDescriptionText + +; Lightning Auto Deck Machine + auto_deck CutePokemonCardList, CutePokemonText, CutePokemonDescriptionText + auto_deck PokemonFluteCardList, PokemonFluteText, PokemonFluteDescriptionText + auto_deck YellowFlashCardList, YellowFlashText, YellowFlashDescriptionText + auto_deck ElectricShockCardList, ElectricShockText, ElectricShockDescriptionText + auto_deck ZappingSelfdestructCardList, ZappingSelfdestructText, ZappingSelfdestructDescriptionText + +; Grass Auto Deck Machine + auto_deck InsectCollectionCardList, InsectCollectionText, InsectCollectionDescriptionText + auto_deck JungleCardList, JungleText, JungleDescriptionText + auto_deck FlowerGardenCardList, FlowerGardenText, FlowerGardenDescriptionText + auto_deck KaleidoscopeCardList, KaleidoscopeText, KaleidoscopeDescriptionText + auto_deck FlowerPowerCardList, FlowerPowerText, FlowerPowerDescriptionText + +; Psychic Auto Deck Machine + auto_deck PsychicPowerCardList, PsychicPowerText, PsychicPowerDescriptionText + auto_deck DreamEaterHaunterCardList, DreamEaterHaunterText, DreamEaterHaunterDescriptionText + auto_deck ScavengingSlowbroCardList, ScavengingSlowbroText, ScavengingSlowbroDescriptionText + auto_deck StrangePowerCardList, StrangePowerText, StrangePowerDescriptionText + auto_deck StrangePsyshockCardList, StrangePsyshockText, StrangePsyshockDescriptionText + +; Science Auto Deck Machine + auto_deck LovelyNidoranCardList, LovelyNidoranText, LovelyNidoranDescriptionText + auto_deck ScienceCorpsCardList, ScienceCorpsText, ScienceCorpsDescriptionText + auto_deck FlyinPokemonCardList, FlyinPokemonText, FlyinPokemonDescriptionText + auto_deck PoisonCardList, PoisonText, PoisonDescriptionText + auto_deck WondersOfScienceCardList, WondersOfScienceText, WondersOfScienceDescriptionText + +; Fire Auto Deck Machine + auto_deck ReplaceEmAllCardList, ReplaceEmAllText, ReplaceEmAllDescriptionText + auto_deck ChariSaurCardList, ChariSaurText, ChariSaurDescriptionText + auto_deck TrafficLightCardList, TrafficLightText, TrafficLightDescriptionText + auto_deck FirePokemonCardList, FirePokemonDeckText, FirePokemonDescriptionText + auto_deck FireChargeCardList, FireChargeText, FireChargeDescriptionText + +; Auto Deck Machine + auto_deck CharmanderAndFriendsCardList, CharmanderAndFriendsText, CharmanderAndFriendsDescriptionText + auto_deck SquirtleAndFriendsCardList, SquirtleAndFriendsText, SquirtleAndFriendsDescriptionText + auto_deck BulbasaurAndFriendsCardList, BulbasaurAndFriendsText, BulbasaurAndFriendsDescriptionText + auto_deck PsychicMachampCardList, PsychicMachampText, PsychicMachampDescriptionText + auto_deck WaterBeetleCardList, WaterBeetleText, WaterBeetleDescriptionText + +; Legendary Auto Deck Machine + auto_deck LegendaryMoltresCardList, LegendaryMoltresText, LegendaryMoltresDescriptionText + auto_deck LegendaryZapdosCardList, LegendaryZapdosText, LegendaryZapdosDescriptionText + auto_deck LegendaryArticunoCardList, LegendaryArticunoText, LegendaryArticunoDescriptionText + auto_deck LegendaryDragoniteCardList, LegendaryDragoniteText, LegendaryDragoniteDescriptionText + auto_deck MysteriousPokemonCardList, MysteriousPokemonText, MysteriousPokemonDescriptionText +; 0x1ba14 diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index 8680139..46df6f6 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -2260,7 +2260,7 @@ DeckBuildingParams: ; 8da9 (2:4da9) DeckSelectionMenu: ; 8db0 (2:4db0) ld hl, DeckBuildingParams call InitDeckBuildingParams - ld a, $ff + ld a, ALL_DECKS call DrawDecksScreen xor a @@ -2321,7 +2321,7 @@ HandleStartButtonInDeckSelectionMenu: ; 8dea (2:4dea) call GetPointerToDeckName pop de call OpenDeckConfirmationMenu - ld a, $ff + ld a, ALL_DECKS call DrawDecksScreen ld a, [wCurDeck] scf @@ -2421,7 +2421,7 @@ DeckSelectionSubMenu: ; 8e42 (2:4e42) or a jr z, .get_input_deck_name .asm_8ec4 - ld a, $ff + ld a, ALL_DECKS call DrawDecksScreen ld a, [wCurDeck] jp DeckSelectionMenu.init_menu_params @@ -2444,7 +2444,7 @@ DeckSelectionSubMenu: ; 8e42 (2:4e42) ld e, l ld hl, wCurDeckName call CopyListFromHLToDEInSRAM - ld a, $ff + ld a, ALL_DECKS call DrawDecksScreen ld a, [wCurDeck] jp DeckSelectionMenu.init_menu_params @@ -2637,7 +2637,7 @@ DeckSelectionData: ; 9027 (2:5027) GetPointerToDeckName: ; 9038 (2:5038) ld a, [wCurDeck] ld h, a - ld l, sDeck2Name - sDeck1Name + ld l, DECK_STRUCT_SIZE call HtimesL push de ld de, sDeck1Name @@ -2906,7 +2906,7 @@ AddDeckToCollection: ; 9152 (2:5152) ; draws the screen which shows the player's current ; deck configurations -; a = some flags to pick which deck names to show +; a = DECK_* flags to pick which deck names to show DrawDecksScreen: ; 9168 (2:5168) ld [hffb5], a call EmptyScreenAndLoadFontDuelAndHandCardsIcons @@ -3704,7 +3704,7 @@ FilteredCardListSelectionParams: ; 9670 (2:5670) db 7 ; y pos db 2 ; y spacing db 0 ; x spacing - db MAX_FILTERED_LIST_VISIBLE_CARDS ; num entries + db NUM_FILTERED_LIST_VISIBLE_CARDS ; num entries db SYM_CURSOR_R ; visible cursor tile db SYM_SPACE ; invisible cursor tile dw NULL ; wCardListHandlerFunction @@ -4294,7 +4294,7 @@ PrintFilteredCardList: ; 993d (2:593d) pop af call CreateFilteredCardList - ld a, MAX_FILTERED_LIST_VISIBLE_CARDS + ld a, NUM_FILTERED_LIST_VISIBLE_CARDS ld [wNumVisibleCardListEntries], a lb de, 1, 7 ld hl, wCardListCoords @@ -4431,14 +4431,14 @@ PrintDeckBuildingCardList: ; 99b0 (2:59b0) ; draw down cursor because ; there are still more cards ; to be scrolled down - xor a - ld [wcecd], a + xor a ; FALSE + ld [wUnableToScrollDown], a ld a, SYM_CURSOR_D jr .draw_cursor .cannot_scroll pop de - ld a, $01 - ld [wcecd], a + ld a, TRUE + ld [wUnableToScrollDown], a ld a, SYM_SPACE .draw_cursor ld b, 19 ; x coord @@ -4728,9 +4728,9 @@ HandleDeckCardSelectionList: ; 9b25 (2:5b25) cp c jr c, .asm_9b8f push af - ld a, [wcecd] + ld a, [wUnableToScrollDown] or a - jr nz, .asm_9b87 + jr nz, .cannot_scroll_down ld a, [wCardListVisibleOffset] inc a ld [wCardListVisibleOffset], a @@ -4740,7 +4740,7 @@ HandleDeckCardSelectionList: ; 9b25 (2:5b25) dec a jr .asm_9b8f -.asm_9b87 +.cannot_scroll_down pop af dec a push af @@ -5260,9 +5260,9 @@ HandleDeckConfirmationMenu: ; 9e41 (2:5e41) call InitCardSelectionParams ld a, [wNumUniqueCards] ld [wNumCardListEntries], a - cp MAX_DECK_CONFIRMATION_VISIBLE_CARDS + cp NUM_DECK_CONFIRMATION_VISIBLE_CARDS jr c, .no_cap - ld a, MAX_DECK_CONFIRMATION_VISIBLE_CARDS + ld a, NUM_DECK_CONFIRMATION_VISIBLE_CARDS .no_cap ld [wCardListNumCursorPositions], a ld [wNumVisibleCardListEntries], a @@ -5629,14 +5629,14 @@ SortCurDeckCardsByID: ; a028 (2:6028) ; 0xa06e ; goes through list in wCurDeckCards, and for each card in it -; creates list in wTempHandCardList of all unique cards +; creates list in wUniqueDeckCardList of all unique cards ; it finds (assuming wCurDeckCards is sorted by ID) -; also counts the number of the different cards +; also counts the total number of the different cards CreateCurDeckUniqueCardList: ; a06e (2:606e) ld b, 0 ld c, $0 ld hl, wCurDeckCards - ld de, wTempHandCardList + ld de, wUniqueDeckCardList .loop ld a, [hli] cp c @@ -5726,15 +5726,15 @@ PrintConfirmationCardList: ; a08a (2:608a) or a jr z, .no_more_cards pop de - xor a - ld [wcecd], a + xor a ; FALSE + ld [wUnableToScrollDown], a ld a, SYM_CURSOR_D jr .got_cursor_tile_2 .no_more_cards pop de - ld a, $01 - ld [wcecd], a + ld a, TRUE + ld [wUnableToScrollDown], a ld a, SYM_SPACE .got_cursor_tile_2 ld b, 19 ; x coord @@ -6147,7 +6147,7 @@ PrintFilteredCardSelectionList: ; a39f (2:639f) pop af call CreateFilteredCardList - ld a, MAX_DECK_CONFIRMATION_VISIBLE_CARDS + ld a, NUM_DECK_CONFIRMATION_VISIBLE_CARDS ld [wNumVisibleCardListEntries], a lb de, 2, 5 ld hl, wCardListCoords @@ -6308,14 +6308,14 @@ PrintCardSelectionList: ; a42d (2:642d) ; draw down cursor because ; there are still more cards ; to be scrolled down - xor a - ld [wcecd], a + xor a ; FALSE + ld [wUnableToScrollDown], a ld a, SYM_CURSOR_D jr .got_cursor_tile_2 .cannot_scroll pop de - ld a, $01 - ld [wcecd], a + ld a, TRUE + ld [wUnableToScrollDown], a ld a, [wCursorAlternateTile] .got_cursor_tile_2 ld b, 19 ; x coord @@ -6714,7 +6714,7 @@ CreateCardSetListAndInitListCoords: ; a6a0 (2:66a0) push af call .GetEntryPrefix call CreateCardSetList - ld a, MAX_CARD_ALBUM_VISIBLE_CARDS + ld a, NUM_CARD_ALBUM_VISIBLE_CARDS ld [wNumVisibleCardListEntries], a lb de, 2, 4 ld hl, wCardListCoords @@ -6853,14 +6853,14 @@ PrintCardSetListEntries: ; a6fa (2:66fa) or a jr z, .no_down_cursor pop de - xor a - ld [wcecd], a + xor a ; FALSE + ld [wUnableToScrollDown], a ld a, SYM_CURSOR_D jr .got_down_cursor_tile .no_down_cursor pop de - ld a, $01 - ld [wcecd], a + ld a, TRUE + ld [wUnableToScrollDown], a ld a, SYM_BOX_BTM_R .got_down_cursor_tile ld b, 19 @@ -7258,7 +7258,7 @@ HandleCardAlbumScreen: ; a913 (2:6913) db 4 ; y pos db 2 ; y spacing db 0 ; x spacing - db MAX_CARD_ALBUM_VISIBLE_CARDS ; num entries + db NUM_CARD_ALBUM_VISIBLE_CARDS ; num entries db SYM_CURSOR_R ; visible cursor tile db SYM_SPACE ; invisible cursor tile dw NULL ; wCardListHandlerFunction @@ -7783,15 +7783,20 @@ Data_adf5: ; adf5 (2:6df5) dw NULL ; wCardListHandlerFunction ; 0xadfe -; hl = ? -; de = deck -Func_adfe: ; adfe (2:6dfe) +; handles printing and player input +; in the card confirmation list shown +; when cards are missing for some deck configuration +; hl = deck name +; de = deck cards +HandleDeckMissingCardsList: ; adfe (2:6dfe) +; read deck name from hl and cards from de push de ld de, wCurDeckName call CopyListFromHLToDEInSRAM pop de ld hl, wCurDeckCards call CopyDeckFromSRAM + ld a, NUM_FILTERS ld hl, wCardFilterCounts call ClearNBytesFromHL @@ -7799,33 +7804,34 @@ Func_adfe: ; adfe (2:6dfe) ld [wTotalCardCount], a ld hl, wCardFilterCounts ld [hl], a - call .Func_ae21 + call .HandleList ; can skip call and fallthrough instead ret -.Func_ae21 +.HandleList call SortCurDeckCardsByID call CreateCurDeckUniqueCardList xor a ld [wCardListVisibleOffset], a .loop - ld hl, .Data_ae91 + ld hl, .DeckConfirmationCardSelectionParams call InitCardSelectionParams ld a, [wNumUniqueCards] ld [wNumCardListEntries], a cp $05 - jr c, .asm_ae3d + jr c, .got_num_positions ld a, $05 -.asm_ae3d +.got_num_positions ld [wCardListNumCursorPositions], a ld [wNumVisibleCardListEntries], a - call .Func_aeb9 - ld hl, wcfda + call .PrintTitleAndList + ld hl, wCardConfirmationText ld a, [hli] ld h, [hl] ld l, a call DrawWideTextBox_PrintText - ld hl, .Func_ae9a +; set card update function + ld hl, .CardListUpdateFunction ld d, h ld a, l ld hl, wCardListUpdateFunction @@ -7837,13 +7843,14 @@ Func_adfe: ; adfe (2:6dfe) .loop_input call DoFrame call HandleDeckCardSelectionList - jr c, .asm_ae89 + jr c, .selection_made call HandleLeftRightInCardList jr c, .loop_input ldh a, [hDPadHeld] and START jr z, .loop_input -.asm_ae70 + +.open_card_pge ld a, $01 call PlaySFXConfirmOrCancel ld a, [wCardListCursorPos] @@ -7859,13 +7866,13 @@ Func_adfe: ; adfe (2:6dfe) call OpenCardPageFromCardList jr .loop -.asm_ae89 +.selection_made ld a, [hffb3] cp $ff ret z - jr .asm_ae70 + jr .open_card_pge -.Data_ae91 +.DeckConfirmationCardSelectionParams db 0 ; x pos db 3 ; y pos db 2 ; y spacing @@ -7875,13 +7882,13 @@ Func_adfe: ; adfe (2:6dfe) db SYM_SPACE ; invisible cursor tile dw NULL ; wCardListHandlerFunction -.Func_ae9a +.CardListUpdateFunction ld hl, hffb0 ld [hl], $01 - call .Func_aed3 + call .PrintDeckIndexAndName ld de, $10e call InitTextPrinting - ld hl, wcfda + ld hl, wCardConfirmationText ld a, [hli] ld h, [hl] ld l, a @@ -7890,8 +7897,8 @@ Func_adfe: ; adfe (2:6dfe) ld [hl], $00 jp PrintConfirmationCardList -.Func_aeb9 - call .Func_aec9 +.PrintTitleAndList + call .ClearScreenAndPrintDeckTitle lb de, 3, 3 ld hl, wCardListCoords ld [hl], e @@ -7900,16 +7907,18 @@ Func_adfe: ; adfe (2:6dfe) call PrintConfirmationCardList ret -.Func_aec9 +.ClearScreenAndPrintDeckTitle call EmptyScreenAndLoadFontDuelAndHandCardsIcons - call .Func_aed3 + call .PrintDeckIndexAndName call EnableLCD ret -.Func_aed3 +; prints text in the form "X. deck" +; where X is the deck index in the list +.PrintDeckIndexAndName ld a, [wCurDeckName] or a - ret z + ret z ; not a valid deck ld de, $1 call InitTextPrinting ld a, [wCurDeck] @@ -7927,7 +7936,7 @@ Func_adfe: ; adfe (2:6dfe) call CopyListFromHLToDE ld hl, wDefaultText call GetTextLengthInTiles - ld b, $00 + ld b, $0 ld hl, wDefaultText add hl, bc ld d, h @@ -8288,124 +8297,138 @@ Func_b177: ; b177 (2:7177) dw Func_bc7a ; 0xb19d -Func_b19d: ; b19d (2:719d) +HandleDeckSaveMachineMenu: ; b19d (2:719d) xor a ld [wCardListVisibleOffset], a ldtx de, DeckSaveMachineText - ld hl, wd0a2 + ld hl, wDeckMachineTitleText ld [hl], e inc hl ld [hl], d - call Func_b379 - ld a, $3c - ld [wd0a5], a + call ClearScreenAndDrawDeckMachineScreen + ld a, NUM_DECK_SAVE_MACHINE_SLOTS + ld [wNumDeckMachineEntries], a + xor a -.asm_b1b3 - ld hl, Data_b6fb +.wait_input + ld hl, DeckMachineSelectionParams call InitCardSelectionParams - call Func_b704 + call DrawListScrollArrows call PrintNumSavedDecks ldtx hl, PleaseSelectDeckText call DrawWideTextBox_PrintText ldtx de, PleaseSelectDeckText - call Func_b285 - call Func_b29f - jr c, .asm_b1b3 + call InitDeckMachineDrawingParams + call HandleDeckMachineSelection + jr c, .wait_input cp $ff - ret z + ret z ; operation cancelled + ; get the index of selected deck ld b, a ld a, [wCardListVisibleOffset] add b - ld [wd088], a + ld [wSelectedDeckMachineEntry], a + call ResetCheckMenuCursorPositionAndBlink call DrawWideTextBox - ld hl, Unknown_b274 + ld hl, .DeckMachineMenuData call PlaceTextItems -.asm_b1e7 +.wait_input_submenu call DoFrame call HandleCheckMenuInput - jp nc, .asm_b1e7 + jp nc, .wait_input_submenu cp $ff - jr nz, .asm_b1fa - ld a, [wd086] - jp .asm_b1b3 + jr nz, .submenu_option_selected + ; return from submenu + ld a, [wTempDeckMachineCursorPos] + jp .wait_input -.asm_b1fa +.submenu_option_selected ld a, [wCheckMenuCursorYPosition] sla a ld hl, wCheckMenuCursorXPosition add [hl] or a - jr nz, .asm_b22c - call Func_b35b - jr nc, .asm_b216 - call Func_b592 - ld a, [wd086] - jp c, .asm_b1b3 - jr .asm_b25e + jr nz, .ok_1 -.asm_b216 +; Save a Deck + call CheckIfSelectedDeckMachineEntryIsEmpty + jr nc, .prompt_ok_if_deleted + call SaveDeckInDeckSaveMachine + ld a, [wTempDeckMachineCursorPos] + jp c, .wait_input + jr .return_to_list +.prompt_ok_if_deleted ldtx hl, OKIfFileDeletedText call YesOrNoMenuWithText - ld a, [wd086] - jr c, .asm_b1b3 - call Func_b592 - ld a, [wd086] - jp c, .asm_b1b3 - jr .asm_b25e - -.asm_b22c + ld a, [wTempDeckMachineCursorPos] + jr c, .wait_input + call SaveDeckInDeckSaveMachine + ld a, [wTempDeckMachineCursorPos] + jp c, .wait_input + jr .return_to_list + +.ok_1 cp $1 - jr nz, .asm_b24c - call Func_b35b - jr c, .asm_b240 + jr nz, .ok_2 + +; Delete a Deck + call CheckIfSelectedDeckMachineEntryIsEmpty + jr c, .is_empty call TryDeleteSavedDeck - ld a, [wd086] - jp c, .asm_b1b3 - jr .asm_b25e + ld a, [wTempDeckMachineCursorPos] + jp c, .wait_input + jr .return_to_list -.asm_b240 +.is_empty ld hl, WaitForVBlank call DrawWideTextBox_WaitForInput - ld a, [wd086] - jp .asm_b1b3 + ld a, [wTempDeckMachineCursorPos] + jp .wait_input -.asm_b24c +.ok_2 cp $2 - jr nz, .asm_b273 - call Func_b35b - jr c, .asm_b240 - call Func_b7c6 - ld a, [wd086] - jp nc, .asm_b1b3 - -.asm_b25e - ld a, [wd087] + jr nz, .cancel + +; Build a Deck + call CheckIfSelectedDeckMachineEntryIsEmpty + jr c, .is_empty + call TryBuildDeckMachineDeck + ld a, [wTempDeckMachineCursorPos] + jp nc, .wait_input + +.return_to_list + ld a, [wTempCardListVisibleOffset] ld [wCardListVisibleOffset], a - call Func_b379 - call Func_b704 + call ClearScreenAndDrawDeckMachineScreen + call DrawListScrollArrows call PrintNumSavedDecks - ld a, [wd086] - jp .asm_b1b3 + ld a, [wTempDeckMachineCursorPos] + jp .wait_input -.asm_b273 +.cancel ret -Unknown_b274: ; b274 (2:7274) +.DeckMachineMenuData textitem 2, 14, SaveADeckText textitem 12, 14, DeleteADeckText textitem 2, 16, BuildADeckText textitem 12, 16, CancelText db $ff +; 0xb285 -Func_b285: ; b285 (2:7285) - ld a, $05 +; sets the number of cursor positions for deck machine menu, +; sets the text ID to show given by de +; and sets DrawDeckMachineScreen as the update function +; de = text ID +InitDeckMachineDrawingParams: ; b285 (2:7285) + ld a, NUM_DECK_MACHINE_SLOTS ld [wCardListNumCursorPositions], a - ld hl, wd0a7 + ld hl, wDeckMachineText ld [hl], e inc hl ld [hl], d - ld hl, Func_b403 + ld hl, DrawDeckMachineScreen ld d, h ld a, l ld hl, wCardListUpdateFunction @@ -8416,36 +8439,44 @@ Func_b285: ; b285 (2:7285) ret ; 0xb29f -Func_b29f: ; b29f (2:729f) +; handles player input inside the Deck Machine screen +; the Start button opens up the deck confirmation menu +; and returns carry +; otherwise, returns no carry and selection made in a +HandleDeckMachineSelection: ; b29f (2:729f) call DoFrame call HandleDeckCardSelectionList - jr c, .asm_b303 - call .Func_b317 - jr c, Func_b29f ; loop back to start + jr c, .selection_made + + call .HandleListJumps + jr c, HandleDeckMachineSelection ; jump back to start ldh a, [hDPadHeld] and START - jr z, Func_b29f ; loop back to start + jr z, HandleDeckMachineSelection ; jump back to start ; start btn ld a, [wCardListVisibleOffset] - ld [wd087], a + ld [wTempCardListVisibleOffset], a ld b, a ld a, [wCardListCursorPos] - ld [wd086], a + ld [wTempDeckMachineCursorPos], a add b ld c, a inc a or $80 ld [wCurDeck], a + + ; get pointer to selected deck cards + ; and if it's an empty deck, jump to start sla c - ld b, $00 + ld b, $0 ld hl, wMachineDeckPtrs add hl, bc ld a, [hli] ld h, [hl] ld l, a push hl - ld bc, $18 + ld bc, DECK_NAME_SIZE add hl, bc ld d, h ld e, l @@ -8454,32 +8485,36 @@ Func_b29f: ; b29f (2:729f) call DisableSRAM pop hl or a - jr z, Func_b29f ; loop back to start + jr z, HandleDeckMachineSelection ; jump back to start +; show deck confirmation screen with deck cards +; and return carry set ld a, $01 call PlaySFXConfirmOrCancel call OpenDeckConfirmationMenu - ld a, [wd087] + ld a, [wTempCardListVisibleOffset] ld [wCardListVisibleOffset], a - call Func_b379 - call Func_b704 + call ClearScreenAndDrawDeckMachineScreen + call DrawListScrollArrows call PrintNumSavedDecks - ld a, [wd086] + ld a, [wTempDeckMachineCursorPos] ld [wCardListCursorPos], a scf ret -.asm_b303 +.selection_made call DrawListCursor_Visible ld a, [wCardListVisibleOffset] - ld [wd087], a + ld [wTempCardListVisibleOffset], a ld a, [wCardListCursorPos] - ld [wd086], a + ld [wTempDeckMachineCursorPos], a ld a, [hffb3] or a ret -.Func_b317 +; handles right and left input for jumping several entries at once +; returns carry if jump was made +.HandleListJumps ld a, [wCardListVisibleOffset] ld c, a ldh a, [hDPadHeld] @@ -8492,60 +8527,64 @@ Func_b29f: ; b29f (2:729f) .d_right ld a, [wCardListVisibleOffset] - add $05 + add NUM_DECK_MACHINE_SLOTS ld b, a - add $05 - ld hl, wd0a5 + add NUM_DECK_MACHINE_SLOTS + ld hl, wNumDeckMachineEntries cp [hl] - jr c, .asm_b347 - ld a, [wd0a5] - sub $05 + jr c, .got_new_pos + ld a, [wNumDeckMachineEntries] + sub NUM_DECK_MACHINE_SLOTS ld b, a - jr .asm_b347 + jr .got_new_pos .d_left ld a, [wCardListVisibleOffset] - sub $05 + sub NUM_DECK_MACHINE_SLOTS ld b, a - jr nc, .asm_b347 - ld b, $00 + jr nc, .got_new_pos + ld b, 0 ; first entry -.asm_b347 +.got_new_pos ld a, b ld [wCardListVisibleOffset], a cp c - jr z, .asm_b359 + jr z, .set_carry + ; play SFX if jump was made + ; and update UI ld a, SFX_01 call PlaySFX - call Func_b403 + call DrawDeckMachineScreen call PrintNumSavedDecks -.asm_b359 +.set_carry scf ret ; 0xb35b -Func_b35b: ; b35b (2:735b) - ld a, [wd088] +; returns carry if deck corresponding to the +; entry selected in the Deck Machine menu is empty +CheckIfSelectedDeckMachineEntryIsEmpty: ; b35b (2:735b) + ld a, [wSelectedDeckMachineEntry] sla a ld l, a - ld h, $00 + ld h, $0 ld bc, wMachineDeckPtrs add hl, bc ld a, [hli] ld h, [hl] ld l, a - ld bc, $18 + ld bc, DECK_NAME_SIZE add hl, bc call EnableSRAM ld a, [hl] call DisableSRAM or a - ret nz + ret nz ; is valid scf - ret + ret; is empty ; 0xb379 -Func_b379: ; b379 (2:7379) +ClearScreenAndDrawDeckMachineScreen: ; b379 (2:7379) call Set_OBJ_8x8 xor a ld [wTileMapFill], a @@ -8561,18 +8600,19 @@ Func_b379: ; b379 (2:7379) lb de, 0, 0 lb bc, 20, 13 call DrawRegularTextBox - call Func_b3b3 + call SetDeckMachineTitleText call GetSavedDeckPointers - call Func_b3e5 + call PrintVisibleDeckMachineEntries call GetSavedDeckCount call EnableLCD ret ; 0xb3b3 -Func_b3b3: ; b3b3 (2:73b3) +; prints wDeckMachineTitleText as title text +SetDeckMachineTitleText: ; b3b3 (2:73b3) lb de, 1, 0 call InitTextPrinting - ld hl, wd0a2 + ld hl, wDeckMachineTitleText ld a, [hli] ld h, [hl] ld l, a @@ -8605,50 +8645,57 @@ GetSavedDeckPointers: ; b3c3 (2:73c3) ret ; 0xb3e5 -Func_b3e5: ; b3e5 (2:73e5) +; given the cursor position in the deck machine menu +; prints the deck names of all entries that are visible +PrintVisibleDeckMachineEntries: ; b3e5 (2:73e5) ld a, [wCardListVisibleOffset] - ld de, $202 - ld b, $05 -.asm_b3ed + lb de, 2, 2 + ld b, NUM_DECK_MACHINE_VISIBLE_DECKS +.loop push af push bc push de - call Func_b424 + call PrintDeckMachineEntry pop de pop bc pop af - ret c + ret c ; jump never made? dec b - ret z + ret z ; no more entries inc a inc e inc e - jr .asm_b3ed + jr .loop ; 0xb3fe -Func_b3fe: ; b3fe (2:73fe) - call Func_b704 - jr Func_b3e5 +UpdateDeckMachineScrollArrowsAndEntries: ; b3fe (2:73fe) + call DrawListScrollArrows + jr PrintVisibleDeckMachineEntries ; 0xb403 -Func_b403: ; b403 (2:7403) - call Func_b704 +DrawDeckMachineScreen: ; b403 (2:7403) + call DrawListScrollArrows ld hl, hffb0 ld [hl], $01 - call Func_b3b3 + call SetDeckMachineTitleText lb de, 1, 14 call InitTextPrinting - ld hl, wd0a7 + ld hl, wDeckMachineText ld a, [hli] ld h, [hl] ld l, a call ProcessTextFromID ld hl, hffb0 ld [hl], $00 - jr Func_b3e5 + jr PrintVisibleDeckMachineEntries ; 0xb424 -Func_b424: ; b424 (2:7424) +; prints the deck name of the deck corresponding +; to index in register a, from wMachineDeckPtrs +; also checks whether the deck can be built +; either by dismantling other decks or not, +; and places the corresponding symbol next to the name +PrintDeckMachineEntry: ; b424 (2:7424) ld b, a push bc ld hl, wDefaultText @@ -8661,10 +8708,13 @@ Func_b424: ; b424 (2:7424) ld hl, wDefaultText call ProcessText pop af + +; get the deck corresponding to input index +; and append its name to wDefaultText push af sla a ld l, a - ld h, $00 + ld h, $0 ld bc, wMachineDeckPtrs add hl, bc ld a, [hli] @@ -8687,7 +8737,7 @@ Func_b424: ; b424 (2:7424) ld d, 13 inc e call InitTextPrinting - ld hl, Text_b4d4 + ld hl, .text call ProcessText scf ret @@ -8697,34 +8747,39 @@ Func_b424: ; b424 (2:7424) push bc ld d, 18 call InitTextPrinting - ld a, $0 + +; print the symbol hat symbolizes whether the deck can +; be built, or if another deck has to be dismantled to build it + ld a, $0 ; no decks dismantled call CheckIfCanBuildSavedDeck pop bc ld hl, wDefaultText - jr c, .asm_b482 - lb de, 3, "FW3_○" + jr c, .cannot_build + lb de, 3, "FW3_○" ; can build jr .asm_b4c2 - -.asm_b482 +.cannot_build push bc ld a, ALL_DECKS call CheckIfCanBuildSavedDeck - jr c, .asm_b490 + jr c, .cannot_build_at_all pop bc - lb de, 3, "FW3_❄" + lb de, 3, "FW3_❄" ; can build by dismantling jr .asm_b4c2 -.asm_b490 - lb de, 0, "FW0_✕" +.cannot_build_at_all + lb de, 0, "FW0_✕" ; cannot build even by dismantling call Func_22ca pop bc pop de + +; place in wDefaultText the number of cards +; that are needed in order to build the deck push bc ld d, 17 inc e call InitTextPrinting pop bc - call Func_b4e1 + call .GetNumCardsMissingToBuildDeck call CalculateOnesAndTensDigits ld hl, wOnesAndTensPlace ld a, [hli] @@ -8750,13 +8805,12 @@ Func_b424: ; b424 (2:7424) ld d, 13 inc e call InitTextPrinting - ld hl, Text_b4d4 + ld hl, .text call ProcessText or a ret -; 0xb4d4 -Text_b4d4: ; b4d4 (2:74d4) +.text db TX_SYMBOL, TX_END db TX_SYMBOL, TX_END db TX_SYMBOL, TX_END @@ -8764,14 +8818,18 @@ Text_b4d4: ; b4d4 (2:74d4) db TX_SYMBOL, TX_END db TX_SYMBOL, TX_END done -; 0xb4e1 -Func_b4e1: ; b4e1 (2:74e1) +; outputs in a the number of cards that the player does not own +; in order to build the deck entry from wMachineDeckPtrs +; given in register b +.GetNumCardsMissingToBuildDeck push bc call SafelySwitchToSRAM0 call CreateCardCollectionListWithDeckCards call SafelySwitchToTempSRAMBank pop bc + +; get address to cards for the corresponding deck entry sla b ld c, b ld b, $00 @@ -8780,34 +8838,35 @@ Func_b4e1: ; b4e1 (2:74e1) ld a, [hli] ld h, [hl] ld l, a - ld bc, $18 + ld bc, DECK_NAME_SIZE add hl, bc + call EnableSRAM ld de, wTempCardCollection - ld bc, $0 -.asm_b505 + lb bc, 0, 0 +.loop inc b ld a, DECK_SIZE cp b - jr c, .asm_b520 + jr c, .done ld a, [hli] push hl ld l, a ld h, $00 add hl, de ld a, [hl] - and $7f + and CARD_COUNT_MASK or a - jr z, .asm_b51c + jr z, .none dec a ld [hl], a pop hl - jr .asm_b505 -.asm_b51c + jr .loop +.none inc c pop hl - jr .asm_b505 -.asm_b520 + jr .loop +.done ld a, c call DisableSRAM ret @@ -8859,43 +8918,53 @@ PrintNumSavedDecks: ; b545 (2:7545) INCROM $b568, $b592 -Func_b592: ; b592 (2:7592) - ld a, $ff +; handles player choice in what deck to save +; in the Deck Save Machine +; assumes the slot to save was selected and +; is stored in wSelectedDeckMachineEntry +; if operation was successful, return carry +SaveDeckInDeckSaveMachine: ; b592 (2:7592) + ld a, ALL_DECKS call DrawDecksScreen xor a -.asm_b598 +.wait_input ld hl, DeckMachineMenuParameters call InitializeMenuParameters ldtx hl, ChooseADeckToSaveText call DrawWideTextBox_PrintText -.loop_input +.wait_submenu_input call DoFrame call HandleStartButtonInDeckSelectionMenu - jr c, .asm_b598 + jr c, .wait_input call HandleMenuInput - jp nc, .loop_input ; can be jr + jp nc, .wait_submenu_input ; can be jr ldh a, [hCurMenuItem] cp $ff - ret z + ret z ; operation cancelled ld [wCurDeck], a call CheckIfCurDeckIsValid - jp nc, .Func_b5c8 + jp nc, .SaveDeckInSelectedEntry ; can be jr + ; is an empty deck call PrintThereIsNoDeckHereText ld a, [wCurDeck] - jr .asm_b598 + jr .wait_input -.Func_b5c8 +; overwrites data in the selected deck in SRAM +; with the deck that was chosen, in wCurDeck +; then returns carry +.SaveDeckInSelectedEntry call GetPointerToDeckName call GetSelectedSavedDeckPtr ld b, DECK_STRUCT_SIZE call EnableSRAM call CopyNBytesFromHLToDE call DisableSRAM - call Func_b379 - call Func_b704 + + call ClearScreenAndDrawDeckMachineScreen + call DrawListScrollArrows call PrintNumSavedDecks - ld a, [wd086] - ld hl, Data_b6fb + ld a, [wTempDeckMachineCursorPos] + ld hl, DeckMachineSelectionParams call InitCardSelectionParams call DrawListCursor_Visible call GetPointerToDeckName @@ -8921,11 +8990,11 @@ DeckMachineMenuParameters: ; b609 (2:7609) ; 0xb611 ; outputs in de pointer of saved deck -; corresponding to index in wd088 +; corresponding to index in wSelectedDeckMachineEntry GetSelectedSavedDeckPtr: ; b611 (2:7611) push af push hl - ld a, [wd088] + ld a, [wSelectedDeckMachineEntry] sla a ld e, a ld d, $00 @@ -9119,7 +9188,7 @@ TryDeleteSavedDeck: ; b6ca (2:76ca) ret ; 0xb6fb -Data_b6fb: ; b6fb (2:76fb) +DeckMachineSelectionParams: ; b6fb (2:76fb) db 1 ; x pos db 2 ; y pos db 2 ; y spacing @@ -9129,31 +9198,31 @@ Data_b6fb: ; b6fb (2:76fb) db SYM_SPACE ; invisible cursor tile dw NULL ; wCardListHandlerFunction -Func_b704: ; b704 (2:7704) +DrawListScrollArrows: ; b704 (2:7704) ld a, [wCardListVisibleOffset] or a - jr z, .asm_b70e + jr z, .no_up_cursor ld a, SYM_CURSOR_U jr .got_tile_1 -.asm_b70e +.no_up_cursor ld a, SYM_BOX_RIGHT .got_tile_1 lb bc, 19, 1 call WriteByteToBGMap0 ld a, [wCardListVisibleOffset] - add $06 + add NUM_DECK_MACHINE_VISIBLE_DECKS + 1 ld b, a - ld a, [wd0a5] + ld a, [wNumDeckMachineEntries] cp b - jr c, .asm_b72a - xor a - ld [wcecd], a + jr c, .no_down_cursor + xor a ; FALSE + ld [wUnableToScrollDown], a ld a, SYM_CURSOR_D jr .got_tile_2 -.asm_b72a - ld a, $01 - ld [wcecd], a +.no_down_cursor + ld a, TRUE + ld [wUnableToScrollDown], a ld a, SYM_BOX_RIGHT .got_tile_2 lb bc, 19, 11 @@ -9161,11 +9230,13 @@ Func_b704: ; b704 (2:7704) ret ; 0xb738 -Func_b738: ; b738 (2:7738) +; handles the deck menu for when the player +; needs to make space for new deck to build +HandleDismantleDeckToMakeSpace: ; b738 (2:7738) ldtx hl, YouMayOnlyCarry4DecksText call DrawWideTextBox_WaitForInput call SafelySwitchToSRAM0 - ld a, $ff + ld a, ALL_DECKS call DrawDecksScreen xor a .init_menu_params @@ -9181,12 +9252,13 @@ Func_b738: ; b738 (2:7738) jp nc, .loop_input ; can be jr ldh a, [hCurMenuItem] cp $ff - jr nz, .asm_b76c + jr nz, .selected_deck + ; operation was cancelled call SafelySwitchToTempSRAMBank scf ret -.asm_b76c +.selected_deck ld [wCurDeck], a ldtx hl, DismantleThisDeckText call YesOrNoMenuWithText @@ -9197,26 +9269,28 @@ Func_b738: ; b738 (2:7738) .dismantle call GetPointerToDeckName push hl - ld de, wd089 + ld de, wDismantledDeckName call EnableSRAM call CopyListFromHLToDE pop hl push hl - ld bc, $18 + ld bc, DECK_NAME_SIZE add hl, bc call AddDeckToCollection pop hl ld a, DECK_STRUCT_SIZE call ClearNBytesFromHL call DisableSRAM - ld a, $ff + + ; redraw deck screen + ld a, ALL_DECKS call DrawDecksScreen ld a, [wCurDeck] ld hl, DeckMachineMenuParameters call InitializeMenuParameters call DrawCursor2 call SafelySwitchToTempSRAMBank - ld hl, wd089 + ld hl, wDismantledDeckName call CopyDeckName xor a ld [wTxRam2 + 0], a @@ -9227,79 +9301,92 @@ Func_b738: ; b738 (2:7738) ret ; 0xb7c6 -Func_b7c6: ; b7c6 (2:77c6) - ld a, [wd088] +; tries to build the deck in wSelectedDeckMachineEntry +; will check if can be built with or without dismantling +; prompts the player in case a deck has to be dismantled +; or, if it's impossible to build deck, shows missing cards list +TryBuildDeckMachineDeck: ; b7c6 (2:77c6) + ld a, [wSelectedDeckMachineEntry] ld b, a push bc ld a, $0 call CheckIfCanBuildSavedDeck pop bc - jr nc, .asm_b7f3 + jr nc, .build_deck ld a, ALL_DECKS call CheckIfCanBuildSavedDeck - jr c, .asm_b7ea + jr c, .do_not_own_all_cards_needed + ; can only be built by dismantling some deck ldtx hl, ThisDeckCanOnlyBeBuiltIfYouDismantleText call DrawWideTextBox_WaitForInput - call Func_b87d - jr nc, .asm_b7f3 + call .DismantleDecksNeededToBuild + jr nc, .build_deck + ; player chose not to dismantle -.asm_b7e5 +.set_carry_and_return ld a, [wCardListCursorPos] scf ret -.asm_b7ea +.do_not_own_all_cards_needed ldtx hl, YouDoNotOwnAllCardsNeededToBuildThisDeckText call DrawWideTextBox_WaitForInput - jp Func_b8f4 + jp .ShowMissingCardList -.asm_b7f3 +.build_deck call EnableSRAM call SafelySwitchToSRAM0 call FindFirstEmptyDeckSlot call SafelySwitchToTempSRAMBank call DisableSRAM - jr nc, .asm_b80b - call Func_b738 - jr nc, .asm_b80b + jr nc, .got_deck_slot + call HandleDismantleDeckToMakeSpace + jr nc, .got_deck_slot scf ret -.asm_b80b - ld [wd08a + $17], a - ld a, [wd088] +.got_deck_slot + ld [wDeckSlotForNewDeck], a + ld a, [wSelectedDeckMachineEntry] ld c, a - ld b, $00 + ld b, $0 sla c ld hl, wMachineDeckPtrs add hl, bc ld a, [hli] ld h, [hl] ld l, a - ld de, wc000 + + ; copy deck to buffer + ld de, wDeckToBuild ld b, DECK_STRUCT_SIZE call EnableSRAM call CopyNBytesFromHLToDE - ld hl, wc000 + $18 + ; remove the needed cards from collection + ld hl, wDeckToBuild + DECK_NAME_SIZE call SafelySwitchToSRAM0 call DecrementDeckCardsInCollection - ld a, [wd08a + $17] + + ; copy the deck cards from the buffer + ; to the deck slot that was chosen + ld a, [wDeckSlotForNewDeck] ld l, a ld h, DECK_STRUCT_SIZE call HtimesL - ld bc, sDeck1Name + ld bc, sBuiltDecks add hl, bc ld d, h ld e, l - ld hl, wc000 + ld hl, wDeckToBuild ld b, DECK_STRUCT_SIZE call CopyNBytesFromHLToDE call DisableSRAM - ld a, $ff + ; draw Decks screen + ld a, ALL_DECKS call DrawDecksScreen - ld a, [wd08a + $17] + ld a, [wDeckSlotForNewDeck] ld [wCurDeck], a ld hl, DeckMachineMenuParameters call InitializeMenuParameters @@ -9309,7 +9396,6 @@ Func_b7c6: ; b7c6 (2:77c6) call CopyDeckName call DisableSRAM call SafelySwitchToTempSRAMBank - xor a ld [wTxRam2 + 0], a ld [wTxRam2 + 1], a @@ -9317,10 +9403,15 @@ Func_b7c6: ; b7c6 (2:77c6) call DrawWideTextBox_WaitForInput scf ret -; 0xb87d -Func_b87d: ; b87d (2:787d) - farcall Func_1ba9a +; asks the player for confirmation to dismantle decks +; needed to build the selected deck from the Deck Save Machine +; returns carry set if player selected "no" +; if player selected "yes", dismantle decks +.DismantleDecksNeededToBuild +; shows Decks screen with the names +; of the decks to be dismantled + farcall CheckWhichDecksToDismantleToBuildSavedDeck call SafelySwitchToSRAM0 call DrawDecksScreen ldtx hl, DismantleTheseDecksText @@ -9333,32 +9424,33 @@ Func_b87d: ; b87d (2:787d) .yes call EnableSRAM - ld a, [wd0a6] - bit 0, a - jr z, .asm_b8a3 - ld a, $00 - call .Func_b8db -.asm_b8a3 - ld a, [wd0a6] - bit 1, a - jr z, .asm_b8af - ld a, $01 - call .Func_b8db -.asm_b8af - ld a, [wd0a6] - bit 2, a - jr z, .asm_b8bb - ld a, $02 - call .Func_b8db -.asm_b8bb - ld a, [wd0a6] - bit 3, a - jr z, .asm_b8c7 - ld a, $03 - call .Func_b8db -.asm_b8c7 + ld a, [wDecksToBeDismantled] + bit DECK_1_F, a + jr z, .deck_2 + ld a, DECK_1_F + call .DismantleDeck +.deck_2 + ld a, [wDecksToBeDismantled] + bit DECK_2_F, a + jr z, .deck_3 + ld a, DECK_2_F + call .DismantleDeck +.deck_3 + ld a, [wDecksToBeDismantled] + bit DECK_3_F, a + jr z, .deck_4 + ld a, DECK_3_F + call .DismantleDeck +.deck_4 + ld a, [wDecksToBeDismantled] + bit DECK_4_F, a + jr z, .done_dismantling + ld a, DECK_4_F + call .DismantleDeck + +.done_dismantling call DisableSRAM - ld a, [wd0a6] + ld a, [wDecksToBeDismantled] call DrawDecksScreen call SafelySwitchToTempSRAMBank ldtx hl, DismantledTheDeckText @@ -9366,27 +9458,33 @@ Func_b87d: ; b87d (2:787d) or a ret -.Func_b8db +; dismantles built deck given by a +; and adds its cards to the collection +; a = DECK_*_F to dismantle +.DismantleDeck ld l, a ld h, DECK_STRUCT_SIZE call HtimesL - ld bc, sDeck1Name + ld bc, sBuiltDecks add hl, bc push hl - ld bc, $18 + ld bc, DECK_NAME_SIZE add hl, bc call AddDeckToCollection pop hl ld a, DECK_STRUCT_SIZE call ClearNBytesFromHL ret -; 0xb8f4 -Func_b8f4: ; b8f4 (2:78f4) - ld a, [wd088] +; collects cards missing from player's collection +; and shows its confirmation list +.ShowMissingCardList +; copy saved deck card from SRAM to wCurDeckCards +; and make unique card list sorted by ID + ld a, [wSelectedDeckMachineEntry] ld [wCurDeck], a call GetSelectedSavedDeckPtr - ld hl, $18 + ld hl, DECK_NAME_SIZE add hl, de ld de, wCurDeckCards ld b, DECK_SIZE @@ -9397,92 +9495,122 @@ Func_b8f4: ; b8f4 (2:78f4) ld [wCurDeckCards + DECK_SIZE], a call SortCurDeckCardsByID call CreateCurDeckUniqueCardList + +; create collection card list, including +; the cards from all built decks ld a, ALL_DECKS call SafelySwitchToSRAM0 call CreateCardCollectionListWithDeckCards call SafelySwitchToTempSRAMBank - ld hl, wTempHandCardList + +; creates list in wFilteredCardList with +; cards that are missing to build this deck + ld hl, wUniqueDeckCardList ld de, wFilteredCardList -.asm_b92a +.loop_deck_configuration ld a, [hli] or a - jr z, .asm_b946 + jr z, .finish_missing_card_list ld b, a push bc push de push hl ld hl, wCurDeckCards - call Func_b960 + call .CheckIfCardIsMissing pop hl pop de pop bc - jr nc, .asm_b92a + jr nc, .loop_deck_configuration + ; this card is missing + ; store in wFilteredCardList this card ID + ; a number of times equal to the amount still needed ld c, a ld a, b -.asm_b93f +.loop_number_missing ld [de], a inc de dec c - jr nz, .asm_b93f - jr .asm_b92a -.asm_b946 - xor a + jr nz, .loop_number_missing + jr .loop_deck_configuration + +.finish_missing_card_list + xor a ; terminator byte ld [de], a + ldtx bc, TheseCardsAreNeededToBuildThisDeckText - ld hl, wcfda + ld hl, wCardConfirmationText ld a, c ld [hli], a ld a, b ld [hl], a + call GetSelectedSavedDeckPtr ld h, d ld l, e ld de, wFilteredCardList - call Func_adfe - jp Func_b7c6.asm_b7e5 -; 0xb960 - -Func_b960: ; b960 (2:7960) - call .Func_b976 - ld hl, wc000 + call HandleDeckMissingCardsList + jp .set_carry_and_return + +; checks if player has enough cards with ID given in register a +; in the collection to build the deck and, if not, returns +; carry set and outputs in a the difference +; a = card ID +; hl = deck cards +.CheckIfCardIsMissing + call .GetCardCountFromDeck + ld hl, wTempCardCollection push de - call .Func_b986 + call .GetCardCountFromCollection ld a, e pop de + + ; d = card count in deck + ; a = card count in collection cp d - jr c, .asm_b971 + jr c, .not_enough or a ret -.asm_b971 + +.not_enough +; needs more cards than player owns in collection +; return carry set and the number of cards needed ld e, a ld a, d sub e scf ret z -.Func_b976 +; returns in d the card count of card ID given in register a +; that is found in the card list in hl +; a = card ID +; hl = deck cards +.GetCardCountFromDeck push af ld e, a - ld d, $00 -.loop + ld d, 0 +.loop_deck_cards ld a, [hli] or a - jr z, .asm_b984 + jr z, .done_deck_cards cp e - jr nz, .loop + jr nz, .loop_deck_cards inc d - jr .loop -.asm_b984 + jr .loop_deck_cards +.done_deck_cards pop af ret -.Func_b986 +; returns in e the card count of card ID given in register a +; that is found in the card collection +; a = card ID +; hl = card collection +.GetCardCountFromCollection push af ld e, a - ld d, $00 + ld d, $0 add hl, de ld a, [hl] - and $7f + and CARD_COUNT_MASK ld e, a pop af ret @@ -9491,22 +9619,22 @@ Func_b960: ; b960 (2:7960) PrinterMenu_DeckConfiguration: ; b991 (2:7991) xor a ld [wCardListVisibleOffset], a - call Func_b379 + call ClearScreenAndDrawDeckMachineScreen ld a, DECK_SIZE - ld [wd0a5], a + ld [wNumDeckMachineEntries], a xor a .asm_b99e - ld hl, Data_b6fb + ld hl, DeckMachineSelectionParams call InitCardSelectionParams - call Func_b704 + call DrawListScrollArrows call PrintNumSavedDecks - ld hl, WaitForVBlank.lcd_off + ldtx hl, PleaseChooseDeckConfigurationToPrintText call DrawWideTextBox_PrintText - ld de, WaitForVBlank.lcd_off - call Func_b285 + ldtx de, PleaseChooseDeckConfigurationToPrintText + call InitDeckMachineDrawingParams .asm_b9b6 - call Func_b29f + call HandleDeckMachineSelection jr c, .asm_b99e cp $ff ret z @@ -9514,8 +9642,8 @@ PrinterMenu_DeckConfiguration: ; b991 (2:7991) ld b, a ld a, [wCardListVisibleOffset] add b - ld [wd088], a - call Func_b35b + ld [wSelectedDeckMachineEntry], a + call CheckIfSelectedDeckMachineEntryIsEmpty jr c, .asm_b9b6 call DrawWideTextBox ldtx hl, PrintThisDeckText @@ -9532,24 +9660,24 @@ PrinterMenu_DeckConfiguration: ; b991 (2:7991) xor a ; terminator byte for deck ld [wCurDeckCards + DECK_SIZE], a call SortCurDeckCardsByID - ld a, [wd088] + ld a, [wSelectedDeckMachineEntry] bank1call Func_7580 - call Func_b379 + call ClearScreenAndDrawDeckMachineScreen .no - ld a, [wd086] + ld a, [wTempDeckMachineCursorPos] ld [wCardListCursorPos], a jp .asm_b99e ; 0xba04 -Func_ba04: ; ba04 (2:7a04) - ld a, [wd0a9] - ld hl, Data_bb83 +HandleAutoDeckMenu: ; ba04 (2:7a04) + ld a, [wCurAutoDeckMachine] + ld hl, .DeckMachineTitleTextList sla a ld c, a ld b, $0 add hl, bc - ld de, wd0a2 + ld de, wDeckMachineTitleText ld a, [hli] ld [de], a inc de @@ -9557,42 +9685,45 @@ Func_ba04: ; ba04 (2:7a04) ld [de], a xor a ld [wCardListVisibleOffset], a - call Func_bb97 - ld a, $5 - ld [wd0a5], a + call .InitAutoDeckMenu + ld a, NUM_DECK_MACHINE_SLOTS + ld [wNumDeckMachineEntries], a xor a - ; fallthrough -Func_ba25: ; ba25 (2:7a25) +.please_select_deck ld hl, .MenuParameters call InitializeMenuParameters ldtx hl, PleaseSelectDeckText call DrawWideTextBox_PrintText - ld a, $5 + ld a, NUM_DECK_MACHINE_SLOTS ld [wCardListNumCursorPositions], a - ld hl, Func_b3fe + ld hl, UpdateDeckMachineScrollArrowsAndEntries ld d, h ld a, l ld hl, wCardListUpdateFunction ld [hli], a ld [hl], d -.asm_ba40 +.wait_input call DoFrame call HandleMenuInput - jr c, .asm_baa3 + jr c, .deck_selection_made + +; the following lines do nothing ldh a, [hDPadHeld] and D_UP | D_DOWN jr z, .asm_ba4e - .asm_ba4e + +; check whether to show deck confirmation list ldh a, [hDPadHeld] and START - jr z, .asm_ba40 + jr z, .wait_input + ld a, [wCardListVisibleOffset] - ld [wd087], a + ld [wTempCardListVisibleOffset], a ld b, a ld a, [wCurMenuItem] - ld [wd086], a + ld [wTempDeckMachineCursorPos], a add b ld c, a inc a @@ -9607,7 +9738,7 @@ Func_ba25: ; ba25 (2:7a25) ld h, [hl] ld l, a push hl - ld bc, $18 + ld bc, DECK_NAME_SIZE add hl, bc ld d, h ld e, l @@ -9615,75 +9746,80 @@ Func_ba25: ; ba25 (2:7a25) pop hl call SafelySwitchToSRAM0 or a - jr z, .asm_ba40 + jr z, .wait_input ; invalid deck + + ; show confirmation list ld a, $1 call PlaySFXConfirmOrCancel call SafelySwitchToSRAM1 call OpenDeckConfirmationMenu call SafelySwitchToSRAM0 - ld a, [wd087] + ld a, [wTempCardListVisibleOffset] ld [wCardListVisibleOffset], a - call Func_bb97 - ld a, [wd086] - jp Func_ba25 + call .InitAutoDeckMenu + ld a, [wTempDeckMachineCursorPos] + jp .please_select_deck -.asm_baa3 +.deck_selection_made call DrawCursor2 ld a, [wCardListVisibleOffset] - ld [wd087], a + ld [wTempCardListVisibleOffset], a ld a, [wCurMenuItem] - ld [wd086], a + ld [wTempDeckMachineCursorPos], a ldh a, [hCurMenuItem] cp $ff - jp z, .asm_bb0d - ld [wd088], a + jp z, .exit ; operation cancelled + ld [wSelectedDeckMachineEntry], a call ResetCheckMenuCursorPositionAndBlink xor a ld [wce5e], a call DrawWideTextBox - ld hl, Data_bb76 + ld hl, .DeckMachineMenuData call PlaceTextItems -.asm_bacc +.wait_submenu_input call DoFrame call HandleCheckMenuInput_YourOrOppPlayArea - jp nc, .asm_bacc + jp nc, .wait_submenu_input cp $ff - jr nz, .asm_badf - ld a, [wd086] - jp Func_ba25 + jr nz, .submenu_option_selected + ld a, [wTempDeckMachineCursorPos] + jp .please_select_deck -.asm_badf +.submenu_option_selected ld a, [wCheckMenuCursorYPosition] sla a ld hl, wCheckMenuCursorXPosition add [hl] or a jr nz, .asm_bb09 + +; Build a Deck call SafelySwitchToSRAM1 - call Func_b7c6 + call TryBuildDeckMachineDeck call SafelySwitchToSRAM0 - ld a, [wd086] - jp nc, Func_ba25 - ld a, [wd087] + ld a, [wTempDeckMachineCursorPos] + jp nc, .please_select_deck + ld a, [wTempCardListVisibleOffset] ld [wCardListVisibleOffset], a - call Func_bb97 - ld a, [wd086] - jp Func_ba25 + call .InitAutoDeckMenu + ld a, [wTempDeckMachineCursorPos] + jp .please_select_deck .asm_bb09 cp $1 - jr nz, .asm_bb12 -.asm_bb0d + jr nz, .read_the_instructions +.exit xor a ld [wTempBankSRAM], a ret -.asm_bb12 +.read_the_instructions +; show card confirmation list ld a, [wCardListVisibleOffset] - ld [wd087], a + ld [wTempCardListVisibleOffset], a ld b, a ld a, [wCurMenuItem] - ld [wd086], a + ld [wTempDeckMachineCursorPos], a add b ld c, a ld [wCurDeck], a @@ -9691,22 +9827,25 @@ Func_ba25: ; ba25 (2:7a25) ld b, $0 ld hl, wMachineDeckPtrs add hl, bc + + ; set the description text in text box push hl - ld hl, wd0aa + ld hl, wAutoDeckMachineTextDescriptions add hl, bc - ld bc, wcfda + ld bc, wCardConfirmationText ld a, [hli] ld [bc], a inc bc ld a, [hl] ld [bc], a pop hl + call SafelySwitchToSRAM1 ld a, [hli] ld h, [hl] ld l, a push hl - ld bc, $18 + ld bc, DECK_NAME_SIZE add hl, bc ld d, h ld e, l @@ -9714,18 +9853,20 @@ Func_ba25: ; ba25 (2:7a25) pop hl call SafelySwitchToSRAM0 or a - jp z, .asm_ba40 + jp z, .wait_input ; invalid deck + + ; show confirmation list ld a, $1 call PlaySFXConfirmOrCancel call SafelySwitchToSRAM1 xor a - call Func_adfe + call HandleDeckMissingCardsList call SafelySwitchToSRAM0 - ld a, [wd087] + ld a, [wTempCardListVisibleOffset] ld [wCardListVisibleOffset], a - call Func_bb97 - ld a, [wd086] - jp Func_ba25 + call .InitAutoDeckMenu + ld a, [wTempDeckMachineCursorPos] + jp .please_select_deck .MenuParameters db 1, 2 ; cursor x, cursor y @@ -9734,15 +9875,14 @@ Func_ba25: ; ba25 (2:7a25) db SYM_CURSOR_R ; cursor tile number db SYM_SPACE ; tile behind cursor dw NULL ; function pointer if non-0 -; 0xbb76 -Data_bb76: ; bb76 (2:7b76) +.DeckMachineMenuData textitem 2, 14, BuildADeckText textitem 12, 14, CancelText textitem 2, 16, ReadTheInstructionsText db $ff -Data_bb83: ; bb83 (2:7b83) +.DeckMachineTitleTextList tx FightingMachineText tx RockMachineText tx WaterMachineText @@ -9754,7 +9894,10 @@ Data_bb83: ; bb83 (2:7b83) tx AutoMachineText tx LegendaryMachineText -Func_bb97: ; bb97 (2:7b97) +; clears screen, loads the proper tiles +; prints the Auto Deck title and deck entries +; and creates the auto deck configurations +.InitAutoDeckMenu call Set_OBJ_8x8 xor a ld [wTileMapFill], a @@ -9772,26 +9915,27 @@ Func_bb97: ; bb97 (2:7b97) call DrawRegularTextBox ld de, $100 call InitTextPrinting - ld hl, wd0a2 + ld hl, wDeckMachineTitleText ld a, [hli] ld h, [hl] ld l, a call ProcessTextFromID call SafelySwitchToSRAM1 - farcall Func_1ba14 - call Func_bbe4 - call Func_b3e5 + farcall ReadAutoDeckConfiguration + call .CreateAutoDeckPointerList + call PrintVisibleDeckMachineEntries call SafelySwitchToSRAM0 call EnableLCD ret -; 0xbbe4 -Func_bbe4: ; bbe4 (2:7be4) +; writes to wMachineDeckPtrs the pointers +; to the Auto Decks in sAutoDecks +.CreateAutoDeckPointerList ld a, 2 * NUM_DECK_MACHINE_SLOTS ld hl, wMachineDeckPtrs call ClearNBytesFromHL ld de, wMachineDeckPtrs - ld hl, sSavedDecks + ld hl, sAutoDecks ld bc, DECK_STRUCT_SIZE ld a, NUM_DECK_MACHINE_SLOTS .loop @@ -9813,25 +9957,25 @@ Func_bc04: ; bc04 (2:7c04) xor a ld [wCardListVisibleOffset], a ldtx de, DeckSaveMachineText - ld hl, wd0a2 + ld hl, wDeckMachineTitleText ld [hl], e inc hl ld [hl], d - call Func_b379 + call ClearScreenAndDrawDeckMachineScreen ld a, DECK_SIZE - ld [wd0a5], a + ld [wNumDeckMachineEntries], a xor a .asm_bc1a - ld hl, Data_b6fb + ld hl, DeckMachineSelectionParams call InitCardSelectionParams - call Func_b704 + call DrawListScrollArrows call PrintNumSavedDecks ldtx hl, PleaseChooseADeckConfigurationToSendText call DrawWideTextBox_PrintText ldtx de, PleaseChooseADeckConfigurationToSendText - call Func_b285 + call InitDeckMachineDrawingParams .asm_bc32 - call Func_b29f + call HandleDeckMachineSelection jr c, .asm_bc1a cp $ff jr nz, .asm_bc3f @@ -9842,8 +9986,8 @@ Func_bc04: ; bc04 (2:7c04) ld b, a ld a, [wCardListVisibleOffset] add b - ld [wd088], a - call Func_b35b + ld [wSelectedDeckMachineEntry], a + call CheckIfSelectedDeckMachineEntryIsEmpty jr c, .asm_bc32 call GetSelectedSavedDeckPtr @@ -9875,24 +10019,24 @@ Func_bc7a: ; bc7a (2:7c7a) xor a ld [wCardListVisibleOffset], a ldtx de, DeckSaveMachineText - ld hl, wd0a2 + ld hl, wDeckMachineTitleText ld [hl], e inc hl ld [hl], d - call Func_b379 + call ClearScreenAndDrawDeckMachineScreen ld a, DECK_SIZE - ld [wd0a5], a + ld [wNumDeckMachineEntries], a xor a .asm_bc90 - ld hl, Data_b6fb + ld hl, DeckMachineSelectionParams call InitCardSelectionParams - call Func_b704 + call DrawListScrollArrows call PrintNumSavedDecks ldtx hl, PleaseChooseASaveSlotText call DrawWideTextBox_PrintText ldtx de, PleaseChooseASaveSlotText - call Func_b285 - call Func_b29f + call InitDeckMachineDrawingParams + call HandleDeckMachineSelection jr c, .asm_bc90 cp $ff jr nz, .asm_bcb5 @@ -9903,8 +10047,8 @@ Func_bc7a: ; bc7a (2:7c7a) ld b, a ld a, [wCardListVisibleOffset] add b - ld [wd088], a - call Func_b35b + ld [wSelectedDeckMachineEntry], a + call CheckIfSelectedDeckMachineEntryIsEmpty jr nc, .asm_bcc4 jr .asm_bcd1 .asm_bcc4 @@ -9926,11 +10070,11 @@ Func_bc7a: ; bc7a (2:7c7a) call CopyNBytesFromHLToDE call DisableSRAM call SaveGame - call Func_b379 + call ClearScreenAndDrawDeckMachineScreen ld a, [wCardListCursorPos] - ld hl, Data_b6fb + ld hl, DeckMachineSelectionParams call InitCardSelectionParams - call Func_b704 + call DrawListScrollArrows call PrintNumSavedDecks call DrawListCursor_Visible ld hl, wNameBuffer diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm index 5a9b86f..75e3081 100644 --- a/src/engine/bank03.asm +++ b/src/engine/bank03.asm @@ -3124,11 +3124,11 @@ ScriptCommand_OpenDeckMachine: ; d336 (3:5336) or a jr z, .asm_d360 dec a - ld [wd0a9], a - farcall Func_ba04 + ld [wCurAutoDeckMachine], a + farcall HandleAutoDeckMenu jr .asm_d364 .asm_d360 - farcall Func_b19d + farcall HandleDeckSaveMachineMenu .asm_d364 call ResumeSong call Func_c2d4 diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm index 89d7093..467af8c 100644 --- a/src/engine/bank06.asm +++ b/src/engine/bank06.asm @@ -4925,28 +4925,32 @@ KeyboardData_Deck: ; 1b019 (6:7019) db $0e, $12, $02 db $10, $0f, $01 -; unknown data. -; needs analyze. -; (6:70d6) - INCROM $1b0d6, $1ba14 + ds 4 ; empty -Func_1ba14: ; 1ba14 (6:7a14) +INCLUDE "data/auto_deck_card_lists.asm" +INCLUDE "data/auto_deck_machines.asm" + +; writes to sAutoDecks all the deck configurations +; from the Auto Deck Machine in wCurAutoDeckMachine +ReadAutoDeckConfiguration: ; 1ba14 (6:7a14) call EnableSRAM - ld a, [wd0a9] + ld a, [wCurAutoDeckMachine] ld l, a - ld h, $1e + ld h, 6 * NUM_DECK_MACHINE_SLOTS call HtimesL - ld bc, $78e8 + ld bc, AutoDeckMachineEntries add hl, bc - ld b, $00 -.asm_7a26 - call Func_1ba4c - call Func_1ba5b - call Func_1ba7d + ld b, 0 +.loop_decks + call .GetPointerToSRAMAutoDeck + call .ReadDeckConfiguration + call .ReadDeckName + + ; store deck description text ID push hl - ld de, wd0aa + ld de, wAutoDeckMachineTextDescriptions ld h, b - ld l, $02 + ld l, 2 call HtimesL add hl, de ld d, h @@ -4959,24 +4963,27 @@ Func_1ba14: ; 1ba14 (6:7a14) ld [de], a inc b ld a, b - cp $05 - jr nz, .asm_7a26 + cp NUM_DECK_MACHINE_SLOTS + jr nz, .loop_decks call DisableSRAM ret -Func_1ba4c: ; 1ba4c (6:7a4c) +; outputs in de the saved deck with index b +.GetPointerToSRAMAutoDeck push hl ld l, b ld h, DECK_STRUCT_SIZE call HtimesL - ld de, sSavedDecks + ld de, sAutoDecks add hl, de ld d, h ld e, l pop hl ret -Func_1ba5b: ; 1ba5b (6:7a5b) +; writes the deck configuration in SRAM +; by reading the given deck card list +.ReadDeckConfiguration push hl push bc push de @@ -4985,24 +4992,24 @@ Func_1ba5b: ; 1ba5b (6:7a5b) inc hl ld d, [hl] pop hl - ld bc, $0018 + ld bc, DECK_NAME_SIZE add hl, bc -.asm_7a67 +.loop_create_deck ld a, [de] inc de - ld b, a + ld b, a ; card count or a - jr z, .asm_7a77 + jr z, .done_create_deck ld a, [de] inc de - ld c, a -.asm_7a70 + ld c, a ; card ID +.loop_card_count ld [hl], c inc hl dec b - jr nz, .asm_7a70 - jr .asm_7a67 -.asm_7a77 + jr nz, .loop_card_count + jr .loop_create_deck +.done_create_deck pop de pop bc pop hl @@ -5010,87 +5017,104 @@ Func_1ba5b: ; 1ba5b (6:7a5b) inc hl ret -Func_1ba7d: ; 1ba7d (6:7a7d) +.ReadDeckName push hl push bc push de ld a, [hli] ld h, [hl] ld l, a - ld de, wd089 + ld de, wDismantledDeckName call CopyText pop hl - ld de, wd089 -.asm_7a8d + ld de, wDismantledDeckName +.loop_copy_name ld a, [de] ld [hli], a or a - jr z, .asm_7a95 + jr z, .done_copy_name inc de - jr .asm_7a8d -.asm_7a95 + jr .loop_copy_name +.done_copy_name pop bc pop hl inc hl inc hl ret -; farcall from 0xb87e(2:787d): [EF|06|9A|7A] -Func_1ba9a: ; 1ba9a (6:7a9a) +; tries out all combinations of dismantling the player's decks +; in order to build the deck in wSelectedDeckMachineEntry +; if none of the combinations work, return carry set +; otherwise, return in a which deck flags should be dismantled +CheckWhichDecksToDismantleToBuildSavedDeck: ; 1ba9a (6:7a9a) xor a - ld [wd0a6], a - ld a, $01 -.asm_7aa0 - call Func_1bae4 + ld [wDecksToBeDismantled], a + +; first check if it can be built by +; only dismantling a single deck + ld a, DECK_1 +.loop_single_built_decks + call .CheckIfCanBuild ret nc - sla a - cp $10 - jr z, .asm_7aac - jr .asm_7aa0 -.asm_7aac - ld a, $03 - call Func_1bae4 + sla a ; next deck + cp (1 << NUM_DECKS) + jr z, .two_deck_combinations + jr .loop_single_built_decks + +.two_deck_combinations +; next check all two deck combinations + ld a, DECK_1 | DECK_2 + call .CheckIfCanBuild ret nc - ld a, $05 - call Func_1bae4 + ld a, DECK_1 | DECK_3 + call .CheckIfCanBuild ret nc - ld a, $09 - call Func_1bae4 + ld a, DECK_1 | DECK_4 + call .CheckIfCanBuild ret nc - ld a, $06 - call Func_1bae4 + ld a, DECK_2 | DECK_3 + call .CheckIfCanBuild ret nc - ld a, $0a - call Func_1bae4 + ld a, DECK_2 | DECK_4 + call .CheckIfCanBuild ret nc - ld a, $0c - call Func_1bae4 + ld a, DECK_3 | DECK_4 + call .CheckIfCanBuild ret nc - ld a, $f7 -.asm_7ad2 - call Func_1bae4 + +; all but one deck combinations + ld a, $ff ^ DECK_4 +.loop_three_deck_combinations + call .CheckIfCanBuild ret nc sra a cp $ff - jr z, .asm_7ade - jr .asm_7ad2 -.asm_7ade - call Func_1bae4 + jr z, .all_decks + jr .loop_three_deck_combinations + +.all_decks +; finally check if can be built by dismantling all decks + call .CheckIfCanBuild ret nc + +; none of the combinations work scf ret -Func_1bae4: ; 1bae4 (6:7ae4) +; returns cary if wSelectedDeckMachineEntry cannot be built +; by dismantling the decks given by register a +; a = DECK_* flags +.CheckIfCanBuild push af - ld hl, wd088 + ld hl, wSelectedDeckMachineEntry ld b, [hl] farcall CheckIfCanBuildSavedDeck - jr c, .asm_7af5 + jr c, .cannot_build pop af - ld [wd0a6], a + ld [wDecksToBeDismantled], a or a ret -.asm_7af5 +.cannot_build pop af scf ret diff --git a/src/sram.asm b/src/sram.asm index a26c7b5..3b2b83c 100644 --- a/src/sram.asm +++ b/src/sram.asm @@ -44,6 +44,7 @@ sPlayerName:: ; a010 sCardCollection:: ; a100 ds $100 +sBuiltDecks:: sDeck1:: deck_struct sDeck1 ; a200 sDeck2:: deck_struct sDeck2 ; a254 sDeck3:: deck_struct sDeck3 ; a2a8 @@ -257,6 +258,8 @@ sCardPopNameList:: ; bb00 SECTION "SRAM1", SRAM +UNION + ; buffers used to temporary store gfx related data ; such as tiles or BG maps sGfxBuffer0:: ; a000 @@ -277,6 +280,25 @@ sGfxBuffer4:: ; b000 sGfxBuffer5:: ; b400 ds $400 +NEXTU + + ds $350 + +; buffer used to store the deck configuration +; from the Auto Deck Machines +; intentionally uses the same address as sSavedDecks +; since TryBuildDeckMachineDeck uses the same +; address in SRAM whether it's an auto deck or a saved deck +; the difference is whether SRAM0 or SRAM1 are loaded +sAutoDecks:: +sAutoDeck1:: deck_struct sAutoDeck1 ; a350 +sAutoDeck2:: deck_struct sAutoDeck2 ; a3a4 +sAutoDeck3:: deck_struct sAutoDeck3 ; a3f8 +sAutoDeck4:: deck_struct sAutoDeck4 ; a44c +sAutoDeck5:: deck_struct sAutoDeck5 ; a4a0 + +ENDU + SECTION "SRAM2", SRAM ds $18fe diff --git a/src/text/text3.asm b/src/text/text3.asm index bf23e60..ffe0f59 100644 --- a/src/text/text3.asm +++ b/src/text/text3.asm @@ -34,7 +34,7 @@ PrintThisCardYesNoText: ; 3c0cc (f:40cc) line " Yes No" done -Text0275: ; 3c0ef (f:40ef) +PleaseChooseDeckConfigurationToPrintText: ; 3c0ef (f:40ef) text "Please choose a Deck configuration" line "to print." done @@ -169,452 +169,452 @@ LegendaryMachineText: ; 3c4cb (f:44cb) text " Legendary Machine " done -Text0292: ; 3c4e3 (f:44e3) +AllFightingPokemonText: ; 3c4e3 (f:44e3) text "All Fighting Pokémon" done -Text0293: ; 3c4f9 (f:44f9) +BenchAttackText: ; 3c4f9 (f:44f9) text "Bench Attack" done -Text0294: ; 3c507 (f:4507) +BattleContestText: ; 3c507 (f:4507) text "Battle Contest" done -Text0295: ; 3c517 (f:4517) +HeatedBattleText: ; 3c517 (f:4517) text "Heated Battle" done -Text0296: ; 3c526 (f:4526) +FirstStrikeText: ; 3c526 (f:4526) text "First-Strike" done -Text0297: ; 3c534 (f:4534) +SqueakingMouseText: ; 3c534 (f:4534) text "Squeaking Mouse" done -Text0298: ; 3c545 (f:4545) +GreatQuakeText: ; 3c545 (f:4545) text "Great Quake" done -Text0299: ; 3c552 (f:4552) +BoneAttackText: ; 3c552 (f:4552) text "Bone Attack" done -Text029a: ; 3c55f (f:455f) +ExcavationText: ; 3c55f (f:455f) text "Excavation" done -Text029b: ; 3c56b (f:456b) +RockCrusherText: ; 3c56b (f:456b) text "Rock Crusher" done -Text029c: ; 3c579 (f:4579) +BlueWaterText: ; 3c579 (f:4579) text "Blue Water" done -Text029d: ; 3c585 (f:4585) +OnTheBeachText: ; 3c585 (f:4585) text "On the Beach" done -Text029e: ; 3c593 (f:4593) +ParalyzeText: ; 3c593 (f:4593) text "Paralyze!" done -Text029f: ; 3c59e (f:459e) +EnergyRemovalText: ; 3c59e (f:459e) text "Energy Removal" done -Text02a0: ; 3c5ae (f:45ae) +RainDancerText: ; 3c5ae (f:45ae) text "Rain Dancer" done -Text02a1: ; 3c5bb (f:45bb) +CutePokemonText: ; 3c5bb (f:45bb) text "Cute Pokémon" done -Text02a2: ; 3c5c9 (f:45c9) +PokemonFluteText: ; 3c5c9 (f:45c9) text "Pokémon Flute" done -Text02a3: ; 3c5d8 (f:45d8) +YellowFlashText: ; 3c5d8 (f:45d8) text "Yellow Flash" done -Text02a4: ; 3c5e6 (f:45e6) +ElectricShockText: ; 3c5e6 (f:45e6) text "Electric Shock" done -Text02a5: ; 3c5f6 (f:45f6) +ZappingSelfdestructText: ; 3c5f6 (f:45f6) text "Zapping Selfdestruct" done -Text02a6: ; 3c60c (f:460c) +InsectCollectionText: ; 3c60c (f:460c) text "Insect Collection" done -Text02a7: ; 3c61f (f:461f) +JungleText: ; 3c61f (f:461f) text "Jungle" done -Text02a8: ; 3c627 (f:4627) +FlowerGardenText: ; 3c627 (f:4627) text "Flower Garden" done -Text02a9: ; 3c636 (f:4636) +KaleidoscopeText: ; 3c636 (f:4636) text "Kaleidoscope" done -Text02aa: ; 3c644 (f:4644) +FlowerPowerText: ; 3c644 (f:4644) text "Flower Power" done -Text02ab: ; 3c652 (f:4652) +PsychicPowerText: ; 3c652 (f:4652) text "Psychic Power" done -Text02ac: ; 3c661 (f:4661) +DreamEaterHaunterText: ; 3c661 (f:4661) text "Dream Eater Haunter" done -Text02ad: ; 3c676 (f:4676) +ScavengingSlowbroText: ; 3c676 (f:4676) text "Scavenging Slowbro" done -Text02ae: ; 3c68a (f:468a) +StrangePowerText: ; 3c68a (f:468a) text "Strange Power" done -Text02af: ; 3c699 (f:4699) +StrangePsyshockText: ; 3c699 (f:4699) text "Strange Psyshock" done -Text02b0: ; 3c6ab (f:46ab) +LovelyNidoranText: ; 3c6ab (f:46ab) text "Lovely Nidoran" done -Text02b1: ; 3c6bb (f:46bb) +ScienceCorpsText: ; 3c6bb (f:46bb) text "Science Corps" done -Text02b2: ; 3c6ca (f:46ca) +FlyinPokemonText: ; 3c6ca (f:46ca) text "Flyin' Pokémon" done -Text02b3: ; 3c6da (f:46da) +PoisonText: ; 3c6da (f:46da) text "Poison" done -Text02b4: ; 3c6e2 (f:46e2) +WondersOfScienceText: ; 3c6e2 (f:46e2) text "Wonders of Science" done -Text02b5: ; 3c6f6 (f:46f6) +ReplaceEmAllText: ; 3c6f6 (f:46f6) text "Replace 'Em All" done -Text02b6: ; 3c707 (f:4707) +ChariSaurText: ; 3c707 (f:4707) text "Chari-Saur" done -Text02b7: ; 3c713 (f:4713) +TrafficLightText: ; 3c713 (f:4713) text "Traffic Light" done -Text02b8: ; 3c722 (f:4722) +FirePokemonDeckText: ; 3c722 (f:4722) text "Fire Pokémon" done -Text02b9: ; 3c730 (f:4730) +FireChargeText: ; 3c730 (f:4730) text "Fire Charge" done -Text02ba: ; 3c73d (f:473d) +CharmanderAndFriendsText: ; 3c73d (f:473d) text "Charmander & Friends" done -Text02bb: ; 3c753 (f:4753) +SquirtleAndFriendsText: ; 3c753 (f:4753) text "Squirtle & Friends" done -Text02bc: ; 3c767 (f:4767) +BulbasaurAndFriendsText: ; 3c767 (f:4767) text "Bulbasaur & Friends" done -Text02bd: ; 3c77c (f:477c) +PsychicMachampText: ; 3c77c (f:477c) text "Psychic Machamp" done -Text02be: ; 3c78d (f:478d) +WaterBeetleText: ; 3c78d (f:478d) text "Water Beetle" done -Text02bf: ; 3c79b (f:479b) +LegendaryMoltresText: ; 3c79b (f:479b) text "Legendary Moltres" done -Text02c0: ; 3c7ae (f:47ae) +LegendaryZapdosText: ; 3c7ae (f:47ae) text "Legendary Zapdos" done -Text02c1: ; 3c7c0 (f:47c0) +LegendaryArticunoText: ; 3c7c0 (f:47c0) text "Legendary Articuno" done -Text02c2: ; 3c7d4 (f:47d4) +LegendaryDragoniteText: ; 3c7d4 (f:47d4) text "Legendary Dragonite" done -Text02c3: ; 3c7e9 (f:47e9) +MysteriousPokemonText: ; 3c7e9 (f:47e9) text "Mysterious Pokémon" done -Text02c4: ; 3c7fd (f:47fd) +AllFightingPokemonDescriptionText: ; 3c7fd (f:47fd) text "A Deck of Fighting Pokémon:" line "Feel their Fighting power!" done -Text02c5: ; 3c835 (f:4835) +BenchAttackDescriptionText: ; 3c835 (f:4835) text "A Deck of Pokémon that can" line "attack the Bench." done -Text02c6: ; 3c863 (f:4863) +BattleContestDescriptionText: ; 3c863 (f:4863) text "A Deck which uses Fighting Attacks" line "such as Slash and Punch." done -Text02c7: ; 3c8a0 (f:48a0) +HeatedBattleDescriptionText: ; 3c8a0 (f:48a0) text "A powerful Deck with both Fire" line "and Fighting Pokémon." done -Text02c8: ; 3c8d6 (f:48d6) +FirstStrikeDescriptionText: ; 3c8d6 (f:48d6) text "A Deck for fast and furious " line "attacks." done -Text02c9: ; 3c8fd (f:48fd) +SqueakingMouseDescriptionText: ; 3c8fd (f:48fd) text "A Deck made of Mouse Pokémon." line "Uses PlusPower to Power up!" done -Text02ca: ; 3c938 (f:4938) +GreatQuakeDescriptionText: ; 3c938 (f:4938) text "Use Dugtrio's Earthquake" line "to cause great damage." done -Text02cb: ; 3c969 (f:4969) +BoneAttackDescriptionText: ; 3c969 (f:4969) text "A Deck of Cubone and Marowak - " line "A call for help." done -Text02cc: ; 3c99b (f:499b) +ExcavationDescriptionText: ; 3c99b (f:499b) text "A Deck which creates Pokémon by" line "evolving Mysterious Fossils." done -Text02cd: ; 3c9d9 (f:49d9) +RockCrusherDescriptionText: ; 3c9d9 (f:49d9) text "A Deck of Rock Pokémon. It's" line "Strong against Lightning Pokémon." done -Text02ce: ; 3ca19 (f:4a19) +BlueWaterDescriptionText: ; 3ca19 (f:4a19) text "A Deck of Water Pokémon: Their" line "Blue Horror washes over enemies." done -Text02cf: ; 3ca5a (f:4a5a) +OnTheBeachDescriptionText: ; 3ca5a (f:4a5a) text "A well balanced Deck" line "of Sandshrew and Water Pokémon!" done -Text02d0: ; 3ca90 (f:4a90) +ParalyzeDescriptionText: ; 3ca90 (f:4a90) text "Paralyze the opponent's Pokémon:" line "Stop 'em and drop 'em!" done -Text02d1: ; 3cac9 (f:4ac9) +EnergyRemovalDescriptionText: ; 3cac9 (f:4ac9) text "Uses Whirlpool and Hyper Beam to" line "remove opponents' Energy cards." done -Text02d2: ; 3cb0b (f:4b0b) +RainDancerDescriptionText: ; 3cb0b (f:4b0b) text "Use Rain Dance to attach Water" line "Energy for powerful Attacks!" done -Text02d3: ; 3cb48 (f:4b48) +CutePokemonDescriptionText: ; 3cb48 (f:4b48) text "A Deck of cute Pokémon such as" line "Pikachu and Eevee." done -Text02d4: ; 3cb7b (f:4b7b) +PokemonFluteDescriptionText: ; 3cb7b (f:4b7b) text "Use the Pokémon Flute to revive" line "opponents' Pokémon and Attack!" done -Text02d5: ; 3cbbb (f:4bbb) +YellowFlashDescriptionText: ; 3cbbb (f:4bbb) text "A deck of Pokémon that use Lightning" line "Energy to zap opponents." done -Text02d6: ; 3cbfa (f:4bfa) +ElectricShockDescriptionText: ; 3cbfa (f:4bfa) text "A Deck which Shocks and Paralyzes" line "opponents with its Attacks." done -Text02d7: ; 3cc39 (f:4c39) +ZappingSelfdestructDescriptionText: ; 3cc39 (f:4c39) text "Selfdestruct causes great damage " line "- even to the opponent's Bench." done -Text02d8: ; 3cc7c (f:4c7c) +InsectCollectionDescriptionText: ; 3cc7c (f:4c7c) text "A Deck made of Insect Pokémon" line "Go Bug Power!" done -Text02d9: ; 3cca9 (f:4ca9) +JungleDescriptionText: ; 3cca9 (f:4ca9) text "A Deck of Grass Pokémon: There " line "are many dangers in the Jungle." done -Text02da: ; 3ccea (f:4cea) +FlowerGardenDescriptionText: ; 3ccea (f:4cea) text "A Deck of Flower Pokémon:" line "Beautiful but Dangerous" done -Text02db: ; 3cd1d (f:4d1d) +KaleidoscopeDescriptionText: ; 3cd1d (f:4d1d) text "Uses Venomoth's Pokémon Power to" line "change the opponent's Weakness." done -Text02dc: ; 3cd5f (f:4d5f) +FlowerPowerDescriptionText: ; 3cd5f (f:4d5f) text "A powerful Big Eggsplosion " line "and Energy Transfer combo!" done -Text02dd: ; 3cd97 (f:4d97) +PsychicPowerDescriptionText: ; 3cd97 (f:4d97) text "Use the Psychic power of the" line "Psychic Pokémon to Attack!" done -Text02de: ; 3cdd0 (f:4dd0) +DreamEaterHaunterDescriptionText: ; 3cdd0 (f:4dd0) text "Uses Haunter's Dream Eater" line "to cause great damage!" done -Text02df: ; 3ce03 (f:4e03) +ScavengingSlowbroDescriptionText: ; 3ce03 (f:4e03) text "Continually draw Trainer " line "Cards from the Discard Pile!" done -Text02e0: ; 3ce3b (f:4e3b) +StrangePowerDescriptionText: ; 3ce3b (f:4e3b) text "Confuse opponents with" line "mysterious power!" done -Text02e1: ; 3ce65 (f:4e65) +StrangePsyshockDescriptionText: ; 3ce65 (f:4e65) text "Use Alakazam's Damage Swap" line "to move damage counters!" done -Text02e2: ; 3ce9a (f:4e9a) +LovelyNidoranDescriptionText: ; 3ce9a (f:4e9a) text "Uses Nidoqueen's Boyfriends to cause" line "great damage to the opponent." done -Text02e3: ; 3cede (f:4ede) +ScienceCorpsDescriptionText: ; 3cede (f:4ede) text "The march of the Science Corps!" line "Attack with the power of science!" done -Text02e4: ; 3cf21 (f:4f21) +FlyinPokemonDescriptionText: ; 3cf21 (f:4f21) text "Pokémon with feathers flock " line "together! Retreating is easy!" done -Text02e5: ; 3cf5d (f:4f5d) +PoisonDescriptionText: ; 3cf5d (f:4f5d) text "A Deck that uses Poison to " line "slowly Knock Out the opponent." done -Text02e6: ; 3cf99 (f:4f99) +WondersOfScienceDescriptionText: ; 3cf99 (f:4f99) text "Block Pokémon Powers with " line "Muk and attack with Mewtwo!" done -Text02e7: ; 3cfd1 (f:4fd1) +ReplaceEmAllDescriptionText: ; 3cfd1 (f:4fd1) text "A Deck that shuffles" line "the opponent's cards" done -Text02e8: ; 3cffc (f:4ffc) +ChariSaurDescriptionText: ; 3cffc (f:4ffc) text "Attack with Charizard - with " line "just a few Fire Energy cards!" done -Text02e9: ; 3d039 (f:5039) +TrafficLightDescriptionText: ; 3d039 (f:5039) text "Pokémon that can Attack with" line "Fire, Water or Lightning Energy!" done -Text02ea: ; 3d078 (f:5078) +FirePokemonDescriptionText: ; 3d078 (f:5078) text "With Fire Pokémon like Charizard, " line "Rapidash and Magmar, it's hot!" done -Text02eb: ; 3d0bb (f:50bb) +FireChargeDescriptionText: ; 3d0bb (f:50bb) text "Desperate attacks Damage your " line "opponent and you!" done -Text02ec: ; 3d0ed (f:50ed) +CharmanderAndFriendsDescriptionText: ; 3d0ed (f:50ed) text "A Fire, Grass and Water Deck:" line "Charmander, Pinsir and Seel" done -Text02ed: ; 3d128 (f:5128) +SquirtleAndFriendsDescriptionText: ; 3d128 (f:5128) text "A Water, Fire, and Lightning Deck:" line "Squirtle, Charmander and Pikachu" done -Text02ee: ; 3d16d (f:516d) +BulbasaurAndFriendsDescriptionText: ; 3d16d (f:516d) text "A Grass, Lightning and Psychic Deck:" line "Bulbasaur, Pikachu and Abra" done -Text02ef: ; 3d1af (f:51af) +PsychicMachampDescriptionText: ; 3d1af (f:51af) text "Machamp, Hitmonlee, Hitmonchan" line "Gengar and Alakazam are furious!" done -Text02f0: ; 3d1f0 (f:51f0) +WaterBeetleDescriptionText: ; 3d1f0 (f:51f0) text "An Evolution Deck with Weedle, " line "Nidoran♂ and Bellsprout." done -Text02f1: ; 3d22a (f:522a) +LegendaryMoltresDescriptionText: ; 3d22a (f:522a) text "Gather Fire Energy with the" line "Legendary Moltres!" done -Text02f2: ; 3d25a (f:525a) +LegendaryZapdosDescriptionText: ; 3d25a (f:525a) text "Zap opponents with the" line "Legandary Zapdos!" done -Text02f3: ; 3d284 (f:5284) +LegendaryArticunoDescriptionText: ; 3d284 (f:5284) text "Paralyze opponents with the" line "Legendary Articuno!" done -Text02f4: ; 3d2b5 (f:52b5) +LegendaryDragoniteDescriptionText: ; 3d2b5 (f:52b5) text "Heal your Pokémon with the" line "Legendary Dragonite!" done -Text02f5: ; 3d2e6 (f:52e6) +MysteriousPokemonDescriptionText: ; 3d2e6 (f:52e6) text "A very special Deck made of" line "very rare Pokémon cards!" done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index 9f50d9d..b9d2561 100644 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -630,7 +630,7 @@ TextOffsets:: ; 34000 (d:4000) textpointer OKIfFileDeletedText ; 0x0272 textpointer ReadTheInstructionsText ; 0x0273 textpointer PrintThisCardYesNoText ; 0x0274 - textpointer Text0275 ; 0x0275 + textpointer PleaseChooseDeckConfigurationToPrintText ; 0x0275 textpointer PrintThisDeckText ; 0x0276 textpointer Text0277 ; 0x0277 textpointer PrintMenuItemsText ; 0x0278 @@ -659,106 +659,106 @@ TextOffsets:: ; 34000 (d:4000) textpointer FireMachineText ; 0x028f textpointer AutoMachineText ; 0x0290 textpointer LegendaryMachineText ; 0x0291 - textpointer Text0292 ; 0x0292 - textpointer Text0293 ; 0x0293 - textpointer Text0294 ; 0x0294 - textpointer Text0295 ; 0x0295 - textpointer Text0296 ; 0x0296 - textpointer Text0297 ; 0x0297 - textpointer Text0298 ; 0x0298 - textpointer Text0299 ; 0x0299 - textpointer Text029a ; 0x029a - textpointer Text029b ; 0x029b - textpointer Text029c ; 0x029c - textpointer Text029d ; 0x029d - textpointer Text029e ; 0x029e - textpointer Text029f ; 0x029f - textpointer Text02a0 ; 0x02a0 - textpointer Text02a1 ; 0x02a1 - textpointer Text02a2 ; 0x02a2 - textpointer Text02a3 ; 0x02a3 - textpointer Text02a4 ; 0x02a4 - textpointer Text02a5 ; 0x02a5 - textpointer Text02a6 ; 0x02a6 - textpointer Text02a7 ; 0x02a7 - textpointer Text02a8 ; 0x02a8 - textpointer Text02a9 ; 0x02a9 - textpointer Text02aa ; 0x02aa - textpointer Text02ab ; 0x02ab - textpointer Text02ac ; 0x02ac - textpointer Text02ad ; 0x02ad - textpointer Text02ae ; 0x02ae - textpointer Text02af ; 0x02af - textpointer Text02b0 ; 0x02b0 - textpointer Text02b1 ; 0x02b1 - textpointer Text02b2 ; 0x02b2 - textpointer Text02b3 ; 0x02b3 - textpointer Text02b4 ; 0x02b4 - textpointer Text02b5 ; 0x02b5 - textpointer Text02b6 ; 0x02b6 - textpointer Text02b7 ; 0x02b7 - textpointer Text02b8 ; 0x02b8 - textpointer Text02b9 ; 0x02b9 - textpointer Text02ba ; 0x02ba - textpointer Text02bb ; 0x02bb - textpointer Text02bc ; 0x02bc - textpointer Text02bd ; 0x02bd - textpointer Text02be ; 0x02be - textpointer Text02bf ; 0x02bf - textpointer Text02c0 ; 0x02c0 - textpointer Text02c1 ; 0x02c1 - textpointer Text02c2 ; 0x02c2 - textpointer Text02c3 ; 0x02c3 - textpointer Text02c4 ; 0x02c4 - textpointer Text02c5 ; 0x02c5 - textpointer Text02c6 ; 0x02c6 - textpointer Text02c7 ; 0x02c7 - textpointer Text02c8 ; 0x02c8 - textpointer Text02c9 ; 0x02c9 - textpointer Text02ca ; 0x02ca - textpointer Text02cb ; 0x02cb - textpointer Text02cc ; 0x02cc - textpointer Text02cd ; 0x02cd - textpointer Text02ce ; 0x02ce - textpointer Text02cf ; 0x02cf - textpointer Text02d0 ; 0x02d0 - textpointer Text02d1 ; 0x02d1 - textpointer Text02d2 ; 0x02d2 - textpointer Text02d3 ; 0x02d3 - textpointer Text02d4 ; 0x02d4 - textpointer Text02d5 ; 0x02d5 - textpointer Text02d6 ; 0x02d6 - textpointer Text02d7 ; 0x02d7 - textpointer Text02d8 ; 0x02d8 - textpointer Text02d9 ; 0x02d9 - textpointer Text02da ; 0x02da - textpointer Text02db ; 0x02db - textpointer Text02dc ; 0x02dc - textpointer Text02dd ; 0x02dd - textpointer Text02de ; 0x02de - textpointer Text02df ; 0x02df - textpointer Text02e0 ; 0x02e0 - textpointer Text02e1 ; 0x02e1 - textpointer Text02e2 ; 0x02e2 - textpointer Text02e3 ; 0x02e3 - textpointer Text02e4 ; 0x02e4 - textpointer Text02e5 ; 0x02e5 - textpointer Text02e6 ; 0x02e6 - textpointer Text02e7 ; 0x02e7 - textpointer Text02e8 ; 0x02e8 - textpointer Text02e9 ; 0x02e9 - textpointer Text02ea ; 0x02ea - textpointer Text02eb ; 0x02eb - textpointer Text02ec ; 0x02ec - textpointer Text02ed ; 0x02ed - textpointer Text02ee ; 0x02ee - textpointer Text02ef ; 0x02ef - textpointer Text02f0 ; 0x02f0 - textpointer Text02f1 ; 0x02f1 - textpointer Text02f2 ; 0x02f2 - textpointer Text02f3 ; 0x02f3 - textpointer Text02f4 ; 0x02f4 - textpointer Text02f5 ; 0x02f5 + textpointer AllFightingPokemonText ; 0x0292 + textpointer BenchAttackText ; 0x0293 + textpointer BattleContestText ; 0x0294 + textpointer HeatedBattleText ; 0x0295 + textpointer FirstStrikeText ; 0x0296 + textpointer SqueakingMouseText ; 0x0297 + textpointer GreatQuakeText ; 0x0298 + textpointer BoneAttackText ; 0x0299 + textpointer ExcavationText ; 0x029a + textpointer RockCrusherText ; 0x029b + textpointer BlueWaterText ; 0x029c + textpointer OnTheBeachText ; 0x029d + textpointer ParalyzeText ; 0x029e + textpointer EnergyRemovalText ; 0x029f + textpointer RainDancerText ; 0x02a0 + textpointer CutePokemonText ; 0x02a1 + textpointer PokemonFluteText ; 0x02a2 + textpointer YellowFlashText ; 0x02a3 + textpointer ElectricShockText ; 0x02a4 + textpointer ZappingSelfdestructText ; 0x02a5 + textpointer InsectCollectionText ; 0x02a6 + textpointer JungleText ; 0x02a7 + textpointer FlowerGardenText ; 0x02a8 + textpointer KaleidoscopeText ; 0x02a9 + textpointer FlowerPowerText ; 0x02aa + textpointer PsychicPowerText ; 0x02ab + textpointer DreamEaterHaunterText ; 0x02ac + textpointer ScavengingSlowbroText ; 0x02ad + textpointer StrangePowerText ; 0x02ae + textpointer StrangePsyshockText ; 0x02af + textpointer LovelyNidoranText ; 0x02b0 + textpointer ScienceCorpsText ; 0x02b1 + textpointer FlyinPokemonText ; 0x02b2 + textpointer PoisonText ; 0x02b3 + textpointer WondersOfScienceText ; 0x02b4 + textpointer ReplaceEmAllText ; 0x02b5 + textpointer ChariSaurText ; 0x02b6 + textpointer TrafficLightText ; 0x02b7 + textpointer FirePokemonDeckText ; 0x02b8 + textpointer FireChargeText ; 0x02b9 + textpointer CharmanderAndFriendsText ; 0x02ba + textpointer SquirtleAndFriendsText ; 0x02bb + textpointer BulbasaurAndFriendsText ; 0x02bc + textpointer PsychicMachampText ; 0x02bd + textpointer WaterBeetleText ; 0x02be + textpointer LegendaryMoltresText ; 0x02bf + textpointer LegendaryZapdosText ; 0x02c0 + textpointer LegendaryArticunoText ; 0x02c1 + textpointer LegendaryDragoniteText ; 0x02c2 + textpointer MysteriousPokemonText ; 0x02c3 + textpointer AllFightingPokemonDescriptionText ; 0x02c4 + textpointer BenchAttackDescriptionText ; 0x02c5 + textpointer BattleContestDescriptionText ; 0x02c6 + textpointer HeatedBattleDescriptionText ; 0x02c7 + textpointer FirstStrikeDescriptionText ; 0x02c8 + textpointer SqueakingMouseDescriptionText ; 0x02c9 + textpointer GreatQuakeDescriptionText ; 0x02ca + textpointer BoneAttackDescriptionText ; 0x02cb + textpointer ExcavationDescriptionText ; 0x02cc + textpointer RockCrusherDescriptionText ; 0x02cd + textpointer BlueWaterDescriptionText ; 0x02ce + textpointer OnTheBeachDescriptionText ; 0x02cf + textpointer ParalyzeDescriptionText ; 0x02d0 + textpointer EnergyRemovalDescriptionText ; 0x02d1 + textpointer RainDancerDescriptionText ; 0x02d2 + textpointer CutePokemonDescriptionText ; 0x02d3 + textpointer PokemonFluteDescriptionText ; 0x02d4 + textpointer YellowFlashDescriptionText ; 0x02d5 + textpointer ElectricShockDescriptionText ; 0x02d6 + textpointer ZappingSelfdestructDescriptionText ; 0x02d7 + textpointer InsectCollectionDescriptionText ; 0x02d8 + textpointer JungleDescriptionText ; 0x02d9 + textpointer FlowerGardenDescriptionText ; 0x02da + textpointer KaleidoscopeDescriptionText ; 0x02db + textpointer FlowerPowerDescriptionText ; 0x02dc + textpointer PsychicPowerDescriptionText ; 0x02dd + textpointer DreamEaterHaunterDescriptionText ; 0x02de + textpointer ScavengingSlowbroDescriptionText ; 0x02df + textpointer StrangePowerDescriptionText ; 0x02e0 + textpointer StrangePsyshockDescriptionText ; 0x02e1 + textpointer LovelyNidoranDescriptionText ; 0x02e2 + textpointer ScienceCorpsDescriptionText ; 0x02e3 + textpointer FlyinPokemonDescriptionText ; 0x02e4 + textpointer PoisonDescriptionText ; 0x02e5 + textpointer WondersOfScienceDescriptionText ; 0x02e6 + textpointer ReplaceEmAllDescriptionText ; 0x02e7 + textpointer ChariSaurDescriptionText ; 0x02e8 + textpointer TrafficLightDescriptionText ; 0x02e9 + textpointer FirePokemonDescriptionText ; 0x02ea + textpointer FireChargeDescriptionText ; 0x02eb + textpointer CharmanderAndFriendsDescriptionText ; 0x02ec + textpointer SquirtleAndFriendsDescriptionText ; 0x02ed + textpointer BulbasaurAndFriendsDescriptionText ; 0x02ee + textpointer PsychicMachampDescriptionText ; 0x02ef + textpointer WaterBeetleDescriptionText ; 0x02f0 + textpointer LegendaryMoltresDescriptionText ; 0x02f1 + textpointer LegendaryZapdosDescriptionText ; 0x02f2 + textpointer LegendaryArticunoDescriptionText ; 0x02f3 + textpointer LegendaryDragoniteDescriptionText ; 0x02f4 + textpointer MysteriousPokemonDescriptionText ; 0x02f5 textpointer PokemonCardGlossaryText ; 0x02f6 textpointer GlossaryMenuPage1Text ; 0x02f7 textpointer GlossaryMenuPage2Text ; 0x02f8 diff --git a/src/wram.asm b/src/wram.asm index 7944c9a..621b985 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -38,6 +38,12 @@ NEXTU wCardPopNameList:: ; c000 ds CARDPOP_NAME_LIST_SIZE +NEXTU + +; buffer used to store a deck that will be built +wDeckToBuild:: ; c000 + ds DECK_STRUCT_SIZE + ENDU ds $100 @@ -1993,7 +1999,7 @@ UNION ; buffer used to show which card IDs ; are visible in a given list wVisibleListCardIDs:: ; cec4 - ds MAX_DECK_CONFIRMATION_VISIBLE_CARDS + ds NUM_DECK_CONFIRMATION_VISIBLE_CARDS NEXTU @@ -2013,7 +2019,9 @@ wNumVisibleCardListEntries:: ; cecb wTotalCardCount:: ; cecc ds $1 -wcecd:: ; cecd +; is TRUE if list cannot be scrolled down +; past the last visible entry +wUnableToScrollDown:: ; cecd ds $1 ; pointer to a function that should be called @@ -2077,6 +2085,10 @@ wCurDeckCardsTerminator:: ; cf67 ds $1 wCurDeckCardsEnd:: + +; list of all the different cards in a deck configuration +wUniqueDeckCardList:: ; cf68 + ; stores the count number of cards owned ; can be 0 in the case that a card is not available ; i.e. already inside a built deck @@ -2125,7 +2137,8 @@ wDeckConfigurationMenuTransitionTable:: ; cfd6 wCurCardListPtr:: ; cfd8 ds $2 -wcfda:: ; cfda +; text ID to print in the card confirmation screen text box +wCardConfirmationText:: ; cfda ds $2 ds $2 @@ -2206,43 +2219,52 @@ wMachineDeckPtrs:: ; d00d wNumSavedDecks:: ; d085 ds $1 -wd086:: ; d086 +; temporarily holds value of wCardListCursorPos +wTempDeckMachineCursorPos:: ; d086 ds $1 -wd087:: ; d087 +; temporarily holds value of wCardListVisibleOffset +wTempCardListVisibleOffset:: ; d087 ds $1 -wd088:: ; d088 +; which list entry was selected in the Deck Machine screen +wSelectedDeckMachineEntry:: ; d088 ds $1 -wd089:: ; d089 - ds $1 +wDismantledDeckName:: ; d089 + ds DECK_NAME_SIZE -wd08a:: ; d08a - ds $18 +; which deck slot to be used to +; build a new deck +wDeckSlotForNewDeck:: ; d0a1 + ds $1 -wd0a2:: ; d0a2 +wDeckMachineTitleText:: ; d0a2 ds $2 wTempBankSRAM:: ; d0a4 ds $1 -wd0a5:: ; d0a5 +wNumDeckMachineEntries:: ; d0a5 ds $1 -wd0a6:: ; d0a6 +; DECK_* flags to be dismantled to build a given deck +wDecksToBeDismantled:: ; d0a6 ds $1 -wd0a7:: ; d0a7 +; text ID to print in the text box when +; inside the Deck Machine menu +wDeckMachineText:: ; d0a7 ds $2 -wd0a9:: ; d0a9 +; which deck machine is being used +wCurAutoDeckMachine:: ; d0a9 ds $1 -wd0aa:: ; d0aa - ds $1 - - ds $9 +; text IDs for each deck descriptions of the +; Ato Deck Machine currently being shown +wAutoDeckMachineTextDescriptions:: ; d0aa + ds 2 * NUM_DECK_MACHINE_SLOTS wd0b4:: ; d0b4 ds $1 -- cgit v1.2.3