review change battle controllers

This commit is contained in:
DizzyEggg 2017-10-31 18:04:08 +01:00
parent 2d14e6bb67
commit 712ae56167
22 changed files with 282 additions and 245 deletions

View File

@ -2229,8 +2229,8 @@ _0805E3EA:
.pool
thumb_func_end sub_805E394
thumb_func_start SetBattleSpriteInvisibilityBitToSpriteInvisibility
SetBattleSpriteInvisibilityBitToSpriteInvisibility: @ 805E408
thumb_func_start CopyBattleSpriteInvisibility
CopyBattleSpriteInvisibility: @ 805E408
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleSpritesDataPtr
@ -2258,7 +2258,7 @@ SetBattleSpriteInvisibilityBitToSpriteInvisibility: @ 805E408
strb r0, [r3]
bx lr
.pool
thumb_func_end SetBattleSpriteInvisibilityBitToSpriteInvisibility
thumb_func_end CopyBattleSpriteInvisibility
thumb_func_start sub_805E448
sub_805E448: @ 805E448

View File

@ -1340,7 +1340,7 @@ GetFrontierTrainerFrontSpriteId: @ 8162AA0
lsls r0, 1
cmp r4, r0
bne _08162AD0
ldr r1, =gTrainerClassToFrontPicId
ldr r1, =gUnknown_0831F578
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldr r2, =0x00000bed
@ -1362,7 +1362,7 @@ _08162AE4:
ldr r0, =0x0000012b
cmp r4, r0
bhi _08162B08
ldr r2, =gTrainerClassToFrontPicId
ldr r2, =gUnknown_0831F578
ldr r0, =gUnknown_0203BC88
ldr r1, [r0]
movs r0, 0x34
@ -1383,7 +1383,7 @@ _08162B08:
ands r0, r1
cmp r0, 0
beq _08162B38
ldr r4, =gTrainerClassToFrontPicId
ldr r4, =gUnknown_0831F578
bl sub_818649C
lsls r0, 24
lsrs r0, 24
@ -1391,7 +1391,7 @@ _08162B08:
b _08162BC8
.pool
_08162B38:
ldr r3, =gTrainerClassToFrontPicId
ldr r3, =gUnknown_0831F578
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldr r1, =0xfffffed4
@ -1413,7 +1413,7 @@ _08162B64:
ands r0, r1
cmp r0, 0
bne _08162BB0
ldr r4, =gTrainerClassToFrontPicId
ldr r4, =gUnknown_0831F578
ldr r3, =gUnknown_08610970
ldr r0, =gSaveBlock2Ptr
ldr r1, [r0]
@ -1436,7 +1436,7 @@ _08162B64:
b _08162BC8
.pool
_08162BB0:
ldr r5, =gTrainerClassToFrontPicId
ldr r5, =gUnknown_0831F578
ldr r4, =gUnknown_08610970
bl sub_81864A8
lsls r0, 24
@ -5845,7 +5845,7 @@ _08165206:
thumb_func_start GetEreaderTrainerFrontSpriteId
GetEreaderTrainerFrontSpriteId: @ 8165244
ldr r1, =gTrainerClassToFrontPicId
ldr r1, =gUnknown_0831F578
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldr r2, =0x00000bed

View File

@ -7890,7 +7890,7 @@ _081CAF34:
adds r0, r5, 0
bl sub_81D1BD0
adds r4, r0, 0
ldr r0, =gTrainerClassToFrontPicId
ldr r0, =gUnknown_0831F578
adds r0, r4, r0
ldrb r0, [r0]
b _081CAF6C
@ -28947,7 +28947,7 @@ sub_81D5588: @ 81D5588
adds r3, r0
ldrb r4, [r3, 0x1B]
bl sub_81D5710
ldr r0, =gTrainerClassToFrontPicId
ldr r0, =gUnknown_0831F578
adds r4, r0
ldrb r0, [r4]
pop {r4}

View File

@ -1,5 +1,5 @@
.align 2
gTrainerClassToFrontPicId:: @ 831F578
gUnknown_0831F578:: @ 831F578
.byte TRAINER_PIC_HIKER
.byte TRAINER_PIC_AQUA_GRUNT_M
.byte TRAINER_PIC_POKEMON_BREEDER_F

View File

@ -894,7 +894,7 @@ void TrySetBehindSubstituteSpriteBit(u8 bank, u16 move);
void DoStatusAnimation(bool8 isStatus2, u32 status);
void DoSpecialBattleAnimation(u8 activeBank, u8 atkBank, u8 defBank, u8 tableId);
bool8 DoBattleAnimationFromTable(u8 active, u8 atkBank, u8 defBank, u8 tableId, u16 argument);
void SetBattleSpriteInvisibilityBitToSpriteInvisibility(u8 bank);
void CopyBattleSpriteInvisibility(u8 bank);
u16 ChooseMoveAndTargetInBattlePalace(void);
void LoadBattleBarGfx(u8 arg0);
bool8 mplay_80342A4(u8 bank);

View File

@ -167,10 +167,11 @@ enum
CONTROLLER_LINKSTANDBYMSG,
CONTROLLER_RESETACTIONMOVESELECTION,
CONTROLLER_55,
CONTROLLER_56
/*new controllers should go after 55 and before 56*/
CONTROLLER_56,
CONTROLLER_CMDS_COUNT
};
#define CONTOLLER_CMDS_COUNT CONTROLLER_56 + 1
// general functions
void HandleLinkBattleSetup(void);
@ -180,9 +181,9 @@ void sub_8033648(void);
void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data);
// emitters
void EmitGetMonData(u8 bufferId, u8 requestId, u8 monsToCheck);
void EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck);
void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused
void EmitSetMonData(u8 bufferId, u8 requestId, u8 monsToCheck, u8 bytes, void *data);
void EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data);
void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused
void EmitLoadMonSprite(u8 bufferId);
void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit);

View File

@ -10,6 +10,7 @@ struct MonCoords
};
extern struct MonCoords gTrainerBackPicCoords[];
extern struct MonCoords gTrainerFrontPicCoords[];
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
extern const u8 gMoveNames[][13];

View File

@ -3,16 +3,16 @@
enum
{
CLASS_PKMN_TRAINER0, //0
CLASS_PKMN_TRAINER1, //1
CLASS_HIKER, //2
CLASS_TEAM_AQUA, //3
CLASS_PKMN_BREEDER, //4
CLASS_COOLTRAINER, //5
CLASS_BIRDKEEPER, //6
CLASS_COLLECTOR, //7
CLASS_SWIMMER_MALE, //8
CLASS_TEAM_MAGMA, //9
CLASS_PKMN_TRAINER0, // 0
CLASS_PKMN_TRAINER1, // 1
CLASS_HIKER, // 2
CLASS_TEAM_AQUA, // 3
CLASS_PKMN_BREEDER, // 4
CLASS_COOLTRAINER, // 5
CLASS_BIRDKEEPER, // 6
CLASS_COLLECTOR, // 7
CLASS_SWIMMER_MALE, // 8
CLASS_TEAM_MAGMA, // 9
CLASS_EXPERT, // 0xA
CLASS_AQUA_ADMIN, // 0xB
CLASS_BLACK_BELT, // 0xC
@ -36,11 +36,32 @@ enum
CLASS_GENTLEMAN, // 0x1E
CLASS_ELITE_FOUR, // 0x1F
CLASS_LEADER, // 0x20
CLASS_CHAMPION = 0x26,
CLASS_MAGMA_ADMIN = 0x31,
CLASS_PKMN_TRAINER_RIVAL = 0x32,
CLASS_MAGMA_LEADER = 0x35,
CLASS_SALON_MAIDEN = 0x3A,
CLASS_SCHOOL_KID, // 0x21
CLASS_SCHOOL_SR_JR, // 0x22
CLASS_WINSTRATE, // 0x23
CLASS_POKE_FAN, // 0x24
CLASS_YOUNGSTER, // 0x25
CLASS_CHAMPION, // 0x26
CLASS_FISHERMAN, // 0x27
CLASS_TRIATHLETE, // 0x28
CLASS_DRAGON_TAMER, // 0x29
CLASS_NINJA_BOY, // 0x2A
CLASS_BATTLE_GIRL, // 0x2B
CLASS_PARASOL_LADY, // 0x2C
CLASS_SWIMMER_FEMALE, // 0x2D
CLASS_TWINS, // 0x2E
CLASS_SAILOR, // 0x2F
CLASS_COOLTRAINER_2, // 0x30
CLASS_MAGMA_ADMIN, // 0x31
CLASS_PKMN_TRAINER_RIVAL, // 0x32
CLASS_BUG_CATCHER, // 0x33
CLASS_PKMN_RANGER, // 0x34
CLASS_MAGMA_LEADER, // 0x35
CLASS_LASS, // 0x36
CLASS_YOUNG_COUPLE, // 0x37
CLASS_OLD_COUPLE, // 0x38
CLASS_SIS_AND_BRO, // 0x39
CLASS_SALON_MAIDEN, // 0x3A
CLASS_DOME_ACE, // 0x3B
CLASS_PALACE_MAVEN, // 0x3C
CLASS_ARENA_TYCOON, // 0x3D

View File

@ -0,0 +1,101 @@
#ifndef GUARD_TRAINER_FRONT_SPRITES_H
#define GUARD_TRAINER_FRONT_SPRITES_H
enum
{
TRAINER_FRONT_PIC_HIKER,
TRAINER_FRONT_PIC_AQUA_GRUNT_M,
TRAINER_FRONT_PIC_PKMN_BREEDER_F,
TRAINER_FRONT_PIC_COOLTRAINER_M,
TRAINER_FRONT_PIC_BIRD_KEEPER,
TRAINER_FRONT_PIC_COLLECTOR,
TRAINER_FRONT_PIC_AQUA_GRUNT_F,
TRAINER_FRONT_PIC_SWIMMER_M,
TRAINER_FRONT_PIC_MAGMA_GRUNT_M,
TRAINER_FRONT_PIC_EXPERT_M,
TRAINER_FRONT_PIC_AQUA_ADMIN_M,
TRAINER_FRONT_PIC_BLACK_BELT,
TRAINER_FRONT_PIC_AQUA_ADMIN_F,
TRAINER_FRONT_PIC_AQUA_LEADER,
TRAINER_FRONT_PIC_HEX_MANIAC,
TRAINER_FRONT_PIC_AROMA_LADY,
TRAINER_FRONT_PIC_RUIN_MANIAC,
TRAINER_FRONT_PIC_INTERVIEWER,
TRAINER_FRONT_PIC_TUBER_F,
TRAINER_FRONT_PIC_TUBER_M,
TRAINER_FRONT_PIC_COOLTRAINER_F,
TRAINER_FRONT_PIC_LADY,
TRAINER_FRONT_PIC_BEAUTY,
TRAINER_FRONT_PIC_RICH_BOY,
TRAINER_FRONT_PIC_EXPERT_F,
TRAINER_FRONT_PIC_POKE_MANIAC,
TRAINER_FRONT_PIC_MAGMA_GRUNT_F,
TRAINER_FRONT_PIC_GUITARIST,
TRAINER_FRONT_PIC_KINDLER,
TRAINER_FRONT_PIC_CAMPER,
TRAINER_FRONT_PIC_PICNICKER,
TRAINER_FRONT_PIC_BUG_MANIAC,
TRAINER_FRONT_PIC_PKMN_BREEDER_M,
TRAINER_FRONT_PIC_PSYCHIC_M,
TRAINER_FRONT_PIC_PSYCHIC_F,
TRAINER_FRONT_PIC_GENTLEMAN,
TRAINER_FRONT_PIC_SIDNEY,
TRAINER_FRONT_PIC_PHOEBE,
TRAINER_FRONT_PIC_GLACIA,
TRAINER_FRONT_PIC_DRAKE,
TRAINER_FRONT_PIC_ROXANNE,
TRAINER_FRONT_PIC_BRAWLY,
TRAINER_FRONT_PIC_WATTSON,
TRAINER_FRONT_PIC_FLANNERY,
TRAINER_FRONT_PIC_NORMAN,
TRAINER_FRONT_PIC_WINONA,
TRAINER_FRONT_PIC_TATE_LIZA,
TRAINER_FRONT_PIC_JUAN,
TRAINER_FRONT_PIC_SCHOOL_KID_M,
TRAINER_FRONT_PIC_SCHOOL_KID_F,
TRAINER_FRONT_PIC_SR_JR,
TRAINER_FRONT_PIC_POKÉFAN_M,
TRAINER_FRONT_PIC_POKÉFAN_F,
TRAINER_FRONT_PIC_YOUNGSTER,
TRAINER_FRONT_PIC_WALLACE,
TRAINER_FRONT_PIC_FISHERMAN,
TRAINER_FRONT_PIC_TRIATHLETE_BIKER_M,
TRAINER_FRONT_PIC_TRIATHLETE_BIKER_F,
TRAINER_FRONT_PIC_TRIATHLETE_JOGGER_M,
TRAINER_FRONT_PIC_TRIATHLETE_JOGGER_F,
TRAINER_FRONT_PIC_TRIATHLETE_SWIMMER_M,
TRAINER_FRONT_PIC_TRIATHLETE_SWIMMER_F,
TRAINER_FRONT_PIC_DRAGON_TAMER,
TRAINER_FRONT_PIC_NINJA_BOY,
TRAINER_FRONT_PIC_BATTLE_GIRL,
TRAINER_FRONT_PIC_PARASOL_LADY,
TRAINER_FRONT_PIC_SWIMMER_F,
TRAINER_FRONT_PIC_TWINS,
TRAINER_FRONT_PIC_SAILOR,
TRAINER_FRONT_PIC_MAGMA_ADMIN_M,
TRAINER_FRONT_PIC_WALLY,
TRAINER_FRONT_PIC_BRENDAN_E,
TRAINER_FRONT_PIC_MAY_E,
TRAINER_FRONT_PIC_BUG_CATCHER,
TRAINER_FRONT_PIC_PKMN_RANGER_M,
TRAINER_FRONT_PIC_PKMN_RANGER_F,
TRAINER_FRONT_PIC_MAGMA_LEADER,
TRAINER_FRONT_PIC_LASS,
TRAINER_FRONT_PIC_YOUNG_COUPLE,
TRAINER_FRONT_PIC_OLD_COUPLE,
TRAINER_FRONT_PIC_SIS_AND_BRO,
TRAINER_FRONT_PIC_STEVEN,
TRAINER_FRONT_PIC_ANABEL,
TRAINER_FRONT_PIC_TUCKER,
TRAINER_FRONT_PIC_SPENSER,
TRAINER_FRONT_PIC_GRETA,
TRAINER_FRONT_PIC_NOLAND,
TRAINER_FRONT_PIC_LUCY,
TRAINER_FRONT_PIC_BRANDON,
TRAINER_FRONT_PIC_RED,
TRAINER_FRONT_PIC_LEAF,
TRAINER_FRONT_PIC_BRENDAN_RS,
TRAINER_FRONT_PIC_MAY_RS
};
#endif // GUARD_TRAINER_FRONT_SPRITES_H

View File

@ -21,6 +21,7 @@
#include "bg.h"
#include "reshow_battle_screen.h"
#include "pokeball.h"
#include "data2.h"
extern u32 gBattleExecBuffer;
extern u8 gActiveBank;
@ -56,7 +57,7 @@ extern u16 gTrainerBattleOpponent_B;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct BattleMove gBattleMoves[];
extern const u8 gTrainerClassToFrontPicId[];
extern const u8 gUnknown_0831F578[];
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
@ -134,7 +135,7 @@ static void sub_8067618(u8 taskId);
static void sub_80676FC(struct Sprite *sprite);
static void sub_806782C(void);
static void (*const sLinkOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) =
static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
LinkOpponentHandleGetMonData,
LinkOpponentHandleGetRawMonData,
@ -519,7 +520,7 @@ static void sub_8064E50(void)
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL);
sub_8076918(gActiveBank);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]);
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
CopyBattleSpriteInvisibility(gActiveBank);
gBattleBankFunc[gActiveBank] = sub_8064D60;
}
}
@ -561,7 +562,7 @@ static void LinkOpponentBufferExecCompleted(void)
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1;
gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1;
}
else
{
@ -573,7 +574,7 @@ static void LinkOpponentHandleGetMonData(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)
@ -582,12 +583,12 @@ static void LinkOpponentHandleGetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
size += CopyLinkOpponentMonData(i, monData + size);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
EmitDataTransfer(1, size, monData);
@ -907,7 +908,7 @@ static void LinkOpponentHandleGetRawMonData(void)
static void LinkOpponentHandleSetMonData(void)
{
u8 monsToCheck;
u8 monToCheck;
u8 i;
if (gBattleBufferA[gActiveBank][2] == 0)
@ -916,12 +917,12 @@ static void LinkOpponentHandleSetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
SetLinkOpponentMonData(i);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
LinkOpponentBufferExecCompleted();
@ -1166,8 +1167,6 @@ static void LinkOpponentHandleLoadMonSprite(void)
sub_80A6138(gActiveBank),
sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240;
gSprites[gBankSpriteIds[gActiveBank]].data0 = gActiveBank;
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank;
@ -1255,16 +1254,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 LinkOpponentHandleDrawTrainerPic(void)
{
s16 xPos;
@ -1290,17 +1279,17 @@ static void LinkOpponentHandleDrawTrainerPic(void)
|| (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_LEAF_GREEN)
{
if (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender != 0)
trainerPicId = gTrainerClassToFrontPicId[0x4F];
trainerPicId = gUnknown_0831F578[0x4F];
else
trainerPicId = gTrainerClassToFrontPicId[0x4E];
trainerPicId = gUnknown_0831F578[0x4E];
}
else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].version & 0xFF) == VERSION_SAPPHIRE)
{
if (gLinkPlayers[GetBankMultiplayerId(gActiveBank)].gender != 0)
trainerPicId = gTrainerClassToFrontPicId[0x51];
trainerPicId = gUnknown_0831F578[0x51];
else
trainerPicId = gTrainerClassToFrontPicId[0x50];
trainerPicId = gUnknown_0831F578[0x50];
}
else
{
@ -1319,17 +1308,17 @@ static void LinkOpponentHandleDrawTrainerPic(void)
|| (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_LEAF_GREEN)
{
if (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].gender != 0)
trainerPicId = gTrainerClassToFrontPicId[0x4F];
trainerPicId = gUnknown_0831F578[0x4F];
else
trainerPicId = gTrainerClassToFrontPicId[0x4E];
trainerPicId = gUnknown_0831F578[0x4E];
}
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 = gTrainerClassToFrontPicId[0x51];
trainerPicId = gUnknown_0831F578[0x51];
else
trainerPicId = gTrainerClassToFrontPicId[0x50];
trainerPicId = gUnknown_0831F578[0x50];
}
else
{
@ -1849,7 +1838,7 @@ static void LinkOpponentHandleSpriteInvisibility(void)
if (IsBankSpritePresent(gActiveBank))
{
gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1];
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
CopyBattleSpriteInvisibility(gActiveBank);
}
LinkOpponentBufferExecCompleted();
}

View File

@ -21,6 +21,7 @@
#include "bg.h"
#include "reshow_battle_screen.h"
#include "pokeball.h"
#include "data2.h"
extern u32 gBattleExecBuffer;
extern u8 gActiveBank;
@ -129,7 +130,7 @@ static void LinkPartnerDoMoveAnimation(void);
static void sub_814DCCC(u8 taskId);
static void sub_814DE9C(void);
static void (*const sLinkPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) =
static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
LinkPartnerHandleGetMonData,
LinkPartnerHandleGetRawMonData,
@ -370,7 +371,7 @@ static void sub_814B4E0(void)
{
if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy)
{
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
CopyBattleSpriteInvisibility(gActiveBank);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
@ -432,7 +433,7 @@ static void LinkPartnerBufferExecCompleted(void)
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1;
gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1;
}
else
{
@ -456,7 +457,7 @@ static void LinkPartnerHandleGetMonData(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)
@ -465,12 +466,12 @@ static void LinkPartnerHandleGetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
size += CopyLinkPartnerMonData(i, monData + size);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
EmitDataTransfer(1, size, monData);
@ -790,7 +791,7 @@ static void LinkPartnerHandleGetRawMonData(void)
static void LinkPartnerHandleSetMonData(void)
{
u8 monsToCheck;
u8 monToCheck;
u8 i;
if (gBattleBufferA[gActiveBank][2] == 0)
@ -799,12 +800,12 @@ static void LinkPartnerHandleSetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
SetLinkPartnerMonData(i);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
LinkPartnerBufferExecCompleted();
@ -1135,17 +1136,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 gTrainerBackPicCoords[];
extern const struct MonCoords gTrainerFrontPicCoords[];
static void LinkPartnerHandleDrawTrainerPic(void)
{
s16 xPos;
@ -1681,7 +1671,7 @@ static void LinkPartnerHandleSpriteInvisibility(void)
if (IsBankSpritePresent(gActiveBank))
{
gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1];
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
CopyBattleSpriteInvisibility(gActiveBank);
}
LinkPartnerBufferExecCompleted();
}

View File

@ -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();
}

View File

@ -24,6 +24,7 @@
#include "reshow_battle_screen.h"
#include "rng.h"
#include "pokeball.h"
#include "data2.h"
extern u32 gBattleExecBuffer;
extern u8 gActiveBank;
@ -169,7 +170,7 @@ static void PlayerDoMoveAnimation(void);
static void task05_08033660(u8 taskId);
static void sub_805CE38(void);
static void (*const sPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) =
static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
PlayerHandleGetMonData,
PlayerHandleGetRawMonData,
@ -254,7 +255,7 @@ static void PlayerBufferExecCompleted(void)
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1;
gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1;
}
else
{
@ -1099,7 +1100,7 @@ static void sub_8058EDC(void)
&& gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1
&& gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy)
{
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
CopyBattleSpriteInvisibility(gActiveBank);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0;
FreeSpriteTilesByTag(0x27F9);
@ -1614,7 +1615,7 @@ static void PlayerHandleGetMonData(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)
@ -1623,12 +1624,12 @@ static void PlayerHandleGetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
size += CopyPlayerMonData(i, monData + size);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
EmitDataTransfer(1, size, monData);
@ -1957,7 +1958,7 @@ void PlayerHandleGetRawMonData(void)
static void PlayerHandleSetMonData(void)
{
u8 monsToCheck;
u8 monToCheck;
u8 i;
if (gBattleBufferA[gActiveBank][2] == 0)
@ -1966,12 +1967,12 @@ static void PlayerHandleSetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
SetPlayerMonData(i);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
PlayerBufferExecCompleted();
@ -2292,17 +2293,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 gTrainerBackPicCoords[];
extern const struct MonCoords gTrainerFrontPicCoords[];
// some explanation here
// in emerald it's possible to have a tag battle in the battle frontier facilities with AI
// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it
@ -3086,7 +3076,7 @@ static void PlayerHandleSpriteInvisibility(void)
if (IsBankSpritePresent(gActiveBank))
{
gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1];
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
CopyBattleSpriteInvisibility(gActiveBank);
}
PlayerBufferExecCompleted();
}

View File

@ -20,6 +20,7 @@
#include "bg.h"
#include "reshow_battle_screen.h"
#include "pokeball.h"
#include "data2.h"
extern u32 gBattleExecBuffer;
extern u8 gActiveBank;
@ -135,7 +136,7 @@ static void PlayerPartnerDoMoveAnimation(void);
static void sub_81BE2C8(u8 taskId);
static void sub_81BE498(void);
static void (*const sPlayerPartnerBufferCommands[CONTOLLER_CMDS_COUNT])(void) =
static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
PlayerPartnerHandleGetMonData,
PlayerPartnerHandleGetRawMonData,
@ -557,7 +558,7 @@ static void sub_81BB92C(void)
{
if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy)
{
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
CopyBattleSpriteInvisibility(gActiveBank);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
@ -619,7 +620,7 @@ static void PlayerPartnerBufferExecCompleted(void)
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1;
gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1;
}
else
{
@ -643,7 +644,7 @@ static void PlayerPartnerHandleGetMonData(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)
@ -652,12 +653,12 @@ static void PlayerPartnerHandleGetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
size += CopyPlayerPartnerMonData(i, monData + size);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
EmitDataTransfer(1, size, monData);
@ -977,7 +978,7 @@ static void PlayerPartnerHandleGetRawMonData(void)
static void PlayerPartnerHandleSetMonData(void)
{
u8 monsToCheck;
u8 monToCheck;
u8 i;
if (gBattleBufferA[gActiveBank][2] == 0)
@ -986,12 +987,12 @@ static void PlayerPartnerHandleSetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
SetPlayerPartnerMonData(i);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
PlayerPartnerBufferExecCompleted();
@ -1322,17 +1323,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 gTrainerBackPicCoords[];
extern const struct MonCoords gTrainerFrontPicCoords[];
// some explanation here
// in emerald it's possible to have a tag battle in the battle frontier facilities with AI
// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it
@ -1927,7 +1917,7 @@ static void PlayerPartnerHandleSpriteInvisibility(void)
if (IsBankSpritePresent(gActiveBank))
{
gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1];
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
CopyBattleSpriteInvisibility(gActiveBank);
}
PlayerPartnerBufferExecCompleted();
}

View File

@ -22,6 +22,7 @@
#include "bg.h"
#include "reshow_battle_screen.h"
#include "pokeball.h"
#include "data2.h"
extern u32 gBattleExecBuffer;
extern u8 gActiveBank;
@ -133,7 +134,7 @@ static void sub_8189548(u8 taskId);
static void sub_818962C(struct Sprite *sprite);
static void sub_818975C(void);
static void (*const sRecordedOpponentBufferCommands[CONTOLLER_CMDS_COUNT])(void) =
static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
RecordedOpponentHandleGetMonData,
RecordedOpponentHandleGetRawMonData,
@ -504,7 +505,7 @@ static void sub_8186F94(void)
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gEnemyParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL);
sub_8076918(gActiveBank);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]);
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
CopyBattleSpriteInvisibility(gActiveBank);
gBattleBankFunc[gActiveBank] = sub_8186EA4;
}
}
@ -546,7 +547,7 @@ static void RecordedOpponentBufferExecCompleted(void)
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1;
gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1;
}
else
{
@ -558,7 +559,7 @@ static void RecordedOpponentHandleGetMonData(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)
@ -567,12 +568,12 @@ static void RecordedOpponentHandleGetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
size += CopyRecordedOpponentMonData(i, monData + size);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
EmitDataTransfer(1, size, monData);
@ -892,7 +893,7 @@ static void RecordedOpponentHandleGetRawMonData(void)
static void RecordedOpponentHandleSetMonData(void)
{
u8 monsToCheck;
u8 monToCheck;
u8 i;
if (gBattleBufferA[gActiveBank][2] == 0)
@ -901,12 +902,12 @@ static void RecordedOpponentHandleSetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
SetRecordedOpponentMonData(i);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
RecordedOpponentBufferExecCompleted();
@ -1239,16 +1240,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 RecordedOpponentHandleDrawTrainerPic(void)
{
s16 xPos;
@ -1791,7 +1782,7 @@ static void RecordedOpponentHandleSpriteInvisibility(void)
if (IsBankSpritePresent(gActiveBank))
{
gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1];
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
CopyBattleSpriteInvisibility(gActiveBank);
}
RecordedOpponentBufferExecCompleted();
}

View File

@ -21,6 +21,7 @@
#include "bg.h"
#include "reshow_battle_screen.h"
#include "pokeball.h"
#include "data2.h"
extern u32 gBattleExecBuffer;
extern u8 gActiveBank;
@ -132,7 +133,7 @@ static void RecordedPlayerDoMoveAnimation(void);
static void sub_818CC24(u8 taskId);
static void sub_818CDF4(void);
static void (*const sRecordedPlayerBufferCommands[CONTOLLER_CMDS_COUNT])(void) =
static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
RecordedPlayerHandleGetMonData,
RecordedPlayerHandleGetRawMonData,
@ -455,7 +456,7 @@ static void sub_818A2B4(void)
{
if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy)
{
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
CopyBattleSpriteInvisibility(gActiveBank);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
DoSpecialBattleAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
@ -517,7 +518,7 @@ static void RecordedPlayerBufferExecCompleted(void)
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1;
gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1;
}
else
{
@ -541,7 +542,7 @@ static void RecordedPlayerHandleGetMonData(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)
@ -550,12 +551,12 @@ static void RecordedPlayerHandleGetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
size += CopyRecordedPlayerMonData(i, monData + size);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
EmitDataTransfer(1, size, monData);
@ -875,7 +876,7 @@ static void RecordedPlayerHandleGetRawMonData(void)
static void RecordedPlayerHandleSetMonData(void)
{
u8 monsToCheck;
u8 monToCheck;
u8 i;
if (gBattleBufferA[gActiveBank][2] == 0)
@ -884,12 +885,12 @@ static void RecordedPlayerHandleSetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
SetRecordedPlayerMonData(i);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
RecordedPlayerBufferExecCompleted();
@ -1220,17 +1221,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 gTrainerBackPicCoords[];
extern const struct MonCoords gTrainerFrontPicCoords[];
static void RecordedPlayerHandleDrawTrainerPic(void)
{
s16 xPos, yPos;
@ -1811,7 +1801,7 @@ static void RecordedPlayerHandleSpriteInvisibility(void)
if (IsBankSpritePresent(gActiveBank))
{
gSprites[gBankSpriteIds[gActiveBank]].invisible = gBattleBufferA[gActiveBank][1];
SetBattleSpriteInvisibilityBitToSpriteInvisibility(gActiveBank);
CopyBattleSpriteInvisibility(gActiveBank);
}
RecordedPlayerBufferExecCompleted();
}

View File

@ -18,6 +18,7 @@
#include "bg.h"
#include "reshow_battle_screen.h"
#include "pokeball.h"
#include "data2.h"
extern u32 gBattleExecBuffer;
extern u8 gActiveBank;
@ -110,7 +111,7 @@ static void SafariBufferRunCommand(void);
static void SafariBufferExecCompleted(void);
static void CompleteWhenChosePokeblock(void);
static void (*const sSafariBufferCommands[CONTOLLER_CMDS_COUNT])(void) =
static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
SafariHandleGetMonData,
SafariHandleGetRawMonData,
@ -323,7 +324,7 @@ static void SafariBufferExecCompleted(void)
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1;
gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1;
}
else
{
@ -372,16 +373,6 @@ static void SafariHandleReturnMonToBall(void)
SafariBufferExecCompleted();
}
// 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 gTrainerBackPicCoords[];
static void SafariHandleDrawTrainerPic(void)
{
DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBank);

View File

@ -24,6 +24,7 @@
#include "reshow_battle_screen.h"
#include "rng.h"
#include "pokeball.h"
#include "data2.h"
#include "party_menu.h"
extern u32 gBattleExecBuffer;
@ -135,7 +136,7 @@ static void SetWallyMonData(u8 monId);
static void WallyDoMoveAnimation(void);
static void sub_816AC04(u8 taskId);
static void (*const sWallyBufferCommands[CONTOLLER_CMDS_COUNT])(void) =
static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
WallyHandleGetMonData,
WallyHandleGetRawMonData,
@ -441,7 +442,7 @@ static void WallyBufferExecCompleted(void)
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
gBattleBufferA[gActiveBank][0] = CONTOLLER_CMDS_COUNT - 1;
gBattleBufferA[gActiveBank][0] = CONTROLLER_CMDS_COUNT - 1;
}
else
{
@ -459,7 +460,7 @@ static void WallyHandleGetMonData(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)
@ -468,12 +469,12 @@ static void WallyHandleGetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
size += CopyWallyMonData(i, monData + size);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
EmitDataTransfer(1, size, monData);
@ -793,7 +794,7 @@ static void WallyHandleGetRawMonData(void)
static void WallyHandleSetMonData(void)
{
u8 monsToCheck;
u8 monToCheck;
u8 i;
if (gBattleBufferA[gActiveBank][2] == 0)
@ -802,12 +803,12 @@ static void WallyHandleSetMonData(void)
}
else
{
monsToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBank][2];
for (i = 0; i < 6; i++)
{
if (monsToCheck & 1)
if (monToCheck & 1)
SetWallyMonData(i);
monsToCheck >>= 1;
monToCheck >>= 1;
}
}
WallyBufferExecCompleted();
@ -1062,16 +1063,6 @@ static void WallyHandleReturnMonToBall(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 gTrainerBackPicCoords[];
static void WallyHandleDrawTrainerPic(void)
{
DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank);

View File

@ -939,11 +939,11 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId)
}
}
void EmitGetMonData(u8 bufferId, u8 requestId, u8 monsToCheck)
void EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck)
{
gBattleBuffersTransferData[0] = CONTROLLER_GETMONDATA;
gBattleBuffersTransferData[1] = requestId;
gBattleBuffersTransferData[2] = monsToCheck;
gBattleBuffersTransferData[2] = monToCheck;
gBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
@ -957,13 +957,13 @@ void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes)
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitSetMonData(u8 bufferId, u8 requestId, u8 monsToCheck, u8 bytes, void *data)
void EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_SETMONDATA;
gBattleBuffersTransferData[1] = requestId;
gBattleBuffersTransferData[2] = monsToCheck;
gBattleBuffersTransferData[2] = monToCheck;
for (i = 0; i < bytes; i++)
gBattleBuffersTransferData[3 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 3 + bytes);

View File

@ -19,7 +19,7 @@ extern const union AffineAnimCmd *const gUnknown_082FF694[];
extern const union AnimCmd *const gUnknown_082FF70C[];
extern const union AnimCmd *const *const gMonAnimationsSpriteAnimsPtrTable[NUM_SPECIES];
extern const union AnimCmd *const *const gUnknown_0830536C[];
extern const u8 gTrainerClassToFrontPicId[];
extern const u8 gUnknown_0831F578[];
// Static type declarations
@ -421,9 +421,9 @@ u8 sub_818D97C(u8 a0, u8 a1)
switch (a0)
{
default:
return gTrainerClassToFrontPicId[0x3F];
return gUnknown_0831F578[0x3F];
case 0:
return gTrainerClassToFrontPicId[0x3C];
return gUnknown_0831F578[0x3C];
}
}
return a0;

View File

@ -1222,14 +1222,14 @@ void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord)
}
}
extern const u8 gTrainerClassToFrontPicId[];
extern const u8 gUnknown_0831F578[];
extern const u8 gTrainerClassToNameIndex[];
extern const u8 gSecretBaseTrainerClasses[][5];
u8 GetSecretBaseTrainerPicIndex(void)
{
u8 trainerClass = gSecretBaseTrainerClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5];
return gTrainerClassToFrontPicId[trainerClass];
return gUnknown_0831F578[trainerClass];
}
u8 GetSecretBaseTrainerNameIndex(void)

View File

@ -1652,11 +1652,11 @@ u8 sub_806EF84(u8 arg0, u8 arg1)
return i;
}
extern const u8 gTrainerClassToFrontPicId[];
extern const u8 gUnknown_0831F578[];
u16 sub_806EFF0(u16 arg0)
{
return gTrainerClassToFrontPicId[arg0];
return gUnknown_0831F578[arg0];
}
u16 PlayerGenderToFrontTrainerPicId(u8 playerGender)