Document PSS functions

This commit is contained in:
DizzyEggg 2018-12-10 21:36:52 +01:00
parent 431e7e7e5c
commit c2d8876174
8 changed files with 369 additions and 609 deletions

View File

@ -7,481 +7,6 @@
thumb_func_start sub_80C9B28
sub_80C9B28: @ 80C9B28
push {r4,r5,lr}
sub sp, 0x4
ldr r5, =gUnknown_02039D08
ldr r0, [r5]
ldrb r4, [r0]
cmp r4, 0
beq _080C9B40
cmp r4, 0x1
beq _080C9B5E
b _080C9B78
.pool
_080C9B40:
bl sub_80CE7E8
movs r0, 0x1
negs r0, r0
str r4, [sp]
movs r1, 0
movs r2, 0
movs r3, 0x10
bl BeginNormalPaletteFade
ldr r1, [r5]
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _080C9B78
_080C9B5E:
bl UpdatePaletteFade
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0
bne _080C9B78
ldr r0, =gUnknown_02039D0F
strb r1, [r0]
ldr r0, [r5]
strb r4, [r0, 0x2]
ldr r0, =sub_80C9E50
bl SetPSSCallback
_080C9B78:
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80C9B28
thumb_func_start sub_80C9B88
sub_80C9B88: @ 80C9B88
push {r4,lr}
sub sp, 0x4
ldr r4, =gUnknown_02039D08
ldr r0, [r4]
ldrb r1, [r0]
cmp r1, 0
beq _080C9BA0
cmp r1, 0x1
beq _080C9BBA
b _080C9BD6
.pool
_080C9BA0:
movs r0, 0x1
negs r0, r0
str r1, [sp]
movs r1, 0
movs r2, 0
movs r3, 0x10
bl BeginNormalPaletteFade
ldr r1, [r4]
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _080C9BD6
_080C9BBA:
bl UpdatePaletteFade
lsls r0, 24
cmp r0, 0
bne _080C9BD6
ldr r1, =gUnknown_02039D0F
movs r0, 0x2
strb r0, [r1]
ldr r1, [r4]
movs r0, 0x3
strb r0, [r1, 0x2]
ldr r0, =sub_80C9E50
bl SetPSSCallback
_080C9BD6:
add sp, 0x4
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80C9B88
thumb_func_start sub_80C9BE8
sub_80C9BE8: @ 80C9BE8
push {r4,lr}
ldr r0, =gUnknown_02039D08
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, 0x4
bls _080C9BF6
b _080C9D08
_080C9BF6:
lsls r0, 2
ldr r1, =_080C9C08
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_080C9C08:
.4byte _080C9C1C
.4byte _080C9C78
.4byte _080C9C8C
.4byte _080C9CC8
.4byte _080C9CE4
_080C9C1C:
bl IsMonBeingMoved
lsls r0, 24
cmp r0, 0
beq _080C9C40
movs r0, 0x20
bl PlaySE
movs r0, 0xF
bl PrintStorageActionText
ldr r0, =gUnknown_02039D08
ldr r1, [r0]
movs r0, 0x1
strb r0, [r1]
b _080C9D08
.pool
_080C9C40:
bl sub_80D127C
lsls r0, 24
cmp r0, 0
beq _080C9C58
ldr r0, =sub_80C954C
bl SetPSSCallback
b _080C9D08
.pool
_080C9C58:
movs r0, 0x5
bl PlaySE
movs r0, 0
bl PrintStorageActionText
movs r0, 0
bl sub_80CAD9C
ldr r0, =gUnknown_02039D08
ldr r1, [r0]
movs r0, 0x2
strb r0, [r1]
b _080C9D08
.pool
_080C9C78:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0xF3
ands r0, r1
cmp r0, 0
beq _080C9D08
b _080C9CAA
.pool
_080C9C8C:
bl Menu_ProcessInputNoWrapClearOnChoose
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
beq _080C9CBC
cmp r1, 0
bgt _080C9CA6
movs r0, 0x1
negs r0, r0
cmp r1, r0
beq _080C9CAA
b _080C9D08
_080C9CA6:
cmp r1, 0x1
bne _080C9D08
_080C9CAA:
bl ClearBottomWindow
ldr r0, =sub_80C82AC
bl SetPSSCallback
b _080C9D08
.pool
_080C9CBC:
movs r0, 0x3
bl PlaySE
bl ClearBottomWindow
b _080C9CD2
_080C9CC8:
movs r0, 0x14
movs r1, 0
movs r2, 0x1
bl sub_80F9BF4
_080C9CD2:
ldr r0, =gUnknown_02039D08
ldr r1, [r0]
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _080C9D08
.pool
_080C9CE4:
bl sub_80F9C30
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0
bne _080C9D08
bl sub_80CABE0
bl CalculatePlayerPartyCount
ldr r1, =gPlayerPartyCount
strb r0, [r1]
ldr r0, =gUnknown_02039D08
ldr r0, [r0]
strb r4, [r0, 0x2]
ldr r0, =sub_80C9E50
bl SetPSSCallback
_080C9D08:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80C9BE8
thumb_func_start sub_80C9D1C
sub_80C9D1C: @ 80C9D1C
push {r4,lr}
ldr r0, =gUnknown_02039D08
ldr r0, [r0]
ldrb r0, [r0]
cmp r0, 0x4
bls _080C9D2A
b _080C9E3C
_080C9D2A:
lsls r0, 2
ldr r1, =_080C9D3C
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_080C9D3C:
.4byte _080C9D50
.4byte _080C9DAC
.4byte _080C9DC0
.4byte _080C9DFC
.4byte _080C9E18
_080C9D50:
bl IsMonBeingMoved
lsls r0, 24
cmp r0, 0
beq _080C9D74
movs r0, 0x20
bl PlaySE
movs r0, 0xF
bl PrintStorageActionText
ldr r0, =gUnknown_02039D08
ldr r1, [r0]
movs r0, 0x1
strb r0, [r1]
b _080C9E3C
.pool
_080C9D74:
bl sub_80D127C
lsls r0, 24
cmp r0, 0
beq _080C9D8C
ldr r0, =sub_80C954C
bl SetPSSCallback
b _080C9E3C
.pool
_080C9D8C:
movs r0, 0x5
bl PlaySE
movs r0, 0x12
bl PrintStorageActionText
movs r0, 0
bl sub_80CAD9C
ldr r0, =gUnknown_02039D08
ldr r1, [r0]
movs r0, 0x2
strb r0, [r1]
b _080C9E3C
.pool
_080C9DAC:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0xF3
ands r0, r1
cmp r0, 0
beq _080C9E3C
b _080C9DE0
.pool
_080C9DC0:
bl Menu_ProcessInputNoWrapClearOnChoose
lsls r0, 24
asrs r1, r0, 24
cmp r1, 0
beq _080C9DE0
cmp r1, 0
bgt _080C9DDA
movs r0, 0x1
negs r0, r0
cmp r1, r0
beq _080C9DF0
b _080C9E3C
_080C9DDA:
cmp r1, 0x1
beq _080C9DF0
b _080C9E3C
_080C9DE0:
bl ClearBottomWindow
ldr r0, =sub_80C82AC
bl SetPSSCallback
b _080C9E3C
.pool
_080C9DF0:
movs r0, 0x3
bl PlaySE
bl ClearBottomWindow
b _080C9E06
_080C9DFC:
movs r0, 0x14
movs r1, 0
movs r2, 0
bl sub_80F9BF4
_080C9E06:
ldr r0, =gUnknown_02039D08
ldr r1, [r0]
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _080C9E3C
.pool
_080C9E18:
bl sub_80F9C30
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0
bne _080C9E3C
bl sub_80CABE0
bl CalculatePlayerPartyCount
ldr r1, =gPlayerPartyCount
strb r0, [r1]
ldr r0, =gUnknown_02039D08
ldr r0, [r0]
strb r4, [r0, 0x2]
ldr r0, =sub_80C9E50
bl SetPSSCallback
_080C9E3C:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80C9D1C
thumb_func_start sub_80C9E50
sub_80C9E50: @ 80C9E50
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x8
lsls r0, 24
lsrs r0, 24
mov r8, r0
ldr r0, =gUnknown_02039D08
ldr r0, [r0]
ldrb r4, [r0, 0x2]
ldrb r0, [r0, 0x1]
cmp r0, 0x3
bne _080C9E88
bl sub_80D127C
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _080C9E88
bl sub_80D12D4
ldr r1, =gUnknown_02039D12
b _080C9E8C
.pool
_080C9E88:
ldr r1, =gUnknown_02039D12
movs r0, 0
_080C9E8C:
strh r0, [r1]
cmp r4, 0x1
beq _080C9EB4
cmp r4, 0x1
ble _080C9E9E
cmp r4, 0x2
beq _080C9F1C
cmp r4, 0x3
beq _080C9F48
_080C9E9E:
bl sub_80C9FC8
ldr r0, =sub_80C7678
bl SetMainCallback2
b _080C9F56
.pool
_080C9EB4:
ldr r0, =gUnknown_02039D08
ldr r1, [r0]
ldr r2, =0x0000218c
adds r0, r1, r2
ldr r4, [r0]
subs r2, 0x5
adds r0, r1, r2
ldrb r7, [r0]
subs r2, 0x1
adds r0, r1, r2
ldrb r6, [r0]
ldr r0, =0x00002188
adds r1, r0
ldrb r5, [r1]
bl sub_80C9FC8
cmp r5, 0
bne _080C9F04
ldr r0, =gUnknown_02039D14
cmp r4, r0
bne _080C9F04
ldr r0, =c2_808CE60
str r0, [sp]
movs r0, 0
adds r1, r4, 0
adds r2, r7, 0
adds r3, r6, 0
bl ShowPokemonSummaryScreenSet40EF
b _080C9F56
.pool
_080C9F04:
ldr r0, =c2_808CE60
str r0, [sp]
adds r0, r5, 0
adds r1, r4, 0
adds r2, r7, 0
adds r3, r6, 0
bl ShowPokemonSummaryScreen
b _080C9F56
.pool
_080C9F1C:
bl sub_80C9FC8
bl StorageGetCurrentBox
lsls r0, 24
lsrs r0, 24
bl GetBoxNamePtr
adds r1, r0, 0
movs r0, 0
str r0, [sp]
ldr r0, =c2_808CE60
str r0, [sp, 0x4]
movs r0, 0x1
movs r2, 0
movs r3, 0
bl DoNamingScreen
b _080C9F56
.pool
_080C9F48:
bl sub_80C9FC8
ldr r2, =c2_808CE60
movs r0, 0xB
movs r1, 0
bl GoToBagMenu
_080C9F56:
mov r0, r8
bl DestroyTask
add sp, 0x8
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80C9E50
thumb_func_start sub_80C9F6C
sub_80C9F6C: @ 80C9F6C
push {lr}
@ -524,8 +49,8 @@ _080C9FC0:
bx r0
thumb_func_end sub_80C9F6C
thumb_func_start sub_80C9FC8
sub_80C9FC8: @ 80C9FC8
thumb_func_start FreePSSData
FreePSSData: @ 80C9FC8
push {r4,lr}
bl sub_80D25F0
bl sub_80D01B8
@ -539,7 +64,7 @@ sub_80C9FC8: @ 80C9FC8
pop {r0}
bx r0
.pool
thumb_func_end sub_80C9FC8
thumb_func_end FreePSSData
thumb_func_start sub_80C9FEC
sub_80C9FEC: @ 80C9FEC
@ -14307,8 +13832,8 @@ sub_80D12B8: @ 80D12B8
.pool
thumb_func_end sub_80D12B8
thumb_func_start sub_80D12D4
sub_80D12D4: @ 80D12D4
thumb_func_start GetMovingItem
GetMovingItem: @ 80D12D4
ldr r0, =gUnknown_02039D08
ldr r0, [r0]
ldr r1, =0x00002234
@ -14316,7 +13841,7 @@ sub_80D12D4: @ 80D12D4
ldrh r0, [r0]
bx lr
.pool
thumb_func_end sub_80D12D4
thumb_func_end GetMovingItem
thumb_func_start sub_80D12E8
sub_80D12E8: @ 80D12E8

View File

@ -1673,7 +1673,7 @@ EventScript_271E0E:: @ 8271E0E
checkflag FLAG_SYS_PC_LANETTE
call_if 1, EventScript_271E3E
msgbox gUnknown_082726A3, MSGBOX_DEFAULT
special ShowPokemonStorageSystem
special ShowPokemonStorageSystemPC
waitstate
goto EventScript_271DAC
end

View File

@ -71,7 +71,7 @@ gSpecials:: @ 81DBA64
def_special ShouldTryRematchBattle
def_special IsTrainerReadyForRematch
def_special BattleSetup_StartRematchBattle
def_special ShowPokemonStorageSystem
def_special ShowPokemonStorageSystemPC
def_special HasEnoughMonsForDoubleBattle
def_special TurnOffTVScreen
def_special DoTVShow

View File

@ -60,5 +60,6 @@ void CB2_BagMenuFromStartMenu(void);
u8 sub_81ABB2C(u8 pocketId);
bool8 UseRegisteredKeyItemOnField(void);
void CB2_GoToSellMenu(void);
void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)());
#endif //GUARD_item_menu_H

View File

@ -66,7 +66,7 @@ struct PokemonStorageSystemData
{
u8 state;
u8 boxOption;
u8 unk_0002;
u8 screenChangeType;
u8 unk_0003;
u8 taskId;
u8 unk_0005;
@ -102,8 +102,19 @@ struct PokemonStorageSystemData
u8 field_CEF[181];
struct PokemonMarkMenu field_DA4;
struct UnkPSSStruct_2002370 field_1E5C;
u8 field_20A4[400];
u16 field_2234;
u8 field_20A4[220];
u8 field_2180;
u8 field_2181;
u8 field_2182;
u8 field_2183;
u8 field_2184;
u8 field_2185;
u8 field_2186;
u8 field_2187;
u8 field_2188;
struct BoxPokemon *field_218C;
u8 field_2190[164];
u16 movingItem;
};
extern struct UnkPSSStruct_2002370 *gUnknown_02039D04;

View File

@ -4,6 +4,7 @@
void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void));
void sub_81C4F98(u8, void(*)(void));
void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16);
void ShowPokemonSummaryScreenSet40EF(u8 mode, struct BoxPokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void));
// The Pokemon Summary Screen can operate in different modes. Certain features,
// such as move re-ordering, are available in the different modes.
@ -11,7 +12,7 @@ enum PokemonSummaryScreenMode
{
PSS_MODE_NORMAL,
PSS_MODE_UNK1,
PSS_MODE_UNK2,
PSS_MODE_BOX,
PSS_MODE_SELECT_MOVE,
};

File diff suppressed because it is too large Load Diff

View File

@ -1005,7 +1005,7 @@ void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex,
pssData->maxMonIndex = maxMonIndex;
pssData->callback = callback;
if (mode == PSS_MODE_UNK2)
if (mode == PSS_MODE_BOX)
pssData->isBoxMon = TRUE;
else
pssData->isBoxMon = FALSE;
@ -1013,7 +1013,7 @@ void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex,
switch (mode)
{
case PSS_MODE_NORMAL:
case PSS_MODE_UNK2:
case PSS_MODE_BOX:
pssData->minPageIndex = 0;
pssData->maxPageIndex = 3;
break;
@ -1327,7 +1327,7 @@ static bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a)
sum->ppBonuses = GetMonData(a, MON_DATA_PP_BONUSES);
break;
case 2:
if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_UNK2 || pssData->unk40EF == TRUE)
if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_BOX || pssData->unk40EF == TRUE)
{
sum->nature = GetNature(a);
sum->currentHP = GetMonData(a, MON_DATA_HP);
@ -3829,7 +3829,7 @@ static u8 sub_81C45F4(struct Pokemon *mon, s16 *a1)
{
if (gMonSpritesGfxPtr != NULL)
{
if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_UNK2 || pssData->unk40EF == TRUE)
if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_BOX || pssData->unk40EF == TRUE)
{
HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites[1], summary->species2, summary->pid);
}
@ -3840,7 +3840,7 @@ static u8 sub_81C45F4(struct Pokemon *mon, s16 *a1)
}
else
{
if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_UNK2 || pssData->unk40EF == TRUE)
if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_BOX || pssData->unk40EF == TRUE)
{
HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], sub_806F4F8(0, 1), summary->species2, summary->pid);
}