label multiuse sprite template functions

This commit is contained in:
DizzyEggg 2018-07-01 15:28:57 +02:00
parent f35c0abe80
commit c556358e47
23 changed files with 183 additions and 190 deletions

View File

@ -6770,8 +6770,8 @@ _080DB1CC:
bl LoadCompressedPalette
adds r0, r5, 0
movs r1, 0
bl sub_806A068
ldr r4, =gUnknown_0202499C
bl SetMultiuseSpriteTemplateToPokemon
ldr r4, =gMultiuseSpriteTemplate
movs r0, 0x2
adds r1, r5, 0
movs r2, 0

View File

@ -1420,8 +1420,8 @@ _080F64F2:
bl LoadCompressedObjectPalette
adds r0, r6, 0
movs r1, 0x1
bl sub_806A068
ldr r0, =gUnknown_0202499C
bl SetMultiuseSpriteTemplateToPokemon
ldr r0, =gMultiuseSpriteTemplate
ldrh r1, [r4, 0x4]
strh r1, [r0, 0x2]
movs r1, 0x88

View File

@ -1092,7 +1092,7 @@ _081C4750:
bl LoadCompressedObjectPalette
ldrh r0, [r4, 0x4]
movs r1, 0x1
bl sub_806A068
bl SetMultiuseSpriteTemplateToPokemon
_081C4768:
ldrh r0, [r6]
adds r0, 0x1
@ -1144,7 +1144,7 @@ sub_81C47B4: @ 81C47B4
ldr r0, =gUnknown_0203CF1C
ldr r6, [r0]
adds r6, 0x70
ldr r0, =gUnknown_0202499C
ldr r0, =gMultiuseSpriteTemplate
movs r1, 0x28
movs r2, 0x40
movs r3, 0x5

View File

@ -737,8 +737,8 @@ _080F8DD8:
bl LoadCompressedObjectPalette
adds r0, r6, 0
movs r1, 0x1
bl sub_806A068
ldr r0, =gUnknown_0202499C
bl SetMultiuseSpriteTemplateToPokemon
ldr r0, =gMultiuseSpriteTemplate
ldrh r1, [r4, 0x4]
strh r1, [r0, 0x2]
mov r1, r9

View File

@ -7174,8 +7174,8 @@ _0807ADE0:
bl GetMonSpritePalStruct
ldrh r0, [r0, 0x4]
adds r1, r4, 0
bl sub_806A068
ldr r0, =gUnknown_0202499C
bl SetMultiuseSpriteTemplateToPokemon
ldr r0, =gMultiuseSpriteTemplate
movs r1, 0x78
movs r2, 0x3C
movs r3, 0x6

View File

@ -235,7 +235,7 @@ gUnknown_082FF704:: @ 82FF704
.2byte 0x0003, 0x0000, 0xffff, 0x0000
.align 2
gUnknown_082FF70C:: @ 82FF70C
gPlayerMonSpriteAnimsTable:: @ 82FF70C
.4byte gUnknown_082FF6EC
.4byte gUnknown_082FF6F4
.4byte gUnknown_082FF6FC

View File

@ -438,7 +438,7 @@ extern u8 gPlayerPartyCount;
extern struct Pokemon gPlayerParty[PARTY_SIZE];
extern u8 gEnemyPartyCount;
extern struct Pokemon gEnemyParty[PARTY_SIZE];
extern struct SpriteTemplate gUnknown_0202499C;
extern struct SpriteTemplate gMultiuseSpriteTemplate;
extern struct PokemonStorage* gPokemonStoragePtr;
extern const struct BattleMove gBattleMoves[];
@ -505,9 +505,9 @@ u8 GetDefaultMoveTarget(u8 battlerId);
u8 GetMonGender(struct Pokemon *mon);
u8 GetBoxMonGender(struct BoxPokemon *boxMon);
u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality);
void sub_806A068(u16 species, u8 battlerPosition);
void sub_806A12C(u16 trainerSpriteId, u8 battlerPosition);
void sub_806A1C0(u16 arg0, u8 battlerPosition);
void SetMultiuseSpriteTemplateToPokemon(u16 species, u8 battlerPosition);
void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition);
void SetMultiuseSpriteTemplateToTrainerFront(u16 arg0, u8 battlerPosition);
// These are full type signatures for GetMonData() and GetBoxMonData(),
// but they are not used since some code erroneously omits the third arg.

View File

@ -34,7 +34,6 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern void sub_81851A8(u8 *);
extern u16 sub_8068B48(void);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
@ -191,7 +190,7 @@ static void LinkOpponentBufferRunCommand(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
LinkOpponentBufferExecCompleted();
@ -1135,9 +1134,9 @@ static void LinkOpponentHandleLoadMonSprite(void)
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(gActiveBattler, 2),
GetBattlerSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
@ -1168,10 +1167,10 @@ static void sub_8066494(u8 battlerId, bool8 dontClearSubstituteBit)
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(
&gUnknown_0202499C,
&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1302,8 +1301,8 @@ static void LinkOpponentHandleDrawTrainerPic(void)
}
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
xPos,
(8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
sub_80A82E4(gActiveBattler));
@ -1314,7 +1313,7 @@ static void LinkOpponentHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void LinkOpponentHandleTrainerSlide(void)
@ -1327,8 +1326,8 @@ static void LinkOpponentHandleTrainerSlide(void)
trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B);
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32;

View File

@ -34,7 +34,6 @@ extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern void sub_81851A8(u8 *);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
@ -189,7 +188,7 @@ static void LinkPartnerBufferRunCommand(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
LinkPartnerBufferExecCompleted();
@ -1024,9 +1023,9 @@ static void LinkPartnerHandleLoadMonSprite(void)
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(gActiveBattler, 2),
GetBattlerSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
@ -1054,10 +1053,10 @@ static void sub_814CC98(u8 battlerId, bool8 dontClearSubstituteBit)
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(
&gUnknown_0202499C,
&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1147,15 +1146,15 @@ static void LinkPartnerHandleDrawTrainerPic(void)
}
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void LinkPartnerHandleTrainerSlide(void)

View File

@ -38,7 +38,6 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern void sub_81A57E4(u8 battlerId, u16 stringId);
extern u8 GetFrontierBrainTrainerPicIndex(void);
extern u8 sub_81D5588(u16 trainerId);
@ -200,7 +199,7 @@ static void OpponentBufferRunCommand(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
OpponentBufferExecCompleted();
@ -1128,9 +1127,9 @@ static void OpponentHandleLoadMonSprite(void)
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(gActiveBattler, 2),
GetBattlerSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
@ -1163,9 +1162,9 @@ static void sub_80613DC(u8 battlerId, bool8 dontClearSubstituteBit)
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1294,8 +1293,8 @@ static void OpponentHandleDrawTrainerPic(void)
}
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
xPos,
(8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
sub_80A82E4(gActiveBattler));
@ -1306,7 +1305,7 @@ static void OpponentHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void OpponentHandleTrainerSlide(void)
@ -1366,8 +1365,8 @@ static void OpponentHandleTrainerSlide(void)
}
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32;

View File

@ -39,7 +39,7 @@ extern u16 gBattle_BG0_Y;
extern s32 gUnknown_0203CD70;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct SpriteTemplate gUnknown_0202499C;
extern struct SpriteTemplate gMultiuseSpriteTemplate;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
@ -47,7 +47,6 @@ extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_81B89AC(u8 arg0);
extern void sub_81AABB0(void);
extern void sub_806A068(u16, u8);
extern void sub_81A57E4(u8 battlerId, u16 stringId);
extern void sub_81851A8(u8 *);
@ -917,7 +916,7 @@ void sub_80587B0(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
PlayerBufferExecCompleted();
@ -2200,10 +2199,10 @@ static void sub_805B258(u8 battlerId, bool8 dontClearSubstituteBit)
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(
&gUnknown_0202499C,
&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -2282,7 +2281,7 @@ static void PlayerHandleDrawTrainerPic(void)
}
else
{
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender;
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_BRENDAN;
}
}
else
@ -2292,9 +2291,9 @@ static void PlayerHandleDrawTrainerPic(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
if ((GetBattlerPosition(gActiveBattler) & BIT_FLANK) != 0) // second mon
if ((GetBattlerPosition(gActiveBattler) & BIT_FLANK) != B_FLANK_LEFT) // Second mon, on the right.
xPos = 90;
else // first mon
else // First mon, on the left.
xPos = 32;
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER)
@ -2319,8 +2318,8 @@ static void PlayerHandleDrawTrainerPic(void)
{
trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender);
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A1C0(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -2330,12 +2329,12 @@ static void PlayerHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = 0;
gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1;
}
// use the back pic in any other scenario
// Use the back pic in any other scenario.
else
{
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -2343,7 +2342,7 @@ static void PlayerHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
}
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void PlayerHandleTrainerSlide(void)
@ -2364,17 +2363,17 @@ static void PlayerHandleTrainerSlide(void)
}
else
{
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender;
trainerPicId = gLinkPlayers[GetMultiplayerId()].gender + TRAINER_BACK_PIC_BRENDAN;
}
}
else
{
trainerPicId = gSaveBlock2Ptr->playerGender;
trainerPicId = gSaveBlock2Ptr->playerGender + TRAINER_BACK_PIC_BRENDAN;
}
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, 80, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, 30);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 80, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, 30);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -96;

View File

@ -35,7 +35,7 @@ extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_81358F4(void);
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern void SetMultiuseSpriteTemplateToPokemon(u16, u8);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
// this file's functions
@ -204,7 +204,7 @@ static void PlayerPartnerBufferRunCommand(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
PlayerPartnerBufferExecCompleted();
@ -1211,9 +1211,9 @@ static void PlayerPartnerHandleLoadMonSprite(void)
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(gActiveBattler, 2),
GetBattlerSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
@ -1241,10 +1241,10 @@ static void sub_81BD0E4(u8 battlerId, bool8 dontClearSubstituteBit)
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(
&gUnknown_0202499C,
&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1326,8 +1326,8 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
{
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -1337,8 +1337,8 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
else // otherwise use front sprite
{
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A1C0(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -1349,7 +1349,7 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1;
}
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void PlayerPartnerHandleTrainerSlide(void)

View File

@ -37,7 +37,6 @@ extern u8 gUnknown_0203C7B4;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern u16 sub_8068B48(void);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
@ -193,7 +192,7 @@ static void RecordedOpponentBufferRunCommand(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
RecordedOpponentBufferExecCompleted();
@ -1119,9 +1118,9 @@ static void RecordedOpponentHandleLoadMonSprite(void)
u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(gActiveBattler, 2),
GetBattlerSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
@ -1154,9 +1153,9 @@ static void sub_81885D8(u8 battlerId, bool8 dontClearSubstituteBit)
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlerPartyIndexes[battlerId]], battlerId);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1252,8 +1251,8 @@ static void RecordedOpponentHandleDrawTrainerPic(void)
}
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
xPos,
(8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
sub_80A82E4(gActiveBattler));
@ -1264,7 +1263,7 @@ static void RecordedOpponentHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void RecordedOpponentHandleTrainerSlide(void)

View File

@ -36,7 +36,6 @@ extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
// this file's functions
@ -190,7 +189,7 @@ static void RecordedPlayerBufferRunCommand(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
RecordedPlayerBufferExecCompleted();
@ -1107,9 +1106,9 @@ static void RecordedPlayerHandleLoadMonSprite(void)
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(gActiveBattler, 2),
GetBattlerSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
@ -1137,10 +1136,10 @@ static void sub_818BA6C(u8 battlerId, bool8 dontClearSubstituteBit)
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBattlerPosition(battlerId));
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(
&gUnknown_0202499C,
&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));
@ -1242,8 +1241,8 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
{
trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender);
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
sub_806A1C0(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -1256,8 +1255,8 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
else
{
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, sub_80A82E4(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@ -1265,7 +1264,7 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
}
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void RecordedPlayerHandleTrainerSlide(void)

View File

@ -239,7 +239,7 @@ static void HandleInputChooseAction(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
SafariBufferExecCompleted();
@ -358,9 +358,9 @@ static void SafariHandleReturnMonToBall(void)
static void SafariHandleDrawTrainerPic(void)
{
DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBattler);
sub_806A12C(gSaveBlock2Ptr->playerGender, GetBattlerPosition(gActiveBattler));
SetMultiuseSpriteTemplateToTrainerBack(gSaveBlock2Ptr->playerGender, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(
&gUnknown_0202499C,
&gMultiuseSpriteTemplate,
80,
(8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80,
30);
@ -368,7 +368,7 @@ static void SafariHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void SafariHandleTrainerSlide(void)

View File

@ -39,7 +39,6 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
// this file's functions
static void WallyHandleGetMonData(void);
@ -254,7 +253,7 @@ static void WallyHandleActions(void)
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
static void CompleteOnBattlerSpriteCallbackDummy(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
WallyBufferExecCompleted();
@ -1039,8 +1038,8 @@ static void WallyHandleReturnMonToBall(void)
static void WallyHandleDrawTrainerPic(void)
{
DecompressTrainerBackPic(TRAINER_BACK_PIC_WALLY, gActiveBattler);
sub_806A12C(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
80,
80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords),
30);
@ -1048,14 +1047,14 @@ static void WallyHandleDrawTrainerPic(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
}
static void WallyHandleTrainerSlide(void)
{
DecompressTrainerBackPic(TRAINER_BACK_PIC_WALLY, gActiveBattler);
sub_806A12C(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
80,
80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords),
30);
@ -1466,8 +1465,8 @@ static void sub_816AA80(u8 battlerId)
gBattlerPartyIndexes[battlerId] = gBattleBufferA[battlerId][1];
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
gUnknown_03005D7C[battlerId] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(&gUnknown_0202499C,
SetMultiuseSpriteTemplateToPokemon(species, GetBattlerPosition(battlerId));
gBattlerSpriteIds[battlerId] = CreateSprite(&gMultiuseSpriteTemplate,
GetBattlerSpriteCoord(battlerId, 2),
GetBattlerSpriteDefault_Y(battlerId),
sub_80A82E4(battlerId));

View File

@ -16,14 +16,15 @@ extern const struct CompressedSpriteSheet gTrainerBackPicTable[];
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const union AffineAnimCmd *const gUnknown_082FF618[];
extern const union AffineAnimCmd *const gUnknown_082FF694[];
extern const union AnimCmd *const gUnknown_082FF70C[];
extern const union AnimCmd *const gPlayerMonSpriteAnimsTable[];
extern const union AnimCmd *const *const gMonAnimationsSpriteAnimsPtrTable[NUM_SPECIES];
extern const union AnimCmd *const *const gUnknown_0830536C[];
extern const u8 gFacilityClassToPicIndex[];
// Static type declarations
struct BattleDomeCard {
struct BattleDomeCard
{
u8 *frames;
struct SpriteFrameImage *images;
u16 paletteTag;
@ -41,10 +42,12 @@ static EWRAM_DATA struct BattleDomeCard gUnknown_0203CD04[8] = {};
// .rodata
static const struct BattleDomeCard gUnknown_0860B058 = {};
static const struct OamData gUnknown_0860B064 = {
static const struct OamData gUnknown_0860B064 =
{
.size = 3
};
static const struct OamData gUnknown_0860B06C = {
static const struct OamData gUnknown_0860B06C =
{
.affineMode = 1, .size = 3
};
@ -158,7 +161,7 @@ static void uns_builder_assign_animtable1(bool8 isTrainer)
{
if (!isTrainer)
{
gUnknown_0203CCEC.anims = gUnknown_082FF70C;
gUnknown_0203CCEC.anims = gPlayerMonSpriteAnimsTable;
}
else
{

View File

@ -300,6 +300,7 @@ u8 gNumberOfMovesToChoose;
u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
// rom const data
static const s8 gUnknown_0831ACE0[] ={-32, -16, -16, -32, -32, 0, 0, 0};
// format: attacking type, defending type, damage multiplier
// the multiplier is a (decimal) fixed-point number:
@ -307,9 +308,6 @@ u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
// 10 is ×1.0 TYPE_MUL_NORMAL
// 05 is ×0.5 TYPE_MUL_NOT_EFFECTIVE
// 00 is ×0.0 TYPE_MUL_NO_EFFECT
static const s8 gUnknown_0831ACE0[] ={-32, -16, -16, -32, -32, 0, 0, 0};
const u8 gTypeEffectiveness[336] =
{
TYPE_NORMAL, TYPE_ROCK, TYPE_MUL_NOT_EFFECTIVE,
@ -2808,7 +2806,7 @@ void sub_8039BB4(struct Sprite *sprite)
static void oac_poke_ally_(struct Sprite *sprite)
{
if ((gIntroSlideFlags & 1) == 0)
if (!(gIntroSlideFlags & 1))
{
sprite->pos2.x -= 2;
if (sprite->pos2.x == 0)

View File

@ -57,12 +57,10 @@ extern const u8 gText_NickHatchPrompt[];
extern u8 sav1_map_get_name(void);
extern void TVShowConvertInternationalString(u8* str1, u8* str2, u8);
extern void sub_806A068(u16, u8);
extern void FadeScreen(u8, u8);
extern void overworld_free_bg_tilemaps(void);
extern void sub_80AF168(void);
extern void ScanlineEffect_Stop(void);
extern void CB2_ReturnToField(void);
extern void play_some_sound(void);
extern void DoNamingScreen(u8, const u8*, u16, u8, u32, MainCallback);
extern u16 sub_80D22D0(void);
@ -437,8 +435,8 @@ static u8 EggHatchCreateMonSprite(u8 a0, u8 switchID, u8 pokeID, u16* speciesLoc
}
break;
case 1:
sub_806A068(GetMonSpritePalStruct(mon)->tag, r5);
spriteID = CreateSprite(&gUnknown_0202499C, 120, 75, 6);
SetMultiuseSpriteTemplateToPokemon(GetMonSpritePalStruct(mon)->tag, r5);
spriteID = CreateSprite(&gMultiuseSpriteTemplate, 120, 75, 6);
gSprites[spriteID].invisible = 1;
gSprites[spriteID].callback = SpriteCallbackDummy;
break;

View File

@ -62,7 +62,6 @@ extern const u8 gText_CommunicationStandby5[];
extern void sub_80356D0(void);
extern void sub_807B154(void);
extern void sub_806A068(u16, u8);
extern void sub_807F19C(void);
extern void sub_807B140(void);
extern void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies);
@ -280,9 +279,9 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo,
pokePal = GetMonSpritePalStructFromOtIdPersonality(currSpecies, trainerId, personality);
LoadCompressedPalette(pokePal->data, 0x110, 0x20);
sub_806A068(currSpecies, 1);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->preEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
SetMultiuseSpriteTemplateToPokemon(currSpecies, 1);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->preEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 1;
@ -295,9 +294,9 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo,
pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, trainerId, personality);
LoadCompressedPalette(pokePal->data, 0x120, 0x20);
sub_806A068(speciesToEvolve, 3);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
SetMultiuseSpriteTemplateToPokemon(speciesToEvolve, 3);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 2;
gSprites[ID].invisible = 1;
@ -373,9 +372,9 @@ static void CB2_EvolutionSceneLoadGraphics(void)
LoadCompressedPalette(pokePal->data, 0x120, 0x20);
sub_806A068(postEvoSpecies, 3);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
SetMultiuseSpriteTemplateToPokemon(postEvoSpecies, 3);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 2;
@ -450,9 +449,9 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void)
{
u8 ID;
sub_806A068(postEvoSpecies, 1);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
SetMultiuseSpriteTemplateToPokemon(postEvoSpecies, 1);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 2;
@ -509,9 +508,9 @@ void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpri
pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, trainerId, personality);
LoadCompressedPalette(pokePal->data, 0x120, 0x20);
sub_806A068(speciesToEvolve, 1);
gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30);
SetMultiuseSpriteTemplateToPokemon(speciesToEvolve, 1);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gMultiuseSpriteTemplate, 120, 64, 30);
gSprites[ID].callback = SpriteCallbackDummy_2;
gSprites[ID].oam.paletteNum = 2;

View File

@ -58,7 +58,6 @@ extern const struct CompressedSpriteSheet gMonFrontPicTable[];
extern const u16 gUnknown_0860F074[];
extern bool8 sub_81221EC(void);
extern void sub_806A068(u16, u8);
extern void LoadSav2WindowGfx(u8, u16, u8);
// this file's functions
@ -661,7 +660,7 @@ static bool8 LoadMonAndSceneGfx(struct Pokemon *mon)
palette = GetMonSpritePalStructFromOtIdPersonality(species, trainerId, personality);
LoadCompressedObjectPalette(palette);
sub_806A068(palette->tag, 1);
SetMultiuseSpriteTemplateToPokemon(palette->tag, 1);
sPokeblockFeed->loadGfxState++;
break;
case 2:
@ -827,7 +826,7 @@ static void Task_PaletteFadeToReturn(u8 taskId)
static u8 CreateMonSprite(struct Pokemon* mon)
{
u16 species = GetMonData(mon, MON_DATA_SPECIES2);
u8 spriteId = CreateSprite(&gUnknown_0202499C, 48, 80, 2);
u8 spriteId = CreateSprite(&gMultiuseSpriteTemplate, 48, 80, 2);
sPokeblockFeed->species = species;
sPokeblockFeed->monSpriteId_ = spriteId;

View File

@ -63,7 +63,7 @@ extern const struct SpriteFrameImage gUnknown_082FF4F8[];
extern const struct SpriteFrameImage gUnknown_082FF518[];
extern const union AffineAnimCmd *const gUnknown_082FF618[];
extern const union AffineAnimCmd *const gUnknown_082FF694[];
extern const union AnimCmd *gUnknown_082FF70C[];
extern const union AnimCmd *gPlayerMonSpriteAnimsTable[];
extern const union AnimCmd *const *const gMonAnimationsSpriteAnimsPtrTable[];
extern const union AnimCmd *const *const gUnknown_08305D0C[];
extern const union AnimCmd *const *const gUnknown_0830536C[];
@ -105,7 +105,7 @@ EWRAM_DATA u8 gPlayerPartyCount = 0;
EWRAM_DATA u8 gEnemyPartyCount = 0;
EWRAM_DATA struct Pokemon gPlayerParty[PARTY_SIZE] = {0};
EWRAM_DATA struct Pokemon gEnemyParty[PARTY_SIZE] = {0};
EWRAM_DATA struct SpriteTemplate gUnknown_0202499C = {0};
EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0};
EWRAM_DATA struct Unknown_806F160_Struct *gUnknown_020249B4[2] = {NULL};
// const rom data
@ -2486,13 +2486,14 @@ static bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId)
{
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER))
return FALSE;
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
return FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
return FALSE;
if (FlagGet(badgeFlag))
else if (FlagGet(badgeFlag))
return TRUE;
return FALSE;
else
return FALSE;
}
u8 GetDefaultMoveTarget(u8 battlerId)
@ -2561,53 +2562,53 @@ u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality)
return MON_MALE;
}
void sub_806A068(u16 species, u8 battlerPosition)
void SetMultiuseSpriteTemplateToPokemon(u16 species, u8 battlerPosition)
{
if (gMonSpritesGfxPtr != NULL)
gUnknown_0202499C = gMonSpritesGfxPtr->templates[battlerPosition];
gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition];
else if (gUnknown_020249B4[0])
gUnknown_0202499C = gUnknown_020249B4[0]->templates[battlerPosition];
gMultiuseSpriteTemplate = gUnknown_020249B4[0]->templates[battlerPosition];
else if (gUnknown_020249B4[1])
gUnknown_0202499C = gUnknown_020249B4[1]->templates[battlerPosition];
gMultiuseSpriteTemplate = gUnknown_020249B4[1]->templates[battlerPosition];
else
gUnknown_0202499C = gUnknown_08329D98[battlerPosition];
gMultiuseSpriteTemplate = gUnknown_08329D98[battlerPosition];
gUnknown_0202499C.paletteTag = species;
if (battlerPosition == 0 || battlerPosition == 2)
gUnknown_0202499C.anims = gUnknown_082FF70C;
gMultiuseSpriteTemplate.paletteTag = species;
if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT)
gMultiuseSpriteTemplate.anims = gPlayerMonSpriteAnimsTable;
else if (species > 500)
gUnknown_0202499C.anims = gMonAnimationsSpriteAnimsPtrTable[species - 500];
gMultiuseSpriteTemplate.anims = gMonAnimationsSpriteAnimsPtrTable[species - 500];
else
gUnknown_0202499C.anims = gMonAnimationsSpriteAnimsPtrTable[species];
gMultiuseSpriteTemplate.anims = gMonAnimationsSpriteAnimsPtrTable[species];
}
void sub_806A12C(u16 trainerSpriteId, u8 battlerPosition)
void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition)
{
gUnknown_0202499C.paletteTag = trainerSpriteId;
gMultiuseSpriteTemplate.paletteTag = trainerSpriteId;
if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT)
{
gUnknown_0202499C = gUnknown_08329DF8[trainerSpriteId];
gUnknown_0202499C.anims = gUnknown_08305D0C[trainerSpriteId];
gMultiuseSpriteTemplate = gUnknown_08329DF8[trainerSpriteId];
gMultiuseSpriteTemplate.anims = gUnknown_08305D0C[trainerSpriteId];
}
else
{
if (gMonSpritesGfxPtr != NULL)
gUnknown_0202499C = gMonSpritesGfxPtr->templates[battlerPosition];
gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition];
else
gUnknown_0202499C = gUnknown_08329D98[battlerPosition];
gUnknown_0202499C.anims = gUnknown_0830536C[trainerSpriteId];
gMultiuseSpriteTemplate = gUnknown_08329D98[battlerPosition];
gMultiuseSpriteTemplate.anims = gUnknown_0830536C[trainerSpriteId];
}
}
void sub_806A1C0(u16 arg0, u8 battlerPosition)
void SetMultiuseSpriteTemplateToTrainerFront(u16 arg0, u8 battlerPosition)
{
if (gMonSpritesGfxPtr != NULL)
gUnknown_0202499C = gMonSpritesGfxPtr->templates[battlerPosition];
gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition];
else
gUnknown_0202499C = gUnknown_08329D98[battlerPosition];
gMultiuseSpriteTemplate = gUnknown_08329D98[battlerPosition];
gUnknown_0202499C.paletteTag = arg0;
gUnknown_0202499C.anims = gUnknown_0830536C[arg0];
gMultiuseSpriteTemplate.paletteTag = arg0;
gMultiuseSpriteTemplate.anims = gUnknown_0830536C[arg0];
}
static void EncryptBoxMon(struct BoxPokemon *boxMon)
@ -3136,7 +3137,8 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg)
{
const u8* data = dataArg;
const u8 *data = dataArg;
switch (field)
{
case MON_DATA_STATUS:
@ -3179,7 +3181,7 @@ void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg)
void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
{
const u8* data = dataArg;
const u8 *data = dataArg;
struct PokemonSubstruct0 *substruct0 = NULL;
struct PokemonSubstruct1 *substruct1 = NULL;
@ -4511,7 +4513,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
else
holdEffect = ItemId_GetHoldEffect(heldItem);
if (holdEffect == 38 && type != 3)
if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE && type != 3)
return 0;
switch (type)
@ -4849,16 +4851,17 @@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId)
{
if (InBattlePyramid())
return GetTrainerEncounterMusicIdInBattlePyramind(trainerOpponentId);
if (sub_81D5C18())
else if (sub_81D5C18())
return sub_81D63C8(trainerOpponentId);
return TRAINER_ENCOUNTER_MUSIC(trainerOpponentId);
else
return TRAINER_ENCOUNTER_MUSIC(trainerOpponentId);
}
u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex)
{
if (statIndex < 1 || statIndex > 5)
{
// should just be "return n", but it wouldn't match without this
// Should just be "return n", but it wouldn't match without this.
u16 retVal = n;
retVal++;
retVal--;
@ -5165,7 +5168,7 @@ void PartySpreadPokerus(struct Pokemon *party)
{
if (pokerus & 0xF)
{
// spread to adjacent party members
// Spread to adjacent party members.
if (i != 0 && !(GetMonData(&party[i - 1], MON_DATA_POKERUS, 0) & 0xF0))
SetMonData(&party[i - 1], MON_DATA_POKERUS, &curPokerus);
if (i != (PARTY_SIZE - 1) && !(GetMonData(&party[i + 1], MON_DATA_POKERUS, 0) & 0xF0))
@ -5365,11 +5368,11 @@ u16 GetBattleBGM(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE_GROUDON)
return MUS_BATTLE34;
if (gBattleTypeFlags & BATTLE_TYPE_REGI)
else if (gBattleTypeFlags & BATTLE_TYPE_REGI)
return MUS_BATTLE36;
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
return MUS_BATTLE20;
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
{
u8 trainerClass;
@ -5414,7 +5417,8 @@ u16 GetBattleBGM(void)
return MUS_BATTLE20;
}
}
return MUS_BATTLE27;
else
return MUS_BATTLE27;
}
void PlayBattleBGM(void)
@ -5948,7 +5952,7 @@ static void sub_806F1FC(struct Unknown_806F160_Struct* structPtr)
structPtr->frameImages[i * structPtr->field_0_0 + j].data = &structPtr->byteArrays[i][j * 0x800];
}
structPtr->templates[i].images = &structPtr->frameImages[i * structPtr->field_0_0];
structPtr->templates[i].anims = gUnknown_082FF70C;
structPtr->templates[i].anims = gPlayerMonSpriteAnimsTable;
structPtr->templates[i].paletteTag = i;
}
}

View File

@ -27,8 +27,7 @@ extern u16 gBattle_BG3_Y;
extern const union AnimCmd * const * const gMonAnimationsSpriteAnimsPtrTable[];
extern void sub_806A068(u16 species, u8 battlerPosition);
extern void sub_806A12C(u16 backPicId, u8 battlerPosition);
extern void SetMultiuseSpriteTemplateToTrainerBack(u16 backPicId, u8 battlerPosition);
// this file's functions
static void CB2_ReshowBattleScreenAfterMenu(void);
@ -235,8 +234,8 @@ static void CreateBattlerSprite(u8 battler)
if (GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0)
return;
sub_806A068(GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
gBattlerSpriteIds[battler] = CreateSprite(&gUnknown_0202499C, GetBattlerSpriteCoord(battler, 2), posY, sub_80A82E4(battler));
SetMultiuseSpriteTemplateToPokemon(GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, 2), posY, sub_80A82E4(battler));
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy;
gSprites[gBattlerSpriteIds[battler]].data[0] = battler;
@ -248,8 +247,8 @@ static void CreateBattlerSprite(u8 battler)
}
else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && battler == B_POSITION_PLAYER_LEFT)
{
sub_806A12C(gSaveBlock2Ptr->playerGender, GetBattlerPosition(B_POSITION_PLAYER_LEFT));
gBattlerSpriteIds[battler] = CreateSprite(&gUnknown_0202499C, 0x50,
SetMultiuseSpriteTemplateToTrainerBack(gSaveBlock2Ptr->playerGender, GetBattlerPosition(B_POSITION_PLAYER_LEFT));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 0x50,
(8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80,
sub_80A82E4(0));
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
@ -258,8 +257,8 @@ static void CreateBattlerSprite(u8 battler)
}
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && battler == B_POSITION_PLAYER_LEFT)
{
sub_806A12C(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(0));
gBattlerSpriteIds[battler] = CreateSprite(&gUnknown_0202499C, 0x50,
SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(0));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 0x50,
(8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords) * 4 + 80,
sub_80A82E4(0));
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
@ -271,8 +270,8 @@ static void CreateBattlerSprite(u8 battler)
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP) == 0)
return;
sub_806A068(GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
gBattlerSpriteIds[battler] = CreateSprite(&gUnknown_0202499C, GetBattlerSpriteCoord(battler, 2), posY, sub_80A82E4(battler));
SetMultiuseSpriteTemplateToPokemon(GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES), GetBattlerPosition(battler));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, GetBattlerSpriteCoord(battler, 2), posY, sub_80A82E4(battler));
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy;
gSprites[gBattlerSpriteIds[battler]].data[0] = battler;