through sub_808CF10

This commit is contained in:
PikalaxALT
2020-03-11 17:03:57 -04:00
parent 6b4b6a54af
commit 5422315db5
15 changed files with 406 additions and 331 deletions
+13 -235
View File
@@ -5,228 +5,6 @@
.text
thumb_func_start sub_808CD98
sub_808CD98: @ 808CD98
push {lr}
bl LoadOam
bl ProcessSpriteCopyRequests
bl sub_8096BF8
bl TransferPlttBuffer
ldr r0, _0808CDC0 @ =sPSSData
ldr r0, [r0]
movs r1, 0xB3
lsls r1, 2
adds r0, r1
ldrh r1, [r0]
movs r0, 0x18
bl SetGpuReg
pop {r0}
bx r0
.align 2, 0
_0808CDC0: .4byte sPSSData
thumb_func_end sub_808CD98
thumb_func_start c2_Box
c2_Box: @ 808CDC4
push {lr}
bl RunTasks
bl DoScheduledBgTilemapCopiesToVram
bl sub_808EFC8
bl sub_808F99C
bl AnimateSprites
bl BuildOamBuffer
pop {r0}
bx r0
thumb_func_end c2_Box
thumb_func_start Cb2_EnterPSS
Cb2_EnterPSS: @ 808CDE4
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
bl ResetTasks
ldr r0, _0808CE08 @ =sCurrentBoxOption
strb r5, [r0]
ldr r4, _0808CE0C @ =sPSSData
ldr r0, _0808CE10 @ =0x000062bc
bl Alloc
str r0, [r4]
cmp r0, 0
bne _0808CE18
ldr r0, _0808CE14 @ =Cb2_ExitPSS
bl SetMainCallback2
b _0808CE4A
.align 2, 0
_0808CE08: .4byte sCurrentBoxOption
_0808CE0C: .4byte sPSSData
_0808CE10: .4byte 0x000062bc
_0808CE14: .4byte Cb2_ExitPSS
_0808CE18:
movs r2, 0
strb r5, [r0, 0x1]
ldr r0, [r4]
strb r2, [r0, 0x3]
ldr r0, _0808CE50 @ =gUnknown_20397BA
movs r1, 0
strh r2, [r0]
ldr r0, [r4]
strb r1, [r0]
ldr r0, _0808CE54 @ =task_box_related_3
movs r1, 0x3
bl CreateTask
ldr r1, [r4]
strb r0, [r1, 0x4]
movs r0, 0x1C @ HELPCONTEXT_BILLS_PC
bl SetHelpContext
bl StorageGetCurrentBox
ldr r1, _0808CE58 @ =sLastUsedBox
strb r0, [r1]
ldr r0, _0808CE5C @ =c2_Box
bl SetMainCallback2
_0808CE4A:
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_0808CE50: .4byte gUnknown_20397BA
_0808CE54: .4byte task_box_related_3
_0808CE58: .4byte sLastUsedBox
_0808CE5C: .4byte c2_Box
thumb_func_end Cb2_EnterPSS
thumb_func_start sub_808CE60
sub_808CE60: @ 808CE60
push {r4,lr}
bl ResetTasks
ldr r4, _0808CE80 @ =sPSSData
ldr r0, _0808CE84 @ =0x000062bc
bl Alloc
adds r1, r0, 0
str r1, [r4]
cmp r1, 0
bne _0808CE8C
ldr r0, _0808CE88 @ =Cb2_ExitPSS
bl SetMainCallback2
b _0808CEB6
.align 2, 0
_0808CE80: .4byte sPSSData
_0808CE84: .4byte 0x000062bc
_0808CE88: .4byte Cb2_ExitPSS
_0808CE8C:
ldr r0, _0808CEBC @ =sCurrentBoxOption
ldrb r0, [r0]
movs r2, 0
strb r0, [r1, 0x1]
ldr r1, [r4]
movs r0, 0x1
strb r0, [r1, 0x3]
ldr r0, [r4]
strb r2, [r0]
ldr r0, _0808CEC0 @ =task_box_related_3
movs r1, 0x3
bl CreateTask
ldr r1, [r4]
strb r0, [r1, 0x4]
movs r0, 0x1C @ HELPCONTEXT_BILLS_PC
bl SetHelpContext
ldr r0, _0808CEC4 @ =c2_Box
bl SetMainCallback2
_0808CEB6:
pop {r4}
pop {r0}
bx r0
.align 2, 0
_0808CEBC: .4byte sCurrentBoxOption
_0808CEC0: .4byte task_box_related_3
_0808CEC4: .4byte c2_Box
thumb_func_end sub_808CE60
thumb_func_start sub_808CEC8
sub_808CEC8: @ 808CEC8
push {lr}
movs r0, 0x10
movs r1, 0
bl SetGpuReg
movs r0, 0x12
movs r1, 0
bl SetGpuReg
movs r0, 0x14
movs r1, 0
bl SetGpuReg
movs r0, 0x16
movs r1, 0
bl SetGpuReg
movs r0, 0x18
movs r1, 0
bl SetGpuReg
movs r0, 0x1A
movs r1, 0
bl SetGpuReg
movs r0, 0x1C
movs r1, 0
bl SetGpuReg
movs r0, 0x1E
movs r1, 0
bl SetGpuReg
pop {r0}
bx r0
thumb_func_end sub_808CEC8
thumb_func_start sub_808CF10
sub_808CF10: @ 808CF10
push {r4,lr}
sub sp, 0x4
bl ResetPaletteFade
bl ResetSpriteData
bl FreeSpriteTileRanges
bl FreeAllSpritePalettes
bl ClearDma3Requests
ldr r1, _0808CF80 @ =gReservedSpriteTileCount
movs r2, 0xA0
lsls r2, 2
adds r0, r2, 0
strh r0, [r1]
ldr r4, _0808CF84 @ =sPSSData
ldr r1, [r4]
adds r0, r1, 0
adds r0, 0x8
adds r1, 0x10
movs r2, 0x8
bl sub_8096BE4
ldr r1, _0808CF88 @ =gKeyRepeatStartDelay
movs r0, 0x14
strh r0, [r1]
bl ClearScheduledBgCopiesToVram
movs r0, 0x3
bl sub_80F7AD8
ldr r2, _0808CF8C @ =gUnknown_83CE6F8
movs r0, 0x4
str r0, [sp]
movs r0, 0
movs r1, 0x1
movs r3, 0x8
bl sub_80F7B80
movs r0, 0
movs r1, 0x1
movs r2, 0
bl sub_80F7CAC
ldr r0, [r4]
ldr r1, _0808CF90 @ =0x000002c7
adds r0, r1
movs r1, 0
strb r1, [r0]
add sp, 0x4
pop {r4}
pop {r0}
bx r0
.align 2, 0
_0808CF80: .4byte gReservedSpriteTileCount
_0808CF84: .4byte sPSSData
_0808CF88: .4byte gKeyRepeatStartDelay
_0808CF8C: .4byte gUnknown_83CE6F8
_0808CF90: .4byte 0x000002c7
thumb_func_end sub_808CF10
thumb_func_start sub_808CF94
sub_808CF94: @ 808CF94
push {lr}
@@ -401,7 +179,7 @@ _0808D0D6:
.align 2, 0
_0808D100: .4byte 0x05000080
_0808D104:
bl sub_808CEC8
bl ResetAllBgCoords
ldr r0, _0808D11C @ =sPSSData
ldr r0, [r0]
ldrb r0, [r0, 0x3]
@@ -511,12 +289,12 @@ _0808D1E8:
ldr r0, _0808D204 @ =sub_808D26C
bl add_to_c3_somehow
_0808D1FA:
ldr r0, _0808D208 @ =sub_808CD98
ldr r0, _0808D208 @ =VblankCb_PSS
bl SetVBlankCallback
b _0808D216
.align 2, 0
_0808D204: .4byte sub_808D26C
_0808D208: .4byte sub_808CD98
_0808D208: .4byte VblankCb_PSS
_0808D20C:
ldr r0, _0808D21C @ =sPSSData
ldr r1, [r0]
@@ -3917,7 +3695,7 @@ _0808EE78:
adds r1, r0
ldrb r4, [r1]
bl sub_808EF68
ldr r3, _0808EEB8 @ =sub_808CE60
ldr r3, _0808EEB8 @ =Cb2_ReturnToPSS
str r4, [sp]
mov r0, r8
adds r1, r6, 0
@@ -3928,7 +3706,7 @@ _0808EE78:
_0808EEAC: .4byte sPSSData
_0808EEB0: .4byte 0x0000217c
_0808EEB4: .4byte 0x0000217a
_0808EEB8: .4byte sub_808CE60
_0808EEB8: .4byte Cb2_ReturnToPSS
_0808EEBC:
bl sub_808EF68
bl StorageGetCurrentBox
@@ -3938,7 +3716,7 @@ _0808EEBC:
adds r1, r0, 0
movs r0, 0
str r0, [sp]
ldr r0, _0808EEE4 @ =sub_808CE60
ldr r0, _0808EEE4 @ =Cb2_ReturnToPSS
str r0, [sp, 0x4]
movs r0, 0x1
movs r2, 0
@@ -3946,10 +3724,10 @@ _0808EEBC:
bl DoNamingScreen
b _0808EEF6
.align 2, 0
_0808EEE4: .4byte sub_808CE60
_0808EEE4: .4byte Cb2_ReturnToPSS
_0808EEE8:
bl sub_808EF68
ldr r2, _0808EF08 @ =sub_808CE60
ldr r2, _0808EF08 @ =Cb2_ReturnToPSS
movs r0, 0x4
movs r1, 0
bl GoToBagMenu
@@ -3963,7 +3741,7 @@ _0808EEF6:
pop {r0}
bx r0
.align 2, 0
_0808EF08: .4byte sub_808CE60
_0808EF08: .4byte Cb2_ReturnToPSS
thumb_func_end sub_808EE18
thumb_func_start sub_808EF0C
@@ -4917,22 +4695,22 @@ sub_808F68C: @ 808F68C
movs r0, 0x1
movs r1, 0x1
movs r3, 0xC
bl sub_80F7B80
bl SetBoxPartyPokemonDropdownMap2
ldr r2, _0808F710 @ =gUnknown_83CE778
movs r0, 0x4
str r0, [sp]
movs r0, 0x2
movs r1, 0x1
movs r3, 0x9
bl sub_80F7B80
bl SetBoxPartyPokemonDropdownMap2
movs r0, 0x1
movs r1, 0xA
movs r2, 0
bl sub_80F7CAC
bl SetBoxPartyPokemonDropdownMap2Pos
movs r0, 0x2
movs r1, 0x15
movs r2, 0
bl sub_80F7CAC
bl SetBoxPartyPokemonDropdownMap2Pos
bl sub_808F9FC
ldr r0, _0808F714 @ =sInPartyMenu
ldrb r0, [r0]
+5 -3
View File
@@ -16,9 +16,11 @@ gUnknown_83CE4D0:: @ 83CE4D0 bin.lz
gUnknown_83CE5FC:: @ 83CE5FC bin.lz
.incbin "graphics/interface/pss_unk_83CE5FC.bin.lz"
gUnknown_83CE6F8:: @ 83CE6F8 @ raw8
.byte 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x01, 0x05, 0x01, 0x06, 0x01, 0x07, 0x01, 0x08, 0x01, 0x11, 0x01, 0x12, 0x01, 0x13, 0x01, 0x14, 0x01, 0x15, 0x01, 0x16, 0x01, 0x17, 0x01, 0x18, 0x01
.byte 0x01, 0x21, 0x02, 0x21, 0x03, 0x21, 0x04, 0x21, 0x05, 0x21, 0x06, 0x21, 0x07, 0x21, 0x08, 0x21, 0x11, 0x21, 0x12, 0x21, 0x13, 0x21, 0x14, 0x21, 0x15, 0x21, 0x16, 0x21, 0x17, 0x21, 0x18, 0x21
gUnknown_83CE6F8:: @ 83CE6F8 data16
.2byte 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108
.2byte 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118
.2byte 0x2101, 0x2102, 0x2103, 0x2104, 0x2105, 0x2106, 0x2107, 0x2108
.2byte 0x2111, 0x2112, 0x2113, 0x2114, 0x2115, 0x2116, 0x2117, 0x2118
gUnknown_83CE738:: @ 83CE738 gbapal
.incbin "graphics/interface/pss_unk_83CE738.gbapal"
+3 -3
View File
@@ -1,12 +1,12 @@
#ifndef GUARD_BOX_PARTY_POKEMON_DROPDOWN_H
#define GUARD_BOX_PARTY_POKEMON_DROPDOWN_H
void sub_80F7AD8(u8 num);
void AllocBoxPartyPokemonDropdowns(u8 num);
void sub_80F7B2C(void);
void sub_80F7B40(void);
void sub_80F7B80(u8 a0, u8 a1, const void * a2, u16 a3, u16 a4);
void SetBoxPartyPokemonDropdownMap2(u8 idx, u8 bgId, const void * src, u16 width, u16 height);
void sub_80F7C7C(u8 a0, const void * a1);
void sub_80F7CAC(u8 a0, u16 a1, u16 a2);
void SetBoxPartyPokemonDropdownMap2Pos(u8 idx, u16 x, u16 y);
void sub_80F7CE8(u8 a0, u16 a1, u16 a2, u16 a3, u16 a4);
void sub_80F7D30(u8 a0, u8 a1, s8 a2);
void sub_80F7E54(u8 a0);
+1 -1
View File
@@ -33,7 +33,7 @@ void SetBoxMonNickAt(u8 boxId, u8 monPosition, const u8 *newNick);
void CompactPartySlots(void);
u32 GetBoxMonDataAt(u8 boxId, u8 monPosition, s32 request);
void ZeroBoxMonAt(u8 boxId, u8 monPosition);
void sub_808CE60(void);
void Cb2_ReturnToPSS(void);
void ResetPokemonStorageSystem(void);
u8 StorageGetCurrentBox(void);
void DrawTextWindowAndBufferTiles(const u8 *name, void *a1, u8 a2, u8 a3, u8 *buffer, s32 a5);
+226
View File
@@ -0,0 +1,226 @@
#ifndef GUARD_POKEMON_STORAGE_SYSTEM_INTERNAL_H
#define GUARD_POKEMON_STORAGE_SYSTEM_INTERNAL_H
#include "pokemon_storage_system.h"
#include "mon_markings.h"
struct UnkPSSStruct_2002370
{
struct Sprite *unk_0000;
struct Sprite *unk_0004[4];
u32 unk_0014[3];
struct Sprite *unk_0020[2];
u8 filler_0028[0x200];
u8 unk_0228[20];
u32 unk_023c;
u16 unk_0240;
u16 unk_0242;
u8 curBox;
u8 unk_0245;
u8 unk_0246;
};
struct StorageMenu
{
const u8 *text;
int textId;
};
struct UnkStruct_2000028
{
const u8 *unk_00;
u8 *unk_04;
u16 unk_08;
u16 unk_0a;
u16 newField;
void (*unk_0c)(struct UnkStruct_2000028 *data);
};
struct UnkStruct_2000020
{
struct UnkStruct_2000028 *unk_00;
u8 unk_04;
u8 unk_05;
};
struct UnkStorageStruct
{
struct Sprite *sprite;
u8 *tiles;
u16 palIndex;
u8 unk8;
u8 unk9;
u8 unk10;
};
struct PssQuestLogBuffer
{
u16 a0;
u16 a2;
u8 a4;
u8 a5;
};
struct PokemonStorageSystemData
{
u8 state;
u8 boxOption;
u8 screenChangeType;
bool8 isReshowingPSS;
u8 taskId;
struct UnkStruct_2000020 unk_0020;
struct UnkStruct_2000028 unk_0028[8];
u16 field_B0[528 / 2];
u16 field_2C0;
u16 field_2C2;
u8 field_2C4;
u8 field_2C5;
u8 showPartyMenuState;
u8 unk_02C7;
u8 unk_02C8;
bool8 unk_02C9;
s16 newCurrBoxId;
u16 bg2_X;
s16 field_2CE;
u16 field_2D0;
u8 field_2D2;
u8 field_2D3;
u8 field_2D4;
u16 field_2D6;
s16 field_2D8;
u16 field_2DA;
u16 field_2DC;
u16 field_2DE;
u16 field_2E0;
u8 filler[22];
u8 field_2F8[1024];
u8 field_6F8;
u8 field_6F9;
u8 field_6FA;
s8 field_6FB;
u16 field_6FC[16];
u16 field_71C;
u16 field_71E;
struct Sprite *field_720[2];
struct Sprite *field_728[2];
struct Sprite *field_730[2];
u32 field_738;
u8 field_73C[80];
u16 field_78C;
s16 wallpaperSetId;
s16 wallpaperId;
u16 field_792[360];
u8 wallpaperChangeState;
u8 field_A63;
u8 field_A64;
s8 field_A65;
u8 *wallpaperTiles;
struct Sprite *movingMonSprite;
struct Sprite *partySprites[PARTY_SIZE];
struct Sprite *boxMonsSprites[IN_BOX_COUNT];
struct Sprite **field_B00;
struct Sprite **field_B04;
u16 field_B08[40];
u16 field_B58[40];
u16 boxSpecies[IN_BOX_COUNT];
u32 boxPersonalities[IN_BOX_COUNT];
u8 field_C5C;
u8 field_C5D;
u8 field_C5E;
u16 field_C60;
s16 field_C62;
s16 field_C64;
u16 field_C66;
u8 field_C68;
s8 field_C69;
u8 field_C6A;
u8 field_C6B;
struct WindowTemplate menuWindow;
struct StorageMenu menuItems[7];
u8 menuItemsCount;
u8 menuWidth;
u8 field_CAE;
u16 field_CB0;
struct Sprite *field_CB4;
struct Sprite *field_CB8;
s32 field_CBC;
s32 field_CC0;
u32 field_CC4;
u32 field_CC8;
s16 field_CCC;
s16 field_CCE;
u16 field_CD0;
s8 field_CD2;
s8 field_CD3;
u8 field_CD4;
u8 field_CD5;
u8 field_CD6;
u8 field_CD7;
u8 field_CD8[2];
const u32 *cursorMonPalette;
u32 cursorMonPersonality;
u16 cursorMonSpecies;
u16 cursorMonItem;
u16 field_CE8;
bool8 setMosaic;
u8 cursorMonMarkings;
u8 cursorMonLevel;
bool8 cursorMonIsEgg;
u8 cursorMonNick[POKEMON_NAME_LENGTH + 1];
u8 cursorMonNickText[36];
u8 cursorMonSpeciesName[36];
u8 cursorMonGenderLvlText[36];
u8 cursorMonItemName[36];
bool8 (*monPlaceChangeFunc)(void);
u8 monPlaceChangeState;
u8 field_D91;
struct Sprite *field_D94;
struct Sprite *field_D98[2];
struct PokemonMarkMenu field_DA4;
/* 1e58 */ struct UnkPSSStruct_2002370 field_1E5C;
/* 20a0 */ struct Pokemon movingMon;
/* 2104 */ struct Pokemon field_2108;
/* 2168 */ s8 field_216C;
/* 2169 */ u8 field_216D;
/* 216a */ s8 field_216E;
/* 216b */ s8 field_216F;
/* 216c */ s8 field_2170;
/* 216d */ s8 field_2171;
/* 216e */ u8 field_2172;
/* 216f */ u8 field_2173;
/* 2170 */ u16 field_2174;
/* 2172 */ u16 field_2176[3];
/* 2178 */ u8 field_2186;
/* 2179 */ u8 field_2187;
/* 217a */ u8 field_2188;
/* 217c */ union
{
struct Pokemon *mon;
struct BoxPokemon *box;
} field_218C;
/* 2180 */ u8 field_2190[40];
/* 21a8 */ u8 field_21B8[40];
/* 21d0 */ u8 field_21E0[POKEMON_NAME_LENGTH + 1];
/* 21db */ u8 itemName[20];
/* 21ef */ u8 inBoxMovingMode;
/* 21f0 */ u16 field_2200;
/* 21f4 */ struct UnkStorageStruct field_2204[3];
/* 2224 */ u16 movingItem;
/* 2226 */ u16 field_2236;
/* 2228 */ struct PssQuestLogBuffer field_2238;
/* 2230 */ u16 field_223A;
/* 2234 */ u16 *field_223C;
/* 2238 */ struct Sprite *cursorMonSprite;
/* 223c */ u16 field_2244[0x40];
/* 22bc */ u8 field_22C4[0x800];
/* 2abc */ u8 field_2AC4[0x1800];
/* 42bc */ u8 field_42C4[0x800];
/* 4abc */ u8 field_4AC4[0x1000];
/* 5abc */ u8 field_5AC4[0x800];
};
extern struct PokemonStorageSystemData *sPSSData;
void Cb2_ExitPSS(void);
#endif //GUARD_POKEMON_STORAGE_SYSTEM_INTERNAL_H
+1
View File
@@ -254,6 +254,7 @@ extern const struct SpriteTemplate gDummySpriteTemplate;
extern struct Sprite gSprites[];
extern struct OamMatrix gOamMatrices[];
extern bool8 gAffineAnimsDisabled;
extern u16 gReservedSpriteTileCount;
void ResetSpriteData(void);
void AnimateSprites(void);
+2
View File
@@ -130,6 +130,7 @@ SECTIONS {
src/trainer_card.o(.text);
src/pokemon_storage_system.o(.text);
src/pokemon_storage_system_2.o(.text);
src/pokemon_storage_system_3.o(.text);
asm/pokemon_storage_system.o(.text);
src/pokemon_icon.o(.text);
src/script_movement.o(.text);
@@ -451,6 +452,7 @@ SECTIONS {
src/option_menu.o(.rodata);
src/trainer_card.o(.rodata);
src/pokemon_storage_system_2.o(.rodata);
src/pokemon_storage_system_3.o(.rodata);
data/pokemon_storage_system.o(.rodata);
src/pokemon_icon.o(.rodata);
src/fldeff_cut.o(.rodata);
+1 -1
View File
@@ -1258,7 +1258,7 @@ static void Task_ContextMenu_FromPartyGiveMenu(u8 taskId)
static void Task_ContextMenu_FromPokemonPC(u8 taskId)
{
sResources->exitCallback = sub_808CE60;
sResources->exitCallback = Cb2_ReturnToPSS;
gTasks[taskId].func = BerryPouch_StartFadeToExitCallback;
}
+10 -10
View File
@@ -553,21 +553,21 @@ u16 GetBgAttribute(u8 bg, u8 attributeId)
{
switch (attributeId)
{
case 1:
case BG_ATTR_CHARBASEINDEX:
return GetBgControlAttribute(bg, BG_CTRL_ATTR_CHARBASEINDEX);
case 2:
case BG_ATTR_MAPBASEINDEX:
return GetBgControlAttribute(bg, BG_CTRL_ATTR_MAPBASEINDEX);
case 3:
case BG_ATTR_SCREENSIZE:
return GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
case 4:
case BG_ATTR_PALETTEMODE:
return GetBgControlAttribute(bg, BG_CTRL_ATTR_PALETTEMODE);
case 7:
case BG_ATTR_PRIORITY:
return GetBgControlAttribute(bg, BG_CTRL_ATTR_PRIORITY);
case 5:
case BG_ATTR_MOSAIC:
return GetBgControlAttribute(bg, BG_CTRL_ATTR_MOSAIC);
case 6:
case BG_ATTR_WRAPAROUND:
return GetBgControlAttribute(bg, BG_CTRL_ATTR_WRAPAROUND);
case 8:
case BG_ATTR_TEXTORAFFINEMODE:
switch (GetBgType(bg))
{
case 0:
@@ -577,9 +577,9 @@ u16 GetBgAttribute(u8 bg, u8 attributeId)
default:
return 0;
}
case 9:
case BG_ATTR_BGTYPE:
return GetBgType(bg);
case 10:
case BG_ATTR_BASETILE:
return sGpuBgConfigs2[bg].baseTile;
default:
return -1;
+31 -31
View File
@@ -21,9 +21,9 @@ struct UnkStruct_203ABE4
const void * src2;
u16 src1Height;
u16 src1Width;
u16 src2Width;
u16 src2Height;
u16 unk_26;
u16 unk_28;
u16 bytesPerRow;
u8 mapSize;
u8 bgId;
bool8 bgUpdateScheduled;
@@ -52,7 +52,7 @@ static const struct {
}
};
void sub_80F7AD8(u8 num)
void AllocBoxPartyPokemonDropdowns(u8 num)
{
u16 i;
sBoxPartyPokemonDropdownPtr = Alloc(num * sizeof(struct UnkStruct_203ABE4));
@@ -80,35 +80,35 @@ void sub_80F7B40(void)
}
}
void sub_80F7B80(u8 a0, u8 a1, const void * a2, u16 a3, u16 a4)
void SetBoxPartyPokemonDropdownMap2(u8 idx, u8 bgId, const void * src, u16 width, u16 height)
{
u16 screenSize;
u16 bgType;
if (a0 < sBoxPartyPokemonDropdownCount)
if (idx < sBoxPartyPokemonDropdownCount)
{
sBoxPartyPokemonDropdownPtr[a0].src1 = NULL;
sBoxPartyPokemonDropdownPtr[a0].src2 = a2;
sBoxPartyPokemonDropdownPtr[a0].bgId = a1;
sBoxPartyPokemonDropdownPtr[a0].src2Height = a3;
sBoxPartyPokemonDropdownPtr[a0].unk_26 = a4;
screenSize = GetBgAttribute(a1, BG_ATTR_SCREENSIZE);
bgType = GetBgAttribute(a1, BG_ATTR_BGTYPE);
sBoxPartyPokemonDropdownPtr[a0].src1Height = sBGdims[bgType][screenSize].height;
sBoxPartyPokemonDropdownPtr[a0].src1Width = sBGdims[bgType][screenSize].width;
sBoxPartyPokemonDropdownPtr[idx].src1 = NULL;
sBoxPartyPokemonDropdownPtr[idx].src2 = src;
sBoxPartyPokemonDropdownPtr[idx].bgId = bgId;
sBoxPartyPokemonDropdownPtr[idx].src2Width = width;
sBoxPartyPokemonDropdownPtr[idx].src2Height = height;
screenSize = GetBgAttribute(bgId, BG_ATTR_SCREENSIZE);
bgType = GetBgAttribute(bgId, BG_ATTR_BGTYPE);
sBoxPartyPokemonDropdownPtr[idx].src1Height = sBGdims[bgType][screenSize].height;
sBoxPartyPokemonDropdownPtr[idx].src1Width = sBGdims[bgType][screenSize].width;
if (bgType != 0)
sBoxPartyPokemonDropdownPtr[a0].mapSize = 1;
sBoxPartyPokemonDropdownPtr[idx].mapSize = 1;
else
sBoxPartyPokemonDropdownPtr[a0].mapSize = 2;
sBoxPartyPokemonDropdownPtr[a0].unk_28 = a3 * sBoxPartyPokemonDropdownPtr[a0].mapSize;
sBoxPartyPokemonDropdownPtr[a0].map2Rect.width = a3;
sBoxPartyPokemonDropdownPtr[a0].map2Rect.height = a4;
sBoxPartyPokemonDropdownPtr[a0].map2Rect.destX = 0;
sBoxPartyPokemonDropdownPtr[a0].map2Rect.destY = 0;
sBoxPartyPokemonDropdownPtr[a0].map2Rect.destX2 = 0;
sBoxPartyPokemonDropdownPtr[a0].map2Rect.destY2 = 0;
sBoxPartyPokemonDropdownPtr[a0].map1Rect = sBoxPartyPokemonDropdownPtr[a0].map2Rect;
sBoxPartyPokemonDropdownPtr[a0].bgUpdateScheduled = TRUE;
sBoxPartyPokemonDropdownPtr[idx].mapSize = 2;
sBoxPartyPokemonDropdownPtr[idx].bytesPerRow = width * sBoxPartyPokemonDropdownPtr[idx].mapSize;
sBoxPartyPokemonDropdownPtr[idx].map2Rect.width = width;
sBoxPartyPokemonDropdownPtr[idx].map2Rect.height = height;
sBoxPartyPokemonDropdownPtr[idx].map2Rect.destX = 0;
sBoxPartyPokemonDropdownPtr[idx].map2Rect.destY = 0;
sBoxPartyPokemonDropdownPtr[idx].map2Rect.destX2 = 0;
sBoxPartyPokemonDropdownPtr[idx].map2Rect.destY2 = 0;
sBoxPartyPokemonDropdownPtr[idx].map1Rect = sBoxPartyPokemonDropdownPtr[idx].map2Rect;
sBoxPartyPokemonDropdownPtr[idx].bgUpdateScheduled = TRUE;
}
}
@@ -121,13 +121,13 @@ void sub_80F7C7C(u8 a0, const void * a1)
}
}
void sub_80F7CAC(u8 a0, u16 a1, u16 a2)
void SetBoxPartyPokemonDropdownMap2Pos(u8 idx, u16 x, u16 y)
{
if (a0 < sBoxPartyPokemonDropdownCount)
if (idx < sBoxPartyPokemonDropdownCount)
{
sBoxPartyPokemonDropdownPtr[a0].map2Rect.destX2 = a1;
sBoxPartyPokemonDropdownPtr[a0].map2Rect.destY2 = a2;
sBoxPartyPokemonDropdownPtr[a0].bgUpdateScheduled = TRUE;
sBoxPartyPokemonDropdownPtr[idx].map2Rect.destX2 = x;
sBoxPartyPokemonDropdownPtr[idx].map2Rect.destY2 = y;
sBoxPartyPokemonDropdownPtr[idx].bgUpdateScheduled = TRUE;
}
}
@@ -202,7 +202,7 @@ static void PushMap1(u8 a0)
static void PushMap2(u8 a0)
{
int i;
int r9 = sBoxPartyPokemonDropdownPtr[a0].mapSize * sBoxPartyPokemonDropdownPtr[a0].src2Height;
int r9 = sBoxPartyPokemonDropdownPtr[a0].mapSize * sBoxPartyPokemonDropdownPtr[a0].src2Width;
const void * addr = sBoxPartyPokemonDropdownPtr[a0].src2 + r9 * sBoxPartyPokemonDropdownPtr[a0].map2Rect.destY + sBoxPartyPokemonDropdownPtr[a0].map2Rect.destX * sBoxPartyPokemonDropdownPtr[a0].mapSize;
for (i = 0; i < sBoxPartyPokemonDropdownPtr[a0].map2Rect.height; i++)
{
+1 -1
View File
@@ -1784,7 +1784,7 @@ static void GoToBerryPouch_PCBox(void)
static void ReturnToBagMenuFromSubmenu_PCBox(void)
{
GoToBagMenu(ITEMMENULOCATION_PCBOX, OPEN_BAG_LAST, sub_808CE60);
GoToBagMenu(ITEMMENULOCATION_PCBOX, OPEN_BAG_LAST, Cb2_ReturnToPSS);
}
static void Task_ItemContext_Sell(u8 taskId)
+1 -17
View File
@@ -7,7 +7,7 @@
#include "menu.h"
#include "new_menu_helpers.h"
#include "overworld.h"
#include "pokemon_storage_system.h"
#include "pokemon_storage_system_internal.h"
#include "script.h"
#include "strings.h"
#include "task.h"
@@ -22,22 +22,6 @@ struct PSS_MenuStringPtrs
const u8 *desc;
};
struct UnkPSSStruct_2002370
{
struct Sprite *unk_0000;
struct Sprite *unk_0004[4];
u32 unk_0014[3];
struct Sprite *unk_0020[2];
u8 filler_0028[0x200];
u8 unk_0228[0x14];
u32 unk_023c;
u16 unk_0240;
u16 unk_0242;
u8 curBox;
u8 unk_0245;
u8 unk_0246;
};
EWRAM_DATA u8 sPreviousBoxOption = 0;
EWRAM_DATA struct UnkPSSStruct_2002370 *gUnknown_20397AC = NULL;
+106
View File
@@ -1,3 +1,109 @@
#include "global.h"
#include "gflib.h"
#include "box_party_pokemon_dropdown.h"
#include "help_system.h"
#include "new_menu_helpers.h"
#include "pokemon_storage_system_internal.h"
#include "task.h"
#include "constants/help_system.h"
EWRAM_DATA struct PokemonStorageSystemData *sPSSData = NULL;
EWRAM_DATA bool8 sInPartyMenu = 0;
EWRAM_DATA u8 sCurrentBoxOption = 0;
EWRAM_DATA u8 gUnknown_20397B6 = 0;
EWRAM_DATA u8 sWhichToReshow = 0;
EWRAM_DATA u8 sLastUsedBox = 0;
EWRAM_DATA u16 gUnknown_20397BA = 0;
void sub_808EFC8(void);
void sub_808F99C(void);
void sub_8096BF8(void);
void task_box_related_3(u8 taskId);
void sub_8096BE4(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2);
extern const u16 gUnknown_83CE6F8[];
void VblankCb_PSS(void)
{
LoadOam();
ProcessSpriteCopyRequests();
sub_8096BF8();
TransferPlttBuffer();
SetGpuReg(REG_OFFSET_BG2HOFS, sPSSData->bg2_X);
}
void Cb2_PSS(void)
{
RunTasks();
DoScheduledBgTilemapCopiesToVram();
sub_808EFC8();
sub_808F99C();
AnimateSprites();
BuildOamBuffer();
}
void Cb2_EnterPSS(u8 boxOption)
{
ResetTasks();
sCurrentBoxOption = boxOption;
sPSSData = Alloc(sizeof(struct PokemonStorageSystemData));
if (sPSSData == NULL)
SetMainCallback2(Cb2_ExitPSS);
else
{
sPSSData->boxOption = boxOption;
sPSSData->isReshowingPSS = FALSE;
gUnknown_20397BA = 0;
sPSSData->state = 0;
sPSSData->taskId = CreateTask(task_box_related_3, 3);
SetHelpContext(HELPCONTEXT_BILLS_PC);
sLastUsedBox = StorageGetCurrentBox();
SetMainCallback2(Cb2_PSS);
}
}
void Cb2_ReturnToPSS(void)
{
ResetTasks();
sPSSData = Alloc(sizeof(struct PokemonStorageSystemData));
if (sPSSData == NULL)
SetMainCallback2(Cb2_ExitPSS);
else
{
sPSSData->boxOption = sCurrentBoxOption;
sPSSData->isReshowingPSS = TRUE;
sPSSData->state = 0;
sPSSData->taskId = CreateTask(task_box_related_3, 3);
SetHelpContext(HELPCONTEXT_BILLS_PC);
SetMainCallback2(Cb2_PSS);
}
}
void ResetAllBgCoords(void)
{
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
SetGpuReg(REG_OFFSET_BG1HOFS, 0);
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
SetGpuReg(REG_OFFSET_BG2HOFS, 0);
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
SetGpuReg(REG_OFFSET_BG3HOFS, 0);
SetGpuReg(REG_OFFSET_BG3VOFS, 0);
}
void sub_808CF10(void)
{
ResetPaletteFade();
ResetSpriteData();
FreeSpriteTileRanges();
FreeAllSpritePalettes();
ClearDma3Requests();
gReservedSpriteTileCount = 0x280;
sub_8096BE4(&sPSSData->unk_0020, sPSSData->unk_0028, 8);
gKeyRepeatStartDelay = 20;
ClearScheduledBgCopiesToVram();
AllocBoxPartyPokemonDropdowns(3);
SetBoxPartyPokemonDropdownMap2(0, 1, gUnknown_83CE6F8, 8, 4);
SetBoxPartyPokemonDropdownMap2Pos(0, 1, 0);
sPSSData->unk_02C7 = 0;
}
+1 -1
View File
@@ -959,7 +959,7 @@ static void Task_SelectTMAction_Type3(u8 taskId)
if (!itemid_is_unique(BagGetItemIdByPocketPosition(POCKET_TM_CASE, data[1])))
{
sTMCaseDynamicResources->savedCallback = sub_808CE60;
sTMCaseDynamicResources->savedCallback = Cb2_ReturnToPSS;
Task_BeginFadeOutFromTMCase(taskId);
}
else
+4 -28
View File
@@ -156,36 +156,12 @@ gUnknown_20386A8: @ 20386A8
.include "src/option_menu.o"
.align 2
.include "src/trainer_card.o"
.align 2
.include "src/pokemon_storage_system_2.o"
.align 2
.include "src/pokemon_storage_system_3.o"
.align 2
@ .include "src/pokemon_storage_system.o"
sPreviousBoxOption: @ 20397A8
.space 0x4
gUnknown_20397AC: @ 20397AC
.space 0x4
sPSSData: @ 20397B0
.space 0x4
sInPartyMenu: @ 20397B4
.space 0x1
sCurrentBoxOption: @ 20397B5
.space 0x1
gUnknown_20397B6: @ 20397B6
.space 0x1
sWhichToReshow: @ 20397B7
.space 0x1
sLastUsedBox: @ 20397B8
.space 0x2
gUnknown_20397BA: @ 20397BA
.space 0x2
gUnknown_20397BC: @ 20397BC
.space 0x64