Document party_menu second pass

This commit is contained in:
GriffinR 2019-10-25 21:55:01 -04:00
parent 6db014cc32
commit e01ec84837
21 changed files with 824 additions and 794 deletions

View File

@ -77,7 +77,7 @@ void sub_803B3AC(void); // unused
void sub_803B598(void); // unused void sub_803B598(void); // unused
void BattleTurnPassed(void); void BattleTurnPassed(void);
u8 IsRunningFromBattleImpossible(void); u8 IsRunningFromBattleImpossible(void);
void sub_803BDA0(u8 battlerId); void SwitchPartyOrder(u8 battlerId);
void SwapTurnOrder(u8 id1, u8 id2); void SwapTurnOrder(u8 id1, u8 id2);
u8 GetWhoStrikesFirst(u8 battlerId1, u8 battlerId2, bool8 ignoreChosenMoves); u8 GetWhoStrikesFirst(u8 battlerId1, u8 battlerId2, bool8 ignoreChosenMoves);
void RunBattleScriptCommands_PopCallbacksStack(void); void RunBattleScriptCommands_PopCallbacksStack(void);

View File

@ -4,7 +4,7 @@
void AllocateBattleResources(void); void AllocateBattleResources(void);
void FreeBattleResources(void); void FreeBattleResources(void);
void AdjustFriendshipOnBattleFaint(u8 battler); void AdjustFriendshipOnBattleFaint(u8 battler);
void sub_80571DC(u8 battler, u8 arg1); void SwitchPartyOrderInGameMulti(u8 battler, u8 arg1);
u32 sub_805725C(u8 battler); u32 sub_805725C(u8 battler);
#endif // GUARD_BATTLE_UTIL_H #endif // GUARD_BATTLE_UTIL_H

View File

@ -54,7 +54,7 @@
#define PARTY_MENU_TYPE_CONTEST 2 #define PARTY_MENU_TYPE_CONTEST 2
#define PARTY_MENU_TYPE_CHOOSE_MON 3 #define PARTY_MENU_TYPE_CHOOSE_MON 3
#define PARTY_MENU_TYPE_CHOOSE_HALF 4 // multi battles, eReader battles, and some battle facilities #define PARTY_MENU_TYPE_CHOOSE_HALF 4 // multi battles, eReader battles, and some battle facilities
#define PARTY_MENU_TYPE_IN_MULTI_BATTLE 5 // TODO: investigate #define PARTY_MENU_TYPE_MULTI_SHOWCASE 5
#define PARTY_MENU_TYPE_DAYCARE 6 #define PARTY_MENU_TYPE_DAYCARE 6
#define PARTY_MENU_TYPE_MOVE_RELEARNER 7 #define PARTY_MENU_TYPE_MOVE_RELEARNER 7
#define PARTY_MENU_TYPE_UNION_ROOM_REGISTER 8 // trading board #define PARTY_MENU_TYPE_UNION_ROOM_REGISTER 8 // trading board

View File

@ -86,7 +86,7 @@ void RemoveMapNamePopUpWindow(void);
u8 GetMapNamePopUpWindowId(void); u8 GetMapNamePopUpWindowId(void);
u8 AddMapNamePopUpWindow(void); u8 AddMapNamePopUpWindow(void);
void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 letterSpacing, u8 lineSpacing); void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 letterSpacing, u8 lineSpacing);
void sub_8199C30(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette); void SetBgTilemapPalette(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette);
void sub_8199D3C(void *ptr, int delta, int width, int height, bool32 is8BPP); void sub_8199D3C(void *ptr, int delta, int width, int height, bool32 is8BPP);
void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram); void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram);
void sub_8197AE8(bool8 copyToVram); void sub_8197AE8(bool8 copyToVram);

View File

@ -4,6 +4,8 @@
#include "main.h" #include "main.h"
#include "task.h" #include "task.h"
// seems like the last two fields may have been left as all-purpose vars
// and the second of the two just happens to only be used in one case
struct PartyMenu struct PartyMenu
{ {
MainCallback exitCallback; MainCallback exitCallback;
@ -15,13 +17,13 @@ struct PartyMenu
s8 slotId2; s8 slotId2;
u8 action; u8 action;
u16 bagItem; u16 bagItem;
s16 unkE; // used as both a moveId and a move slot/cursor position s16 data1; // used variously as a moveId, counter, moveSlotId, or cursorPos
s16 learnMoveState; s16 learnMoveState; // data2, used only as a learn move state
}; };
extern struct PartyMenu gPartyMenu; extern struct PartyMenu gPartyMenu;
extern bool8 gUnknown_0203CEE8; extern bool8 gPartyMenuUseExitCallback;
extern u8 gUnknown_0203CEE9; extern u8 gSelectedMonPartyId;
extern MainCallback gPostMenuFieldCallback; extern MainCallback gPostMenuFieldCallback;
extern u8 gSelectedOrderFromParty[4]; extern u8 gSelectedOrderFromParty[4];
extern u8 gBattlePartyCurrentOrder[3]; extern u8 gBattlePartyCurrentOrder[3];
@ -71,9 +73,9 @@ void OpenPartyMenuInBattle(u8 arg);
void ChooseMonForInBattleItem(void); void ChooseMonForInBattleItem(void);
void sub_81B8C68(void); void sub_81B8C68(void);
void sub_81B8D64(u8 battlerId, u8 multiplayerFlag); void sub_81B8D64(u8 battlerId, u8 multiplayerFlag);
void sub_81B8E80(u8 battlerId, u8 unk, u8 arrayIndex); void SwitchPartyOrderLinkMulti(u8 battlerId, u8 slot, u8 arrayIndex);
void SwitchPartyMonSlots(u8 slot, u8 slot2); void SwitchPartyMonSlots(u8 slot, u8 slot2);
u8 GetBattlerPartyId(u8 slot); u8 GetPartyIdFromBattlePartyId(u8 slot);
void ShowPartyMenuToShowcaseMultiBattleParty(void); void ShowPartyMenuToShowcaseMultiBattleParty(void);
void ChooseMonForDaycare(void); void ChooseMonForDaycare(void);
bool8 CB2_FadeFromPartyMenu(void); bool8 CB2_FadeFromPartyMenu(void);

View File

@ -21,7 +21,7 @@ u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u
u8 UpdateMonIconFrame(struct Sprite *sprite); u8 UpdateMonIconFrame(struct Sprite *sprite);
void LoadMonIconPalette(u16 species); void LoadMonIconPalette(u16 species);
void sub_80D328C(struct Sprite *sprite); void sub_80D328C(struct Sprite *sprite);
void UpdateTradeMonIconFrame(struct Sprite *sprite); void MonIconSpriteCallback(struct Sprite *sprite);
void SetPartyHPBarSprite(struct Sprite *sprite, u8 animNum); void SetPartyHPBarSprite(struct Sprite *sprite, u8 animNum);
u8 GetMonIconPaletteIndexFromSpecies(u16 species); u8 GetMonIconPaletteIndexFromSpecies(u16 species);

View File

@ -1342,8 +1342,8 @@ static void WaitForMonSelection(void)
{ {
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
{ {
if (gUnknown_0203CEE8 == TRUE) if (gPartyMenuUseExitCallback == TRUE)
BtlController_EmitChosenMonReturnValue(1, gUnknown_0203CEE9, gBattlePartyCurrentOrder); BtlController_EmitChosenMonReturnValue(1, gSelectedMonPartyId, gBattlePartyCurrentOrder);
else else
BtlController_EmitChosenMonReturnValue(1, PARTY_SIZE, NULL); BtlController_EmitChosenMonReturnValue(1, PARTY_SIZE, NULL);

View File

@ -1311,14 +1311,14 @@ void BtlController_EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
} }
void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 partyId, u8 *c) void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 partyId, u8 *battlePartyOrder)
{ {
s32 i; s32 i;
sBattleBuffersTransferData[0] = CONTROLLER_CHOSENMONRETURNVALUE; sBattleBuffersTransferData[0] = CONTROLLER_CHOSENMONRETURNVALUE;
sBattleBuffersTransferData[1] = partyId; sBattleBuffersTransferData[1] = partyId;
for (i = 0; i < 3; i++) for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
sBattleBuffersTransferData[2 + i] = c[i]; sBattleBuffersTransferData[2 + i] = battlePartyOrder[i];
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 5); PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 5);
} }

View File

@ -1061,8 +1061,8 @@ void HandleBattleLowHpMusicChange(void)
{ {
u8 playerBattler1 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); u8 playerBattler1 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
u8 playerBattler2 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); u8 playerBattler2 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
u8 battler1PartyId = GetBattlerPartyId(gBattlerPartyIndexes[playerBattler1]); u8 battler1PartyId = GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[playerBattler1]);
u8 battler2PartyId = GetBattlerPartyId(gBattlerPartyIndexes[playerBattler2]); u8 battler2PartyId = GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[playerBattler2]);
if (GetMonData(&gPlayerParty[battler1PartyId], MON_DATA_HP) != 0) if (GetMonData(&gPlayerParty[battler1PartyId], MON_DATA_HP) != 0)
HandleLowHpMusicChange(&gPlayerParty[battler1PartyId], playerBattler1); HandleLowHpMusicChange(&gPlayerParty[battler1PartyId], playerBattler1);

View File

@ -4122,20 +4122,20 @@ u8 IsRunningFromBattleImpossible(void)
return 0; return 0;
} }
void sub_803BDA0(u8 battler) void SwitchPartyOrder(u8 battler)
{ {
s32 i; s32 i;
u8 r4; u8 partyId1;
u8 r1; u8 partyId2;
// gBattleStruct->field_60[battler][i] // gBattleStruct->field_60[battler][i]
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++) for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
gBattlePartyCurrentOrder[i] = *(battler * 3 + i + (u8*)(gBattleStruct->field_60)); gBattlePartyCurrentOrder[i] = *(battler * 3 + i + (u8*)(gBattleStruct->field_60));
r4 = GetBattlerPartyId(gBattlerPartyIndexes[battler]); partyId1 = GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battler]);
r1 = GetBattlerPartyId(*(gBattleStruct->monToSwitchIntoId + battler)); partyId2 = GetPartyIdFromBattlePartyId(*(gBattleStruct->monToSwitchIntoId + battler));
SwitchPartyMonSlots(r4, r1); SwitchPartyMonSlots(partyId1, partyId2);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{ {
@ -4590,7 +4590,7 @@ static void HandleTurnActionSelectionState(void)
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
{ {
if (gChosenActionByBattler[i] == B_ACTION_SWITCH) if (gChosenActionByBattler[i] == B_ACTION_SWITCH)
sub_80571DC(i, *(gBattleStruct->monToSwitchIntoId + i)); SwitchPartyOrderInGameMulti(i, *(gBattleStruct->monToSwitchIntoId + i));
} }
} }
} }

View File

@ -5434,7 +5434,7 @@ static void atk51_switchhandleorder(void)
break; break;
case 1: case 1:
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
sub_803BDA0(gActiveBattler); SwitchPartyOrder(gActiveBattler);
break; break;
case 2: case 2:
if (!(gBattleStruct->field_93 & gBitTable[gActiveBattler])) if (!(gBattleStruct->field_93 & gBitTable[gActiveBattler]))
@ -5459,11 +5459,11 @@ static void atk51_switchhandleorder(void)
} }
else if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) else if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
{ {
sub_80571DC(gActiveBattler, *(gBattleStruct->monToSwitchIntoId + gActiveBattler)); SwitchPartyOrderInGameMulti(gActiveBattler, *(gBattleStruct->monToSwitchIntoId + gActiveBattler));
} }
else else
{ {
sub_803BDA0(gActiveBattler); SwitchPartyOrder(gActiveBattler);
} }
PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species) PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species)
@ -7567,19 +7567,19 @@ static void atk8F_forcerandomswitch(void)
*(gBattleStruct->monToSwitchIntoId + gBattlerTarget) = i; *(gBattleStruct->monToSwitchIntoId + gBattlerTarget) = i;
if (!IsMultiBattle()) if (!IsMultiBattle())
sub_803BDA0(gBattlerTarget); SwitchPartyOrder(gBattlerTarget);
if ((gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) if ((gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER)
|| (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI) || (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI)
|| (gBattleTypeFlags & BATTLE_TYPE_x2000000 && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER) || (gBattleTypeFlags & BATTLE_TYPE_x2000000 && gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER)
|| (gBattleTypeFlags & BATTLE_TYPE_x2000000 && gBattleTypeFlags & BATTLE_TYPE_MULTI)) || (gBattleTypeFlags & BATTLE_TYPE_x2000000 && gBattleTypeFlags & BATTLE_TYPE_MULTI))
{ {
sub_81B8E80(gBattlerTarget, i, 0); SwitchPartyOrderLinkMulti(gBattlerTarget, i, 0);
sub_81B8E80(gBattlerTarget ^ BIT_FLANK, i, 1); SwitchPartyOrderLinkMulti(gBattlerTarget ^ BIT_FLANK, i, 1);
} }
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
sub_80571DC(gBattlerTarget, i); SwitchPartyOrderInGameMulti(gBattlerTarget, i);
} }
} }
else else

View File

@ -102,7 +102,7 @@ void AdjustFriendshipOnBattleFaint(u8 battlerId)
} }
} }
void sub_80571DC(u8 battlerId, u8 arg1) void SwitchPartyOrderInGameMulti(u8 battlerId, u8 arg1)
{ {
if (GetBattlerSide(battlerId) != B_SIDE_OPPONENT) if (GetBattlerSide(battlerId) != B_SIDE_OPPONENT)
{ {
@ -113,7 +113,7 @@ void sub_80571DC(u8 battlerId, u8 arg1)
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++) for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
gBattlePartyCurrentOrder[i] = *(0 * 3 + i + (u8*)(gBattleStruct->field_60)); gBattlePartyCurrentOrder[i] = *(0 * 3 + i + (u8*)(gBattleStruct->field_60));
SwitchPartyMonSlots(GetBattlerPartyId(gBattlerPartyIndexes[battlerId]), GetBattlerPartyId(arg1)); SwitchPartyMonSlots(GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battlerId]), GetPartyIdFromBattlePartyId(arg1));
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++) for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
*(0 * 3 + i + (u8*)(gBattleStruct->field_60)) = gBattlePartyCurrentOrder[i]; *(0 * 3 + i + (u8*)(gBattleStruct->field_60)) = gBattlePartyCurrentOrder[i];

View File

@ -1124,7 +1124,7 @@ static void sub_80B0318(u8 taskId)
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(12, 7)); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(12, 7));
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ);
sub_8199C30(0, 0, 0, 0x1E, 0x14, 0xF); SetBgTilemapPalette(0, 0, 0, 0x1E, 0x14, 0xF);
schedule_bg_copy_tilemap_to_vram(0); schedule_bg_copy_tilemap_to_vram(0);
SetFlash2ScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], data[2], data[3], 1); SetFlash2ScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], data[2], data[3], 1);
CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480); CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480);

View File

@ -1868,7 +1868,7 @@ u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16
} }
} }
void sub_8199C30(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette) void SetBgTilemapPalette(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette)
{ {
u8 i; u8 i;
u8 j; u8 j;

File diff suppressed because it is too large Load Diff

View File

@ -4861,7 +4861,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if (battlerId != 4) if (battlerId != 4)
{ {
gAbsentBattlerFlags &= ~gBitTable[battlerId]; gAbsentBattlerFlags &= ~gBitTable[battlerId];
CopyPlayerPartyMonToBattleData(battlerId, GetBattlerPartyId(gBattlerPartyIndexes[battlerId])); CopyPlayerPartyMonToBattleData(battlerId, GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battlerId]));
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER && gBattleResults.numRevivesUsed < 255) if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER && gBattleResults.numRevivesUsed < 255)
gBattleResults.numRevivesUsed++; gBattleResults.numRevivesUsed++;
} }
@ -6440,11 +6440,11 @@ void SetMonPreventsSwitchingString(void)
gBattleTextBuff1[4] = B_BUFF_EOS; gBattleTextBuff1[4] = B_BUFF_EOS;
if (GetBattlerSide(gBattleStruct->battlerPreventingSwitchout) == B_SIDE_PLAYER) if (GetBattlerSide(gBattleStruct->battlerPreventingSwitchout) == B_SIDE_PLAYER)
gBattleTextBuff1[3] = GetBattlerPartyId(gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout]); gBattleTextBuff1[3] = GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout]);
else else
gBattleTextBuff1[3] = gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout]; gBattleTextBuff1[3] = gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout];
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBattlerInMenuId, GetBattlerPartyId(gBattlerPartyIndexes[gBattlerInMenuId])) PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBattlerInMenuId, GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[gBattlerInMenuId]))
BattleStringExpandPlaceholders(gText_PkmnsXPreventsSwitching, gStringVar4); BattleStringExpandPlaceholders(gText_PkmnsXPreventsSwitching, gStringVar4);
} }

View File

@ -1029,13 +1029,13 @@ const u16 sSpriteImageSizes[3][4] =
}, },
}; };
u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality, bool32 extra) u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality, bool32 handleDeoxys)
{ {
u8 spriteId; u8 spriteId;
struct MonIconSpriteTemplate iconTemplate = struct MonIconSpriteTemplate iconTemplate =
{ {
.oam = &sMonIconOamData, .oam = &sMonIconOamData,
.image = GetMonIconPtr(species, personality, extra), .image = GetMonIconPtr(species, personality, handleDeoxys),
.anims = sMonIconAnims, .anims = sMonIconAnims,
.affineAnims = sMonIconAffineAnims, .affineAnims = sMonIconAffineAnims,
.callback = callback, .callback = callback,
@ -1125,9 +1125,9 @@ u16 sub_80D2E84(u16 species)
} }
} }
const u8 *GetMonIconPtr(u16 species, u32 personality, bool32 extra) const u8 *GetMonIconPtr(u16 species, u32 personality, bool32 handleDeoxys)
{ {
return GetMonIconTiles(GetIconSpecies(species, personality), extra); return GetMonIconTiles(GetIconSpecies(species, personality), handleDeoxys);
} }
void sub_80D2EF8(struct Sprite *sprite) void sub_80D2EF8(struct Sprite *sprite)
@ -1184,17 +1184,17 @@ void FreeMonIconPalette(u16 species)
FreeSpritePaletteByTag(gMonIconPaletteTable[palIndex].tag); FreeSpritePaletteByTag(gMonIconPaletteTable[palIndex].tag);
} }
void UpdateTradeMonIconFrame(struct Sprite *sprite) void MonIconSpriteCallback(struct Sprite *sprite)
{ {
UpdateMonIconFrame(sprite); UpdateMonIconFrame(sprite);
} }
const u8* GetMonIconTiles(u16 species, bool32 extra) const u8* GetMonIconTiles(u16 species, bool32 handleDeoxys)
{ {
const u8* iconSprite = gMonIconTable[species]; const u8* iconSprite = gMonIconTable[species];
if (species == SPECIES_DEOXYS && extra == TRUE) if (species == SPECIES_DEOXYS && handleDeoxys == TRUE)
{ {
iconSprite = (const u8*)(0x400 + (u32)iconSprite); //WTF? iconSprite = (const u8*)(0x400 + (u32)iconSprite); // use the specific Deoxys form icon (Speed in this case)
} }
return iconSprite; return iconSprite;
} }

View File

@ -2575,9 +2575,9 @@ static void DrawPokerusCuredSymbol(struct Pokemon *mon) // This checks if the mo
static void SetDexNumberColor(bool8 isMonShiny) static void SetDexNumberColor(bool8 isMonShiny)
{ {
if (!isMonShiny) if (!isMonShiny)
sub_8199C30(3, 1, 4, 8, 8, 0); SetBgTilemapPalette(3, 1, 4, 8, 8, 0);
else else
sub_8199C30(3, 1, 4, 8, 8, 5); SetBgTilemapPalette(3, 1, 4, 8, 8, 5);
schedule_bg_copy_tilemap_to_vram(3); schedule_bg_copy_tilemap_to_vram(3);
} }

View File

@ -481,7 +481,7 @@ static void CB2_CreateTradeMenu(void)
{ {
struct Pokemon *mon = &gPlayerParty[i]; struct Pokemon *mon = &gPlayerParty[i];
sTradeMenuData->partySpriteIds[TRADE_PLAYER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2), sTradeMenuData->partySpriteIds[TRADE_PLAYER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2),
UpdateTradeMonIconFrame, MonIconSpriteCallback,
(sTradeMonSpriteCoords[i][0] * 8) + 14, (sTradeMonSpriteCoords[i][0] * 8) + 14,
(sTradeMonSpriteCoords[i][1] * 8) - 12, (sTradeMonSpriteCoords[i][1] * 8) - 12,
1, 1,
@ -493,7 +493,7 @@ static void CB2_CreateTradeMenu(void)
{ {
struct Pokemon *mon = &gEnemyParty[i]; struct Pokemon *mon = &gEnemyParty[i];
sTradeMenuData->partySpriteIds[TRADE_PARTNER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL), sTradeMenuData->partySpriteIds[TRADE_PARTNER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL),
UpdateTradeMonIconFrame, MonIconSpriteCallback,
(sTradeMonSpriteCoords[i + PARTY_SIZE][0] * 8) + 14, (sTradeMonSpriteCoords[i + PARTY_SIZE][0] * 8) + 14,
(sTradeMonSpriteCoords[i + PARTY_SIZE][1] * 8) - 12, (sTradeMonSpriteCoords[i + PARTY_SIZE][1] * 8) - 12,
1, 1,
@ -668,7 +668,7 @@ static void CB2_ReturnToTradeMenu(void)
{ {
struct Pokemon *mon = &gPlayerParty[i]; struct Pokemon *mon = &gPlayerParty[i];
sTradeMenuData->partySpriteIds[TRADE_PLAYER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL), sTradeMenuData->partySpriteIds[TRADE_PLAYER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL),
UpdateTradeMonIconFrame, MonIconSpriteCallback,
(sTradeMonSpriteCoords[i][0] * 8) + 14, (sTradeMonSpriteCoords[i][0] * 8) + 14,
(sTradeMonSpriteCoords[i][1] * 8) - 12, (sTradeMonSpriteCoords[i][1] * 8) - 12,
1, 1,
@ -680,7 +680,7 @@ static void CB2_ReturnToTradeMenu(void)
{ {
struct Pokemon *mon = &gEnemyParty[i]; struct Pokemon *mon = &gEnemyParty[i];
sTradeMenuData->partySpriteIds[TRADE_PARTNER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL), sTradeMenuData->partySpriteIds[TRADE_PARTNER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL),
UpdateTradeMonIconFrame, MonIconSpriteCallback,
(sTradeMonSpriteCoords[i + PARTY_SIZE][0] * 8) + 14, (sTradeMonSpriteCoords[i + PARTY_SIZE][0] * 8) + 14,
(sTradeMonSpriteCoords[i + PARTY_SIZE][1] * 8) - 12, (sTradeMonSpriteCoords[i + PARTY_SIZE][1] * 8) - 12,
1, 1,
@ -1809,7 +1809,7 @@ static void DrawTradeMenuParty(u8 whichParty)
gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]].data[0] = 20; gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]].data[0] = 20;
gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]].data[2] = (sTradeMonSpriteCoords[selectedMonParty * PARTY_SIZE][0] + sTradeMonSpriteCoords[selectedMonParty * PARTY_SIZE + 1][0]) / 2 * 8 + 14; gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]].data[2] = (sTradeMonSpriteCoords[selectedMonParty * PARTY_SIZE][0] + sTradeMonSpriteCoords[selectedMonParty * PARTY_SIZE + 1][0]) / 2 * 8 + 14;
gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]].data[4] = (sTradeMonSpriteCoords[selectedMonParty * PARTY_SIZE][1] * 8) - 12; gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]].data[4] = (sTradeMonSpriteCoords[selectedMonParty * PARTY_SIZE][1] * 8) - 12;
StoreSpriteCallbackInData6(&gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]], UpdateTradeMonIconFrame); StoreSpriteCallbackInData6(&gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]], MonIconSpriteCallback);
sTradeMenuData->drawPartyState[whichParty]++; sTradeMenuData->drawPartyState[whichParty]++;
TradeMenuBouncePartySprites(&gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]]); TradeMenuBouncePartySprites(&gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]]);
CopyToBgTilemapBufferRect_ChangePalette(1, sTradePartyBoxTilemap, whichParty * 15, 0, 15, 17, 0); CopyToBgTilemapBufferRect_ChangePalette(1, sTradePartyBoxTilemap, whichParty * 15, 0, 15, 17, 0);
@ -1820,7 +1820,7 @@ static void DrawTradeMenuParty(u8 whichParty)
PrintNicknamesForTradeMenu(); PrintNicknamesForTradeMenu();
break; break;
case 2: case 2:
if (gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]].callback == UpdateTradeMonIconFrame) if (gSprites[sTradeMenuData->partySpriteIds[0][partyIdx + (selectedMonParty * PARTY_SIZE)]].callback == MonIconSpriteCallback)
sTradeMenuData->drawPartyState[whichParty] = 3; sTradeMenuData->drawPartyState[whichParty] = 3;
break; break;
case 3: case 3: