From fc597000fb0d9aabc37c5c0542efd069d4701f66 Mon Sep 17 00:00:00 2001 From: May Evans <36418502+PlagueVonKarma@users.noreply.github.com> Date: Sun, 2 Apr 2023 21:37:57 +0100 Subject: [PATCH] Fix trainer sprite loading Moved Yujirou to the end of the file and made the bank switching code more efficient, was swamp code before. --- constants/trainer_constants.asm | 2 +- data/trainers/names.asm | 2 +- data/trainers/parties.asm | 12 ++++++------ data/trainers/pic_pointers_money.asm | 2 +- engine/battle/core.asm | 6 ++---- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/constants/trainer_constants.asm b/constants/trainer_constants.asm index 1a7c0860..607a8a38 100644 --- a/constants/trainer_constants.asm +++ b/constants/trainer_constants.asm @@ -27,7 +27,6 @@ ENDM trainer_const BIKER ; $0A trainer_const BURGLAR ; $0B trainer_const ENGINEER ; $0C - trainer_const YUJIROU ; $0D, was unused juggler trainer_const FISHER ; $0E trainer_const SWIMMER ; $0F trainer_const CUE_BALL ; $10 @@ -62,4 +61,5 @@ ENDM trainer_const CHANNELER ; $2D trainer_const AGATHA ; $2E trainer_const LANCE ; $2F + trainer_const YUJIROU ; $0D, was unused juggler, also not 0D but I can't be bothered to change everything DEF NUM_TRAINERS EQU const_value - 1 diff --git a/data/trainers/names.asm b/data/trainers/names.asm index 9040e16f..861abcfd 100644 --- a/data/trainers/names.asm +++ b/data/trainers/names.asm @@ -11,7 +11,6 @@ TrainerNames:: db "BIKER@" db "BURGLAR@" db "ENGINEER@" - db "YUJIROU@" db "FISHERMAN@" db "SWIMMER@" db "CUE BALL@" @@ -46,3 +45,4 @@ TrainerNames:: db "CHANNELER@" db "AGATHA@" db "LANCE@" + db "YUJIROU@" diff --git a/data/trainers/parties.asm b/data/trainers/parties.asm index 7bd0c9dd..06d9d0c1 100644 --- a/data/trainers/parties.asm +++ b/data/trainers/parties.asm @@ -11,7 +11,6 @@ TrainerDataPointers: dw BikerData dw BurglarData dw EngineerData - dw YujirouData ; was unused juggler dw FisherData dw SwimmerData dw CueBallData @@ -46,6 +45,7 @@ TrainerDataPointers: dw ChannelerData dw AgathaData dw LanceData + dw YujirouData ; was unused juggler ; if first byte != $FF, then ; first byte is level (of all pokemon on this team) @@ -322,11 +322,6 @@ EngineerData: db 21, MAGNEMITE, 0 db 18, MAGNEMITE, MAGNEMITE, MAGNETITE, 0 -YujirouData: ; was unused juggler - db $FF, 7, KONYA, 7, RATTATA, 10, LICKITUNG, 0 -; post-game rematch team (currently unused) - db $FF, 66, PERSIAN, 67, TAUROS, 67, MADAAMU, 66, BLISSEY, 67, SNORLAX, 70, LICKILICKY, 0 - FisherData: ; SS Anne 2F Rooms db 17, GOLDEEN, TENTACOOL, GOLDEEN, 0 @@ -858,3 +853,8 @@ 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 + +YujirouData: ; was unused juggler + db $FF, 7, KONYA, 7, RATTATA, 10, LICKITUNG, 0 +; post-game rematch team (currently unused) + db $FF, 66, PERSIAN, 67, TAUROS, 67, MADAAMU, 66, BLISSEY, 67, SNORLAX, 70, LICKILICKY, 0 diff --git a/data/trainers/pic_pointers_money.asm b/data/trainers/pic_pointers_money.asm index 720dace4..6e6d8fb6 100644 --- a/data/trainers/pic_pointers_money.asm +++ b/data/trainers/pic_pointers_money.asm @@ -19,7 +19,6 @@ TrainerPicAndMoneyPointers:: pic_money BikerPic, 2000 pic_money BurglarPic, 9000 pic_money EngineerPic, 5000 - pic_money YujirouPic, 9900 ; was unused juggler pic_money FisherPic, 3500 pic_money SwimmerPic, 500 pic_money CueBallPic, 2500 @@ -54,4 +53,5 @@ TrainerPicAndMoneyPointers:: pic_money ChannelerPic, 3000 pic_money AgathaPic, 9900 pic_money LancePic, 9900 + pic_money YujirouPic, 9900 ; was unused juggler assert_table_length NUM_TRAINERS diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 0597e5ea..fb8c78c5 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6954,11 +6954,9 @@ _LoadTrainerPic: ld d, a ; de contains pointer to trainer pic ld a, [wLinkState] and a - ;ld a, BANK("Pics 6") ; this is where all the trainer pics are (not counting Red's) - ;jr z, .loadSprite - jr nz, .useRed ; New Trainer Pic code, credit to Rangi's Red*/Blue* hack + jr nz, .useRed ld a, [wTrainerClass] - cp YUJIROU ; first trainer class in "Pics 10" + cp YUJIROU ; first trainer class in "Pics 10" - Rangi's code to load more trainer pics ld a, Bank("Pics 10") jr nc, .loadSprite ld a, Bank("Pics 6")