diff options
Diffstat (limited to 'src/battle_controller_link_opponent.c')
-rw-r--r-- | src/battle_controller_link_opponent.c | 60 |
1 files changed, 17 insertions, 43 deletions
diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 1b12a7a80..a399adf25 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -24,47 +24,21 @@ #include "reshow_battle_screen.h" #include "pokeball.h" #include "data2.h" +#include "battle_setup.h" -extern u32 gBattleControllerExecFlags; -extern u8 gActiveBattler; -extern u8 gBattlerSpriteIds[MAX_BATTLERS_COUNT]; -extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT]; -extern u8 gBattlersCount; -extern bool8 gDoingBattleAnim; -extern void (*gBattlerControllerFuncs[MAX_BATTLERS_COUNT])(void); -extern void (*gPreBattleCallback1)(void); -extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; -extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200]; -extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200]; -extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT]; -extern struct SpriteTemplate gUnknown_0202499C; -extern u16 gSpecialVar_ItemId; -extern u8 gHealthboxSpriteIds[MAX_BATTLERS_COUNT]; -extern u8 gBattleOutcome; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; -extern u16 gUnknown_020243FC; -extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT]; -extern u8 gBattleMonForms[MAX_BATTLERS_COUNT]; -extern u16 gPartnerTrainerId; -extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); -extern u8 gBattlerTarget; -extern u8 gAbsentBattlerFlags; -extern u8 gUnknown_020244B4[]; -extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT]; extern struct MusicPlayerInfo gMPlayInfo_BGM; extern struct UnusedControllerStruct gUnknown_02022D0C; -extern u16 gTrainerBattleOpponent_A; -extern u16 gTrainerBattleOpponent_B; extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; extern const struct BattleMove gBattleMoves[]; -extern const u8 gFacilityClassToPicIndex[]; extern void sub_8172EF0(u8 bank, struct Pokemon *mon); extern void sub_806A068(u16, u8); extern void sub_81851A8(u8 *); extern u16 sub_8068B48(void); +extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId); // this file's functions static void LinkOpponentHandleGetMonData(void); @@ -1270,7 +1244,7 @@ static void LinkOpponentHandleDrawTrainerPic(void) if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) { - if (gActiveBattler == 1) + if (gActiveBattler == B_POSITION_OPPONENT_LEFT) trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_A); else trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); @@ -1280,18 +1254,18 @@ static void LinkOpponentHandleDrawTrainerPic(void) if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN) { - if (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender != 0) - trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_10]; + if (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender != MALE) + trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_LEAF]; else - trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_9]; + trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_RED]; } else if ((gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY || (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE) { - if (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender != 0) - trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_12]; + if (gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender != MALE) + trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_RS_MAY]; else - trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_11]; + trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_RS_BRENDAN]; } else { @@ -1310,17 +1284,17 @@ static void LinkOpponentHandleDrawTrainerPic(void) || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_LEAF_GREEN) { if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0) - trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_10]; + trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_LEAF]; else - trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_9]; + trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_RED]; } else if ((gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_RUBY || (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_SAPPHIRE) { if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0) - trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_12]; + trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_RS_MAY]; else - trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_11]; + trainerPicId = gFacilityClassToPicIndex[FACILITY_CLASS_PKMN_TRAINER_RS_BRENDAN]; } else { @@ -1722,7 +1696,7 @@ static void LinkOpponentHandleFaintingCry(void) static void LinkOpponentHandleIntroSlide(void) { HandleIntroSlide(gBattleBufferA[gActiveBattler][1]); - gUnknown_020243FC |= 1; + gIntroSlideFlags |= 1; LinkOpponentBufferExecCompleted(); } @@ -1744,7 +1718,7 @@ static void LinkOpponentHandleIntroTrainerBallThrow(void) gTasks[taskId].data[0] = gActiveBattler; if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1) - gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30; + gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30; gBattleSpritesDataPtr->animationData->field_9_x1 = 1; gBattlerControllerFuncs[gActiveBattler] = nullsub_28; @@ -1804,7 +1778,7 @@ static void LinkOpponentHandleDrawPartyStatusSummary(void) } } - gUnknown_020244B4[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]); + gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]); gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0; if (gBattleBufferA[gActiveBattler][2] != 0) @@ -1826,7 +1800,7 @@ static void sub_806782C(void) static void LinkOpponentHandleCmd49(void) { if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1) - gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30; + gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = sub_8073C30; LinkOpponentBufferExecCompleted(); } |