From f4f2628f8d196d39315c8f57e161b83958597408 Mon Sep 17 00:00:00 2001 From: May Evans <36418502+PlagueVonKarma@users.noreply.github.com> Date: Sat, 17 Dec 2022 20:47:39 +0000 Subject: [PATCH] Gym scaling base This adds gym scaling for every leader, plus Koichi of the Fighting Dojo. Me and Ema decided to give Koichi scaling, as he is a gym leader in everything but class. I will likely give Yujirou the same treatment once he's all set up. The parties have not been set up, assuming Martha is working on them. An important note: space is somewhat limited on trainers now, so the leaders will need implementing incrementally. You will most likely have to remove unnecessary trainers to make this work. --- data/maps/objects/FightingDojo.asm | 10 ++--- data/maps/objects/VictoryRoad2F.asm | 2 +- data/maps/objects/ViridianGym.asm | 6 +-- data/trainers/parties.asm | 59 ++++++++++++++++------------- scan_includes.exe.stackdump | 15 ++++---- scripts/CeladonGym.asm | 19 +++++++++- scripts/CeruleanGym.asm | 19 +++++++++- scripts/CinnabarGym.asm | 19 +++++++++- scripts/FightingDojo.asm | 19 +++++++++- scripts/FuchsiaGym.asm | 19 +++++++++- scripts/SaffronGym.asm | 19 +++++++++- scripts/VermilionGym.asm | 19 +++++++++- scripts/ViridianGym.asm | 2 +- 13 files changed, 177 insertions(+), 50 deletions(-) diff --git a/data/maps/objects/FightingDojo.asm b/data/maps/objects/FightingDojo.asm index 808abf71..c6e17c7e 100644 --- a/data/maps/objects/FightingDojo.asm +++ b/data/maps/objects/FightingDojo.asm @@ -8,11 +8,11 @@ FightingDojo_Object: def_bg_events def_object_events - object_event 5, 3, SPRITE_HIKER, STAY, DOWN, 1, OPP_BLACKBELT, 1 - object_event 3, 4, SPRITE_HIKER, STAY, RIGHT, 2, OPP_BLACKBELT, 2 - object_event 3, 6, SPRITE_HIKER, STAY, RIGHT, 3, OPP_BLACKBELT, 3 - object_event 5, 5, SPRITE_HIKER, STAY, LEFT, 4, OPP_BLACKBELT, 4 - object_event 5, 7, SPRITE_HIKER, STAY, LEFT, 5, OPP_BLACKBELT, 5 + object_event 5, 3, SPRITE_HIKER, STAY, DOWN, 1, OPP_BLACKBELT, 1 ; koichi + object_event 3, 4, SPRITE_HIKER, STAY, RIGHT, 2, OPP_BLACKBELT, 9 + object_event 3, 6, SPRITE_HIKER, STAY, RIGHT, 3, OPP_BLACKBELT, 10 + object_event 5, 5, SPRITE_HIKER, STAY, LEFT, 4, OPP_BLACKBELT, 11 + object_event 5, 7, SPRITE_HIKER, STAY, LEFT, 5, OPP_BLACKBELT, 12 object_event 4, 1, SPRITE_POKE_BALL, STAY, NONE, 6 ; person object_event 5, 1, SPRITE_POKE_BALL, STAY, NONE, 7 ; person diff --git a/data/maps/objects/VictoryRoad2F.asm b/data/maps/objects/VictoryRoad2F.asm index 00fbb99e..9ee091e2 100644 --- a/data/maps/objects/VictoryRoad2F.asm +++ b/data/maps/objects/VictoryRoad2F.asm @@ -13,7 +13,7 @@ VictoryRoad2F_Object: def_bg_events def_object_events - object_event 12, 9, SPRITE_HIKER, STAY, LEFT, 1, OPP_BLACKBELT, 9 + object_event 12, 9, SPRITE_HIKER, STAY, LEFT, 1, OPP_BLACKBELT, 16 object_event 21, 13, SPRITE_SUPER_NERD, STAY, LEFT, 2, OPP_JUGGLER, 2 object_event 19, 8, SPRITE_COOLTRAINER_M, STAY, DOWN, 3, OPP_TAMER, 5 object_event 4, 2, SPRITE_SUPER_NERD, STAY, DOWN, 4, OPP_POKEMANIAC, 6 diff --git a/data/maps/objects/ViridianGym.asm b/data/maps/objects/ViridianGym.asm index da085f20..61216e68 100644 --- a/data/maps/objects/ViridianGym.asm +++ b/data/maps/objects/ViridianGym.asm @@ -12,11 +12,11 @@ ViridianGym_Object: def_object_events object_event 4, 3, SPRITE_GIOVANNI, STAY, DOWN, 1, OPP_GIOVANNI, 3 object_event 12, 7, SPRITE_COOLTRAINER_M, STAY, DOWN, 2, OPP_COOLTRAINER_M, 9 - object_event 11, 11, SPRITE_HIKER, STAY, UP, 3, OPP_BLACKBELT, 6 + object_event 11, 11, SPRITE_HIKER, STAY, UP, 3, OPP_BLACKBELT, 13 object_event 10, 7, SPRITE_ROCKER, STAY, DOWN, 4, OPP_TAMER, 3 - object_event 7, 10, SPRITE_HIKER, STAY, LEFT, 5, OPP_BLACKBELT, 7 + object_event 7, 10, SPRITE_HIKER, STAY, LEFT, 5, OPP_BLACKBELT, 14 object_event 13, 5, SPRITE_COOLTRAINER_M, STAY, RIGHT, 6, OPP_COOLTRAINER_M, 10 - object_event 9, 1, SPRITE_HIKER, STAY, DOWN, 7, OPP_BLACKBELT, 8 + object_event 9, 1, SPRITE_HIKER, STAY, DOWN, 7, OPP_BLACKBELT, 15 object_event 2, 16, SPRITE_ROCKER, STAY, RIGHT, 8, OPP_TAMER, 4 object_event 4, 8, SPRITE_COOLTRAINER_M, STAY, DOWN, 9, OPP_COOLTRAINER_M, 1 object_event 16, 15, SPRITE_GYM_GUIDE, STAY, DOWN, 10 ; person diff --git a/data/trainers/parties.asm b/data/trainers/parties.asm index 69809dca..2edf0108 100644 --- a/data/trainers/parties.asm +++ b/data/trainers/parties.asm @@ -486,11 +486,19 @@ BirdKeeperData: db 28, SPEAROW, DODUO, FEAROW, 0 BlackbeltData: -; Fighting Dojo - db 37, HITMONLEE, HITMONCHAN, 0 - db 31, MANKEY, MANKEY, PRIMEAPE, 0 - db 32, MACHOP, MACHOKE, 0 - db 36, PRIMEAPE, 0 +; Koichi parties + db 7, MACHOP, MANKEY, 0 + db 18, MACHOP, MANKEY, POLIWHIRL, 0 + db 22, MACHOKE, MANKEY, POLIWHIRL, HITMONLEE, HITMONCHAN, 0 + db 28, MACHOKE, PRIMEAPE, POLIWHIRL, HITMONLEE, HITMONCHAN, HITMONTOP, 0 + db 34, MACHOKE, PRIMEAPE, POLIWHIRL, HITMONLEE, HITMONCHAN, HITMONTOP, 0 + db 39, MACHAMP, PRIMEAPE, POLIWRATH, HITMONLEE, HITMONCHAN, HITMONTOP, 0 + db 46, MACHAMP, ANNIHILAPE, POLIWRATH, HITMONLEE, HITMONCHAN, HITMONTOP, 0 + db 55, MACHAMP, ANNIHILAPE, POLIWRATH, HITMONLEE, HITMONCHAN, HITMONTOP, 0 +; Fighting Dojo Trainers + db 31, CHEEP, CHEEP, JABETTA, 0 + db 32, MACHOKE, MACHAMP, 0 + db 36, SIRFETCHD, 0 db 31, MACHOP, MANKEY, PRIMEAPE, 0 ; Viridian Gym - changed to fit the Ground-type gym theme db 40, GRAVELER, GOLEM, 0 @@ -591,32 +599,32 @@ RocketData: db 23, ZUBAT, RATTATA, RATICATE, ZUBAT, 0 ; Unused - this will be used in the Silph Gauntlet db 65, PERSIAN, ARBOK, WEEZING, CROBAT, HYPNO, GUARDIA, 0 -; Silph Co. 2F - db 29, CUBONE, ZUBAT, 0 - db 25, GOLBAT, ZUBAT, ZUBAT, RATICATE, ZUBAT, 0 +; Silph Co. 2F - cut + ;db 29, CUBONE, ZUBAT, 0 + ;db 25, GOLBAT, ZUBAT, ZUBAT, RATICATE, ZUBAT, 0 ; Silph Co. 3F db 28, RATICATE, HYPNO, RATICATE, 0 -; Silph Co. 4F - db 29, MACHOP, DROWZEE, 0 - db 28, EKANS, ZUBAT, CUBONE, 0 -; Silph Co. 5F - db 33, ARBOK, 0 - db 33, HYPNO, 0 -; Silph Co. 6F - db 29, MACHOP, MACHOKE, 0 - db 28, ZUBAT, ZUBAT, GOLBAT, 0 +; Silph Co. 4F - cut + ;db 29, MACHOP, DROWZEE, 0 + ;db 28, EKANS, ZUBAT, CUBONE, 0 +; Silph Co. 5F - cut + ;db 33, ARBOK, 0 + ;db 33, HYPNO, 0 +; Silph Co. 6F - cut + ;db 29, MACHOP, MACHOKE, 0 + ;db 28, ZUBAT, ZUBAT, GOLBAT, 0 ; Silph Co. 7F db 26, RATICATE, ARBOK, KOFFING, GOLBAT, 0 db 29, CUBONE, CUBONE, 0 db 29, SANDSHREW, SANDSLASH, 0 -; Silph Co. 8F - db 26, RATICATE, ZUBAT, GOLBAT, RATTATA, 0 - db 28, WEEZING, GOLBAT, KOFFING, 0 -; Silph Co. 9F - db 28, DROWZEE, GRIMER, MACHOP, 0 - db 28, GOLBAT, DROWZEE, HYPNO, 0 -; Silph Co. 10F - db 33, MACHOKE, 0 +; Silph Co. 8F - cut + ;db 26, RATICATE, ZUBAT, GOLBAT, RATTATA, 0 + ;db 28, WEEZING, GOLBAT, KOFFING, 0 +; Silph Co. 9F - cut + ;db 28, DROWZEE, GRIMER, MACHOP, 0 + ;db 28, GOLBAT, DROWZEE, HYPNO, 0 +; Silph Co. 10F - cut + ;db 33, MACHOKE, 0 ; Silph Co. 11F db 25, RATTATA, RATTATA, ZUBAT, RATTATA, EKANS, 0 db 32, CUBONE, DROWZEE, MAROWAK, 0 @@ -792,4 +800,3 @@ LanceData: db $FF, 58, CROCKY, 57, KINGDRA, 57, AERODACTYL, 59, CHARIZARD, 59, CRYITHAN, 62, DRAGONITE, 0 ; post-game rematch team (currently unused) ; db $FF, 78, CROCKY, 77, KINGDRA, 77, AERODACTYL, 79, EXEGGUTOR_A, 79, CRYITHAN, 82, DRAGONITE, 0 - diff --git a/scan_includes.exe.stackdump b/scan_includes.exe.stackdump index 19b16799..1a2f55b0 100644 --- a/scan_includes.exe.stackdump +++ b/scan_includes.exe.stackdump @@ -1,15 +1,16 @@ Exception: STATUS_ACCESS_VIOLATION at rip=00100401246 -rax=FFFFFFF7FFF8CD51 rbx=000000000000084E rcx=0000000800000010 -rdx=0000000000000000 rsi=0000000800059544 rdi=0000000000000000 -r8 =00000000FFFFC7C4 r9 =0000000000000000 r10=0000000100000000 -r11=0000000100401282 r12=00000008000732B0 r13=0000000100403148 +rax=FFFFFFF7FFF91B01 rbx=0000000000006048 rcx=0000000800000010 +rdx=0000000000000000 rsi=000000080006C835 rdi=0000000000000000 +r8 =00000000FFFFC744 r9 =0000000000000000 r10=0000000100000000 +r11=0000000100401282 r12=000000080006E500 r13=0000000100403148 r14=0000000000000000 r15=0000000000000001 -rbp=0000000100403156 rsp=00000000FFFFCA60 -program=C:\cygwin64\home\chipp\kep-hack\tools\scan_includes.exe, pid 177, thread main +rbp=0000000100403156 rsp=00000000FFFFC9E0 +program=C:\cygwin64\home\chipp\kep-hack\tools\scan_includes.exe, pid 1692, thread main cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B Stack trace: Frame Function Args -00100403156 00100401246 (00800059544, 00000000022, 00100403166, 000FFFFCB90) +00100403156 00100401246 (0080006C835, 00000000022, 00100403166, 00100403148) +00100403156 00100401409 (0080005A44B, 00000000022, 00100403166, 000FFFFCB90) 00100403156 00100401409 (00000000000, 00100000001, 00180227860, 00100407000) 00100403178 00100401C87 (00000000020, 00000000000, 00180049B11, 00180048A70) 000FFFFCD30 00180049B7D (00000000000, 00000000000, 00000000000, 00000000000) diff --git a/scripts/CeladonGym.asm b/scripts/CeladonGym.asm index 2ffa1995..3ea55abc 100644 --- a/scripts/CeladonGym.asm +++ b/scripts/CeladonGym.asm @@ -126,7 +126,24 @@ ErikaText: ldh a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer - call InitBattleEnemyParameters + ; call InitBattleEnemyParameters ; put this back if you mess up + + ; gym scaling spaghetti code begins here - remove initial parameters as we're making our own + ld a, OPP_ERIKA + ld [wCurOpponent], a + + ld hl, wObtainedBadges ; Picking the team based on badge count. Need +1 so it loads the right team: remember, you're fighting for the badge! Thanks to Chatot4444 for the help. + ld b, 1 + call CountSetBits + ld a, [wNumSetBits] + inc a + + ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a + + ;ends here + ld a, $4 ld [wGymLeaderNo], a ld a, $3 diff --git a/scripts/CeruleanGym.asm b/scripts/CeruleanGym.asm index 798716e3..46455987 100644 --- a/scripts/CeruleanGym.asm +++ b/scripts/CeruleanGym.asm @@ -112,7 +112,24 @@ MistyText: ldh a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer - call InitBattleEnemyParameters + ; call InitBattleEnemyParameters ; put this back if you mess up + + ; gym scaling spaghetti code begins here - remove initial parameters as we're making our own + ld a, OPP_MISTY + ld [wCurOpponent], a + + ld hl, wObtainedBadges ; Picking the team based on badge count. Need +1 so it loads the right team: remember, you're fighting for the badge! Thanks to Chatot4444 for the help. + ld b, 1 + call CountSetBits + ld a, [wNumSetBits] + inc a + + ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a + + ;ends here + ld a, $2 ld [wGymLeaderNo], a xor a diff --git a/scripts/CinnabarGym.asm b/scripts/CinnabarGym.asm index 370a875f..9c2662da 100644 --- a/scripts/CinnabarGym.asm +++ b/scripts/CinnabarGym.asm @@ -191,7 +191,24 @@ CinnabarGymScript_758b7: ldh a, [hSpriteIndexOrTextID] ld [wSpriteIndex], a call EngageMapTrainer - call InitBattleEnemyParameters + ; call InitBattleEnemyParameters ; put this back if you mess up + + ; gym scaling spaghetti code begins here - remove initial parameters as we're making our own + ld a, OPP_BLAINE + ld [wCurOpponent], a + + ld hl, wObtainedBadges ; Picking the team based on badge count. Need +1 so it loads the right team: remember, you're fighting for the badge! Thanks to Chatot4444 for the help. + ld b, 1 + call CountSetBits + ld a, [wNumSetBits] + inc a + + ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a + + ;ends here + ld hl, wd72d set 6, [hl] set 7, [hl] diff --git a/scripts/FightingDojo.asm b/scripts/FightingDojo.asm index fc9f68ea..bc2ff323 100644 --- a/scripts/FightingDojo.asm +++ b/scripts/FightingDojo.asm @@ -119,7 +119,24 @@ FightingDojoText1: ldh a, [hSpriteIndexOrTextID] ld [wSpriteIndex], a call EngageMapTrainer - call InitBattleEnemyParameters + ; call InitBattleEnemyParameters ; put this back if you mess up + + ; gym scaling spaghetti code begins here - remove initial parameters as we're making our own + ld a, OPP_BLACKBELT + ld [wCurOpponent], a + + ld hl, wObtainedBadges ; Picking the team based on badge count. Need +1 so it loads the right team: remember, you're fighting for the badge! Thanks to Chatot4444 for the help. + ld b, 1 + call CountSetBits + ld a, [wNumSetBits] + inc a + + ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a + + ;ends here + ld a, $3 ld [wFightingDojoCurScript], a ld [wCurMapScript], a diff --git a/scripts/FuchsiaGym.asm b/scripts/FuchsiaGym.asm index 8dc93d22..8ee62404 100644 --- a/scripts/FuchsiaGym.asm +++ b/scripts/FuchsiaGym.asm @@ -126,7 +126,24 @@ KogaText: ldh a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer - call InitBattleEnemyParameters + ; call InitBattleEnemyParameters ; put this back if you mess up + + ; gym scaling spaghetti code begins here - remove initial parameters as we're making our own + ld a, OPP_KOGA + ld [wCurOpponent], a + + ld hl, wObtainedBadges ; Picking the team based on badge count. Need +1 so it loads the right team: remember, you're fighting for the badge! Thanks to Chatot4444 for the help. + ld b, 1 + call CountSetBits + ld a, [wNumSetBits] + inc a + + ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a + + ;ends here + ld a, $5 ld [wGymLeaderNo], a xor a diff --git a/scripts/SaffronGym.asm b/scripts/SaffronGym.asm index 23b2dd85..20af67cc 100644 --- a/scripts/SaffronGym.asm +++ b/scripts/SaffronGym.asm @@ -127,7 +127,24 @@ SabrinaText: ldh a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer - call InitBattleEnemyParameters + ; call InitBattleEnemyParameters ; put this back if you mess up + + ; gym scaling spaghetti code begins here - remove initial parameters as we're making our own + ld a, OPP_SABRINA + ld [wCurOpponent], a + + ld hl, wObtainedBadges ; Picking the team based on badge count. Need +1 so it loads the right team: remember, you're fighting for the badge! Thanks to Chatot4444 for the help. + ld b, 1 + call CountSetBits + ld a, [wNumSetBits] + inc a + + ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a + + ;ends here + ld a, $6 ld [wGymLeaderNo], a ld a, $3 diff --git a/scripts/VermilionGym.asm b/scripts/VermilionGym.asm index 3bbb8743..396d5576 100644 --- a/scripts/VermilionGym.asm +++ b/scripts/VermilionGym.asm @@ -134,7 +134,24 @@ LTSurgeText: ldh a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer - call InitBattleEnemyParameters + ; call InitBattleEnemyParameters ; put this back if you mess up + + ; gym scaling spaghetti code begins here - remove initial parameters as we're making our own + ld a, OPP_LT_SURGE + ld [wCurOpponent], a + + ld hl, wObtainedBadges ; Picking the team based on badge count. Need +1 so it loads the right team: remember, you're fighting for the badge! Thanks to Chatot4444 for the help. + ld b, 1 + call CountSetBits + ld a, [wNumSetBits] + inc a + + ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a + + ;ends here + ld a, $3 ld [wGymLeaderNo], a xor a diff --git a/scripts/ViridianGym.asm b/scripts/ViridianGym.asm index bd214c68..3d9b4d81 100644 --- a/scripts/ViridianGym.asm +++ b/scripts/ViridianGym.asm @@ -231,7 +231,7 @@ GiovanniText: ldh a, [hSpriteIndex] ld [wSpriteIndex], a call EngageMapTrainer - call InitBattleEnemyParameters + call InitBattleEnemyParameters ; giovanni is deliberately not scaled as he is always fought last ld a, $8 ld [wGymLeaderNo], a ld a, $3