From 1893b4c7cff5e224adf30596d908ecfff08a48b1 Mon Sep 17 00:00:00 2001 From: emaskyesmogon <79380228+emaskyesmogon@users.noreply.github.com> Date: Wed, 31 Aug 2022 20:47:02 -0600 Subject: [PATCH] expanded Pokemon size Rhyperior files are dummies and will need to be properly edited with sprites, Rhydon evo data, etc, but it (and the other files included) show that the trainer and pokemon sprite indexes have been separated, which allows us to add the other KEP mons --- constants/pokedex_constants.asm | 1 + constants/pokemon_constants.asm | 1 + data/pokemon/base_stats.asm | 1 + data/pokemon/base_stats/rhyperior.asm | 27 ++++++++++++++++++++ data/pokemon/cries.asm | 1 + data/pokemon/dex_entries.asm | 8 ++++++ data/pokemon/dex_order.asm | 1 + data/pokemon/evos_moves.asm | 12 +++++++++ data/pokemon/menu_icons.asm | 1 + data/pokemon/names.asm | 1 + data/pokemon/new_dex_text.asm | 10 ++++++++ data/pokemon/palettes.asm | 1 + engine/battle/battle_transitions.asm | 4 +-- engine/battle/core.asm | 12 ++++++++- engine/battle/wild_encounters.asm | 1 + engine/overworld/movement.asm | 3 +++ home/copy.asm | 16 ++++++++++++ home/copy2.asm | 15 ----------- home/list_menu.asm | 2 ++ home/trainers.asm | 36 ++++++++++++++++++++++----- scripts/CeruleanCity.asm | 4 +++ scripts/OaksLab.asm | 4 +++ scripts/PokemonTower2F.asm | 4 +++ scripts/Route12.asm | 2 ++ scripts/Route16.asm | 2 ++ scripts/Route22.asm | 6 +++++ scripts/SSAnne2F.asm | 4 +++ scripts/SilphCo7F.asm | 4 +++ 28 files changed, 160 insertions(+), 24 deletions(-) create mode 100644 data/pokemon/base_stats/rhyperior.asm diff --git a/constants/pokedex_constants.asm b/constants/pokedex_constants.asm index f4d6759e..6128d2a8 100644 --- a/constants/pokedex_constants.asm +++ b/constants/pokedex_constants.asm @@ -200,5 +200,6 @@ const DEX_DRAGONITE ; 149 const DEX_MEWTWO ; 150 const DEX_MEW ; 151 + const DEX_RHYPERIOR DEF NUM_POKEMON EQU const_value - 1 diff --git a/constants/pokemon_constants.asm b/constants/pokemon_constants.asm index b77d3016..b8bc5604 100644 --- a/constants/pokemon_constants.asm +++ b/constants/pokemon_constants.asm @@ -206,6 +206,7 @@ const BETOBEBII ; $C5 (new) const BELLOSSOM ; $C6 (new) const SCIZOR ; $C7 (new) + const RHYPERIOR ; $C8 (test) DEF NUM_POKEMON_INDEXES EQU const_value - 1 diff --git a/data/pokemon/base_stats.asm b/data/pokemon/base_stats.asm index e5129dc1..629e8ddc 100644 --- a/data/pokemon/base_stats.asm +++ b/data/pokemon/base_stats.asm @@ -196,4 +196,5 @@ INCLUDE "data/pokemon/base_stats/dragonair.asm" INCLUDE "data/pokemon/base_stats/dragonite.asm" INCLUDE "data/pokemon/base_stats/mewtwo.asm" INCLUDE "data/pokemon/base_stats/mew.asm" +INCLUDE "data/pokemon/base_stats/rhyperior.asm" assert_table_length NUM_POKEMON diff --git a/data/pokemon/base_stats/rhyperior.asm b/data/pokemon/base_stats/rhyperior.asm new file mode 100644 index 00000000..ecaaff01 --- /dev/null +++ b/data/pokemon/base_stats/rhyperior.asm @@ -0,0 +1,27 @@ + db DEX_RHYDON ; pokedex id + + db 115, 140, 130, 50, 55 + ; hp atk def spd spc + + db GROUND, ROCK ; type + db 60 ; catch rate + db 204 ; base exp + + INCBIN "gfx/pokemon/front/rhydon.pic", 0, 1 ; sprite dimensions + dw RhydonPicFront, RhydonPicBack + + db HORN_ATTACK, STOMP, TAIL_WHIP, FURY_ATTACK ; level 1 learnset + db GROWTH_SLOW ; growth rate + + ; tm/hm learnset + tmhm MEGA_PUNCH, MEGA_KICK, TOXIC, HORN_DRILL, BODY_SLAM, \ + TAKE_DOWN, DOUBLE_EDGE, BUBBLEBEAM, WATER_GUN, ICE_BEAM, \ + BLIZZARD, HYPER_BEAM, PAY_DAY, SUBMISSION, COUNTER, \ + SEISMIC_TOSS, RAGE, THUNDERBOLT, THUNDER, EARTHQUAKE, \ + FISSURE, DIG, MIMIC, DOUBLE_TEAM, BIDE, \ + FIRE_BLAST, SKULL_BASH, REST, ROCK_SLIDE, SUBSTITUTE, \ + SURF, STRENGTH + ; end + + db BANK(RhydonPicFront) + assert BANK(RhydonPicFront) == BANK(RhydonPicBack) diff --git a/data/pokemon/cries.asm b/data/pokemon/cries.asm index dc054fd8..107ab171 100644 --- a/data/pokemon/cries.asm +++ b/data/pokemon/cries.asm @@ -205,4 +205,5 @@ CryData:: mon_cry SFX_CRY_05, $FF, $40 ; Betobebii mon_cry SFX_CRY_00, $00, $00 ; Bellossom (unfinished) mon_cry SFX_CRY_00, $00, $00 ; Scizor (unfinished) + mon_cry SFX_CRY_00, $00, $00 ; Rhyperior (test) assert_table_length NUM_POKEMON_INDEXES diff --git a/data/pokemon/dex_entries.asm b/data/pokemon/dex_entries.asm index 116de3c5..585fe968 100644 --- a/data/pokemon/dex_entries.asm +++ b/data/pokemon/dex_entries.asm @@ -199,6 +199,7 @@ PokedexEntryPointers: dw MissingNoDexEntry dw BellossomDexEntry dw ScizorDexEntry + dw RhyperiorDexEntry assert_table_length NUM_POKEMON_INDEXES ; string: species name @@ -1550,3 +1551,10 @@ ScizorDexEntry: text_far _ScizorDexEntry text_end +RhyperiorDexEntry: + db "TEST@" + db 5,11 + dw 5000 + text_far _RhyperiorDexEntry + text_end + \ No newline at end of file diff --git a/data/pokemon/dex_order.asm b/data/pokemon/dex_order.asm index b83a7c67..973cb558 100644 --- a/data/pokemon/dex_order.asm +++ b/data/pokemon/dex_order.asm @@ -199,4 +199,5 @@ PokedexOrder: db DEX_BETOBEBII db DEX_BELLOSSOM db DEX_SCIZOR + db DEX_RHYPERIOR assert_table_length NUM_POKEMON_INDEXES diff --git a/data/pokemon/evos_moves.asm b/data/pokemon/evos_moves.asm index cb36eb06..2c50a57d 100644 --- a/data/pokemon/evos_moves.asm +++ b/data/pokemon/evos_moves.asm @@ -202,6 +202,7 @@ EvosMovesPointerTable: dw BetobebiiEvosMoves dw BellossomEvosMoves dw ScizorEvosMoves + dw RhyperiorEvosMoves assert_table_length NUM_POKEMON_INDEXES RhydonEvosMoves: @@ -2538,3 +2539,14 @@ ScizorEvosMoves: db 50, BULLET_PUNCH db 0 +RhyperiorEvosMoves: +; Evolutions + db 0 +; Learnset + db 30, STOMP + db 35, TAIL_WHIP + db 40, FURY_ATTACK + db 48, HORN_DRILL + db 55, LEER + db 64, TAKE_DOWN + db 0 diff --git a/data/pokemon/menu_icons.asm b/data/pokemon/menu_icons.asm index 59fe58db..7748cb02 100644 --- a/data/pokemon/menu_icons.asm +++ b/data/pokemon/menu_icons.asm @@ -196,4 +196,5 @@ MonPartyData: nybble ICON_SNAKE ; Dragonite nybble ICON_MON ; Mewtwo nybble ICON_MON ; Mew + nybble ICON_MON ; Rhyperior end_nybble_array NUM_POKEMON diff --git a/data/pokemon/names.asm b/data/pokemon/names.asm index f208eb05..97b95922 100644 --- a/data/pokemon/names.asm +++ b/data/pokemon/names.asm @@ -199,4 +199,5 @@ MonsterNames:: db "BETOBEBII@" db "BELLOSSOM@" db "SCIZOR@@@@" + db "RHYPERIOR@" assert_table_length NUM_POKEMON_INDEXES diff --git a/data/pokemon/new_dex_text.asm b/data/pokemon/new_dex_text.asm index 081d39bd..d9eaeea1 100644 --- a/data/pokemon/new_dex_text.asm +++ b/data/pokemon/new_dex_text.asm @@ -448,6 +448,16 @@ _BellossomDexEntry:: next "to summon the sun" dex +_RhyperiorDexEntry:: + text "This is a newly" + next "discovered" + next "#MON. It is" + + page "currently under" + next "investigation. No" + next "info is available" + dex + _MissingNoDexEntry:: text "This is a newly" next "discovered" diff --git a/data/pokemon/palettes.asm b/data/pokemon/palettes.asm index 52ff3229..984520f9 100644 --- a/data/pokemon/palettes.asm +++ b/data/pokemon/palettes.asm @@ -197,4 +197,5 @@ MonsterPalettes: db PAL_BROWNMON ; DRAGONITE db PAL_MEWMON ; MEWTWO db PAL_MEWMON ; MEW + db PAL_GREYMON ; RHYPERIOR assert_table_length NUM_POKEMON + 1 diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index a16fd250..fd33882d 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -82,8 +82,8 @@ BattleTransitions: GetBattleTransitionID_WildOrTrainer: ld a, [wCurOpponent] - cp OPP_ID_OFFSET - jr nc, .trainer + and a + jr nz, .trainer res 0, c ret .trainer diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 4441ca3c..7a7291ce 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -955,6 +955,12 @@ TrainerBattleVictory: ; win money ld hl, MoneyForWinningText call PrintText + + xor a + ld [wIsTrainerBattle], a + ld a, 1 + ld [wWasTrainerBattle], a + ld de, wPlayerMoney + 2 ld hl, wAmountMoneyWon + 2 ld c, $3 @@ -1142,6 +1148,8 @@ ChooseNextMon: ; called when player is out of usable mons. ; prints appropriate lose message, sets carry flag if player blacked out (special case for initial rival fight) HandlePlayerBlackOut: + xor a + ld [wIsTrainerBattle], a ld a, [wLinkState] cp LINK_STATE_BATTLING jr z, .notRival1Battle @@ -6801,9 +6809,11 @@ InitBattleCommon: push af res 1, [hl] callfar InitBattleVariables + ld a, [wIsTrainerBattle] + and a + jp z, InitWildBattle ld a, [wEnemyMonSpecies2] sub OPP_ID_OFFSET - jp c, InitWildBattle ld [wTrainerClass], a call GetTrainerInformation callfar ReadTrainer diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index 8c9c1529..0a053428 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -99,6 +99,7 @@ TryDoWildEncounter: ret .willEncounter xor a + ld [wIsTrainerBattle], a ret INCLUDE "data/wild/probabilities.asm" diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index e08da61a..4994c8fa 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -119,6 +119,9 @@ UpdateNPCSprite: ld hl, wMapSpriteData add l ld l, a + jr nc, .nc + inc h +.nc ld a, [hl] ; read movement byte 2 ld [wCurSpriteMovement2], a ld h, HIGH(wSpriteStateData1) diff --git a/home/copy.asm b/home/copy.asm index 880d1fb7..5a9b99b0 100644 --- a/home/copy.asm +++ b/home/copy.asm @@ -22,3 +22,19 @@ CopyData:: or b jr nz, CopyData ret + +FarCopyData2:: +; Identical to FarCopyData, but uses hROMBankTemp +; as temp space instead of wBuffer. + ldh [hROMBankTemp], a + ldh a, [hLoadedROMBank] + push af + ldh a, [hROMBankTemp] + ldh [hLoadedROMBank], a + ld [MBC1RomBank], a + call CopyData + pop af + ldh [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + \ No newline at end of file diff --git a/home/copy2.asm b/home/copy2.asm index 1c9a56f3..d615bd60 100644 --- a/home/copy2.asm +++ b/home/copy2.asm @@ -1,18 +1,3 @@ -FarCopyData2:: -; Identical to FarCopyData, but uses hROMBankTemp -; as temp space instead of wBuffer. - ldh [hROMBankTemp], a - ldh a, [hLoadedROMBank] - push af - ldh a, [hROMBankTemp] - ldh [hLoadedROMBank], a - ld [MBC1RomBank], a - call CopyData - pop af - ldh [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - FarCopyData3:: ; Copy bc bytes from a:de to hl. ldh [hROMBankTemp], a diff --git a/home/list_menu.asm b/home/list_menu.asm index 77e75012..154c7eba 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -143,6 +143,8 @@ DisplayListMenuIDLoop:: ld [wd0b5], a ld a, BANK(ItemNames) ld [wPredefBank], a + ld a, ITEM_NAME + ld [wNameListType], a call GetName jr .storeChosenEntry .pokemonList diff --git a/home/trainers.asm b/home/trainers.asm index 4dc63fef..8d83e96f 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -190,16 +190,20 @@ EndTrainerBattle:: res 0, [hl] ; player is no longer engaged by any trainer ld a, [wIsInBattle] cp $ff - jp z, ResetButtonPressedAndMapScript + jr z, EndTrainerBattleWhiteout ld a, $2 call ReadTrainerHeaderInfo ld a, [wTrainerHeaderFlagBit] ld c, a ld b, FLAG_SET call TrainerFlagAction ; flag trainer as fought - ld a, [wEnemyMonOrTrainerClass] - cp OPP_ID_OFFSET - jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) + ld a, [wWasTrainerBattle] + and a + jr nz, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) + ld a, [wCurMap] + cp POKEMON_TOWER_7F + jr z, .skipRemoveSprite ; the tower 7f scripts call EndTrainerBattle manually after + ; wIsTrainerBattle has been unset ld hl, wMissableObjectList ld de, $2 ld a, [wSpriteIndex] @@ -209,11 +213,19 @@ EndTrainerBattle:: ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it predef HideObject .skipRemoveSprite + xor a + ld [wWasTrainerBattle], a ld hl, wd730 bit 4, [hl] res 4, [hl] ret nz +EndTrainerBattleWhiteout: + xor a + ld [wIsTrainerBattle], a + ld [wWasTrainerBattle], a + ; fallthrough to original routine + ResetButtonPressedAndMapScript:: xor a ld [wJoyIgnore], a @@ -232,12 +244,14 @@ InitBattleEnemyParameters:: ld a, [wEngagedTrainerClass] ld [wCurOpponent], a ld [wEnemyMonOrTrainerClass], a - cp OPP_ID_OFFSET + ld a, [wIsTrainerBattle] + and a + jr z, .noTrainer ld a, [wEngagedTrainerSet] - jr c, .noTrainer ld [wTrainerNo], a ret .noTrainer + ld a, [wEngagedTrainerSet] ld [wCurEnemyLVL], a ret @@ -333,7 +347,17 @@ EngageMapTrainer:: ld a, [hli] ; load trainer class ld [wEngagedTrainerClass], a ld a, [hl] ; load trainer mon set + bit 7, a + jr nz, .pokemon ld [wEngagedTrainerSet], a + ld a, 1 + ld [wIsTrainerBattle], a + jp PlayTrainerMusic +.pokemon + and $7F + ld [wEngagedTrainerSet], a + xor a + ld [wIsTrainerBattle], a jp PlayTrainerMusic PrintEndBattleText:: diff --git a/scripts/CeruleanCity.asm b/scripts/CeruleanCity.asm index ae4350cd..6b9ddc5b 100644 --- a/scripts/CeruleanCity.asm +++ b/scripts/CeruleanCity.asm @@ -156,6 +156,8 @@ CeruleanCityScript1: ld a, $9 .done ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a xor a ldh [hJoyHeld], a @@ -168,6 +170,8 @@ CeruleanCityScript2: ld a, [wIsInBattle] cp $ff jp z, CeruleanCityScript_1948c + xor a + ld [wIsTrainerBattle], a call CeruleanCityScript_1955d ld a, $f0 ld [wJoyIgnore], a diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index c567e0f8..cd67cef6 100644 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -382,6 +382,8 @@ OaksLabScript11: ret nz ; define which team rival uses, and fight it + ld a, 1 + ld [wIsTrainerBattle], a ld a, OPP_RIVAL1 ld [wCurOpponent], a ld a, [wRivalStarter] @@ -416,6 +418,8 @@ OaksLabScript11: ret OaksLabScript12: + xor a + ld [wIsTrainerBattle], a ld a, $f0 ld [wJoyIgnore], a ld a, PLAYER_DIR_UP diff --git a/scripts/PokemonTower2F.asm b/scripts/PokemonTower2F.asm index 73799e68..8a4227f5 100644 --- a/scripts/PokemonTower2F.asm +++ b/scripts/PokemonTower2F.asm @@ -66,6 +66,8 @@ PokemonTower2Script1: ld a, [wIsInBattle] cp $ff jp z, PokemonTower2Script_604fe + xor a + ld [wIsTrainerBattle], a ld a, $f0 ld [wJoyIgnore], a SetEvent EVENT_BEAT_POKEMON_TOWER_RIVAL @@ -164,6 +166,8 @@ PokemonTower2Text1: ld a, $6 .done ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a ld a, $1 ld [wPokemonTower2FCurScript], a diff --git a/scripts/Route12.asm b/scripts/Route12.asm index d46a95bb..2b852a41 100644 --- a/scripts/Route12.asm +++ b/scripts/Route12.asm @@ -33,6 +33,8 @@ Route12Script0: ld [wCurOpponent], a ld a, 30 ld [wCurEnemyLVL], a + xor a + ld [wIsTrainerBattle], a ld a, HS_ROUTE_12_SNORLAX ld [wMissableObjectIndex], a predef HideObject diff --git a/scripts/Route16.asm b/scripts/Route16.asm index b77bbf61..108931f1 100644 --- a/scripts/Route16.asm +++ b/scripts/Route16.asm @@ -33,6 +33,8 @@ Route16Script0: ld [wCurOpponent], a ld a, 30 ld [wCurEnemyLVL], a + xor a + ld [wIsTrainerBattle], a ld a, HS_ROUTE_16_SNORLAX ld [wMissableObjectIndex], a predef HideObject diff --git a/scripts/Route22.asm b/scripts/Route22.asm index 1b02752f..e1a901f4 100644 --- a/scripts/Route22.asm +++ b/scripts/Route22.asm @@ -33,6 +33,8 @@ Route22Script_50ed6: .asm_50ee1 ld a, [hl] ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a ret Route22MoveRivalSprite: @@ -149,6 +151,8 @@ Route22Script2: ld a, [wIsInBattle] cp $ff jp z, Route22Script_50ece + xor a + ld [wIsTrainerBattle], a ld a, [wSpritePlayerStateData1FacingDirection] and a ; cp SPRITE_FACING_DOWN jr nz, .notDown @@ -304,6 +308,8 @@ Route22Script5: ld a, [wIsInBattle] cp $ff jp z, Route22Script_50ece + xor a + ld [wIsTrainerBattle], a ld a, $2 ldh [hSpriteIndex], a ld a, [wcf0d] diff --git a/scripts/SSAnne2F.asm b/scripts/SSAnne2F.asm index d15ec180..7346b268 100644 --- a/scripts/SSAnne2F.asm +++ b/scripts/SSAnne2F.asm @@ -114,6 +114,8 @@ SSAnne2Script1: ld a, $3 .done ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a call SSAnne2Script_61416 ld a, $2 @@ -124,6 +126,8 @@ SSAnne2Script2: ld a, [wIsInBattle] cp $ff jp z, SSAnne2Script_613ab + xor a + ld [wIsTrainerBattle], a call SSAnne2Script_61416 ld a, $f0 ld [wJoyIgnore], a diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index ac4aaa89..4055e991 100644 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -199,6 +199,8 @@ SilphCo7Script3: ld a, $9 .asm_51cc0 ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a ld a, $4 jp SilphCo7Text_51c10 @@ -206,6 +208,8 @@ SilphCo7Script4: ld a, [wIsInBattle] cp $ff jp z, SilphCo7Text_51c0c + xor a + ld [wIsTrainerBattle], a ld a, $f0 ld [wJoyIgnore], a SetEvent EVENT_BEAT_SILPH_CO_RIVAL