diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-09 00:15:28 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2018-01-09 00:15:28 -0500 |
commit | 7b7f11119ac386e51910b957f855eade7e40381b (patch) | |
tree | 7c47307071b382686042eceae8df4ef6bca14222 | |
parent | 02dadce72cc0e9541f527c61f6fcbbdfad9358bc (diff) |
through sub_8097DE0
-rw-r--r-- | asm/pokemon_storage_system.s | 177 | ||||
-rw-r--r-- | data/pokemon_storage_system.s | 50 | ||||
-rw-r--r-- | src/pokemon/pokemon_storage_system.c | 109 |
3 files changed, 109 insertions, 227 deletions
diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 85e29b183..6b4ccbc06 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -5,183 +5,6 @@ .text - thumb_func_start sub_8097CC0 -sub_8097CC0: @ 8097CC0 - push {r4,lr} - ldr r0, _08097CD8 @ =gSharedMem - ldrb r1, [r0, 0x4] - adds r4, r0, 0 - cmp r1, 0x4 - bls _08097CCE - b _08097DD0 -_08097CCE: - lsls r0, r1, 2 - ldr r1, _08097CDC @ =_08097CE0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08097CD8: .4byte gSharedMem -_08097CDC: .4byte _08097CE0 - .align 2, 0 -_08097CE0: - .4byte _08097CF4 - .4byte _08097D38 - .4byte _08097D4C - .4byte _08097D94 - .4byte _08097DB8 -_08097CF4: - bl sub_809BF20 - lsls r0, 24 - cmp r0, 0 - beq _08097D18 - movs r0, 0x20 - bl PlaySE - movs r0, 0xF - bl PrintStorageActionText - ldr r1, _08097D14 @ =gSharedMem - movs r0, 0x1 - strb r0, [r1, 0x4] - b _08097DD0 - .align 2, 0 -_08097D14: .4byte gSharedMem -_08097D18: - movs r0, 0x5 - bl PlaySE - movs r0, 0x12 - bl PrintStorageActionText - movs r0, 0 - bl sub_8098A38 - ldr r1, _08097D34 @ =gSharedMem - movs r0, 0x2 - strb r0, [r1, 0x4] - b _08097DD0 - .align 2, 0 -_08097D34: .4byte gSharedMem -_08097D38: - ldr r0, _08097D48 @ =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _08097DD0 - b _08097D6C - .align 2, 0 -_08097D48: .4byte gMain -_08097D4C: - bl ProcessMenuInputNoWrap - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _08097D6C - cmp r1, 0 - bgt _08097D66 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08097D7C - b _08097DD0 -_08097D66: - cmp r1, 0x1 - beq _08097D7C - b _08097DD0 -_08097D6C: - bl sub_8098A5C - ldr r0, _08097D78 @ =sub_8096C84 - bl SetPSSCallback - b _08097DD0 - .align 2, 0 -_08097D78: .4byte sub_8096C84 -_08097D7C: - movs r0, 0x3 - bl PlaySE - bl sub_8098A5C - ldr r1, _08097D90 @ =gSharedMem - ldrb r0, [r1, 0x4] - adds r0, 0x1 - strb r0, [r1, 0x4] - b _08097DD0 - .align 2, 0 -_08097D90: .4byte gSharedMem -_08097D94: - movs r1, 0 - movs r0, 0xE - strh r0, [r4, 0xC] - ldr r0, _08097DB4 @ =0x0000dad0 - strh r0, [r4, 0xE] - movs r0, 0x14 - strh r0, [r4, 0x10] - strh r1, [r4, 0x12] - adds r0, r4, 0 - adds r0, 0xC - bl sub_80C5E38 - ldrb r0, [r4, 0x4] - adds r0, 0x1 - strb r0, [r4, 0x4] - b _08097DD0 - .align 2, 0 -_08097DB4: .4byte 0x0000dad0 -_08097DB8: - bl sub_80C5F98 - lsls r0, 24 - cmp r0, 0 - beq _08097DD0 - bl CalculatePlayerPartyCount - ldr r1, _08097DD8 @ =gPlayerPartyCount - strb r0, [r1] - ldr r0, _08097DDC @ =sub_80961A8 - bl SetMainCallback2 -_08097DD0: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08097DD8: .4byte gPlayerPartyCount -_08097DDC: .4byte sub_80961A8 - thumb_func_end sub_8097CC0 - - thumb_func_start sub_8097DE0 -sub_8097DE0: @ 8097DE0 - push {lr} - ldr r1, _08097E1C @ =gSharedMem - movs r0, 0 - strb r0, [r1, 0x7] - strh r0, [r1, 0x8] - strh r0, [r1, 0xA] - ldr r1, _08097E20 @ =REG_BG3CNT - ldr r2, _08097E24 @ =0x00001e0f - adds r0, r2, 0 - strh r0, [r1] - ldr r1, _08097E28 @ =gPokemonStorageScrollingBGTile - ldr r2, _08097E2C @ =0x0600e000 - ldr r0, _08097E30 @ =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, _08097E34 @ =0x80000010 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - ldr r0, _08097E38 @ =gPokemonStorageScrollingBGTilemap - ldr r1, _08097E3C @ =0x0600f000 - bl LZ77UnCompVram - ldr r0, _08097E40 @ =gPokemonStorageScrollingBGPalette - movs r1, 0xD0 - movs r2, 0x10 - bl LoadPalette - pop {r0} - bx r0 - .align 2, 0 -_08097E1C: .4byte gSharedMem -_08097E20: .4byte REG_BG3CNT -_08097E24: .4byte 0x00001e0f -_08097E28: .4byte gPokemonStorageScrollingBGTile -_08097E2C: .4byte 0x0600e000 -_08097E30: .4byte 0x040000d4 -_08097E34: .4byte 0x80000010 -_08097E38: .4byte gPokemonStorageScrollingBGTilemap -_08097E3C: .4byte 0x0600f000 -_08097E40: .4byte gPokemonStorageScrollingBGPalette - thumb_func_end sub_8097DE0 - thumb_func_start sub_8097E44 sub_8097E44: @ 8097E44 push {lr} diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s index 4340301ba..4a59bb504 100644 --- a/data/pokemon_storage_system.s +++ b/data/pokemon_storage_system.s @@ -4,56 +4,6 @@ .section .rodata .align 2 -gPokemonStorageScrollingBGPalette:: @ 83B6A10 - .incbin "graphics/pokemon_storage/scrolling_bg.gbapal" - - .align 2 -gPokemonStorageScrollingBGTile:: @ 83B6A30 - .incbin "graphics/pokemon_storage/scrolling_bg.4bpp" - - .align 2 -gPokemonStorageScrollingBGTilemap:: @ 83B6A50 - .incbin "graphics/pokemon_storage/scrolling_bg_map.bin.lz" - -@ unused tilemap? - .2byte 0x1281 - .2byte 0x1282 - .2byte 0x1283 - .2byte 0x1284 - .2byte 0x1285 - .2byte 0x1286 - .2byte 0x1287 - .2byte 0x1288 - .2byte 0x128C - .2byte 0x128D - .2byte 0x128E - .2byte 0x128F - .2byte 0x1290 - .2byte 0x1291 - .2byte 0x1292 - .2byte 0x1293 - .2byte 0x0281 - .2byte 0x0282 - .2byte 0x0283 - .2byte 0x0284 - .2byte 0x0285 - .2byte 0x0286 - .2byte 0x0287 - .2byte 0x0288 - .2byte 0x028C - .2byte 0x028D - .2byte 0x028E - .2byte 0x028F - .2byte 0x0290 - .2byte 0x0291 - .2byte 0x0292 - .2byte 0x0293 - .2byte 0x12AD - .2byte 0x12AE - .2byte 0x12A8 - .2byte 0x12A8 - - .align 2 WaveformPalette: @ 83B6B94 .incbin "graphics/pokemon_storage/waveform.gbapal" diff --git a/src/pokemon/pokemon_storage_system.c b/src/pokemon/pokemon_storage_system.c index daae82df6..5fd43cfb8 100644 --- a/src/pokemon/pokemon_storage_system.c +++ b/src/pokemon/pokemon_storage_system.c @@ -89,6 +89,7 @@ struct PokemonStorageSystemData { u8 unk_0004; u8 unk_0005; u8 unk_0006; + u8 unk_0007; u16 unk_0008; u16 unk_000a; struct PCScreenEffectStruct unk_000c; @@ -266,6 +267,51 @@ const u8 gBoxSelectionPopupCenterTiles[] = INCBIN_U8("graphics/pokemon_storage/b const u8 gBoxSelectionPopupSidesTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp"); +const u16 gPokemonStorageScrollingBGPalette[] = INCBIN_U16("graphics/pokemon_storage/scrolling_bg.gbapal"); + +const u16 gPokemonStorageScrollingBGTile[] = INCBIN_U16("graphics/pokemon_storage/scrolling_bg.4bpp"); + +const u8 gPokemonStorageScrollingBGTilemap[] = INCBIN_U8("graphics/pokemon_storage/scrolling_bg_map.bin.lz"); + +const u16 sUnknownTilemap[] = { + 0x1281, + 0x1282, + 0x1283, + 0x1284, + 0x1285, + 0x1286, + 0x1287, + 0x1288, + 0x128C, + 0x128D, + 0x128E, + 0x128F, + 0x1290, + 0x1291, + 0x1292, + 0x1293, + 0x0281, + 0x0282, + 0x0283, + 0x0284, + 0x0285, + 0x0286, + 0x0287, + 0x0288, + 0x028C, + 0x028D, + 0x028E, + 0x028F, + 0x0290, + 0x0291, + 0x0292, + 0x0293, + 0x12AD, + 0x12AE, + 0x12A8, + 0x12A8 +}; + extern const struct StorageAction gPCStorageActionTexts[]; extern const struct PokemonStorageSystemData *gPokemonStorageSystemPtr; extern u8 *const gUnknown_083B6DB8; @@ -2073,6 +2119,69 @@ void sub_8097BA0(void) } } +void sub_8097CC0(void) { + switch (ePokemonStorageSystem.unk_0004) { + case 0: + if (sub_809BF20()) { + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_HOLDING_POKE); + ePokemonStorageSystem.unk_0004 = 1; + } + else { + PlaySE(SE_SELECT); + PrintStorageActionText(PC_TEXT_CONTINUE_BOX); + sub_8098A38(0); + ePokemonStorageSystem.unk_0004 = 2; + } + break; + case 1: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + } + break; + case 2: + switch (ProcessMenuInputNoWrap()) { + case 0: + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + break; + case -1: + case 1: + PlaySE(SE_PC_OFF); + sub_8098A5C(); + ePokemonStorageSystem.unk_0004++; + break; + } + break; + case 3: + ePokemonStorageSystem.unk_000c.tileTag = 0x000e; + ePokemonStorageSystem.unk_000c.paletteTag = 0xdad0; + ePokemonStorageSystem.unk_000c.unk04 = 20; + ePokemonStorageSystem.unk_000c.unk06 = 0; + sub_80C5E38(&ePokemonStorageSystem.unk_000c); + ePokemonStorageSystem.unk_0004++; + break; + case 4: + if (sub_80C5F98()) { + gPlayerPartyCount = CalculatePlayerPartyCount(); + SetMainCallback2(sub_80961A8); + } + break; + } +} + +void sub_8097DE0(void) +{ + ePokemonStorageSystem.unk_0007 = 0; + ePokemonStorageSystem.unk_0008 = 0; + ePokemonStorageSystem.unk_000a = 0; + REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(3) | BGCNT_SCREENBASE(30); + DmaCopy16Defvars(3, gPokemonStorageScrollingBGTile, BG_SCREEN_ADDR(28), sizeof gPokemonStorageScrollingBGTile); + LZ77UnCompVram(gPokemonStorageScrollingBGTilemap, BG_SCREEN_ADDR(30)); + LoadPalette(gPokemonStorageScrollingBGPalette, 0xd0, 0x10); +} + asm(".section .text.8098898"); void PrintStorageActionText(u8 index) { |