review change battle controllers
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "reshow_battle_screen.h"
|
||||
#include "rng.h"
|
||||
#include "pokeball.h"
|
||||
#include "data2.h"
|
||||
|
||||
extern u32 gBattleExecBuffer;
|
||||
extern u8 gActiveBank;
|
||||
@@ -135,7 +136,7 @@ static void sub_806280C(struct Sprite *sprite);
|
||||
static void sub_8062828(u8 taskId);
|
||||
static void sub_8062A2C(void);
|
||||
|
||||
static void (*const sOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) =
|
||||
static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
|
||||
{
|
||||
OpponentHandleGetMonData,
|
||||
OpponentHandleGetRawMonData,
|
||||
@@ -501,7 +502,7 @@ static void sub_805FD00(void)
|
||||
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL);
|
||||
sub_8076918(gActiveBank);
|
||||
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]);
|
||||
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
|
||||
CopyBattleSpriteInvisibility(gActiveBank);
|
||||
gBattleBankFunc[gActiveBank] = sub_805FC10;
|
||||
}
|
||||
}
|
||||
@@ -540,7 +541,7 @@ static void OpponentBufferExecCompleted(void)
|
||||
u8 playerId = GetMultiplayerId();
|
||||
|
||||
PrepareBufferDataTransferLink(2, 4, &playerId);
|
||||
gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1;
|
||||
gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -552,7 +553,7 @@ static void OpponentHandleGetMonData(void)
|
||||
{
|
||||
u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data
|
||||
u32 size = 0;
|
||||
u8 monsToCheck;
|
||||
u8 monToCheck;
|
||||
s32 i;
|
||||
|
||||
if (gBattleBufferA[gActiveBank][2] == 0)
|
||||
@@ -561,12 +562,12 @@ static void OpponentHandleGetMonData(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
monsToCheck = gBattleBufferA[gActiveBank][2];
|
||||
monToCheck = gBattleBufferA[gActiveBank][2];
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
if (monsToCheck & 1)
|
||||
if (monToCheck & 1)
|
||||
size += GetOpponentMonData(i, monData + size);
|
||||
monsToCheck >>= 1;
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
EmitDataTransfer(1, size, monData);
|
||||
@@ -895,7 +896,7 @@ static void OpponentHandleGetRawMonData(void)
|
||||
|
||||
static void OpponentHandleSetMonData(void)
|
||||
{
|
||||
u8 monsToCheck;
|
||||
u8 monToCheck;
|
||||
u8 i;
|
||||
|
||||
if (gBattleBufferA[gActiveBank][2] == 0)
|
||||
@@ -904,12 +905,12 @@ static void OpponentHandleSetMonData(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
monsToCheck = gBattleBufferA[gActiveBank][2];
|
||||
monToCheck = gBattleBufferA[gActiveBank][2];
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
if (monsToCheck & 1)
|
||||
if (monToCheck & 1)
|
||||
SetOpponentMonData(i);
|
||||
monsToCheck >>= 1;
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
OpponentBufferExecCompleted();
|
||||
@@ -1243,16 +1244,6 @@ static void DoSwitchOutAnimation(void)
|
||||
}
|
||||
}
|
||||
|
||||
// todo: get rid of it once the struct is declared in a header
|
||||
struct MonCoords
|
||||
{
|
||||
// This would use a bitfield, but sub_8079F44
|
||||
// uses it as a u8 and casting won't match.
|
||||
u8 coords; // u8 x:4, y:4;
|
||||
u8 y_offset;
|
||||
};
|
||||
extern const struct MonCoords gTrainerFrontPicCoords[];
|
||||
|
||||
static void OpponentHandleDrawTrainerPic(void)
|
||||
{
|
||||
u32 trainerPicId;
|
||||
@@ -1997,7 +1988,7 @@ static void OpponentHandleSpriteInvisibility(void)
|
||||
if (IsBankSpritePresent(gActiveBank))
|
||||
{
|
||||
gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1];
|
||||
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
|
||||
CopyBattleSpriteInvisibility(gActiveBank);
|
||||
}
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user