From 1aabb7613d4570260de2f821676887909faba286 Mon Sep 17 00:00:00 2001 From: Frank DeBlasio <35279583+fdeblasio@users.noreply.github.com> Date: Wed, 20 Dec 2023 17:14:33 -0500 Subject: [PATCH] Refactor Trainer sprites (#3597) * Added TrainerSprite struct with coordinates * Added .frontPic to struct * Added .palette to TrainerSprite struct * Added .animation to the struct * Added define for sprite size * Condensed animations since they were all the same * Improved TRAINER_SPRITE/PAL defines * Simplified seemingly unused .y_offset and TRAINER_PIC_SIZE values * Condensed TRAINER_SPRITE and TRAINER_PAL into TRAINER_PIC * Renamed .size to .y_offset since that what it appears to actually be * Moved y_offset into TRAINER_PIC * Moved animation inside of TRAINER_PIC * Added array number to preproc * Removed trailing spaces * Added sprite/palette files to preproc * Revert adding sprites to preproc as it fails agbcc This reverts commit dce57f8d1bfab70b4c6630a9c4e5b43495891459. * Added backsprite struct * Added animations to backsprite struct * Changed TRAINER_PIC to TRAINER_SPRITE * Added animation to backsprite preproc * Added .backPic to struct * Moved array number into backsprite preproc * Removed definitions for trainer sprites * Hardcoded sAnims_Trainer into struct since every sprite uses it * Fixed TRAINER_SPRITE arguments --- include/data.h | 27 ++- include/graphics.h | 228 ------------------- src/battle_controller_link_opponent.c | 2 +- src/battle_controller_link_partner.c | 4 +- src/battle_controller_opponent.c | 2 +- src/battle_controller_player.c | 8 +- src/battle_controller_player_partner.c | 22 +- src/battle_controller_recorded_opponent.c | 2 +- src/battle_controller_recorded_player.c | 8 +- src/battle_controller_safari.c | 2 +- src/battle_controller_wally.c | 4 +- src/battle_controllers.c | 10 +- src/battle_gfx_sfx_util.c | 10 +- src/data.c | 73 +----- src/data/graphics/trainers.h | 235 ++++++++++++++++++++ src/data/trainer_graphics/back_pic_anims.h | 129 ----------- src/data/trainer_graphics/back_pic_tables.h | 72 ------ src/field_effect.c | 15 +- src/pokemon.c | 6 +- src/pokenav_match_call_gfx.c | 4 +- src/reshow_battle_screen.c | 4 +- src/trainer_pokemon_sprites.c | 12 +- 22 files changed, 308 insertions(+), 571 deletions(-) delete mode 100644 src/data/trainer_graphics/back_pic_anims.h delete mode 100644 src/data/trainer_graphics/back_pic_tables.h diff --git a/include/data.h b/include/data.h index 82b85607c0af..21a5984ba81a 100644 --- a/include/data.h +++ b/include/data.h @@ -28,6 +28,22 @@ struct MonCoords u8 y_offset; }; +struct TrainerSprite +{ + u8 y_offset; + struct CompressedSpriteSheet frontPic; + struct CompressedSpritePalette palette; + const union AnimCmd *const *const animation; +}; + +struct TrainerBacksprite +{ + struct MonCoords coordinates; + struct CompressedSpriteSheet backPic; + struct CompressedSpritePalette palette; + const union AnimCmd *const *const animation; +}; + #define MON_COORDS_SIZE(width, height)(DIV_ROUND_UP(width, 8) << 4 | DIV_ROUND_UP(height, 8)) #define GET_MON_COORDS_WIDTH(size)((size >> 4) * 8) #define GET_MON_COORDS_HEIGHT(size)((size & 0xF) * 8) @@ -91,15 +107,10 @@ extern const union AffineAnimCmd *const gAffineAnims_BattleSpriteOpponentSide[]; extern const union AffineAnimCmd *const gAffineAnims_BattleSpriteContest[]; extern const union AnimCmd sAnim_GeneralFrame0[]; +extern const union AnimCmd sAnim_GeneralFrame3[]; extern const union AnimCmd *const gAnims_MonPic[]; -extern const union AnimCmd *const *const gTrainerFrontAnimsPtrTable[]; -extern const struct MonCoords gTrainerFrontPicCoords[]; -extern const struct CompressedSpriteSheet gTrainerFrontPicTable[]; -extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; -extern const union AnimCmd *const *const gTrainerBackAnimsPtrTable[]; -extern const struct MonCoords gTrainerBackPicCoords[]; -extern const struct CompressedSpriteSheet gTrainerBackPicTable[]; // functionally unused -extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; +extern const struct TrainerSprite gTrainerSprites[]; +extern const struct TrainerBacksprite gTrainerBacksprites[]; extern const struct Trainer gTrainers[]; extern const u8 gTrainerClassNames[][13]; diff --git a/include/graphics.h b/include/graphics.h index 08508e47ee81..dfd656d2b8e4 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -65,234 +65,6 @@ extern const u32 gOpenPokeballGfx[]; // pokemon gfx extern const u16 gMonIconPalettes[][16]; -// trainer sprites -extern const u32 gTrainerFrontPic_Hiker[]; -extern const u32 gTrainerFrontPic_AquaGruntM[]; -extern const u32 gTrainerFrontPic_PokemonBreederF[]; -extern const u32 gTrainerFrontPic_CoolTrainerM[]; -extern const u32 gTrainerFrontPic_BirdKeeper[]; -extern const u32 gTrainerFrontPic_Collector[]; -extern const u32 gTrainerFrontPic_AquaGruntF[]; -extern const u32 gTrainerFrontPic_SwimmerM[]; -extern const u32 gTrainerFrontPic_MagmaGruntM[]; -extern const u32 gTrainerFrontPic_ExpertM[]; -extern const u32 gTrainerFrontPic_AquaAdminM[]; -extern const u32 gTrainerFrontPic_BlackBelt[]; -extern const u32 gTrainerFrontPic_AquaAdminF[]; -extern const u32 gTrainerFrontPic_AquaLeaderArchie[]; -extern const u32 gTrainerFrontPic_HexManiac[]; -extern const u32 gTrainerFrontPic_AromaLady[]; -extern const u32 gTrainerFrontPic_RuinManiac[]; -extern const u32 gTrainerFrontPic_Interviewer[]; -extern const u32 gTrainerFrontPic_TuberF[]; -extern const u32 gTrainerFrontPic_TuberM[]; -extern const u32 gTrainerFrontPic_CoolTrainerF[]; -extern const u32 gTrainerFrontPic_Lady[]; -extern const u32 gTrainerFrontPic_Beauty[]; -extern const u32 gTrainerFrontPic_RichBoy[]; -extern const u32 gTrainerFrontPic_ExpertF[]; -extern const u32 gTrainerFrontPic_Pokemaniac[]; -extern const u32 gTrainerFrontPic_MagmaGruntF[]; -extern const u32 gTrainerFrontPic_Guitarist[]; -extern const u32 gTrainerFrontPic_Kindler[]; -extern const u32 gTrainerFrontPic_Camper[]; -extern const u32 gTrainerFrontPic_Picnicker[]; -extern const u32 gTrainerFrontPic_BugManiac[]; -extern const u32 gTrainerFrontPic_PokemonBreederM[]; -extern const u32 gTrainerFrontPic_PsychicM[]; -extern const u32 gTrainerFrontPic_PsychicF[]; -extern const u32 gTrainerFrontPic_Gentleman[]; -extern const u32 gTrainerFrontPic_EliteFourSidney[]; -extern const u32 gTrainerFrontPic_EliteFourPhoebe[]; -extern const u32 gTrainerFrontPic_EliteFourGlacia[]; -extern const u32 gTrainerFrontPic_EliteFourDrake[]; -extern const u32 gTrainerFrontPic_LeaderRoxanne[]; -extern const u32 gTrainerFrontPic_LeaderBrawly[]; -extern const u32 gTrainerFrontPic_LeaderWattson[]; -extern const u32 gTrainerFrontPic_LeaderFlannery[]; -extern const u32 gTrainerFrontPic_LeaderNorman[]; -extern const u32 gTrainerFrontPic_LeaderWinona[]; -extern const u32 gTrainerFrontPic_LeaderTateAndLiza[]; -extern const u32 gTrainerFrontPic_LeaderJuan[]; -extern const u32 gTrainerFrontPic_SchoolKidM[]; -extern const u32 gTrainerFrontPic_SchoolKidF[]; -extern const u32 gTrainerFrontPic_SrAndJr[]; -extern const u32 gTrainerFrontPic_PokefanM[]; -extern const u32 gTrainerFrontPic_PokefanF[]; -extern const u32 gTrainerFrontPic_Youngster[]; -extern const u32 gTrainerFrontPic_ChampionWallace[]; -extern const u32 gTrainerFrontPic_Fisherman[]; -extern const u32 gTrainerFrontPic_CyclingTriathleteM[]; -extern const u32 gTrainerFrontPic_CyclingTriathleteF[]; -extern const u32 gTrainerFrontPic_RunningTriathleteM[]; -extern const u32 gTrainerFrontPic_RunningTriathleteF[]; -extern const u32 gTrainerFrontPic_SwimmingTriathleteM[]; -extern const u32 gTrainerFrontPic_SwimmingTriathleteF[]; -extern const u32 gTrainerFrontPic_DragonTamer[]; -extern const u32 gTrainerFrontPic_NinjaBoy[]; -extern const u32 gTrainerFrontPic_BattleGirl[]; -extern const u32 gTrainerFrontPic_ParasolLady[]; -extern const u32 gTrainerFrontPic_SwimmerF[]; -extern const u32 gTrainerFrontPic_Twins[]; -extern const u32 gTrainerFrontPic_Sailor[]; -extern const u32 gTrainerFrontPic_MagmaAdmin[]; -extern const u32 gTrainerFrontPic_Wally[]; -extern const u32 gTrainerFrontPic_Brendan[]; -extern const u32 gTrainerFrontPic_May[]; -extern const u32 gTrainerFrontPic_BugCatcher[]; -extern const u32 gTrainerFrontPic_PokemonRangerM[]; -extern const u32 gTrainerFrontPic_PokemonRangerF[]; -extern const u32 gTrainerFrontPic_MagmaLeaderMaxie[]; -extern const u32 gTrainerFrontPic_Lass[]; -extern const u32 gTrainerFrontPic_YoungCouple[]; -extern const u32 gTrainerFrontPic_OldCouple[]; -extern const u32 gTrainerFrontPic_SisAndBro[]; -extern const u32 gTrainerFrontPic_Steven[]; -extern const u32 gTrainerFrontPic_SalonMaidenAnabel[]; -extern const u32 gTrainerFrontPic_DomeAceTucker[]; -extern const u32 gTrainerFrontPic_PalaceMavenSpenser[]; -extern const u32 gTrainerFrontPic_ArenaTycoonGreta[]; -extern const u32 gTrainerFrontPic_FactoryHeadNoland[]; -extern const u32 gTrainerFrontPic_PikeQueenLucy[]; -extern const u32 gTrainerFrontPic_PyramidKingBrandon[]; -extern const u32 gTrainerFrontPic_Red[]; -extern const u32 gTrainerFrontPic_Leaf[]; -extern const u32 gTrainerFrontPic_RubySapphireBrendan[]; -extern const u32 gTrainerFrontPic_RubySapphireMay[]; - -// New front sprites -extern const u32 gTrainerFrontPic_BreederFHGSS[]; -extern const u32 gTrainerPalette_BreederFHGSS[]; -extern const u32 gTrainerFrontPic_LassHGSS[]; -extern const u32 gTrainerPalette_LassHGSS[]; -extern const u32 gTrainerFrontPic_RocketGruntFHGSS[]; -extern const u32 gTrainerPalette_RocketGruntFHGSS[]; -extern const u32 gTrainerFrontPic_BeautyPP[]; -extern const u32 gTrainerPalette_BeautyPP[]; -extern const u32 gTrainerFrontPic_BugCatcherFPP[]; -extern const u32 gTrainerPalette_BugCatcherFPP[]; -extern const u32 gTrainerFrontPic_FirebreatherPP[]; -extern const u32 gTrainerPalette_FirebreatherPP[]; -extern const u32 gTrainerFrontPic_FishermanPP[]; -extern const u32 gTrainerPalette_FishermanPP[]; -extern const u32 gTrainerFrontPic_GuardFPP[]; -extern const u32 gTrainerPalette_GuardFPP[]; -extern const u32 gTrainerFrontPic_GuardMPP[]; -extern const u32 gTrainerPalette_GuardMPP[]; -extern const u32 gTrainerFrontPic_PsychicMPP[]; -extern const u32 gTrainerPalette_PsychicMPP[]; -extern const u32 gTrainerFrontPic_RocketGruntFPP[]; -extern const u32 gTrainerPalette_RocketGruntFPP[]; -extern const u32 gTrainerFrontPic_HexManiacORAS[]; -extern const u32 gTrainerPalette_HexManiacORAS[]; - - -extern const u32 gTrainerPalette_Hiker[]; -extern const u32 gTrainerPalette_AquaGruntM[]; -extern const u32 gTrainerPalette_PokemonBreederF[]; -extern const u32 gTrainerPalette_CoolTrainerM[]; -extern const u32 gTrainerPalette_BirdKeeper[]; -extern const u32 gTrainerPalette_Collector[]; -extern const u32 gTrainerPalette_AquaGruntF[]; -extern const u32 gTrainerPalette_SwimmerM[]; -extern const u32 gTrainerPalette_MagmaGruntM[]; -extern const u32 gTrainerPalette_ExpertM[]; -extern const u32 gTrainerPalette_AquaAdminM[]; -extern const u32 gTrainerPalette_BlackBelt[]; -extern const u32 gTrainerPalette_AquaAdminF[]; -extern const u32 gTrainerPalette_AquaLeaderArchie[]; -extern const u32 gTrainerPalette_HexManiac[]; -extern const u32 gTrainerPalette_AromaLady[]; -extern const u32 gTrainerPalette_RuinManiac[]; -extern const u32 gTrainerPalette_Interviewer[]; -extern const u32 gTrainerPalette_TuberF[]; -extern const u32 gTrainerPalette_TuberM[]; -extern const u32 gTrainerPalette_CoolTrainerF[]; -extern const u32 gTrainerPalette_Lady[]; -extern const u32 gTrainerPalette_Beauty[]; -extern const u32 gTrainerPalette_RichBoy[]; -extern const u32 gTrainerPalette_ExpertF[]; -extern const u32 gTrainerPalette_Pokemaniac[]; -extern const u32 gTrainerPalette_MagmaGruntF[]; -extern const u32 gTrainerPalette_Guitarist[]; -extern const u32 gTrainerPalette_Kindler[]; -extern const u32 gTrainerPalette_Camper[]; -extern const u32 gTrainerPalette_Picnicker[]; -extern const u32 gTrainerPalette_BugManiac[]; -extern const u32 gTrainerPalette_PokemonBreederM[]; -extern const u32 gTrainerPalette_PsychicM[]; -extern const u32 gTrainerPalette_PsychicF[]; -extern const u32 gTrainerPalette_Gentleman[]; -extern const u32 gTrainerPalette_EliteFourSidney[]; -extern const u32 gTrainerPalette_EliteFourPhoebe[]; -extern const u32 gTrainerPalette_EliteFourGlacia[]; -extern const u32 gTrainerPalette_EliteFourDrake[]; -extern const u32 gTrainerPalette_LeaderRoxanne[]; -extern const u32 gTrainerPalette_LeaderBrawly[]; -extern const u32 gTrainerPalette_LeaderWattson[]; -extern const u32 gTrainerPalette_LeaderFlannery[]; -extern const u32 gTrainerPalette_LeaderNorman[]; -extern const u32 gTrainerPalette_LeaderWinona[]; -extern const u32 gTrainerPalette_LeaderTateAndLiza[]; -extern const u32 gTrainerPalette_LeaderJuan[]; -extern const u32 gTrainerPalette_SchoolKidM[]; -extern const u32 gTrainerPalette_SchoolKidF[]; -extern const u32 gTrainerPalette_SrAndJr[]; -extern const u32 gTrainerPalette_PokefanM[]; -extern const u32 gTrainerPalette_PokefanF[]; -extern const u32 gTrainerPalette_Youngster[]; -extern const u32 gTrainerPalette_ChampionWallace[]; -extern const u32 gTrainerPalette_Fisherman[]; -extern const u32 gTrainerPalette_CyclingTriathleteM[]; -extern const u32 gTrainerPalette_CyclingTriathleteF[]; -extern const u32 gTrainerPalette_RunningTriathleteM[]; -extern const u32 gTrainerPalette_RunningTriathleteF[]; -extern const u32 gTrainerPalette_SwimmingTriathleteM[]; -extern const u32 gTrainerPalette_SwimmingTriathleteF[]; -extern const u32 gTrainerPalette_DragonTamer[]; -extern const u32 gTrainerPalette_NinjaBoy[]; -extern const u32 gTrainerPalette_BattleGirl[]; -extern const u32 gTrainerPalette_ParasolLady[]; -extern const u32 gTrainerPalette_SwimmerF[]; -extern const u32 gTrainerPalette_Twins[]; -extern const u32 gTrainerPalette_Sailor[]; -extern const u32 gTrainerPalette_MagmaAdmin[]; -extern const u32 gTrainerPalette_Wally[]; -extern const u32 gTrainerPalette_Brendan[]; -extern const u32 gTrainerPalette_May[]; -extern const u32 gTrainerPalette_BugCatcher[]; -extern const u32 gTrainerPalette_PokemonRangerM[]; -extern const u32 gTrainerPalette_PokemonRangerF[]; -extern const u32 gTrainerPalette_MagmaLeaderMaxie[]; -extern const u32 gTrainerPalette_Lass[]; -extern const u32 gTrainerPalette_YoungCouple[]; -extern const u32 gTrainerPalette_OldCouple[]; -extern const u32 gTrainerPalette_SisAndBro[]; -extern const u32 gTrainerPalette_Steven[]; -extern const u32 gTrainerPalette_SalonMaidenAnabel[]; -extern const u32 gTrainerPalette_DomeAceTucker[]; -extern const u32 gTrainerPalette_PalaceMavenSpenser[]; -extern const u32 gTrainerPalette_ArenaTycoonGreta[]; -extern const u32 gTrainerPalette_FactoryHeadNoland[]; -extern const u32 gTrainerPalette_PikeQueenLucy[]; -extern const u32 gTrainerPalette_PyramidKingBrandon[]; -extern const u32 gTrainerPalette_Red[]; -extern const u32 gTrainerPalette_Leaf[]; -extern const u32 gTrainerPalette_RubySapphireBrendan[]; -extern const u32 gTrainerPalette_RubySapphireMay[]; - -extern const u8 gTrainerBackPic_Brendan[]; -extern const u8 gTrainerBackPic_May[]; -extern const u8 gTrainerBackPic_Red[]; -extern const u8 gTrainerBackPic_Leaf[]; -extern const u8 gTrainerBackPic_RubySapphireBrendan[]; -extern const u8 gTrainerBackPic_RubySapphireMay[]; -extern const u8 gTrainerBackPic_Wally[]; -extern const u8 gTrainerBackPic_Steven[]; - -extern const u32 gTrainerBackPicPalette_Red[]; -extern const u32 gTrainerBackPicPalette_Leaf[]; - // pokeblock extern const u32 gMenuPokeblock_Gfx[]; extern const u32 gMenuPokeblock_Pal[]; diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 3a3cb7e8ce33..b89c2263f3f0 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -462,7 +462,7 @@ static void LinkOpponentHandleDrawTrainerPic(u32 battler) } BtlController_HandleDrawTrainerPic(battler, trainerPicId, TRUE, - xPos, 40 + 4 * (8 - gTrainerFrontPicCoords[trainerPicId].size), + xPos, 40 + 4 * (8 - gTrainerSprites[trainerPicId].y_offset), -1); } diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 4b8daeb1e1fd..58bbe676f096 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -234,7 +234,7 @@ static void LinkPartnerHandleDrawTrainerPic(u32 battler) trainerPicId = LinkPlayerGetTrainerPicId(GetBattlerMultiplayerId(battler)); BtlController_HandleDrawTrainerPic(battler, trainerPicId, FALSE, - xPos, 80 + 4 * (8 - gTrainerBackPicCoords[trainerPicId].size), + xPos, 80 + 4 * (8 - gTrainerBacksprites[trainerPicId].coordinates.size), -1); } @@ -261,7 +261,7 @@ static void LinkPartnerHandleHealthBarUpdate(u32 battler) static void LinkPartnerHandleIntroTrainerBallThrow(u32 battler) { u32 trainerPicId = LinkPlayerGetTrainerPicId(GetBattlerMultiplayerId(battler)); - const u32 *trainerPal = gTrainerBackPicPaletteTable[trainerPicId].data; + const u32 *trainerPal = gTrainerBacksprites[trainerPicId].palette.data; // Link partner uses the same intro sequence as the player partner. BtlController_HandleIntroTrainerBallThrow(battler, 0xD6F9, trainerPal, 24, Controller_PlayerPartnerShowIntroHealthbox); } diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 6b09f0d41fa7..649240ce34da 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -485,7 +485,7 @@ static void OpponentHandleDrawTrainerPic(u32 battler) } BtlController_HandleDrawTrainerPic(battler, trainerPicId, TRUE, - xPos, 40 + 4 * (8 - gTrainerFrontPicCoords[trainerPicId].size), + xPos, 40 + 4 * (8 - gTrainerSprites[trainerPicId].y_offset), -1); } diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 64c393c6ffa6..3e1f42dfa6e2 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -1940,18 +1940,18 @@ static void PlayerHandleDrawTrainerPic(u32 battler) if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER && gPartnerTrainerId < TRAINER_CUSTOM_PARTNER) { xPos = 90; - yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80; + yPos = (8 - gTrainerSprites[trainerPicId].y_offset) * 4 + 80; } else { - yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80; + yPos = (8 - gTrainerBacksprites[trainerPicId].coordinates.size) * 4 + 80; } } else { xPos = 80; - yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80; + yPos = (8 - gTrainerBacksprites[trainerPicId].coordinates.size) * 4 + 80; } // Use front pic table for any tag battles unless your partner is Steven or a custom partner. @@ -2294,7 +2294,7 @@ static void PlayerHandleOneReturnValue_Duplicate(u32 battler) static void PlayerHandleIntroTrainerBallThrow(u32 battler) { - const u32 *trainerPal = gTrainerBackPicPaletteTable[gSaveBlock2Ptr->playerGender].data; + const u32 *trainerPal = gTrainerBacksprites[gSaveBlock2Ptr->playerGender].palette.data; BtlController_HandleIntroTrainerBallThrow(battler, 0xD6F8, trainerPal, 31, Intro_TryShinyAnimShowHealthbox); } diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index ed9f29c66702..da4e0ceaf583 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -300,25 +300,19 @@ static void PlayerPartnerHandleDrawTrainerPic(u32 battler) { trainerPicId = TRAINER_BACK_PIC_STEVEN; xPos = 90; - yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80; - } - else if (gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER) - { - trainerPicId = gPartnerSpriteId; - xPos = 90; - yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80; + yPos = (8 - gTrainerBacksprites[trainerPicId].coordinates.size) * 4 + 80; } else if (IsAiVsAiBattle()) { trainerPicId = gTrainers[gPartnerTrainerId].trainerPic; xPos = 60; - yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80; + yPos = (8 - gTrainerSprites[trainerPicId].y_offset) * 4 + 80; } else { trainerPicId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId); xPos = 32; - yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80; + yPos = (8 - gTrainerSprites[trainerPicId].y_offset) * 4 + 80; } // Use back pic only if the partner is Steven or a custom partner. @@ -439,14 +433,12 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(u32 battler) { const u32 *trainerPal; - if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER) - trainerPal = gTrainerBackPicPaletteTable[TRAINER_BACK_PIC_STEVEN].data; - else if (gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER) // Custom multi battle. - trainerPal = gTrainerBackPicPaletteTable[gPartnerSpriteId].data; + if (gPartnerTrainerId > TRAINER_PARTNER(PARTNER_NONE)) + trainerPal = gTrainerBacksprites[gPartnerSpriteId].palette.data; else if (IsAiVsAiBattle()) - trainerPal = gTrainerFrontPicPaletteTable[gTrainers[gPartnerTrainerId].trainerPic].data; + trainerPal = gTrainerSprites[gTrainers[gPartnerTrainerId].trainerPic].palette.data; else - trainerPal = gTrainerFrontPicPaletteTable[GetFrontierTrainerFrontSpriteId(gPartnerTrainerId)].data; // 2 vs 2 multi battle in Battle Frontier, load front sprite and pal. + trainerPal = gTrainerSprites[GetFrontierTrainerFrontSpriteId(gPartnerTrainerId)].palette.data; // 2 vs 2 multi battle in Battle Frontier, load front sprite and pal. BtlController_HandleIntroTrainerBallThrow(battler, 0xD6F9, trainerPal, 24, Controller_PlayerPartnerShowIntroHealthbox); } diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 58ef101ec99a..36caa14c1433 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -421,7 +421,7 @@ static void RecordedOpponentHandleDrawTrainerPic(u32 battler) } BtlController_HandleDrawTrainerPic(battler, trainerPicId, TRUE, - xPos, 40 + 4 * (8 - gTrainerFrontPicCoords[trainerPicId].size), + xPos, 40 + 4 * (8 - gTrainerSprites[trainerPicId].y_offset), -1); } diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index 39e869867efc..b8322b3eaf64 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -393,18 +393,18 @@ static void RecordedPlayerHandleDrawTrainerPic(u32 battler) if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) { xPos = 90; - yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80; + yPos = (8 - gTrainerSprites[trainerPicId].y_offset) * 4 + 80; } else { - yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80; + yPos = (8 - gTrainerBacksprites[trainerPicId].coordinates.size) * 4 + 80; } } else { xPos = 80; - yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80; + yPos = (8 - gTrainerBacksprites[trainerPicId].coordinates.size) * 4 + 80; } if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) @@ -517,7 +517,7 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(u32 battler) else trainerPicId = gSaveBlock2Ptr->playerGender + TRAINER_BACK_PIC_BRENDAN; - trainerPal = gTrainerFrontPicPaletteTable[trainerPicId].data; + trainerPal = gTrainerSprites[trainerPicId].palette.data; BtlController_HandleIntroTrainerBallThrow(battler, 0xD6F9, trainerPal, 24, Intro_TryShinyAnimShowHealthbox); } diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index b020a7fe736d..7b3430763995 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -249,7 +249,7 @@ static void SafariHandleDrawTrainerPic(u32 battler) u32 trainerPicId = gSaveBlock2Ptr->playerGender + TRAINER_BACK_PIC_BRENDAN; BtlController_HandleDrawTrainerPic(battler, trainerPicId, FALSE, - 80, 80 + 4 * (8 - gTrainerBackPicCoords[trainerPicId].size), + 80, 80 + 4 * (8 - gTrainerBacksprites[trainerPicId].coordinates.size), 30); } diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index a262886f4614..7b0bb6f154f4 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -297,7 +297,7 @@ static void WallyBufferExecCompleted(u32 battler) static void WallyHandleDrawTrainerPic(u32 battler) { BtlController_HandleDrawTrainerPic(battler, TRAINER_BACK_PIC_WALLY, FALSE, - 80, 80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].size), + 80, 80 + 4 * (8 - gTrainerBacksprites[TRAINER_BACK_PIC_WALLY].coordinates.size), 30); } @@ -420,7 +420,7 @@ static void WallyHandleFaintingCry(u32 battler) static void WallyHandleIntroTrainerBallThrow(u32 battler) { - const u32 *trainerPal = gTrainerBackPicPaletteTable[TRAINER_BACK_PIC_WALLY].data; + const u32 *trainerPal = gTrainerBacksprites[TRAINER_BACK_PIC_WALLY].palette.data; BtlController_HandleIntroTrainerBallThrow(battler, 0xD6F8, trainerPal, 31, Intro_TryShinyAnimShowHealthbox); } diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 885e9394bbb0..632d7e50d848 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -2480,7 +2480,7 @@ void BtlController_HandleDrawTrainerPic(u32 battler, u32 trainerPicId, bool32 is yPos, subpriority); - gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerSprites[trainerPicId].palette.tag); gSprites[gBattlerSpriteIds[battler]].x2 = -DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[battler]].sSpeedX = 2; gSprites[gBattlerSpriteIds[battler]].oam.affineParam = trainerPicId; @@ -2498,7 +2498,7 @@ void BtlController_HandleDrawTrainerPic(u32 battler, u32 trainerPicId, bool32 is yPos, subpriority); - gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerSprites[trainerPicId].palette.tag); gSprites[gBattlerSpriteIds[battler]].oam.affineMode = ST_OAM_AFFINE_OFF; gSprites[gBattlerSpriteIds[battler]].hFlip = 1; gSprites[gBattlerSpriteIds[battler]].y2 = 48; @@ -2532,7 +2532,7 @@ void BtlController_HandleTrainerSlide(u32 battler, u32 trainerPicId) SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(battler)); gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 80, - (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80, + (8 - gTrainerBacksprites[trainerPicId].coordinates.size) * 4 + 80, 30); gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; gSprites[gBattlerSpriteIds[battler]].x2 = -96; @@ -2544,10 +2544,10 @@ void BtlController_HandleTrainerSlide(u32 battler, u32 trainerPicId) SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(battler)); gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 176, - (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, + (8 - gTrainerSprites[trainerPicId].y_offset) * 4 + 40, 30); gSprites[gBattlerSpriteIds[battler]].oam.affineParam = trainerPicId; - gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); + gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerSprites[trainerPicId].palette.tag); gSprites[gBattlerSpriteIds[battler]].x2 = 96; gSprites[gBattlerSpriteIds[battler]].x += 32; gSprites[gBattlerSpriteIds[battler]].sSpeedX = -2; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index d1c668ab2493..9a4ebe301314 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -652,23 +652,23 @@ void BattleGfxSfxDummy2(u16 species) void DecompressTrainerFrontPic(u16 frontPicId, u8 battler) { u8 position = GetBattlerPosition(battler); - DecompressPicFromTable(&gTrainerFrontPicTable[frontPicId], + DecompressPicFromTable(&gTrainerSprites[frontPicId].frontPic, gMonSpritesGfxPtr->sprites.ptr[position]); - LoadCompressedSpritePalette(&gTrainerFrontPicPaletteTable[frontPicId]); + LoadCompressedSpritePalette(&gTrainerSprites[frontPicId].palette); } void DecompressTrainerBackPic(u16 backPicId, u8 battler) { u8 position = GetBattlerPosition(battler); - DecompressPicFromTable(&gTrainerBackPicTable[backPicId], + DecompressPicFromTable(&gTrainerBacksprites[backPicId].backPic, gMonSpritesGfxPtr->sprites.ptr[position]); - LoadCompressedPalette(gTrainerBackPicPaletteTable[backPicId].data, + LoadCompressedPalette(gTrainerBacksprites[backPicId].palette.data, OBJ_PLTT_ID(battler), PLTT_SIZE_4BPP); } void FreeTrainerFrontPicPalette(u16 frontPicId) { - FreeSpritePaletteByTag(gTrainerFrontPicPaletteTable[frontPicId].tag); + FreeSpritePaletteByTag(gTrainerSprites[frontPicId].palette.tag); } // Unused. diff --git a/src/data.c b/src/data.c index 1fda8b787641..da6edde3f351 100644 --- a/src/data.c +++ b/src/data.c @@ -47,79 +47,13 @@ const struct SpriteFrameImage gBattlerPicTable_OpponentRight[] = {BATTLER_OFFSET(15), MON_PIC_SIZE}, }; -const struct SpriteFrameImage gTrainerBackPicTable_Brendan[] = -{ - {gTrainerBackPic_Brendan + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Brendan + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Brendan + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Brendan + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, -}; - -const struct SpriteFrameImage gTrainerBackPicTable_May[] = -{ - {gTrainerBackPic_May + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, - {gTrainerBackPic_May + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, - {gTrainerBackPic_May + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, - {gTrainerBackPic_May + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, -}; - -const struct SpriteFrameImage gTrainerBackPicTable_Red[] = -{ - {gTrainerBackPic_Red + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Red + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Red + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Red + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Red + TRAINER_PIC_SIZE * 4, TRAINER_PIC_SIZE}, -}; - -const struct SpriteFrameImage gTrainerBackPicTable_Leaf[] = -{ - {gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 4, TRAINER_PIC_SIZE}, -}; - -const struct SpriteFrameImage gTrainerBackPicTable_RubySapphireBrendan[] = -{ - {gTrainerBackPic_RubySapphireBrendan + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, - {gTrainerBackPic_RubySapphireBrendan + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, - {gTrainerBackPic_RubySapphireBrendan + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, - {gTrainerBackPic_RubySapphireBrendan + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, -}; - -const struct SpriteFrameImage gTrainerBackPicTable_RubySapphireMay[] = -{ - {gTrainerBackPic_RubySapphireMay + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, - {gTrainerBackPic_RubySapphireMay + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, - {gTrainerBackPic_RubySapphireMay + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, - {gTrainerBackPic_RubySapphireMay + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, -}; - -const struct SpriteFrameImage gTrainerBackPicTable_Wally[] = -{ - {gTrainerBackPic_Wally + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Wally + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Wally + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Wally + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, -}; - -const struct SpriteFrameImage gTrainerBackPicTable_Steven[] = -{ - {gTrainerBackPic_Steven + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Steven + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Steven + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, - {gTrainerBackPic_Steven + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, -}; - const union AnimCmd sAnim_GeneralFrame0[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, }; -static const union AnimCmd sAnim_GeneralFrame3[] = +const union AnimCmd sAnim_GeneralFrame3[] = { ANIMCMD_FRAME(3, 0), ANIMCMD_END, @@ -285,11 +219,6 @@ const union AnimCmd *const gAnims_MonPic[MAX_MON_PIC_FRAMES] = sAnim_MonPic_1, }; -#include "data/trainer_graphics/front_pic_anims.h" -#include "data/trainer_graphics/front_pic_tables.h" -#include "data/trainer_graphics/back_pic_anims.h" -#include "data/trainer_graphics/back_pic_tables.h" - #include "data/trainer_parties.h" #include "data/text/trainer_class_names.h" #include "data/trainers.h" diff --git a/src/data/graphics/trainers.h b/src/data/graphics/trainers.h index 7f07b54be535..b06fc3e67c64 100644 --- a/src/data/graphics/trainers.h +++ b/src/data/graphics/trainers.h @@ -1,3 +1,6 @@ +#include "constants/trainers.h" +#include "data.h" + const u32 gTrainerFrontPic_Hiker[] = INCBIN_U32("graphics/trainers/front_pics/hiker.4bpp.lz"); const u32 gTrainerPalette_Hiker[] = INCBIN_U32("graphics/trainers/front_pics/hiker.gbapal.lz"); @@ -325,3 +328,235 @@ const u32 gTrainerPalette_RocketGruntFPP[] = INCBIN_U32("graphics/trainers/front const u32 gTrainerFrontPic_HexManiacORAS[] = INCBIN_U32("graphics/trainers/front_pics/hex_maniac_oras.4bpp.lz"); const u32 gTrainerPalette_HexManiacORAS[] = INCBIN_U32("graphics/trainers/front_pics/hex_maniac_oras.gbapal.lz"); + +static const union AnimCmd *const sAnims_Trainer[] ={ + sAnim_GeneralFrame0, +}; + +#define TRAINER_SPRITE(trainerPic, file) \ + [TRAINER_PIC_##trainerPic] = \ + { \ + .y_offset = 8, \ + .frontPic = {gTrainerFrontPic_##file, TRAINER_PIC_SIZE, TRAINER_PIC_##trainerPic},\ + .palette = {gTrainerPalette_##file, TRAINER_PIC_##trainerPic}, \ + .animation = sAnims_Trainer, \ + } + +const struct TrainerSprite gTrainerSprites[] = +{ + TRAINER_SPRITE(HIKER, Hiker), + TRAINER_SPRITE(AQUA_GRUNT_M, AquaGruntM), + TRAINER_SPRITE(POKEMON_BREEDER_F, PokemonBreederF), + TRAINER_SPRITE(COOLTRAINER_M, CoolTrainerM), + TRAINER_SPRITE(BIRD_KEEPER, BirdKeeper), + TRAINER_SPRITE(COLLECTOR, Collector), + TRAINER_SPRITE(AQUA_GRUNT_F, AquaGruntF), + TRAINER_SPRITE(SWIMMER_M, SwimmerM), + TRAINER_SPRITE(MAGMA_GRUNT_M, MagmaGruntM), + TRAINER_SPRITE(EXPERT_M, ExpertM), + TRAINER_SPRITE(AQUA_ADMIN_M, AquaAdminM), + TRAINER_SPRITE(BLACK_BELT, BlackBelt), + TRAINER_SPRITE(AQUA_ADMIN_F, AquaAdminF), + TRAINER_SPRITE(AQUA_LEADER_ARCHIE, AquaLeaderArchie), + TRAINER_SPRITE(HEX_MANIAC, HexManiac), + TRAINER_SPRITE(AROMA_LADY, AromaLady), + TRAINER_SPRITE(RUIN_MANIAC, RuinManiac), + TRAINER_SPRITE(INTERVIEWER, Interviewer), + TRAINER_SPRITE(TUBER_F, TuberF), + TRAINER_SPRITE(TUBER_M, TuberM), + TRAINER_SPRITE(COOLTRAINER_F, CoolTrainerF), + TRAINER_SPRITE(LADY, Lady), + TRAINER_SPRITE(BEAUTY, Beauty), + TRAINER_SPRITE(RICH_BOY, RichBoy), + TRAINER_SPRITE(EXPERT_F, ExpertF), + TRAINER_SPRITE(POKEMANIAC, Pokemaniac), + TRAINER_SPRITE(MAGMA_GRUNT_F, MagmaGruntF), + TRAINER_SPRITE(GUITARIST, Guitarist), + TRAINER_SPRITE(KINDLER, Kindler), + TRAINER_SPRITE(CAMPER, Camper), + TRAINER_SPRITE(PICNICKER, Picnicker), + TRAINER_SPRITE(BUG_MANIAC, BugManiac), + TRAINER_SPRITE(POKEMON_BREEDER_M, PokemonBreederM), + TRAINER_SPRITE(PSYCHIC_M, PsychicM), + TRAINER_SPRITE(PSYCHIC_F, PsychicF), + TRAINER_SPRITE(GENTLEMAN, Gentleman), + TRAINER_SPRITE(ELITE_FOUR_SIDNEY, EliteFourSidney), + TRAINER_SPRITE(ELITE_FOUR_PHOEBE, EliteFourPhoebe), + TRAINER_SPRITE(ELITE_FOUR_GLACIA, EliteFourGlacia), + TRAINER_SPRITE(ELITE_FOUR_DRAKE, EliteFourDrake), + TRAINER_SPRITE(LEADER_ROXANNE, LeaderRoxanne), + TRAINER_SPRITE(LEADER_BRAWLY, LeaderBrawly), + TRAINER_SPRITE(LEADER_WATTSON, LeaderWattson), + TRAINER_SPRITE(LEADER_FLANNERY, LeaderFlannery), + TRAINER_SPRITE(LEADER_NORMAN, LeaderNorman), + TRAINER_SPRITE(LEADER_WINONA, LeaderWinona), + TRAINER_SPRITE(LEADER_TATE_AND_LIZA, LeaderTateAndLiza), + TRAINER_SPRITE(LEADER_JUAN, LeaderJuan), + TRAINER_SPRITE(SCHOOL_KID_M, SchoolKidM), + TRAINER_SPRITE(SCHOOL_KID_F, SchoolKidF), + TRAINER_SPRITE(SR_AND_JR, SrAndJr), + TRAINER_SPRITE(POKEFAN_M, PokefanM), + TRAINER_SPRITE(POKEFAN_F, PokefanF), + TRAINER_SPRITE(YOUNGSTER, Youngster), + TRAINER_SPRITE(CHAMPION_WALLACE, ChampionWallace), + TRAINER_SPRITE(FISHERMAN, Fisherman), + TRAINER_SPRITE(CYCLING_TRIATHLETE_M, CyclingTriathleteM), + TRAINER_SPRITE(CYCLING_TRIATHLETE_F, CyclingTriathleteF), + TRAINER_SPRITE(RUNNING_TRIATHLETE_M, RunningTriathleteM), + TRAINER_SPRITE(RUNNING_TRIATHLETE_F, RunningTriathleteF), + TRAINER_SPRITE(SWIMMING_TRIATHLETE_M, SwimmingTriathleteM), + TRAINER_SPRITE(SWIMMING_TRIATHLETE_F, SwimmingTriathleteF), + TRAINER_SPRITE(DRAGON_TAMER, DragonTamer), + TRAINER_SPRITE(NINJA_BOY, NinjaBoy), + TRAINER_SPRITE(BATTLE_GIRL, BattleGirl), + TRAINER_SPRITE(PARASOL_LADY, ParasolLady), + TRAINER_SPRITE(SWIMMER_F, SwimmerF), + TRAINER_SPRITE(TWINS, Twins), + TRAINER_SPRITE(SAILOR, Sailor), + TRAINER_SPRITE(MAGMA_ADMIN, MagmaAdmin), + TRAINER_SPRITE(WALLY, Wally), + TRAINER_SPRITE(BRENDAN, Brendan), + TRAINER_SPRITE(MAY, May), + TRAINER_SPRITE(BUG_CATCHER, BugCatcher), + TRAINER_SPRITE(POKEMON_RANGER_M, PokemonRangerM), + TRAINER_SPRITE(POKEMON_RANGER_F, PokemonRangerF), + TRAINER_SPRITE(MAGMA_LEADER_MAXIE, MagmaLeaderMaxie), + TRAINER_SPRITE(LASS, Lass), + TRAINER_SPRITE(YOUNG_COUPLE, YoungCouple), + TRAINER_SPRITE(OLD_COUPLE, OldCouple), + TRAINER_SPRITE(SIS_AND_BRO, SisAndBro), + TRAINER_SPRITE(STEVEN, Steven), + TRAINER_SPRITE(SALON_MAIDEN_ANABEL, SalonMaidenAnabel), + TRAINER_SPRITE(DOME_ACE_TUCKER, DomeAceTucker), + TRAINER_SPRITE(PALACE_MAVEN_SPENSER, PalaceMavenSpenser), + TRAINER_SPRITE(ARENA_TYCOON_GRETA, ArenaTycoonGreta), + TRAINER_SPRITE(FACTORY_HEAD_NOLAND, FactoryHeadNoland), + TRAINER_SPRITE(PIKE_QUEEN_LUCY, PikeQueenLucy), + TRAINER_SPRITE(PYRAMID_KING_BRANDON, PyramidKingBrandon), + TRAINER_SPRITE(RED, Red), + TRAINER_SPRITE(LEAF, Leaf), + TRAINER_SPRITE(RS_BRENDAN, RubySapphireBrendan), + TRAINER_SPRITE(RS_MAY, RubySapphireMay), +}; + +static const union AnimCmd sAnimCmd_Hoenn[] = +{ + ANIMCMD_FRAME(0, 24), + ANIMCMD_FRAME(1, 9), + ANIMCMD_FRAME(2, 24), + ANIMCMD_FRAME(0, 9), + ANIMCMD_FRAME(3, 50), + ANIMCMD_END, +}; + +static const union AnimCmd sAnimCmd_Kanto[] = +{ + ANIMCMD_FRAME(1, 20), + ANIMCMD_FRAME(2, 6), + ANIMCMD_FRAME(3, 6), + ANIMCMD_FRAME(4, 24), + ANIMCMD_FRAME(0, 1), + ANIMCMD_END, +}; + +static const union AnimCmd *const sBackAnims_Hoenn[] = +{ + sAnim_GeneralFrame3, + sAnimCmd_Hoenn, +}; + +static const union AnimCmd *const sBackAnims_Kanto[] = +{ + sAnim_GeneralFrame0, + sAnimCmd_Kanto, +}; + +const struct SpriteFrameImage gTrainerBackPicTable_Brendan[] = +{ + {gTrainerBackPic_Brendan + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Brendan + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Brendan + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Brendan + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, +}; + +const struct SpriteFrameImage gTrainerBackPicTable_May[] = +{ + {gTrainerBackPic_May + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, + {gTrainerBackPic_May + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, + {gTrainerBackPic_May + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, + {gTrainerBackPic_May + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, +}; + +const struct SpriteFrameImage gTrainerBackPicTable_Red[] = +{ + {gTrainerBackPic_Red + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Red + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Red + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Red + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Red + TRAINER_PIC_SIZE * 4, TRAINER_PIC_SIZE}, +}; + +const struct SpriteFrameImage gTrainerBackPicTable_Leaf[] = +{ + {gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 4, TRAINER_PIC_SIZE}, +}; + +const struct SpriteFrameImage gTrainerBackPicTable_RubySapphireBrendan[] = +{ + {gTrainerBackPic_RubySapphireBrendan + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, + {gTrainerBackPic_RubySapphireBrendan + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, + {gTrainerBackPic_RubySapphireBrendan + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, + {gTrainerBackPic_RubySapphireBrendan + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, +}; + +const struct SpriteFrameImage gTrainerBackPicTable_RubySapphireMay[] = +{ + {gTrainerBackPic_RubySapphireMay + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, + {gTrainerBackPic_RubySapphireMay + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, + {gTrainerBackPic_RubySapphireMay + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, + {gTrainerBackPic_RubySapphireMay + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, +}; + +const struct SpriteFrameImage gTrainerBackPicTable_Wally[] = +{ + {gTrainerBackPic_Wally + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Wally + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Wally + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Wally + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, +}; + +const struct SpriteFrameImage gTrainerBackPicTable_Steven[] = +{ + {gTrainerBackPic_Steven + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Steven + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Steven + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE}, + {gTrainerBackPic_Steven + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE}, +}; + +// .backPic goes functionally unused, since none of these pics are compressed +// and the place they would get extracted to gets overwritten later anyway +// the casts are so they'll play nice with the strict struct definition +#define TRAINER_BACK_SPRITE(trainerPic, yOffset, sprite, pal, anim) \ + [TRAINER_BACK_PIC_##trainerPic] = \ + { \ + .coordinates = {.size = 8, .y_offset = yOffset}, \ + .backPic = {(const u32 *)gTrainerBackPic_##sprite, TRAINER_PIC_SIZE * ARRAY_COUNT(gTrainerBackPicTable_##sprite), TRAINER_BACK_PIC_##trainerPic}, \ + .palette = {gTrainer##pal, TRAINER_BACK_PIC_##trainerPic}, \ + .animation = sBackAnims_##anim, \ + } + +const struct TrainerBacksprite gTrainerBacksprites[] = +{ + TRAINER_BACK_SPRITE(BRENDAN, 4, Brendan, Palette_Brendan, Hoenn), + TRAINER_BACK_SPRITE(MAY, 4, May, Palette_May, Hoenn), + TRAINER_BACK_SPRITE(RED, 5, Red, BackPicPalette_Red, Kanto), + TRAINER_BACK_SPRITE(LEAF, 5, Leaf, BackPicPalette_Leaf, Kanto), + TRAINER_BACK_SPRITE(RUBY_SAPPHIRE_BRENDAN, 4, RubySapphireBrendan, Palette_RubySapphireBrendan, Hoenn), + TRAINER_BACK_SPRITE(RUBY_SAPPHIRE_MAY, 4, RubySapphireMay, Palette_RubySapphireMay, Hoenn), + TRAINER_BACK_SPRITE(WALLY, 4, Wally, Palette_Wally, Hoenn), + TRAINER_BACK_SPRITE(STEVEN, 4, Steven, Palette_Steven, Hoenn), +}; diff --git a/src/data/trainer_graphics/back_pic_anims.h b/src/data/trainer_graphics/back_pic_anims.h deleted file mode 100644 index ed12e0cb41e7..000000000000 --- a/src/data/trainer_graphics/back_pic_anims.h +++ /dev/null @@ -1,129 +0,0 @@ -static const union AnimCmd sAnimCmd_Brendan_1[] = -{ - ANIMCMD_FRAME(0, 24), - ANIMCMD_FRAME(1, 9), - ANIMCMD_FRAME(2, 24), - ANIMCMD_FRAME(0, 9), - ANIMCMD_FRAME(3, 50), - ANIMCMD_END, -}; - -static const union AnimCmd sAnimCmd_May_Steven_1[] = -{ - ANIMCMD_FRAME(0, 24), - ANIMCMD_FRAME(1, 9), - ANIMCMD_FRAME(2, 24), - ANIMCMD_FRAME(0, 9), - ANIMCMD_FRAME(3, 50), - ANIMCMD_END, -}; - -static const union AnimCmd sAnimCmd_Wally_1[] = -{ - ANIMCMD_FRAME(0, 24), - ANIMCMD_FRAME(1, 9), - ANIMCMD_FRAME(2, 24), - ANIMCMD_FRAME(0, 9), - ANIMCMD_FRAME(3, 50), - ANIMCMD_END, -}; - -static const union AnimCmd sAnimCmd_Red_1[] = -{ - ANIMCMD_FRAME(1, 20), - ANIMCMD_FRAME(2, 6), - ANIMCMD_FRAME(3, 6), - ANIMCMD_FRAME(4, 24), - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -static const union AnimCmd sAnimCmd_Leaf_1[] = -{ - ANIMCMD_FRAME(1, 20), - ANIMCMD_FRAME(2, 6), - ANIMCMD_FRAME(3, 6), - ANIMCMD_FRAME(4, 24), - ANIMCMD_FRAME(0, 1), - ANIMCMD_END, -}; - -static const union AnimCmd sAnimCmd_RubySapphireBrendan_1[] = -{ - ANIMCMD_FRAME(0, 24), - ANIMCMD_FRAME(1, 9), - ANIMCMD_FRAME(2, 24), - ANIMCMD_FRAME(0, 9), - ANIMCMD_FRAME(3, 50), - ANIMCMD_END, -}; - -static const union AnimCmd sAnimCmd_RubySapphireMay_1[] = -{ - ANIMCMD_FRAME(0, 24), - ANIMCMD_FRAME(1, 9), - ANIMCMD_FRAME(2, 24), - ANIMCMD_FRAME(0, 9), - ANIMCMD_FRAME(3, 50), - ANIMCMD_END, -}; - -static const union AnimCmd *const sBackAnims_Brendan[] = -{ - sAnim_GeneralFrame3, - sAnimCmd_Brendan_1, -}; - -static const union AnimCmd *const sBackAnims_May[] = -{ - sAnim_GeneralFrame3, - sAnimCmd_May_Steven_1, -}; - -static const union AnimCmd *const sBackAnims_Red[] = -{ - sAnim_GeneralFrame0, - sAnimCmd_Red_1, -}; - -static const union AnimCmd *const sBackAnims_Leaf[] = -{ - sAnim_GeneralFrame0, - sAnimCmd_Leaf_1, -}; - -static const union AnimCmd *const sBackAnims_RubySapphireBrendan[] = -{ - sAnim_GeneralFrame3, - sAnimCmd_RubySapphireBrendan_1, -}; - -static const union AnimCmd *const sBackAnims_RubySapphireMay[] = -{ - sAnim_GeneralFrame3, - sAnimCmd_RubySapphireMay_1, -}; - -static const union AnimCmd *const sBackAnims_Wally[] = -{ - sAnim_GeneralFrame3, - sAnimCmd_Wally_1, -}; - -static const union AnimCmd *const sBackAnims_Steven[] = -{ - sAnim_GeneralFrame3, - sAnimCmd_May_Steven_1, -}; - -const union AnimCmd *const *const gTrainerBackAnimsPtrTable[] = -{ - [TRAINER_BACK_PIC_BRENDAN] = sBackAnims_Brendan, - [TRAINER_BACK_PIC_MAY] = sBackAnims_May, - [TRAINER_BACK_PIC_RED] = sBackAnims_Red, - [TRAINER_BACK_PIC_LEAF] = sBackAnims_Leaf, - [TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN] = sBackAnims_RubySapphireBrendan, - [TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY] = sBackAnims_RubySapphireMay, - [TRAINER_BACK_PIC_WALLY] = sBackAnims_Wally, - [TRAINER_BACK_PIC_STEVEN] = sBackAnims_Steven, -}; diff --git a/src/data/trainer_graphics/back_pic_tables.h b/src/data/trainer_graphics/back_pic_tables.h deleted file mode 100644 index 524d48d480ef..000000000000 --- a/src/data/trainer_graphics/back_pic_tables.h +++ /dev/null @@ -1,72 +0,0 @@ -const struct MonCoords gTrainerBackPicCoords[] = -{ - [TRAINER_BACK_PIC_BRENDAN] = {.size = 8, .y_offset = 4}, - [TRAINER_BACK_PIC_MAY] = {.size = 8, .y_offset = 4}, - [TRAINER_BACK_PIC_RED] = {.size = 8, .y_offset = 5}, - [TRAINER_BACK_PIC_LEAF] = {.size = 8, .y_offset = 5}, - [TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN] = {.size = 8, .y_offset = 4}, - [TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY] = {.size = 8, .y_offset = 4}, - [TRAINER_BACK_PIC_WALLY] = {.size = 8, .y_offset = 4}, - [TRAINER_BACK_PIC_STEVEN] = {.size = 8, .y_offset = 4}, -}; - -// this table goes functionally unused, since none of these pics are compressed -// and the place they would get extracted to gets overwritten later anyway -// the casts are so they'll play nice with the strict struct definition -const struct CompressedSpriteSheet gTrainerBackPicTable[] = -{ - [TRAINER_BACK_PIC_BRENDAN] = { - .data = (const u32 *)gTrainerBackPic_Brendan, - .size = TRAINER_PIC_SIZE * ARRAY_COUNT(gTrainerBackPicTable_Brendan), - .tag = TRAINER_BACK_PIC_BRENDAN, - }, - [TRAINER_BACK_PIC_MAY] = { - .data = (const u32 *)gTrainerBackPic_May, - .size = TRAINER_PIC_SIZE * ARRAY_COUNT(gTrainerBackPicTable_May), - .tag = TRAINER_BACK_PIC_MAY, - }, - [TRAINER_BACK_PIC_RED] = { - .data = (const u32 *)gTrainerBackPic_Red, - .size = TRAINER_PIC_SIZE * ARRAY_COUNT(gTrainerBackPicTable_Red), - .tag = TRAINER_BACK_PIC_RED, - }, - [TRAINER_BACK_PIC_LEAF] = { - .data = (const u32 *)gTrainerBackPic_Leaf, - .size = TRAINER_PIC_SIZE * ARRAY_COUNT(gTrainerBackPicTable_Leaf), - .tag = TRAINER_BACK_PIC_LEAF, - }, - [TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN] = { - .data = (const u32 *)gTrainerBackPic_RubySapphireBrendan, - .size = TRAINER_PIC_SIZE * ARRAY_COUNT(gTrainerBackPicTable_RubySapphireBrendan), - .tag = TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN, - }, - [TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY] = { - .data = (const u32 *)gTrainerBackPic_RubySapphireMay, - .size = TRAINER_PIC_SIZE * ARRAY_COUNT(gTrainerBackPicTable_RubySapphireMay), - .tag = TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY, - }, - [TRAINER_BACK_PIC_WALLY] = { - .data = (const u32 *)gTrainerBackPic_Wally, - .size = TRAINER_PIC_SIZE * ARRAY_COUNT(gTrainerBackPicTable_Wally), - .tag = TRAINER_BACK_PIC_WALLY, - }, - [TRAINER_BACK_PIC_STEVEN] = { - .data = (const u32 *)gTrainerBackPic_Steven, - .size = TRAINER_PIC_SIZE * ARRAY_COUNT(gTrainerBackPicTable_Steven), - .tag = TRAINER_BACK_PIC_STEVEN, - }, -}; - -#define TRAINER_BACK_PAL(trainerPic, pal) [TRAINER_BACK_PIC_##trainerPic] = {pal, TRAINER_BACK_PIC_##trainerPic} - -const struct CompressedSpritePalette gTrainerBackPicPaletteTable[] = -{ - TRAINER_BACK_PAL(BRENDAN, gTrainerPalette_Brendan), - TRAINER_BACK_PAL(MAY, gTrainerPalette_May), - TRAINER_BACK_PAL(RED, gTrainerBackPicPalette_Red), - TRAINER_BACK_PAL(LEAF, gTrainerBackPicPalette_Leaf), - TRAINER_BACK_PAL(RUBY_SAPPHIRE_BRENDAN, gTrainerPalette_RubySapphireBrendan), - TRAINER_BACK_PAL(RUBY_SAPPHIRE_MAY, gTrainerPalette_RubySapphireMay), - TRAINER_BACK_PAL(WALLY, gTrainerPalette_Wally), - TRAINER_BACK_PAL(STEVEN, gTrainerPalette_Steven), -}; diff --git a/src/field_effect.c b/src/field_effect.c index ededb3b7dd49..ba81fedcc251 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -1,4 +1,5 @@ #include "global.h" +#include "data.h" #include "decompress.h" #include "event_object_movement.h" #include "field_camera.h" @@ -240,8 +241,6 @@ static void UseVsSeeker_CleanUpFieldEffect(struct Task *task); static u8 sActiveList[32]; // External declarations -extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; -extern const struct CompressedSpriteSheet gTrainerFrontPicTable[]; extern u8 *gFieldEffectScriptPointers[]; extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; @@ -893,10 +892,10 @@ bool8 FieldEffectActiveListContains(u8 id) u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buffer) { struct SpriteTemplate spriteTemplate; - LoadCompressedSpritePaletteOverrideBuffer(&gTrainerFrontPicPaletteTable[trainerSpriteID], buffer); - LoadCompressedSpriteSheetOverrideBuffer(&gTrainerFrontPicTable[trainerSpriteID], buffer); - spriteTemplate.tileTag = gTrainerFrontPicTable[trainerSpriteID].tag; - spriteTemplate.paletteTag = gTrainerFrontPicPaletteTable[trainerSpriteID].tag; + LoadCompressedSpritePaletteOverrideBuffer(&gTrainerSprites[trainerSpriteID].palette, buffer); + LoadCompressedSpriteSheetOverrideBuffer(&gTrainerSprites[trainerSpriteID].frontPic, buffer); + spriteTemplate.tileTag = gTrainerSprites[trainerSpriteID].frontPic.tag; + spriteTemplate.paletteTag = gTrainerSprites[trainerSpriteID].palette.tag; spriteTemplate.oam = &sOam_64x64; spriteTemplate.anims = gDummySpriteAnimTable; spriteTemplate.images = NULL; @@ -907,8 +906,8 @@ u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buf static void UNUSED LoadTrainerGfx_TrainerCard(u8 gender, u16 palOffset, u8 *dest) { - LZDecompressVram(gTrainerFrontPicTable[gender].data, dest); - LoadCompressedPalette(gTrainerFrontPicPaletteTable[gender].data, palOffset, PLTT_SIZE_4BPP); + LZDecompressVram(gTrainerSprites[gender].frontPic.data, dest); + LoadCompressedPalette(gTrainerSprites[gender].palette.data, palOffset, PLTT_SIZE_4BPP); } u8 AddNewGameBirchObject(s16 x, s16 y, u8 subpriority) diff --git a/src/pokemon.c b/src/pokemon.c index ed14bb27c39e..d83cf1fadb99 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1875,7 +1875,7 @@ void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerPicId, u8 battlerPosition if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT) { gMultiuseSpriteTemplate = sTrainerBackSpriteTemplates[trainerPicId]; - gMultiuseSpriteTemplate.anims = gTrainerBackAnimsPtrTable[trainerPicId]; + gMultiuseSpriteTemplate.anims = gTrainerBacksprites[trainerPicId].animation; } else { @@ -1883,7 +1883,7 @@ void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerPicId, u8 battlerPosition gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition]; else gMultiuseSpriteTemplate = gBattlerSpriteTemplates[battlerPosition]; - gMultiuseSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[trainerPicId]; + gMultiuseSpriteTemplate.anims = gTrainerSprites[trainerPicId].animation; } } @@ -1895,7 +1895,7 @@ void SetMultiuseSpriteTemplateToTrainerFront(u16 trainerPicId, u8 battlerPositio gMultiuseSpriteTemplate = gBattlerSpriteTemplates[battlerPosition]; gMultiuseSpriteTemplate.paletteTag = trainerPicId; - gMultiuseSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[trainerPicId]; + gMultiuseSpriteTemplate.anims = gTrainerSprites[trainerPicId].animation; } static void EncryptBoxMon(struct BoxPokemon *boxMon) diff --git a/src/pokenav_match_call_gfx.c b/src/pokenav_match_call_gfx.c index d28d4a276eba..594b4d83d41c 100755 --- a/src/pokenav_match_call_gfx.c +++ b/src/pokenav_match_call_gfx.c @@ -1247,8 +1247,8 @@ static void LoadCheckPageTrainerPic(struct Pokenav_MatchCallGfx *gfx) int trainerPic = GetMatchCallTrainerPic(PokenavList_GetSelectedIndex()); if (trainerPic >= 0) { - DecompressPicFromTable(&gTrainerFrontPicTable[trainerPic], gfx->trainerPicGfx); - LZ77UnCompWram(gTrainerFrontPicPaletteTable[trainerPic].data, gfx->trainerPicPal); + DecompressPicFromTable(&gTrainerSprites[trainerPic].frontPic, gfx->trainerPicGfx); + LZ77UnCompWram(gTrainerSprites[trainerPic].palette.data, gfx->trainerPicPal); cursor = RequestDma3Copy(gfx->trainerPicGfx, gfx->trainerPicGfxPtr, sizeof(gfx->trainerPicGfx), 1); LoadPalette(gfx->trainerPicPal, gfx->trainerPicPalOffset, sizeof(gfx->trainerPicPal)); gfx->trainerPicSprite->data[0] = 0; diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index 38999e1c79cd..d6043accc136 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -236,7 +236,7 @@ static void CreateBattlerSprite(u8 battler) { SetMultiuseSpriteTemplateToTrainerBack(gSaveBlock2Ptr->playerGender, GetBattlerPosition(B_POSITION_PLAYER_LEFT)); gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 0x50, - (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].size) * 4 + 80, + (8 - gTrainerBacksprites[gSaveBlock2Ptr->playerGender].coordinates.size) * 4 + 80, GetBattlerSpriteSubpriority(0)); gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy; @@ -246,7 +246,7 @@ static void CreateBattlerSprite(u8 battler) { SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(0)); gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 0x50, - (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].size) * 4 + 80, + (8 - gTrainerBacksprites[TRAINER_BACK_PIC_WALLY].coordinates.size) * 4 + 80, GetBattlerSpriteSubpriority(0)); gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler; gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy; diff --git a/src/trainer_pokemon_sprites.c b/src/trainer_pokemon_sprites.c index 8b7d1bbdea37..6ffbc836d7a4 100644 --- a/src/trainer_pokemon_sprites.c +++ b/src/trainer_pokemon_sprites.c @@ -66,9 +66,9 @@ static bool16 DecompressPic(u16 species, u32 personality, bool8 isFrontPic, u8 * else { if (isFrontPic) - DecompressPicFromTable(&gTrainerFrontPicTable[species], dest); + DecompressPicFromTable(&gTrainerSprites[species].frontPic, dest); else - DecompressPicFromTable(&gTrainerBackPicTable[species], dest); + DecompressPicFromTable(&gTrainerBacksprites[species].backPic, dest); } return FALSE; } @@ -93,12 +93,12 @@ static void LoadPicPaletteByTagOrSlot(u16 species, u32 otId, u32 personality, u8 if (paletteTag == TAG_NONE) { sCreatingSpriteTemplate.paletteTag = TAG_NONE; - LoadCompressedPalette(gTrainerFrontPicPaletteTable[species].data, OBJ_PLTT_ID(paletteSlot), PLTT_SIZE_4BPP); + LoadCompressedPalette(gTrainerSprites[species].palette.data, OBJ_PLTT_ID(paletteSlot), PLTT_SIZE_4BPP); } else { sCreatingSpriteTemplate.paletteTag = paletteTag; - LoadCompressedSpritePalette(&gTrainerFrontPicPaletteTable[species]); + LoadCompressedSpritePalette(&gTrainerSprites[species].palette); } } } @@ -108,7 +108,7 @@ static void LoadPicPaletteBySlot(u16 species, u32 otId, u32 personality, u8 pale if (!isTrainer) LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality), PLTT_ID(paletteSlot), PLTT_SIZE_4BPP); else - LoadCompressedPalette(gTrainerFrontPicPaletteTable[species].data, PLTT_ID(paletteSlot), PLTT_SIZE_4BPP); + LoadCompressedPalette(gTrainerSprites[species].palette.data, PLTT_ID(paletteSlot), PLTT_SIZE_4BPP); } static void AssignSpriteAnimsTable(bool8 isTrainer) @@ -116,7 +116,7 @@ static void AssignSpriteAnimsTable(bool8 isTrainer) if (!isTrainer) sCreatingSpriteTemplate.anims = gAnims_MonPic; else - sCreatingSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[0]; + sCreatingSpriteTemplate.anims = gTrainerSprites[0].animation; } static u16 CreatePicSprite(u16 species, u32 otId, u32 personality, bool8 isFrontPic, s16 x, s16 y, u8 paletteSlot, u16 paletteTag, bool8 isTrainer)