diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-12 13:41:32 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-12 13:41:32 -0500 |
commit | aadd5c8ac07ef5967d8e2cf58fbdd04f79d5b82a (patch) | |
tree | bc46874635718a20ee9712460ce96ffd002a561f | |
parent | 8c2c8ed3a9e377382a0ac645053e4b7b4ab41c4e (diff) |
through sub_8099EB0 and relevant data
-rw-r--r-- | asm/pokemon_storage_system.s | 192 | ||||
-rw-r--r-- | data/pokemon_storage_system.s | 346 | ||||
-rw-r--r-- | include/pokemon_storage_system.h | 7 | ||||
-rw-r--r-- | ld_script.txt | 1 | ||||
-rw-r--r-- | src/pokemon/pokemon_storage_system_4.c | 233 |
5 files changed, 237 insertions, 542 deletions
diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index e66901961..55c7d448b 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -5,198 +5,6 @@ .text - thumb_func_start sub_8099DCC -sub_8099DCC: @ 8099DCC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl get_preferred_box - lsls r0, 24 - lsrs r0, 24 - ldr r1, _08099DF8 @ =gPokemonStorage - ldr r2, _08099DFC @ =0x000083c2 - adds r1, r2 - adds r0, r1 - movs r1, 0 - strb r4, [r0] - ldr r0, _08099E00 @ =gPokemonStorageSystemPtr - ldr r0, [r0] - ldr r2, _08099E04 @ =0x00001032 - adds r0, r2 - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08099DF8: .4byte gPokemonStorage -_08099DFC: .4byte 0x000083c2 -_08099E00: .4byte gPokemonStorageSystemPtr -_08099E04: .4byte 0x00001032 - thumb_func_end sub_8099DCC - - thumb_func_start sub_8099E08 -sub_8099E08: @ 8099E08 - push {r4,r5,lr} - sub sp, 0x4 - ldr r0, _08099E24 @ =gPokemonStorageSystemPtr - ldr r5, [r0] - ldr r0, _08099E28 @ =0x00001032 - adds r4, r5, r0 - ldrb r0, [r4] - cmp r0, 0x1 - beq _08099E54 - cmp r0, 0x1 - bgt _08099E2C - cmp r0, 0 - beq _08099E36 - b _08099EA6 - .align 2, 0 -_08099E24: .4byte gPokemonStorageSystemPtr -_08099E28: .4byte 0x00001032 -_08099E2C: - cmp r0, 0x2 - beq _08099E90 - cmp r0, 0x3 - beq _08099EA2 - b _08099EA6 -_08099E36: - ldr r1, _08099E4C @ =0x00000d08 - adds r0, r5, r1 - ldr r0, [r0] - ldr r1, _08099E50 @ =0x0000ffff - str r1, [sp] - movs r1, 0x1 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _08099E9A - .align 2, 0 -_08099E4C: .4byte 0x00000d08 -_08099E50: .4byte 0x0000ffff -_08099E54: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _08099EA6 - bl get_preferred_box - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_8099EB0 - bl sub_809A654 - ldr r1, _08099E88 @ =0x00000d08 - adds r0, r5, r1 - ldr r0, [r0] - ldr r1, _08099E8C @ =0x0000ffff - str r1, [sp] - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - b _08099E9A - .align 2, 0 -_08099E88: .4byte 0x00000d08 -_08099E8C: .4byte 0x0000ffff -_08099E90: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _08099EA6 -_08099E9A: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _08099EA6 -_08099EA2: - movs r0, 0 - b _08099EA8 -_08099EA6: - movs r0, 0x1 -_08099EA8: - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8099E08 - - thumb_func_start sub_8099EB0 -sub_8099EB0: @ 8099EB0 - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - cmp r1, 0 - beq _08099ED8 - ldr r0, _08099F38 @ =gPokemonStorageSystemPtr - ldr r0, [r0] - movs r2, 0 - ldr r3, _08099F3C @ =0x000008ba - adds r1, r0, r3 - ldrb r0, [r1] - cmp r0, 0 - bne _08099ED0 - movs r2, 0x1 -_08099ED0: - strb r2, [r1] - ldr r0, _08099F40 @ =0x0600d000 - bl sub_809A14C -_08099ED8: - ldr r0, _08099F44 @ =gPokemonStorage - ldr r1, _08099F48 @ =0x000083c2 - adds r0, r1 - adds r0, r4, r0 - ldrb r4, [r0] - lsls r4, 4 - ldr r0, _08099F4C @ =gWallpaperTable - adds r4, r0 - ldr r0, [r4, 0xC] - ldr r1, _08099F38 @ =gPokemonStorageSystemPtr - ldr r5, [r1] - ldr r2, _08099F3C @ =0x000008ba - adds r6, r5, r2 - ldrb r2, [r6] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 20 - movs r3, 0x80 - lsls r3, 15 - adds r1, r3 - lsrs r1, 16 - movs r2, 0x60 - bl LoadPalette - ldr r0, [r4, 0x8] - ldr r1, _08099F50 @ =0x00000d62 - adds r5, r1 - adds r1, r5, 0 - bl LZ77UnCompWram - ldr r0, _08099F40 @ =0x0600d000 - lsls r2, r7, 24 - asrs r2, 24 - ldrb r3, [r6] - adds r1, r5, 0 - bl sub_8099F58 - ldr r0, [r4] - ldrb r1, [r6] - lsls r1, 13 - ldr r2, _08099F54 @ =0x06008000 - adds r1, r2 - bl LZ77UnCompVram - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08099F38: .4byte gPokemonStorageSystemPtr -_08099F3C: .4byte 0x000008ba -_08099F40: .4byte 0x0600d000 -_08099F44: .4byte gPokemonStorage -_08099F48: .4byte 0x000083c2 -_08099F4C: .4byte gWallpaperTable -_08099F50: .4byte 0x00000d62 -_08099F54: .4byte 0x06008000 - thumb_func_end sub_8099EB0 - thumb_func_start sub_8099F58 sub_8099F58: @ 8099F58 push {r4-r7,lr} diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s index 883630413..8d62633d3 100644 --- a/data/pokemon_storage_system.s +++ b/data/pokemon_storage_system.s @@ -3,352 +3,6 @@ .section .rodata - .align 2 -gWallpaperPalettes_Forest: @ 83B6F64 - .incbin "graphics/pokemon_storage/box_bg1.gbapal" - .incbin "graphics/pokemon_storage/forest_frame.gbapal" - .incbin "graphics/pokemon_storage/forest_bg.gbapal" - - .align 2 -gWallpaperTiles_Forest: @ 83B6FC4 - .incbin "graphics/pokemon_storage/forest.4bpp.lz" - - .align 2 -gWallpaperTilemap_Forest: @ 83B7394 - .incbin "graphics/pokemon_storage/forest.bin.lz" - - .align 2 -gWallpaperPalettes_City: @ 83B7470 - .incbin "graphics/pokemon_storage/box_bg1.gbapal" - .incbin "graphics/pokemon_storage/city_frame.gbapal" - .incbin "graphics/pokemon_storage/city_bg.gbapal" - - .align 2 -gWallpaperTiles_City: @ 83B74D0 - .incbin "graphics/pokemon_storage/city.4bpp.lz" - - .align 2 -gWallpaperTilemap_City: @ 83B76D8 - .incbin "graphics/pokemon_storage/city.bin.lz" - - .align 2 -gWallpaperPalettes_Desert: @ 83B7788 - .incbin "graphics/pokemon_storage/box_bg1.gbapal" - .incbin "graphics/pokemon_storage/desert_frame.gbapal" - .incbin "graphics/pokemon_storage/desert_bg.gbapal" - - .align 2 -gWallpaperTiles_Desert: @ 83B77E8 - .incbin "graphics/pokemon_storage/desert.4bpp.lz" - - .align 2 -gWallpaperTilemap_Desert: @ 83B7AD4 - .incbin "graphics/pokemon_storage/desert.bin.lz" - - .align 2 -gWallpaperPalettes_Savanna: @ 83B7BB8 - .incbin "graphics/pokemon_storage/box_bg1.gbapal" - .incbin "graphics/pokemon_storage/savanna_frame.gbapal" - .incbin "graphics/pokemon_storage/savanna_bg.gbapal" - - .align 2 -gWallpaperTiles_Savanna: @ 83B7C18 - .incbin "graphics/pokemon_storage/savanna.4bpp.lz" - - .align 2 -gWallpaperTilemap_Savanna: @ 83B7E38 - .incbin "graphics/pokemon_storage/savanna.bin.lz" - - .align 2 -gWallpaperPalettes_Crag: @ 83B7F04 - .incbin "graphics/pokemon_storage/box_bg1.gbapal" - .incbin "graphics/pokemon_storage/crag_frame.gbapal" - .incbin "graphics/pokemon_storage/crag_bg.gbapal" - - .align 2 -gWallpaperTiles_Crag: @ 83B7F64 - .incbin "graphics/pokemon_storage/crag.4bpp.lz" - - .align 2 -gWallpaperTilemap_Crag: @ 83B82B4 - .incbin "graphics/pokemon_storage/crag.bin.lz" - - .align 2 -gWallpaperPalettes_Volcano: @ 83B838C - .incbin "graphics/pokemon_storage/box_bg1.gbapal" - .incbin "graphics/pokemon_storage/volcano_frame.gbapal" - .incbin "graphics/pokemon_storage/volcano_bg.gbapal" - - .align 2 -gWallpaperTiles_Volcano: @ 83B83EC - .incbin "graphics/pokemon_storage/volcano.4bpp.lz" - - .space 4 - - .align 2 -gWallpaperTilemap_Volcano: @ 83B8720 - .incbin "graphics/pokemon_storage/volcano.bin.lz" - - .align 2 -gWallpaperPalettes_Snow: @ 83B87F8 - .incbin "graphics/pokemon_storage/box_bg1.gbapal" - .incbin "graphics/pokemon_storage/snow_frame.gbapal" - .incbin "graphics/pokemon_storage/snow_bg.gbapal" - - .align 2 -gWallpaperTiles_Snow: @ 83B8858 - .incbin "graphics/pokemon_storage/snow.4bpp.lz" - - .align 2 -gWallpaperTilemap_Snow: @ 83B8B10 - .incbin "graphics/pokemon_storage/snow.bin.lz" - - .align 2 -gWallpaperPalettes_Cave: @ 83B8BDC - .incbin "graphics/pokemon_storage/box_bg1.gbapal" - .incbin "graphics/pokemon_storage/cave_frame.gbapal" - .incbin "graphics/pokemon_storage/cave_bg.gbapal" - - .align 2 -gWallpaperTiles_Cave: @ 83B8C3C - .incbin "graphics/pokemon_storage/cave.4bpp.lz" - - .align 2 -gWallpaperTilemap_Cave: @ 83B8F80 - .incbin "graphics/pokemon_storage/cave.bin.lz" - - .align 2 -gWallpaperPalettes_Beach: @ 83B905C - .incbin "graphics/pokemon_storage/box_bg1.gbapal" - .incbin "graphics/pokemon_storage/beach_frame.gbapal" - .incbin "graphics/pokemon_storage/beach_bg.gbapal" - - .align 2 -gWallpaperTiles_Beach: @ 83B90BC - .incbin "graphics/pokemon_storage/beach.4bpp.lz" - - .align 2 -gWallpaperTilemap_Beach: @ 83B9440 - .incbin "graphics/pokemon_storage/beach.bin.lz" - - .align 2 -gWallpaperPalettes_Seafloor: @ 83B9528 - .incbin "graphics/pokemon_storage/box_bg1.gbapal" - .incbin "graphics/pokemon_storage/seafloor_frame.gbapal" - .incbin "graphics/pokemon_storage/seafloor_bg.gbapal" - - .align 2 -gWallpaperTiles_Seafloor: @ 83B9588 - .incbin "graphics/pokemon_storage/seafloor.4bpp.lz" - - .align 2 -gWallpaperTilemap_Seafloor: @ 83B983C - .incbin "graphics/pokemon_storage/seafloor.bin.lz" - - .align 2 -gWallpaperPalettes_River: @ 83B9918 - .incbin "graphics/pokemon_storage/box_bg1.gbapal" - .incbin "graphics/pokemon_storage/river_frame.gbapal" - .incbin "graphics/pokemon_storage/river_bg.gbapal" - - .align 2 -gWallpaperTiles_River: @ 83B9978 - .incbin "graphics/pokemon_storage/river.4bpp.lz" - - .align 2 -gWallpaperTilemap_River: @ 83B9C0C - .incbin "graphics/pokemon_storage/river.bin.lz" - - .align 2 -gWallpaperPalettes_Sky: @ 83B9CF8 - .incbin "graphics/pokemon_storage/box_bg1.gbapal" - .incbin "graphics/pokemon_storage/sky_frame.gbapal" - .incbin "graphics/pokemon_storage/sky_bg.gbapal" - - .align 2 -gWallpaperTiles_Sky: @ 83B9D58 - .incbin "graphics/pokemon_storage/sky.4bpp.lz" - - .align 2 -gWallpaperTilemap_Sky: @ 83B9FF0 - .incbin "graphics/pokemon_storage/sky.bin.lz" - - .align 2 -gWallpaperPalettes_Polkadot: @ 83BA0D0 - .incbin "graphics/pokemon_storage/box_bg2.gbapal" - .incbin "graphics/pokemon_storage/polkadot_frame.gbapal" - .incbin "graphics/pokemon_storage/polkadot_bg.gbapal" - - .align 2 -gWallpaperTiles_Polkadot: @ 83BA130 - .incbin "graphics/pokemon_storage/polkadot.4bpp.lz" - - .align 2 -gWallpaperTilemap_Polkadot: @ 83BA32C - .incbin "graphics/pokemon_storage/polkadot.bin.lz" - - .align 2 -gWallpaperPalettes_Pokecenter: @ 83BA3E4 - .incbin "graphics/pokemon_storage/box_bg2.gbapal" - .incbin "graphics/pokemon_storage/pokecenter_frame.gbapal" - .incbin "graphics/pokemon_storage/pokecenter_bg.gbapal" - - .align 2 -gWallpaperTiles_Pokecenter: @ 83BA444 - .incbin "graphics/pokemon_storage/pokecenter.4bpp.lz" - - .align 2 -gWallpaperTilemap_Pokecenter: @ 83BA7E8 - .incbin "graphics/pokemon_storage/pokecenter.bin.lz" - - .align 2 -gWallpaperPalettes_Machine: @ 83BA8FC - .incbin "graphics/pokemon_storage/box_bg3.gbapal" - .incbin "graphics/pokemon_storage/machine_frame.gbapal" - .incbin "graphics/pokemon_storage/machine_bg.gbapal" - - .align 2 -gWallpaperTiles_Machine: @ 83BA95C - .incbin "graphics/pokemon_storage/machine.4bpp.lz" - - .align 2 -gWallpaperTilemap_Machine: @ 83BAC4C - .incbin "graphics/pokemon_storage/machine.bin.lz" - - .align 2 -gWallpaperPalettes_Plain: @ 83BAD18 - .incbin "graphics/pokemon_storage/box_bg4.gbapal" - .incbin "graphics/pokemon_storage/plain_frame.gbapal" - .incbin "graphics/pokemon_storage/plain_bg.gbapal" - - .align 2 -gWallpaperTiles_Plain: @ 83BAD78 - .incbin "graphics/pokemon_storage/plain.4bpp.lz" - - .align 2 -gWallpaperTilemap_Plain: @ 83BAE74 - .incbin "graphics/pokemon_storage/plain.bin.lz" - -@ 12×18 tilemap - .incbin "graphics/unused/tilemap_3BAEF8.bin" - - .align 1 -gUnknown_083BB0A8:: @ 83BB0A8 - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - - .align 2 -gWallpaperTable:: @ 83BB0E8 - @ Forest - .4byte gWallpaperTiles_Forest - .4byte 0x3D0 - .4byte gWallpaperTilemap_Forest - .4byte gWallpaperPalettes_Forest - - @ City - .4byte gWallpaperTiles_City - .4byte 0x208 - .4byte gWallpaperTilemap_City - .4byte gWallpaperPalettes_City - - @ Desert - .4byte gWallpaperTiles_Desert - .4byte 0x2EC - .4byte gWallpaperTilemap_Desert - .4byte gWallpaperPalettes_Desert - - @ Savanna - .4byte gWallpaperTiles_Savanna - .4byte 0x220 - .4byte gWallpaperTilemap_Savanna - .4byte gWallpaperPalettes_Savanna - - @ Crag - .4byte gWallpaperTiles_Crag - .4byte 0x350 - .4byte gWallpaperTilemap_Crag - .4byte gWallpaperPalettes_Crag - - @ Volcano - .4byte gWallpaperTiles_Volcano - .4byte 0x334 - .4byte gWallpaperTilemap_Volcano - .4byte gWallpaperPalettes_Volcano - - @ Snow - .4byte gWallpaperTiles_Snow - .4byte 0x2B8 - .4byte gWallpaperTilemap_Snow - .4byte gWallpaperPalettes_Snow - - @ Cave - .4byte gWallpaperTiles_Cave - .4byte 0x344 - .4byte gWallpaperTilemap_Cave - .4byte gWallpaperPalettes_Cave - - @ Beach - .4byte gWallpaperTiles_Beach - .4byte 0x384 - .4byte gWallpaperTilemap_Beach - .4byte gWallpaperPalettes_Beach - - @ Seafloor - .4byte gWallpaperTiles_Seafloor - .4byte 0x2B4 - .4byte gWallpaperTilemap_Seafloor - .4byte gWallpaperPalettes_Seafloor - - @ River - .4byte gWallpaperTiles_River - .4byte 0x294 - .4byte gWallpaperTilemap_River - .4byte gWallpaperPalettes_River - - @ Sky - .4byte gWallpaperTiles_Sky - .4byte 0x298 - .4byte gWallpaperTilemap_Sky - .4byte gWallpaperPalettes_Sky - - @ Polkadot - .4byte gWallpaperTiles_Polkadot - .4byte 0x1FC - .4byte gWallpaperTilemap_Polkadot - .4byte gWallpaperPalettes_Polkadot - - @ Pokecenter - .4byte gWallpaperTiles_Pokecenter - .4byte 0x3A4 - .4byte gWallpaperTilemap_Pokecenter - .4byte gWallpaperPalettes_Pokecenter - - @ Machine - .4byte gWallpaperTiles_Machine - .4byte 0x2F0 - .4byte gWallpaperTilemap_Machine - .4byte gWallpaperPalettes_Machine - - @ Plain - .4byte gWallpaperTiles_Plain - .4byte 0xFC - .4byte gWallpaperTilemap_Plain - .4byte gWallpaperPalettes_Plain - PCPal_Arrow: .incbin "graphics/pokemon_storage/arrow.gbapal" PCGfx_Arrow: diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 09b3be60f..cd4dceadf 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -101,7 +101,7 @@ struct PokemonStorageSystemData { u16 unk_08b4; u16 unk_08b6; u16 unk_08b8; - u8 unk_08ba; + bool8 unk_08ba; u8 unk_08bb; u16 unk_08bc; u16 unk_08be; @@ -112,12 +112,13 @@ struct PokemonStorageSystemData { u16 unk_08c8; u8 unk_08ca[0x400]; u8 unk_0cca; - u16 unk_0ccc[0x20]; + u16 unk_0ccc[0x1e]; + u32 unk_0d08; u8 filler_0d0c[0x50]; u16 unk_0d5c; s16 unk_0d5e; s16 unk_0d60; - u8 unk_0d62[0x2d0]; + u16 unk_0d62[360]; u8 unk_1032; struct Sprite *unk_1034; struct Sprite *unk_1038[6]; // party diff --git a/ld_script.txt b/ld_script.txt index e1d28736e..b0b5d4796 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -550,6 +550,7 @@ SECTIONS { src/pokemon/pokemon_storage_system.o(.rodata); src/pokemon/pokemon_storage_system_2.o(.rodata); src/pokemon/pokemon_storage_system_3.o(.rodata); + src/pokemon/pokemon_storage_system_4.o(.rodata); data/pokemon_storage_system.o(.rodata); src/pokemon/pokemon_icon.o(.rodata); src/pokemon/pokemon_summary_screen.o(.rodata); diff --git a/src/pokemon/pokemon_storage_system_4.c b/src/pokemon/pokemon_storage_system_4.c index 697292d5c..8982ce461 100644 --- a/src/pokemon/pokemon_storage_system_4.c +++ b/src/pokemon/pokemon_storage_system_4.c @@ -1,6 +1,7 @@ // Includes #include "global.h" +#include "palette.h" #include "pokemon_storage_system.h" // Static type declarations @@ -16,14 +17,24 @@ EWRAM_DATA u8 gUnknown_020384E8 = 0; EWRAM_DATA u8 gUnknown_020384E9 = 0; EWRAM_DATA u16 gUnknown_020384EA = 0; +struct WallpaperTable { + const u8 *tiles; + u32 size; + const u8 *tileMap; + const u16 *palettes; +}; + // Static ROM declarations void sub_809900C(u8 boxId, s8 a1); s8 sub_8099D90(u8 boxId); void sub_8099EB0(u8 boxId, s8 a1); +void sub_8099F58(u16 *vdest, const u16 *src, s8 a2, u8 a3); +void sub_809A14C(u16 *vdest); void sub_809A23C(u8 boxId); void sub_809A3D0(u8 boxId, s8 a1); void sub_809A598(void); +void sub_809A654(void); void sub_809A6DC(void); void sub_809A774(s8 a0); void sub_809A810(void); @@ -34,7 +45,7 @@ void sub_809A810(void); void sub_8099BF8(u8 boxId) { - gPokemonStorageSystemPtr->unk_08ba = 0; + gPokemonStorageSystemPtr->unk_08ba = FALSE; gPokemonStorageSystemPtr->unk_08b4 = 0; DmaFill32(3, 0, BG_SCREEN_ADDR(26), 0x1000); sub_8099EB0(boxId, 0); @@ -92,3 +103,223 @@ s8 sub_8099D90(u8 boxId) } return i <= 6 ? 1 : -1; } + +void sub_8099DCC(u8 wallpaperId) +{ + u8 curBox = get_preferred_box(); + gPokemonStorage.wallpaper[curBox] = wallpaperId; + gPokemonStorageSystemPtr->unk_1032 = 0; +} + +bool8 sub_8099E08(void) +{ + switch (gPokemonStorageSystemPtr->unk_1032) + { + case 0: + BeginNormalPaletteFade(gPokemonStorageSystemPtr->unk_0d08, 1, 0, 0x10, 0xffff); + gPokemonStorageSystemPtr->unk_1032++; + break; + case 1: + if (!UpdatePaletteFade()) + { + u8 curBox = get_preferred_box(); + sub_8099EB0(curBox, 0); + sub_809A654(); + BeginNormalPaletteFade(gPokemonStorageSystemPtr->unk_0d08, 1, 0x10, 0, 0xffff); + gPokemonStorageSystemPtr->unk_1032++; + } + break; + case 2: + if (!UpdatePaletteFade()) + gPokemonStorageSystemPtr->unk_1032++; + break; + case 3: + return FALSE; + } + return TRUE; +} + +const u16 gWallpaperPalettes_Forest[] = INCBIN_U16("graphics/pokemon_storage/box_bg1.gbapal"); +const u16 gWallpaperPalettes_Forest_2[] = INCBIN_U16("graphics/pokemon_storage/forest_frame.gbapal"); +const u16 gWallpaperPalettes_Forest_2_3[] = INCBIN_U16("graphics/pokemon_storage/forest_bg.gbapal"); + +const u8 gWallpaperTiles_Forest[] = INCBIN_U8("graphics/pokemon_storage/forest.4bpp.lz"); + +const u8 gWallpaperTilemap_Forest[] = INCBIN_U8("graphics/pokemon_storage/forest.bin.lz"); + +const u16 gWallpaperPalettes_City[] = INCBIN_U16("graphics/pokemon_storage/box_bg1.gbapal"); +const u16 gWallpaperPalettes_City_2[] = INCBIN_U16("graphics/pokemon_storage/city_frame.gbapal"); +const u16 gWallpaperPalettes_City_2_3[] = INCBIN_U16("graphics/pokemon_storage/city_bg.gbapal"); + +const u8 gWallpaperTiles_City[] = INCBIN_U8("graphics/pokemon_storage/city.4bpp.lz"); + +const u8 gWallpaperTilemap_City[] = INCBIN_U8("graphics/pokemon_storage/city.bin.lz"); + +const u16 gWallpaperPalettes_Desert[] = INCBIN_U16("graphics/pokemon_storage/box_bg1.gbapal"); +const u16 gWallpaperPalettes_Desert_2[] = INCBIN_U16("graphics/pokemon_storage/desert_frame.gbapal"); +const u16 gWallpaperPalettes_Desert_2_3[] = INCBIN_U16("graphics/pokemon_storage/desert_bg.gbapal"); + +const u8 gWallpaperTiles_Desert[] = INCBIN_U8("graphics/pokemon_storage/desert.4bpp.lz"); + +const u8 gWallpaperTilemap_Desert[] = INCBIN_U8("graphics/pokemon_storage/desert.bin.lz"); + +const u16 gWallpaperPalettes_Savanna[] = INCBIN_U16("graphics/pokemon_storage/box_bg1.gbapal"); +const u16 gWallpaperPalettes_Savanna_2[] = INCBIN_U16("graphics/pokemon_storage/savanna_frame.gbapal"); +const u16 gWallpaperPalettes_Savanna_2_3[] = INCBIN_U16("graphics/pokemon_storage/savanna_bg.gbapal"); + +const u8 gWallpaperTiles_Savanna[] = INCBIN_U8("graphics/pokemon_storage/savanna.4bpp.lz"); + +const u8 gWallpaperTilemap_Savanna[] = INCBIN_U8("graphics/pokemon_storage/savanna.bin.lz"); + +const u16 gWallpaperPalettes_Crag[] = INCBIN_U16("graphics/pokemon_storage/box_bg1.gbapal"); +const u16 gWallpaperPalettes_Crag_2[] = INCBIN_U16("graphics/pokemon_storage/crag_frame.gbapal"); +const u16 gWallpaperPalettes_Crag_2_3[] = INCBIN_U16("graphics/pokemon_storage/crag_bg.gbapal"); + +const u8 gWallpaperTiles_Crag[] = INCBIN_U8("graphics/pokemon_storage/crag.4bpp.lz"); + +const u8 gWallpaperTilemap_Crag[] = INCBIN_U8("graphics/pokemon_storage/crag.bin.lz"); + +const u16 gWallpaperPalettes_Volcano[] = INCBIN_U16("graphics/pokemon_storage/box_bg1.gbapal"); +const u16 gWallpaperPalettes_Volcano_2[] = INCBIN_U16("graphics/pokemon_storage/volcano_frame.gbapal"); +const u16 gWallpaperPalettes_Volcano_2_3[] = INCBIN_U16("graphics/pokemon_storage/volcano_bg.gbapal"); + +const u8 gWallpaperTiles_Volcano[] = INCBIN_U8("graphics/pokemon_storage/volcano.4bpp.lz"); +const u32 filler_83b871c = 0; // needed to match but otherwise garbage + +const u8 gWallpaperTilemap_Volcano[] = INCBIN_U8("graphics/pokemon_storage/volcano.bin.lz"); + +const u16 gWallpaperPalettes_Snow[] = INCBIN_U16("graphics/pokemon_storage/box_bg1.gbapal"); +const u16 gWallpaperPalettes_Snow_2[] = INCBIN_U16("graphics/pokemon_storage/snow_frame.gbapal"); +const u16 gWallpaperPalettes_Snow_2_3[] = INCBIN_U16("graphics/pokemon_storage/snow_bg.gbapal"); + +const u8 gWallpaperTiles_Snow[] = INCBIN_U8("graphics/pokemon_storage/snow.4bpp.lz"); + +const u8 gWallpaperTilemap_Snow[] = INCBIN_U8("graphics/pokemon_storage/snow.bin.lz"); + +const u16 gWallpaperPalettes_Cave[] = INCBIN_U16("graphics/pokemon_storage/box_bg1.gbapal"); +const u16 gWallpaperPalettes_Cave_2[] = INCBIN_U16("graphics/pokemon_storage/cave_frame.gbapal"); +const u16 gWallpaperPalettes_Cave_2_3[] = INCBIN_U16("graphics/pokemon_storage/cave_bg.gbapal"); + +const u8 gWallpaperTiles_Cave[] = INCBIN_U8("graphics/pokemon_storage/cave.4bpp.lz"); + +const u8 gWallpaperTilemap_Cave[] = INCBIN_U8("graphics/pokemon_storage/cave.bin.lz"); + +const u16 gWallpaperPalettes_Beach[] = INCBIN_U16("graphics/pokemon_storage/box_bg1.gbapal"); +const u16 gWallpaperPalettes_Beach_2[] = INCBIN_U16("graphics/pokemon_storage/beach_frame.gbapal"); +const u16 gWallpaperPalettes_Beach_2_3[] = INCBIN_U16("graphics/pokemon_storage/beach_bg.gbapal"); + +const u8 gWallpaperTiles_Beach[] = INCBIN_U8("graphics/pokemon_storage/beach.4bpp.lz"); + +const u8 gWallpaperTilemap_Beach[] = INCBIN_U8("graphics/pokemon_storage/beach.bin.lz"); + +const u16 gWallpaperPalettes_Seafloor[] = INCBIN_U16("graphics/pokemon_storage/box_bg1.gbapal"); +const u16 gWallpaperPalettes_Seafloor_2[] = INCBIN_U16("graphics/pokemon_storage/seafloor_frame.gbapal"); +const u16 gWallpaperPalettes_Seafloor_2_3[] = INCBIN_U16("graphics/pokemon_storage/seafloor_bg.gbapal"); + +const u8 gWallpaperTiles_Seafloor[] = INCBIN_U8("graphics/pokemon_storage/seafloor.4bpp.lz"); + +const u8 gWallpaperTilemap_Seafloor[] = INCBIN_U8("graphics/pokemon_storage/seafloor.bin.lz"); + +const u16 gWallpaperPalettes_River[] = INCBIN_U16("graphics/pokemon_storage/box_bg1.gbapal"); +const u16 gWallpaperPalettes_River_2[] = INCBIN_U16("graphics/pokemon_storage/river_frame.gbapal"); +const u16 gWallpaperPalettes_River_2_3[] = INCBIN_U16("graphics/pokemon_storage/river_bg.gbapal"); + +const u8 gWallpaperTiles_River[] = INCBIN_U8("graphics/pokemon_storage/river.4bpp.lz"); + +const u8 gWallpaperTilemap_River[] = INCBIN_U8("graphics/pokemon_storage/river.bin.lz"); + +const u16 gWallpaperPalettes_Sky[] = INCBIN_U16("graphics/pokemon_storage/box_bg1.gbapal"); +const u16 gWallpaperPalettes_Sky_2[] = INCBIN_U16("graphics/pokemon_storage/sky_frame.gbapal"); +const u16 gWallpaperPalettes_Sky_2_3[] = INCBIN_U16("graphics/pokemon_storage/sky_bg.gbapal"); + +const u8 gWallpaperTiles_Sky[] = INCBIN_U8("graphics/pokemon_storage/sky.4bpp.lz"); + +const u8 gWallpaperTilemap_Sky[] = INCBIN_U8("graphics/pokemon_storage/sky.bin.lz"); + +const u16 gWallpaperPalettes_Polkadot[] = INCBIN_U16("graphics/pokemon_storage/box_bg2.gbapal"); +const u16 gWallpaperPalettes_Polkadot_2[] = INCBIN_U16("graphics/pokemon_storage/polkadot_frame.gbapal"); +const u16 gWallpaperPalettes_Polkadot_2_3[] = INCBIN_U16("graphics/pokemon_storage/polkadot_bg.gbapal"); + +const u8 gWallpaperTiles_Polkadot[] = INCBIN_U8("graphics/pokemon_storage/polkadot.4bpp.lz"); + +const u8 gWallpaperTilemap_Polkadot[] = INCBIN_U8("graphics/pokemon_storage/polkadot.bin.lz"); + +const u16 gWallpaperPalettes_Pokecenter[] = INCBIN_U16("graphics/pokemon_storage/box_bg2.gbapal"); +const u16 gWallpaperPalettes_Pokecenter_2[] = INCBIN_U16("graphics/pokemon_storage/pokecenter_frame.gbapal"); +const u16 gWallpaperPalettes_Pokecenter_2_3[] = INCBIN_U16("graphics/pokemon_storage/pokecenter_bg.gbapal"); + +const u8 gWallpaperTiles_Pokecenter[] = INCBIN_U8("graphics/pokemon_storage/pokecenter.4bpp.lz"); + +const u8 gWallpaperTilemap_Pokecenter[] = INCBIN_U8("graphics/pokemon_storage/pokecenter.bin.lz"); + +const u16 gWallpaperPalettes_Machine[] = INCBIN_U16("graphics/pokemon_storage/box_bg3.gbapal"); +const u16 gWallpaperPalettes_Machine_2[] = INCBIN_U16("graphics/pokemon_storage/machine_frame.gbapal"); +const u16 gWallpaperPalettes_Machine_2_3[] = INCBIN_U16("graphics/pokemon_storage/machine_bg.gbapal"); + +const u8 gWallpaperTiles_Machine[] = INCBIN_U8("graphics/pokemon_storage/machine.4bpp.lz"); + +const u8 gWallpaperTilemap_Machine[] = INCBIN_U8("graphics/pokemon_storage/machine.bin.lz"); + +const u16 gWallpaperPalettes_Plain[] = INCBIN_U16("graphics/pokemon_storage/box_bg4.gbapal"); +const u16 gWallpaperPalettes_Plain_2[] = INCBIN_U16("graphics/pokemon_storage/plain_frame.gbapal"); +const u16 gWallpaperPalettes_Plain_2_3[] = INCBIN_U16("graphics/pokemon_storage/plain_bg.gbapal"); + +const u8 gWallpaperTiles_Plain[] = INCBIN_U8("graphics/pokemon_storage/plain.4bpp.lz"); + +const u8 gWallpaperTilemap_Plain[] = INCBIN_U8("graphics/pokemon_storage/plain.bin.lz"); + +const u16 gUnknown_083BAEF8[] = INCBIN_U16("graphics/unused/tilemap_3BAEF8.bin"); + +const u16 gUnknown_083BB0A8[][2] = { + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF} +}; + +const struct WallpaperTable gWallpaperTable[] = { + {gWallpaperTiles_Forest, 0x3D0, gWallpaperTilemap_Forest, gWallpaperPalettes_Forest}, // Forest + {gWallpaperTiles_City, 0x208, gWallpaperTilemap_City, gWallpaperPalettes_City}, // City + {gWallpaperTiles_Desert, 0x2EC, gWallpaperTilemap_Desert, gWallpaperPalettes_Desert}, // Desert + {gWallpaperTiles_Savanna, 0x220, gWallpaperTilemap_Savanna, gWallpaperPalettes_Savanna}, // Savanna + {gWallpaperTiles_Crag, 0x350, gWallpaperTilemap_Crag, gWallpaperPalettes_Crag}, // Crag + {gWallpaperTiles_Volcano, 0x334, gWallpaperTilemap_Volcano, gWallpaperPalettes_Volcano}, // Volcano + {gWallpaperTiles_Snow, 0x2B8, gWallpaperTilemap_Snow, gWallpaperPalettes_Snow}, // Snow + {gWallpaperTiles_Cave, 0x344, gWallpaperTilemap_Cave, gWallpaperPalettes_Cave}, // Cave + {gWallpaperTiles_Beach, 0x384, gWallpaperTilemap_Beach, gWallpaperPalettes_Beach}, // Beach + {gWallpaperTiles_Seafloor, 0x2B4, gWallpaperTilemap_Seafloor, gWallpaperPalettes_Seafloor}, // Seafloor + {gWallpaperTiles_River, 0x294, gWallpaperTilemap_River, gWallpaperPalettes_River}, // River + {gWallpaperTiles_Sky, 0x298, gWallpaperTilemap_Sky, gWallpaperPalettes_Sky}, // Sky + {gWallpaperTiles_Polkadot, 0x1FC, gWallpaperTilemap_Polkadot, gWallpaperPalettes_Polkadot}, // Polkadot + {gWallpaperTiles_Pokecenter, 0x3A4, gWallpaperTilemap_Pokecenter, gWallpaperPalettes_Pokecenter}, // Pokecenter + {gWallpaperTiles_Machine, 0x2F0, gWallpaperTilemap_Machine, gWallpaperPalettes_Machine}, // Machine + {gWallpaperTiles_Plain, 0xFC, gWallpaperTilemap_Plain, gWallpaperPalettes_Plain} // Plain +}; + +void sub_8099EB0(u8 boxId, s8 a1) +{ + const struct WallpaperTable *wallpaperTable; + + if (a1) + { + gPokemonStorageSystemPtr->unk_08ba = gPokemonStorageSystemPtr->unk_08ba ? FALSE : TRUE; + sub_809A14C(BG_SCREEN_ADDR(26)); + } + wallpaperTable = gWallpaperTable +gPokemonStorage.wallpaper[boxId]; + LoadPalette(wallpaperTable->palettes, gPokemonStorageSystemPtr->unk_08ba * 0x30 + 0x40, 0x60); + LZ77UnCompWram(wallpaperTable->tileMap, gPokemonStorageSystemPtr->unk_0d62); + sub_8099F58(BG_SCREEN_ADDR(26), gPokemonStorageSystemPtr->unk_0d62, a1, gPokemonStorageSystemPtr->unk_08ba); + LZ77UnCompVram(wallpaperTable->tiles, BG_CHAR_ADDR(2) + (gPokemonStorageSystemPtr->unk_08ba << 13)); +} |