link opponent controller is done

This commit is contained in:
DizzyEggg 2017-10-24 15:25:20 +02:00
parent 1f3a867a0b
commit bffcd426cf
9 changed files with 1917 additions and 6410 deletions

File diff suppressed because it is too large Load Diff

View File

@ -799,8 +799,8 @@ extern struct BattleStruct* gBattleStruct;
// special animations table // special animations table
#define B_ANIM_LVL_UP 0x0 #define B_ANIM_LVL_UP 0x0
#define B_ANIM_SWITCH_OUT_MON 0x1 #define B_ANIM_SWITCH_OUT_PLAYER_MON 0x1
#define B_ANIM_SPECIAL_2 0x2 #define B_ANIM_SWITCH_OUT_OPPONENT_MON 0x2
#define B_ANIM_BALL_THROW 0x3 #define B_ANIM_BALL_THROW 0x3
#define B_ANIM_SAFARI_BALL_THROW 0x4 #define B_ANIM_SAFARI_BALL_THROW 0x4
#define B_ANIM_SUBSTITUTE_TO_MON 0x5 #define B_ANIM_SUBSTITUTE_TO_MON 0x5
@ -898,6 +898,7 @@ void SetBattleSpriteInvisibilityBitToSpriteInvisibility(u8 bank);
u16 ChooseMoveAndTargetInBattlePalace(void); u16 ChooseMoveAndTargetInBattlePalace(void);
void LoadBattleBarGfx(u8 arg0); void LoadBattleBarGfx(u8 arg0);
bool8 mplay_80342A4(u8 bank); bool8 mplay_80342A4(u8 bank);
void sub_805EEE0(u8 bank);
enum enum
{ {
@ -955,10 +956,7 @@ struct BattleHealthboxInfo
u8 specialAnimActive : 1; //x40 u8 specialAnimActive : 1; //x40
u8 flag_x80 : 1; u8 flag_x80 : 1;
u8 field_1_x1 : 1; u8 field_1_x1 : 1;
u8 field_1_x2 : 1; u8 field_1_x1E : 4;
u8 field_1_x4 : 1;
u8 field_1_x8 : 1;
u8 field_1_x10 : 1;
u8 field_1_x20 : 1; u8 field_1_x20 : 1;
u8 field_1_x40 : 1; u8 field_1_x40 : 1;
u8 field_1_x80 : 1; u8 field_1_x80 : 1;

View File

@ -66,8 +66,7 @@ SECTIONS {
src/battle_controller_opponent.o(.text); src/battle_controller_opponent.o(.text);
asm/battle_controller_opponent.o(.text); asm/battle_controller_opponent.o(.text);
src/battle_ai_switch_items.o(.text); src/battle_ai_switch_items.o(.text);
src/battle_controller_linkopponent.o(.text); src/battle_controller_link_opponent.o(.text);
asm/battle_controller_linkopponent.o(.text);
src/pokemon_1.o(.text); src/pokemon_1.o(.text);
asm/pokemon_1.o(.text); asm/pokemon_1.o(.text);
src/calculate_base_damage.o(.text); src/calculate_base_damage.o(.text);
@ -341,7 +340,7 @@ SECTIONS {
src/battle_controller_player.o(.rodata); src/battle_controller_player.o(.rodata);
data/smokescreen.o(.rodata); data/smokescreen.o(.rodata);
src/battle_controller_opponent.o(.rodata); src/battle_controller_opponent.o(.rodata);
src/battle_controller_linkopponent.o(.rodata); src/battle_controller_link_opponent.o(.rodata);
data/data2c.o(.rodata); data/data2c.o(.rodata);
src/trig.o(.rodata); src/trig.o(.rodata);
src/util.o(.rodata); src/util.o(.rodata);

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,6 @@ extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT];
extern u8 gBattleOutcome; extern u8 gBattleOutcome;
extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_X;
extern u16 gBattle_BG0_Y; extern u16 gBattle_BG0_Y;
extern u8 gBankInMenu;
extern u16 gUnknown_020243FC; extern u16 gUnknown_020243FC;
extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT]; extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT];
extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; extern u8 gBattleMonForms[BATTLE_BANKS_COUNT];
@ -1129,7 +1128,7 @@ static void DoSwitchOutAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{ {
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
gBattleBankFunc[gActiveBank] = sub_814B3DC; gBattleBankFunc[gActiveBank] = sub_814B3DC;
} }
break; break;
@ -1221,7 +1220,7 @@ static void LinkPartnerHandleFaintAnimation(void)
{ {
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
PlaySE12WithPanning(SE_POKE_DEAD, -64); PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER);
gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; gSprites[gBankSpriteIds[gActiveBank]].data1 = 0;
gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; gSprites[gBankSpriteIds[gActiveBank]].data2 = 5;
gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00;

View File

@ -1,143 +0,0 @@
#include "global.h"
#include "battle.h"
#include "battle_controllers.h"
#include "battle_message.h"
#include "battle_interface.h"
#include "battle_anim.h"
#include "link.h"
extern u8 gActiveBank;
extern bool8 gDoingBattleAnim;
extern u8 gUnknown_020244CC;
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
// this file's functions
void LinkOpponentHandleGetMonData(void);
void LinkOpponentHandleGetRawMonData(void);
void LinkOpponentHandleSetMonData(void);
void LinkOpponentHandleSetRawMonData(void);
void LinkOpponentHandleLoadMonSprite(void);
void LinkOpponentHandleSwitchInAnim(void);
void LinkOpponentHandleReturnMonToBall(void);
void LinkOpponentHandleDrawTrainerPic(void);
void LinkOpponentHandleTrainerSlide(void);
void LinkOpponentHandleTrainerSlideBack(void);
void LinkOpponentHandleFaintAnimation(void);
void LinkOpponentHandleCmd11(void);
void LinkOpponentHandleCmd12(void);
void LinkOpponentHandleBallThrow(void);
void LinkOpponentHandlePause(void);
void LinkOpponentHandleMoveAnimation(void);
void LinkOpponentHandlePrintString(void);
void LinkOpponentHandlePrintStringPlayerOnly(void);
void LinkOpponentHandleChooseAction(void);
void LinkOpponentHandleCmd19(void);
void LinkOpponentHandleChooseMove(void);
void LinkOpponentHandleOpenBag(void);
void LinkOpponentHandleChoosePokemon(void);
void LinkOpponentHandleCmd23(void);
void LinkOpponentHandleHealthBarUpdate(void);
void LinkOpponentHandleExpUpdate(void);
void LinkOpponentHandleStatusIconUpdate(void);
void LinkOpponentHandleStatusAnimation(void);
void LinkOpponentHandleStatusXor(void);
void LinkOpponentHandleDataTransfer(void);
void LinkOpponentHandleDMA3Transfer(void);
void LinkOpponentHandlePlayBGM(void);
void LinkOpponentHandleCmd32(void);
void LinkOpponentHandleCmd33(void);
void LinkOpponentHandleCmd34(void);
void LinkOpponentHandleCmd35(void);
void LinkOpponentHandleCmd36(void);
void LinkOpponentHandleCmd37(void);
void LinkOpponentHandleCmd38(void);
void LinkOpponentHandleCmd39(void);
void LinkOpponentHandleCmd40(void);
void LinkOpponentHandleHitAnimation(void);
void LinkOpponentHandleCmd42(void);
void LinkOpponentHandleEffectivenessSound(void);
void LinkOpponentHandlePlayFanfareOrBGM(void);
void LinkOpponentHandleFaintingCry(void);
void LinkOpponentHandleIntroSlide(void);
void LinkOpponentHandleIntroTrainerBallThrow(void);
void LinkOpponentHandleDrawPartyStatusSummary(void);
void LinkOpponentHandleCmd49(void);
void LinkOpponentHandleCmd50(void);
void LinkOpponentHandleSpriteInvisibility(void);
void LinkOpponentHandleBattleAnimation(void);
void LinkOpponentHandleLinkStandbyMsg(void);
void LinkOpponentHandleResetActionMoveSelection(void);
void LinkOpponentHandleCmd55(void);
void nullsub_92(void);
void LinkOpponentBufferRunCommand(void);
void (*const gLinkOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) =
{
LinkOpponentHandleGetMonData,
LinkOpponentHandleGetRawMonData,
LinkOpponentHandleSetMonData,
LinkOpponentHandleSetRawMonData,
LinkOpponentHandleLoadMonSprite,
LinkOpponentHandleSwitchInAnim,
LinkOpponentHandleReturnMonToBall,
LinkOpponentHandleDrawTrainerPic,
LinkOpponentHandleTrainerSlide,
LinkOpponentHandleTrainerSlideBack,
LinkOpponentHandleFaintAnimation,
LinkOpponentHandleCmd11,
LinkOpponentHandleCmd12,
LinkOpponentHandleBallThrow,
LinkOpponentHandlePause,
LinkOpponentHandleMoveAnimation,
LinkOpponentHandlePrintString,
LinkOpponentHandlePrintStringPlayerOnly,
LinkOpponentHandleChooseAction,
LinkOpponentHandleCmd19,
LinkOpponentHandleChooseMove,
LinkOpponentHandleOpenBag,
LinkOpponentHandleChoosePokemon,
LinkOpponentHandleCmd23,
LinkOpponentHandleHealthBarUpdate,
LinkOpponentHandleExpUpdate,
LinkOpponentHandleStatusIconUpdate,
LinkOpponentHandleStatusAnimation,
LinkOpponentHandleStatusXor,
LinkOpponentHandleDataTransfer,
LinkOpponentHandleDMA3Transfer,
LinkOpponentHandlePlayBGM,
LinkOpponentHandleCmd32,
LinkOpponentHandleCmd33,
LinkOpponentHandleCmd34,
LinkOpponentHandleCmd35,
LinkOpponentHandleCmd36,
LinkOpponentHandleCmd37,
LinkOpponentHandleCmd38,
LinkOpponentHandleCmd39,
LinkOpponentHandleCmd40,
LinkOpponentHandleHitAnimation,
LinkOpponentHandleCmd42,
LinkOpponentHandleEffectivenessSound,
LinkOpponentHandlePlayFanfareOrBGM,
LinkOpponentHandleFaintingCry,
LinkOpponentHandleIntroSlide,
LinkOpponentHandleIntroTrainerBallThrow,
LinkOpponentHandleDrawPartyStatusSummary,
LinkOpponentHandleCmd49,
LinkOpponentHandleCmd50,
LinkOpponentHandleSpriteInvisibility,
LinkOpponentHandleBattleAnimation,
LinkOpponentHandleLinkStandbyMsg,
LinkOpponentHandleResetActionMoveSelection,
LinkOpponentHandleCmd55,
nullsub_92
};
void nullsub_28(void)
{
}
void SetBankFuncToLinkOpponentBufferRunCommand(void)
{
gBattleBankFunc[gActiveBank] = LinkOpponentBufferRunCommand;
}

View File

@ -2285,7 +2285,7 @@ static void DoSwitchOutAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{ {
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
gBattleBankFunc[gActiveBank] = sub_8059744; gBattleBankFunc[gActiveBank] = sub_8059744;
} }
break; break;
@ -2453,7 +2453,7 @@ static void PlayerHandleFaintAnimation(void)
{ {
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
PlaySE12WithPanning(SE_POKE_DEAD, -64); PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER);
gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; gSprites[gBankSpriteIds[gActiveBank]].data1 = 0;
gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; gSprites[gBankSpriteIds[gActiveBank]].data2 = 5;
gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00;
@ -2911,7 +2911,7 @@ static void PlayerHandleHitAnimation(void)
} }
else else
{ {
gDoingBattleAnim = 1; gDoingBattleAnim = TRUE;
gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; gSprites[gBankSpriteIds[gActiveBank]].data1 = 0;
DoHitAnimHealthboxEffect(gActiveBank); DoHitAnimHealthboxEffect(gActiveBank);
gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect; gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect;

View File

@ -1315,7 +1315,7 @@ static void DoSwitchOutAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{ {
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
gBattleBankFunc[gActiveBank] = sub_81BB828; gBattleBankFunc[gActiveBank] = sub_81BB828;
} }
break; break;
@ -1414,7 +1414,7 @@ static void PlayerPartnerHandleFaintAnimation(void)
{ {
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); sub_805E990(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
PlaySE12WithPanning(SE_POKE_DEAD, -64); PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER);
gSprites[gBankSpriteIds[gActiveBank]].data1 = 0; gSprites[gBankSpriteIds[gActiveBank]].data1 = 0;
gSprites[gBankSpriteIds[gActiveBank]].data2 = 5; gSprites[gBankSpriteIds[gActiveBank]].data2 = 5;
gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00; gSprites[gBankSpriteIds[gActiveBank]].callback = sub_8039C00;

View File

@ -1213,7 +1213,7 @@ static void DoSwitchOutAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
{ {
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_MON); DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
gBattleBankFunc[gActiveBank] = sub_818A1B0; gBattleBankFunc[gActiveBank] = sub_818A1B0;
} }
break; break;