More storage

This commit is contained in:
DizzyEggg 2018-12-10 23:42:44 +01:00
parent c2d8876174
commit c5b5f4bd77
5 changed files with 342 additions and 445 deletions

View File

@ -7,309 +7,7 @@
thumb_func_start sub_80C9F6C
sub_80C9F6C: @ 80C9F6C
push {lr}
sub sp, 0x4
ldr r0, =gSpecialVar_ItemId
ldrh r1, [r0]
mov r0, sp
strh r1, [r0]
cmp r1, 0
beq _080C9FC0
bl GetBoxCursorPosition
lsls r0, 24
lsrs r1, r0, 24
ldr r0, =sInPartyMenu
ldrb r0, [r0]
cmp r0, 0
beq _080C9FAC
movs r0, 0x64
muls r0, r1
ldr r1, =gPlayerParty
adds r0, r1
movs r1, 0xC
mov r2, sp
bl SetMonData
b _080C9FB6
.pool
_080C9FAC:
adds r0, r1, 0
movs r1, 0xC
mov r2, sp
bl SetBoxMonDataFromSelectedBox
_080C9FB6:
mov r0, sp
ldrh r0, [r0]
movs r1, 0x1
bl RemoveBagItem
_080C9FC0:
add sp, 0x4
pop {r0}
bx r0
thumb_func_end sub_80C9F6C
thumb_func_start FreePSSData
FreePSSData: @ 80C9FC8
push {r4,lr}
bl sub_80D25F0
bl sub_80D01B8
ldr r4, =gUnknown_02039D08
ldr r0, [r4]
bl Free
movs r0, 0
str r0, [r4]
bl FreeAllWindowBuffers
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end FreePSSData
thumb_func_start sub_80C9FEC
sub_80C9FEC: @ 80C9FEC
push {lr}
sub sp, 0x4
ldr r1, =0x00001f0f
movs r0, 0xE
bl SetGpuReg
ldr r1, =gUnknown_085720DC
movs r0, 0
str r0, [sp]
movs r0, 0x3
movs r2, 0
movs r3, 0
bl DecompressAndLoadBgGfxUsingHeap
ldr r0, =gUnknown_08572174
ldr r1, =0x0600f800
bl LZ77UnCompVram
add sp, 0x4
pop {r0}
bx r0
.pool
thumb_func_end sub_80C9FEC
thumb_func_start sub_80CA028
sub_80CA028: @ 80CA028
push {lr}
movs r0, 0x3
movs r1, 0x80
movs r2, 0x1
bl ChangeBgX
movs r0, 0x3
movs r1, 0x80
movs r2, 0x2
bl ChangeBgY
pop {r0}
bx r0
thumb_func_end sub_80CA028
thumb_func_start sub_80CA044
sub_80CA044: @ 80CA044
push {r4,r5,lr}
sub sp, 0x4
ldr r1, =gUnknown_08572734
movs r0, 0
movs r2, 0x4
bl InitBgsFromTemplates
ldr r1, =gPSSMenu_Gfx
movs r0, 0
str r0, [sp]
movs r0, 0x1
movs r2, 0
movs r3, 0
bl DecompressAndLoadBgGfxUsingHeap
ldr r0, =gUnknown_085722A0
ldr r5, =gUnknown_02039D08
ldr r1, [r5]
ldr r4, =0x00005ac4
adds r1, r4
bl LZ77UnCompWram
ldr r1, [r5]
adds r1, r4
movs r0, 0x1
bl SetBgTilemapBuffer
movs r0, 0x1
bl ShowBg
movs r0, 0x1
bl schedule_bg_copy_tilemap_to_vram
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80CA044
thumb_func_start sub_80CA0A4
sub_80CA0A4: @ 80CA0A4
push {lr}
ldr r0, =gUnknown_08572714
bl InitWindows
lsls r0, 16
cmp r0, 0
beq _080CA0C0
bl DeactivateAllTextPrinters
movs r0, 0x1
b _080CA0C2
.pool
_080CA0C0:
movs r0, 0
_080CA0C2:
pop {r1}
bx r1
thumb_func_end sub_80CA0A4
thumb_func_start sub_80CA0C8
sub_80CA0C8: @ 80CA0C8
push {lr}
ldr r0, =gWaveformSpritePalette
bl LoadSpritePalette
pop {r0}
bx r0
.pool
thumb_func_end sub_80CA0C8
thumb_func_start sub_80CA0D8
sub_80CA0D8: @ 80CA0D8
push {lr}
ldr r0, =gUnknown_085723DC
movs r1, 0
movs r2, 0x20
bl LoadPalette
ldr r0, =gUnknown_085723FC
movs r1, 0x20
movs r2, 0x20
bl LoadPalette
ldr r0, =gUnknown_085726F4
movs r1, 0xF0
movs r2, 0x20
bl LoadPalette
ldr r0, =gUnknown_02039D08
ldr r0, [r0]
ldrb r0, [r0, 0x1]
cmp r0, 0x3
beq _080CA124
ldr r0, =gUnknown_0857241C
movs r1, 0x30
movs r2, 0x20
bl LoadPalette
b _080CA12E
.pool
_080CA124:
ldr r0, =gUnknown_0857243C
movs r1, 0x30
movs r2, 0x20
bl LoadPalette
_080CA12E:
ldr r1, =0x00001e05
movs r0, 0xA
bl SetGpuReg
bl sub_80CA318
bl sub_80CA154
bl sub_80CA1C4
bl sub_80CA230
pop {r0}
bx r0
.pool
thumb_func_end sub_80CA0D8
thumb_func_start sub_80CA154
sub_80CA154: @ 80CA154
push {r4,lr}
ldr r1, =0x0000dac8
movs r0, 0x10
movs r2, 0
bl sub_811FFB4
ldr r4, =gUnknown_02039D08
ldr r1, [r4]
ldr r3, =0x00000d94
adds r1, r3
str r0, [r1]
ldrb r2, [r0, 0x5]
movs r1, 0xD
negs r1, r1
ands r1, r2
movs r2, 0x4
orrs r1, r2
strb r1, [r0, 0x5]
ldr r0, [r4]
adds r0, r3
ldr r0, [r0]
adds r0, 0x43
movs r1, 0x1
strb r1, [r0]
ldr r0, [r4]
adds r0, r3
ldr r2, [r0]
movs r1, 0x28
strh r1, [r2, 0x20]
ldr r1, [r0]
movs r0, 0x96
strh r0, [r1, 0x22]
movs r0, 0x10
bl GetSpriteTileStartByTag
ldr r1, [r4]
movs r2, 0xDA
lsls r2, 4
adds r1, r2
lsls r0, 16
lsrs r0, 11
ldr r2, =0x06010000
adds r0, r2
str r0, [r1]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80CA154
thumb_func_start sub_80CA1C4
sub_80CA1C4: @ 80CA1C4
push {r4,lr}
sub sp, 0x8
ldr r0, =gWaveformSpriteSheet
ldr r1, [r0, 0x4]
ldr r0, [r0]
str r0, [sp]
str r1, [sp, 0x4]
mov r0, sp
bl LoadSpriteSheet
movs r4, 0
_080CA1DA:
lsls r1, r4, 6
subs r1, r4
adds r1, 0x8
lsls r1, 16
asrs r1, 16
ldr r0, =gUnknown_085728BC
movs r2, 0x9
movs r3, 0x2
bl CreateSprite
lsls r0, 24
lsrs r0, 24
ldr r1, =gUnknown_02039D08
ldr r2, [r1]
lsls r1, r4, 2
ldr r3, =0x00000d98
adds r2, r3
adds r2, r1
lsls r1, r0, 4
adds r1, r0
lsls r1, 2
ldr r0, =gSprites
adds r1, r0
str r1, [r2]
adds r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
cmp r4, 0x1
bls _080CA1DA
add sp, 0x8
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80CA1C4
thumb_func_start sub_80CA230
sub_80CA230: @ 80CA230
@ -8876,7 +8574,7 @@ _080CEA08:
ldrb r0, [r0]
movs r1, 0x8
mov r2, sp
bl SetBoxMonDataFromSelectedBox
bl SetCurrentBoxMonData
_080CEA1C:
add sp, 0x4
pop {r4}
@ -13361,7 +13059,7 @@ sub_80D0E90: @ 80D0E90
adds r0, r5, 0
movs r1, 0xC
mov r2, sp
bl SetBoxMonDataFromSelectedBox
bl SetCurrentBoxMonData
adds r0, r5, 0
movs r1, 0x1
bl sub_80CB7AC
@ -13489,7 +13187,7 @@ sub_80D0FAC: @ 80D0FAC
adds r2, r4
adds r0, r7, 0
movs r1, 0xC
bl SetBoxMonDataFromSelectedBox
bl SetCurrentBoxMonData
mov r1, r8
ldr r0, [r1]
adds r0, r4
@ -13577,7 +13275,7 @@ sub_80D1080: @ 80D1080
adds r2, r0
adds r0, r5, 0
movs r1, 0xC
bl SetBoxMonDataFromSelectedBox
bl SetCurrentBoxMonData
adds r0, r5, 0
movs r1, 0
bl sub_80CB7AC
@ -13643,7 +13341,7 @@ sub_80D1114: @ 80D1114
adds r0, r5, 0
movs r1, 0xC
mov r2, sp
bl SetBoxMonDataFromSelectedBox
bl SetCurrentBoxMonData
adds r0, r5, 0
movs r1, 0x1
bl sub_80CB7AC
@ -15228,8 +14926,8 @@ GetBoxMonDataFromSelectedBox: @ 80D1DB8
.pool
thumb_func_end GetBoxMonDataFromSelectedBox
thumb_func_start SetBoxMonDataFromSelectedBox
SetBoxMonDataFromSelectedBox: @ 80D1DD8
thumb_func_start SetCurrentBoxMonData
SetCurrentBoxMonData: @ 80D1DD8
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
@ -15246,7 +14944,7 @@ SetBoxMonDataFromSelectedBox: @ 80D1DD8
pop {r0}
bx r0
.pool
thumb_func_end SetBoxMonDataFromSelectedBox
thumb_func_end SetCurrentBoxMonData
thumb_func_start GetBoxMonNickFromAnyBox
GetBoxMonNickFromAnyBox: @ 80D1DFC

View File

@ -3,81 +3,6 @@
.section .rodata
.align 2
gUnknown_08572864:: @ 8572864
window_template 0, 0x18, 0xB, 5, 4, 0xF, 0x5C
.align 2
gOamData_857286C:: @ 857286C
.2byte 0x0000
.2byte 0xC000
.2byte 0x0000
.align 2
gOamData_8572874:: @ 8572874
.2byte 0x4000
.2byte 0x0000
.2byte 0x0000
.align 2
gSpriteAnim_857287C:: @ 857287C
obj_image_anim_frame 0, 5
obj_image_anim_end
.align 2
gSpriteAnim_8572884:: @ 8572884
obj_image_anim_frame 2, 8
obj_image_anim_frame 4, 8
obj_image_anim_frame 6, 8
obj_image_anim_jump 0
.align 2
gSpriteAnim_8572894:: @ 8572894
obj_image_anim_frame 8, 5
obj_image_anim_end
.align 2
gSpriteAnim_857289C:: @ 857289C
obj_image_anim_frame 10, 8
obj_image_anim_frame 4, 8
obj_image_anim_frame 12, 8
obj_image_anim_jump 0
.align 2
gSpriteAnimTable_85728AC:: @ 85728AC
.4byte gSpriteAnim_857287C
.4byte gSpriteAnim_8572884
.4byte gSpriteAnim_8572894
.4byte gSpriteAnim_857289C
gUnknown_085728BC:: @ 85728BC
spr_template 5, 0xDACA, gOamData_8572874, gSpriteAnimTable_85728AC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_085728D4:: @ 85728D4
spr_template 0x12, 0xDAC0, gOamData_85728EC, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gOamData_85728EC:: @ 85728EC
.2byte 0x0000
.2byte 0x8000
.2byte 0x0000
.align 2
gSpriteAffineAnim_85728F4:: @ 85728F4
obj_rot_scal_anim_frame 0xFFFE, 0xFFFE, 0, 120
obj_rot_scal_anim_end
.align 2
gSpriteAffineAnim_8572904:: @ 8572904
obj_rot_scal_anim_frame 0x10, 0x10, 0, 0
obj_rot_scal_anim_frame 0x10, 0x10, 0, 15
obj_rot_scal_anim_end
.align 2
gSpriteAffineAnimTable_857291C:: @ 857291C
.4byte gSpriteAffineAnim_85728F4
.4byte gSpriteAffineAnim_8572904
.align 2
gWallpaperPalettes_Forest:: @ 8572924

View File

@ -4740,4 +4740,7 @@ extern const u32 gUnknown_08D8D58C[];
extern const u32 gPokedexAreaScreenAreaUnknown_Gfx[];
extern const u16 gPokedexAreaScreenAreaUnknown_Pal[];
// Pokemon Storage System
extern const u32 gPSSMenu_Gfx[];
#endif //GUARD_GRAPHICS_H

View File

@ -67,7 +67,7 @@ struct PokemonStorageSystemData
u8 state;
u8 boxOption;
u8 screenChangeType;
u8 unk_0003;
bool8 isReshowingPSS;
u8 taskId;
u8 unk_0005;
struct UnkStruct_2000020 unk_0020;
@ -99,7 +99,10 @@ struct PokemonStorageSystemData
u8 field_CEC;
u8 field_CED;
u8 field_CEE;
u8 field_CEF[181];
u8 field_CEF[165];
struct Sprite *field_D94;
struct Sprite *field_D98[2];
u16 *field_DA0;
struct PokemonMarkMenu field_DA4;
struct UnkPSSStruct_2002370 field_1E5C;
u8 field_20A4[220];
@ -115,6 +118,8 @@ struct PokemonStorageSystemData
struct BoxPokemon *field_218C;
u8 field_2190[164];
u16 movingItem;
u8 field_2236[14478];
u8 field_5AC4[0x800];
};
extern struct UnkPSSStruct_2002370 *gUnknown_02039D04;

View File

@ -1,11 +1,13 @@
#include "global.h"
#include "alloc.h"
#include "bg.h"
#include "decompress.h"
#include "dma3.h"
#include "event_data.h"
#include "field_screen.h"
#include "field_weather.h"
#include "gpu_regs.h"
#include "graphics.h"
#include "international_string_util.h"
#include "item.h"
#include "item_menu.h"
@ -83,6 +85,18 @@ enum
SCREEN_CHANGE_ITEM_FROM_BAG,
};
#define TAG_PAL_WAVEFORM 0xDACA
#define TAG_PAL_DAC8 0xDAC8
#define TAG_PAL_DAC6 0xDAC6
#define TAG_PAL_DACE 0xDACE
#define TAG_PAL_DAC7 0xDAC7
#define TAG_TILE_WAVEFORM 0x5
#define TAG_TILE_10 0x10
#define TAG_TILE_2 0x2
#define TAG_TILE_D 0xD
#define TAG_TILE_A 0xA
IWRAM_DATA u8 gUnknown_03000F78[0x188];
extern const u8 gText_PartyFull[];
@ -117,22 +131,22 @@ void sub_80C7958(u8 curBox);
void ResetWaldaWallpaper(void);
void sub_80C7B14(void);
void sub_80C7BB4(void);
void sub_80CA028(void);
void ScrollBackground(void);
void sub_80C7B80(void);
void sub_80D2AA4(void);
void sub_80C7BE4(void);
void sub_80CAA14(void);
void sub_80CE790(void);
void sub_80CE8E4(void);
void sub_80C9F6C(void);
void GiveChosenBagItem(void);
void sub_80CA888(void);
void sub_80CA044(void);
void sub_80CA0C8(void);
void LoadPSSMenuGfx(void);
void LoadWaveformSpritePalette(void);
void sub_80CDC18(void);
void sub_80CD36C(void);
void sub_80CD3EC(void);
void sub_80CAC1C(void);
void sub_80C9FEC(void);
void SetScrollingBackground(void);
void sub_80CABE0(void);
void sub_80CAEAC(void);
void sub_80D0C60(void);
@ -143,8 +157,13 @@ void sub_80CA0D8(void);
void sub_80CFFD0(void);
void sub_80CE250(void);
void sub_80CE3A0(void);
void sub_80D01B8(void);
void sub_80CE2D8(void);
void sub_80D25F0(void);
void sub_80CA230(void);
void sub_80CA318(void);
void sub_80CA154(void);
void sub_80CA1C4(void);
void sub_80CC064(void);
void sub_80CE324(void);
void ClearBottomWindow(void);
@ -167,7 +186,7 @@ void sub_80CB950(void);
void sub_80CA9C0(void);
void BoxSetMosaic(void);
void sub_80C7CF4(struct Sprite *sprite);
bool8 sub_80CA0A4(void);
bool8 InitPSSWindows(void);
bool8 sub_80CC0A0(void);
bool8 sub_80CE2A8(void);
bool8 sub_80D0164(void);
@ -192,10 +211,10 @@ bool8 CanShifMon(void);
bool8 IsCursorOnCloseBox(void);
bool8 IsMonBeingMoved(void);
bool8 sub_80CE19C(u8 arg0);
void sub_80C7FA8(u8 taskId);
void Cb_InitPSS(u8 taskId);
void Cb_PlaceMon(u8 taskId);
void Cb_ChangeScreen(u8 taskId);
void sub_80C81AC(u8 taskId);
void Cb_ShowPSS(u8 taskId);
void Cb_OnBPressed(u8 taskId);
void Cb_HandleBoxOptions(u8 taskId);
void Cb_OnSelectedMon(u8 taskId);
@ -217,7 +236,7 @@ void Cb_ShowMarkMenu(u8 taskId);
void Cb_ShowMonSummary(u8 taskId);
void Cb_ReleaseMon(u8 taskId);
void task_pokemon_box_related(u8 taskId);
void sub_80C972C_2(u8 taskId);
void Cb_ReshowPSSAfterChoosingBagItem(u8 taskId);
void Cb_MainPSS(u8 taskId);
void Cb_JumpBox(u8 taskId);
void Cb_HandleWallpapers(u8 taskId);
@ -249,6 +268,7 @@ struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority)
void SetWallpaperForCurrentBox(u8 wallpaperId);
void sub_80CAE0C(u8 arg0);
u16 GetMovingItem(void);
void SetCurrentBoxMonData(s32 monId, s32 request, const void *value);
// const rom data
const struct PSS_MenuStringPtrs gUnknown_085716C0[] =
@ -271,25 +291,25 @@ const struct WindowTemplate gUnknown_085716E8 =
.baseBlock = 0x1,
};
static const union AnimCmd sSpriteAnim_85716F0[] =
const union AnimCmd sSpriteAnim_85716F0[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_85716F8[] =
const union AnimCmd sSpriteAnim_85716F8[] =
{
ANIMCMD_FRAME(4, 5),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_8571700[] =
const union AnimCmd sSpriteAnim_8571700[] =
{
ANIMCMD_FRAME(6, 5),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_8571708[] =
const union AnimCmd sSpriteAnim_8571708[] =
{
ANIMCMD_FRAME(10, 5),
ANIMCMD_END
@ -303,13 +323,13 @@ const union AnimCmd *const sSpriteAnimTable_8571710[] =
sSpriteAnim_8571708
};
static const union AffineAnimCmd sSpriteAffineAnim_8571720[] =
const union AffineAnimCmd sSpriteAffineAnim_8571720[] =
{
AFFINEANIMCMD_FRAME(0xE0, 0xE0, 0, 0),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd *const sSpriteAffineAnimTable_8571730[] =
const union AffineAnimCmd *const sSpriteAffineAnimTable_8571730[] =
{
sSpriteAffineAnim_8571720
};
@ -320,8 +340,8 @@ const u8 gUnknown_08571737[] = _("/30");
const u16 gBoxSelectionPopupPalette[] = INCBIN_U16("graphics/unknown/unknown_57173C.gbapal");
const u8 gBoxSelectionPopupCenterTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_center.4bpp");
const u8 gBoxSelectionPopupSidesTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp");
const u32 gUnknown_085720DC[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz");
const u32 gUnknown_08572174[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz");
const u32 gPokemonStorageScrollingBGTileset[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz");
const u32 gPokemonStorageScrollingBGTilemap[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz");
const u32 gUnknown_08572280[] = INCBIN_U32("graphics/unknown/unknown_572280.gbapal");
const u32 gUnknown_085722A0[] = INCBIN_U32("graphics/unknown/unknown_5722A0.bin.lz");
@ -331,7 +351,7 @@ const u16 gUnknown_0857239C[] =
0x2101, 0x2102, 0x2103, 0x2104, 0x2105, 0x2106, 0x2107, 0x2108, 0x2111, 0x2112, 0x2113, 0x2114, 0x2115, 0x2116, 0x2117, 0x2118,
};
const u16 gUnknown_085723DC[] = INCBIN_U16("graphics/unknown/unknown_5723DC.gbapal");
const u16 gUnknown_085723DC[] = INCBIN_U16("graphics/unknown/unknown_5723DC.gbapal"); // Left-most part and Close Box.
const u16 gUnknown_085723FC[] = INCBIN_U16("graphics/unknown/unknown_5723FC.gbapal");
const u16 gUnknown_0857241C[] = INCBIN_U16("graphics/unknown/unknown_57241C.gbapal");
const u16 gUnknown_0857243C[] = INCBIN_U16("graphics/unknown/unknown_57243C.gbapal");
@ -430,20 +450,20 @@ const struct BgTemplate gUnknown_08572734[] =
const struct SpritePalette gWaveformSpritePalette =
{
gWaveformPalette, 0xDACA
gWaveformPalette, TAG_PAL_WAVEFORM
};
const struct SpriteSheet gWaveformSpriteSheet =
{
gWaveformTiles, sizeof(gWaveformTiles), 5
gWaveformTiles, sizeof(gWaveformTiles), TAG_TILE_WAVEFORM
};
const struct OamData gOamData_857286C;
const struct OamData sOamData_857286C;
const struct SpriteTemplate gUnknown_08572754 =
{
.tileTag = 2,
.paletteTag = 0xDAC6,
.oam = &gOamData_857286C,
.tileTag = TAG_TILE_2,
.paletteTag = TAG_PAL_DAC6,
.oam = &sOamData_857286C,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
@ -485,6 +505,146 @@ const struct StorageAction gPCStorageActionTexts[] =
[PC_TEXT_CANT_STORE_MAIL] = {gText_MailCantBeStored, 0},
};
const struct WindowTemplate gUnknown_08572864 =
{
.bg = 0,
.tilemapLeft = 24,
.tilemapTop = 11,
.width = 5,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x5C,
};
const struct OamData sOamData_857286C =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0
};
const struct OamData sOamData_8572874 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 1,
.x = 0,
.matrixNum = 0,
.size = 0,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0
};
const union AnimCmd sSpriteAnim_857287C[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_END
};
const union AnimCmd sSpriteAnim_8572884[] =
{
ANIMCMD_FRAME(2, 8),
ANIMCMD_FRAME(4, 8),
ANIMCMD_FRAME(6, 8),
ANIMCMD_JUMP(0)
};
const union AnimCmd sSpriteAnim_8572894[] =
{
ANIMCMD_FRAME(8, 5),
ANIMCMD_END
};
const union AnimCmd sSpriteAnim_857289C[] =
{
ANIMCMD_FRAME(10, 8),
ANIMCMD_FRAME(4, 8),
ANIMCMD_FRAME(12, 8),
ANIMCMD_JUMP(0)
};
const union AnimCmd *const sSpriteAnimTable_85728AC[] =
{
sSpriteAnim_857287C,
sSpriteAnim_8572884,
sSpriteAnim_8572894,
sSpriteAnim_857289C
};
const struct SpriteTemplate gUnknown_085728BC =
{
.tileTag = 5,
.paletteTag = 0xDACA,
.oam = &sOamData_8572874,
.anims = sSpriteAnimTable_85728AC,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
const struct OamData sOamData_85728EC;
const struct SpriteTemplate gUnknown_085728D4 =
{
.tileTag = 18,
.paletteTag = 0xDAC0,
.oam = &sOamData_85728EC,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
const struct OamData sOamData_85728EC =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 2,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0
};
const union AffineAnimCmd gSpriteAffineAnim_85728F4[] =
{
AFFINEANIMCMD_FRAME(-2, -2, 0, 120),
AFFINEANIMCMD_END
};
const union AffineAnimCmd gSpriteAffineAnim_8572904[] =
{
AFFINEANIMCMD_FRAME(16, 16, 0, 0),
AFFINEANIMCMD_FRAME(16, 16, 0, 15),
AFFINEANIMCMD_END
};
const union AffineAnimCmd *const gSpriteAffineAnimTable_857291C[] =
{
gSpriteAffineAnim_85728F4,
gSpriteAffineAnim_8572904
};
// code
u8 CountMonsInBox(u8 boxId)
{
@ -566,7 +726,7 @@ u8 CountPartyMons(void)
return count;
}
static u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n)
u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n)
{
u8 *str;
@ -577,7 +737,7 @@ static u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n)
return str;
}
static void sub_80C7128(u16 *dest, u16 dest_left, u16 dest_top, const u16 *src, u16 src_left, u16 src_top, u16 dest_width, u16 dest_height, u16 src_width)
void sub_80C7128(u16 *dest, u16 dest_left, u16 dest_top, const u16 *src, u16 src_left, u16 src_top, u16 dest_width, u16 dest_height, u16 src_width)
{
u16 i;
@ -1030,7 +1190,7 @@ void sub_80C7CF4(struct Sprite *sprite)
}
}
void sub_80C7D28(void)
void VblankCb_PSS(void)
{
LoadOam();
ProcessSpriteCopyRequests();
@ -1039,11 +1199,11 @@ void sub_80C7D28(void)
SetGpuReg(REG_OFFSET_BG2HOFS, gUnknown_02039D08->bg2_X);
}
void c2_Box(void)
void Cb2_PSS(void)
{
RunTasks();
do_scheduled_bg_tilemap_copies_to_vram();
sub_80CA028();
ScrollBackground();
sub_80CAA14();
AnimateSprites();
BuildOamBuffer();
@ -1053,7 +1213,7 @@ void Cb2_EnterPSS(u8 boxOption)
{
ResetTasks();
sBoxOption = boxOption;
gUnknown_02039D08 = Alloc(0x62C4);
gUnknown_02039D08 = Alloc(sizeof(*gUnknown_02039D08));
if (gUnknown_02039D08 == NULL)
{
SetMainCallback2(Cb2_ExitPSS);
@ -1061,19 +1221,19 @@ void Cb2_EnterPSS(u8 boxOption)
else
{
gUnknown_02039D08->boxOption = boxOption;
gUnknown_02039D08->unk_0003 = 0;
gUnknown_02039D08->isReshowingPSS = FALSE;
gUnknown_02039D12 = 0;
gUnknown_02039D08->state = 0;
gUnknown_02039D08->taskId = CreateTask(sub_80C7FA8, 3);
gUnknown_02039D08->taskId = CreateTask(Cb_InitPSS, 3);
gUnknown_02039D10 = StorageGetCurrentBox();
SetMainCallback2(c2_Box);
SetMainCallback2(Cb2_PSS);
}
}
void Cb2_ReturnToPSS(void)
{
ResetTasks();
gUnknown_02039D08 = Alloc(0x62C4);
gUnknown_02039D08 = Alloc(sizeof(*gUnknown_02039D08));
if (gUnknown_02039D08 == NULL)
{
SetMainCallback2(Cb2_ExitPSS);
@ -1081,14 +1241,14 @@ void Cb2_ReturnToPSS(void)
else
{
gUnknown_02039D08->boxOption = sBoxOption;
gUnknown_02039D08->unk_0003 = 1;
gUnknown_02039D08->isReshowingPSS = TRUE;
gUnknown_02039D08->state = 0;
gUnknown_02039D08->taskId = CreateTask(sub_80C7FA8, 3);
SetMainCallback2(c2_Box);
gUnknown_02039D08->taskId = CreateTask(Cb_InitPSS, 3);
SetMainCallback2(Cb2_PSS);
}
}
void sub_80C7E50(void)
void ResetAllBgCoords(void)
{
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
@ -1140,7 +1300,7 @@ void SetPSSCallback(TaskFunc newFunc)
gUnknown_02039D08->state = 0;
}
void sub_80C7FA8(u8 taskId)
void Cb_InitPSS(u8 taskId)
{
switch (gUnknown_02039D08->state)
{
@ -1148,7 +1308,7 @@ void sub_80C7FA8(u8 taskId)
SetVBlankCallback(NULL);
SetGpuReg(REG_OFFSET_DISPCNT, 0);
sub_80C7E98();
if (gUnknown_02039D08->unk_0003 != 0)
if (gUnknown_02039D08->isReshowingPSS)
{
switch (gUnknown_02039D0F)
{
@ -1159,15 +1319,15 @@ void sub_80C7FA8(u8 taskId)
sub_80CE8E4();
break;
case 2:
sub_80C9F6C();
GiveChosenBagItem();
break;
}
}
sub_80CA044();
sub_80CA0C8();
LoadPSSMenuGfx();
LoadWaveformSpritePalette();
break;
case 1:
if (!sub_80CA0A4())
if (!InitPSSWindows())
{
SetPSSCallback(Cb_ChangeScreen);
return;
@ -1180,13 +1340,13 @@ void sub_80C7FA8(u8 taskId)
LoadUserWindowBorderGfx(1, 0xB, 0xE0);
break;
case 3:
sub_80C7E50();
if (gUnknown_02039D08->unk_0003 == 0)
ResetAllBgCoords();
if (!gUnknown_02039D08->isReshowingPSS)
sub_80C7F1C();
break;
case 4:
sub_80CAF04();
if (gUnknown_02039D08->unk_0003 == 0)
if (!gUnknown_02039D08->isReshowingPSS)
sub_80CD36C();
else
sub_80CD3EC();
@ -1199,7 +1359,7 @@ void sub_80C7FA8(u8 taskId)
}
else
{
sub_80C9FEC();
SetScrollingBackground();
sub_80CAC1C();
}
break;
@ -1218,8 +1378,8 @@ void sub_80C7FA8(u8 taskId)
if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS)
{
gUnknown_02039D08->field_DA4.baseTileTag = 0xD;
gUnknown_02039D08->field_DA4.basePaletteTag = 0xDACE;
gUnknown_02039D08->field_DA4.baseTileTag = TAG_TILE_D;
gUnknown_02039D08->field_DA4.basePaletteTag = TAG_PAL_DACE;
sub_811F90C(&gUnknown_02039D08->field_DA4);
sub_811FA90();
}
@ -1231,17 +1391,17 @@ void sub_80C7FA8(u8 taskId)
break;
case 10:
sub_80C7F4C();
if (gUnknown_02039D08->unk_0003 == 0)
if (!gUnknown_02039D08->isReshowingPSS)
{
BlendPalettes(0xFFFFFFFF, 0x10, 0);
SetPSSCallback(sub_80C81AC);
SetPSSCallback(Cb_ShowPSS);
}
else
{
BlendPalettes(0xFFFFFFFF, 0x10, 0);
SetPSSCallback(sub_80C972C_2);
SetPSSCallback(Cb_ReshowPSSAfterChoosingBagItem);
}
SetVBlankCallback(sub_80C7D28);
SetVBlankCallback(VblankCb_PSS);
return;
default:
return;
@ -1250,7 +1410,7 @@ void sub_80C7FA8(u8 taskId)
gUnknown_02039D08->state++;
}
void sub_80C81AC(u8 taskId)
void Cb_ShowPSS(u8 taskId)
{
switch (gUnknown_02039D08->state)
{
@ -1266,7 +1426,7 @@ void sub_80C81AC(u8 taskId)
}
}
void sub_80C972C_2(u8 taskId)
void Cb_ReshowPSSAfterChoosingBagItem(u8 taskId)
{
switch (gUnknown_02039D08->state)
{
@ -1881,7 +2041,7 @@ void Cb_DepositMenu(u8 taskId)
{
case 0:
PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX);
sub_80C77E8(&gUnknown_02039D08->field_1E5C, 10, 0xDAC7, 3, FALSE);
sub_80C77E8(&gUnknown_02039D08->field_1E5C, TAG_TILE_A, TAG_PAL_DAC7, 3, FALSE);
sub_80C78D4(gUnknown_02039D0E);
gUnknown_02039D08->state++;
break;
@ -2529,7 +2689,7 @@ void Cb_JumpBox(u8 taskId)
{
case 0:
PrintStorageActionText(PC_TEXT_JUMP_TO_WHICH_BOX);
sub_80C77E8(&gUnknown_02039D08->field_1E5C, 10, 0xDAC7, 3, FALSE);
sub_80C77E8(&gUnknown_02039D08->field_1E5C, TAG_TILE_A, TAG_PAL_DAC7, 3, FALSE);
sub_80C78D4(StorageGetCurrentBox());
gUnknown_02039D08->state++;
break;
@ -2791,3 +2951,109 @@ void Cb_ChangeScreen(u8 taskId)
DestroyTask(taskId);
}
void GiveChosenBagItem(void)
{
u16 item = gSpecialVar_ItemId;
if (item != 0)
{
u8 id = GetBoxCursorPosition();
if (sInPartyMenu)
SetMonData(&gPlayerParty[id], MON_DATA_HELD_ITEM, &item);
else
SetCurrentBoxMonData(id, MON_DATA_HELD_ITEM, &item);
RemoveBagItem(item, 1);
}
}
void FreePSSData(void)
{
sub_80D25F0();
sub_80D01B8();
FREE_AND_SET_NULL(gUnknown_02039D08);
FreeAllWindowBuffers();
}
void SetScrollingBackground(void)
{
SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_PRIORITY(3) | BGCNT_CHARBASE(3) | BGCNT_16COLOR | BGCNT_SCREENBASE(31));
DecompressAndLoadBgGfxUsingHeap(3, gPokemonStorageScrollingBGTileset, 0, 0, 0);
LZ77UnCompVram(gPokemonStorageScrollingBGTilemap, (void *)VRAM + 0xF800);
}
void ScrollBackground(void)
{
ChangeBgX(3, 128, 1);
ChangeBgY(3, 128, 2);
}
void LoadPSSMenuGfx(void)
{
InitBgsFromTemplates(0, gUnknown_08572734, ARRAY_COUNT(gUnknown_08572734));
DecompressAndLoadBgGfxUsingHeap(1, gPSSMenu_Gfx, 0, 0, 0);
LZ77UnCompWram(gUnknown_085722A0, gUnknown_02039D08->field_5AC4);
SetBgTilemapBuffer(1, gUnknown_02039D08->field_5AC4);
ShowBg(1);
schedule_bg_copy_tilemap_to_vram(1);
}
bool8 InitPSSWindows(void)
{
if (!InitWindows(gUnknown_08572714))
{
return FALSE;
}
else
{
DeactivateAllTextPrinters();
return TRUE;
}
}
void LoadWaveformSpritePalette(void)
{
LoadSpritePalette(&gWaveformSpritePalette);
}
void sub_80CA0D8(void)
{
LoadPalette(gUnknown_085723DC, 0, 0x20);
LoadPalette(gUnknown_085723FC, 0x20, 0x20);
LoadPalette(gUnknown_085726F4, 0xF0, 0x20);
if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS)
LoadPalette(gUnknown_0857241C, 0x30, 0x20);
else
LoadPalette(gUnknown_0857243C, 0x30, 0x20);
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_16COLOR | BGCNT_SCREENBASE(30));
sub_80CA318();
sub_80CA154();
sub_80CA1C4();
sub_80CA230();
}
void sub_80CA154(void)
{
gUnknown_02039D08->field_D94 = sub_811FFB4(TAG_TILE_10, TAG_PAL_DAC8, NULL);
gUnknown_02039D08->field_D94->oam.priority = 1;
gUnknown_02039D08->field_D94->subpriority = 1;
gUnknown_02039D08->field_D94->pos1.x = 40;
gUnknown_02039D08->field_D94->pos1.y = 150;
gUnknown_02039D08->field_DA0 = (void*) OBJ_VRAM0 + 32 * GetSpriteTileStartByTag(TAG_TILE_10);
}
void sub_80CA1C4(void)
{
u16 i;
struct SpriteSheet sheet = gWaveformSpriteSheet;
LoadSpriteSheet(&sheet);
for (i = 0; i < 2; i++)
{
u8 spriteId = CreateSprite(&gUnknown_085728BC, i * 63 + 8, 9, 2);
gUnknown_02039D08->field_D98[i] = &gSprites[spriteId];
}
}