diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/box_party_pokemon_dropdown.c | 120 | ||||
-rw-r--r-- | src/graphics.c | 4 | ||||
-rw-r--r-- | src/pokemon_storage_system_3.c | 1046 | ||||
-rw-r--r-- | src/strings.c | 60 |
4 files changed, 1052 insertions, 178 deletions
diff --git a/src/box_party_pokemon_dropdown.c b/src/box_party_pokemon_dropdown.c index 2e0becdf9..b194777f3 100644 --- a/src/box_party_pokemon_dropdown.c +++ b/src/box_party_pokemon_dropdown.c @@ -3,7 +3,7 @@ #include "box_party_pokemon_dropdown.h" #include "malloc.h" -struct UnkStruct_203ABE4_Sub +struct BPPD_MapRect { s16 destX; s16 destY; @@ -13,10 +13,10 @@ struct UnkStruct_203ABE4_Sub s16 destY2; }; -struct UnkStruct_203ABE4 +struct BPPD_Struct { - struct UnkStruct_203ABE4_Sub map1Rect; - struct UnkStruct_203ABE4_Sub map2Rect; + struct BPPD_MapRect map1Rect; + struct BPPD_MapRect map2Rect; const void * src1; const void * src2; u16 src1Height; @@ -29,11 +29,11 @@ struct UnkStruct_203ABE4 bool8 bgUpdateScheduled; }; -static EWRAM_DATA struct UnkStruct_203ABE4 * sBoxPartyPokemonDropdownPtr = NULL; +static EWRAM_DATA struct BPPD_Struct * sBoxPartyPokemonDropdownPtr = NULL; static EWRAM_DATA u16 sBoxPartyPokemonDropdownCount = 0; -static void PushMap1(u8 a0); -static void PushMap2(u8 a0); +static void PushMap1(u8 idx); +static void PushMap2(u8 idx); static const struct { u16 height; @@ -55,7 +55,7 @@ static const struct { void AllocBoxPartyPokemonDropdowns(u8 num) { u16 i; - sBoxPartyPokemonDropdownPtr = Alloc(num * sizeof(struct UnkStruct_203ABE4)); + sBoxPartyPokemonDropdownPtr = Alloc(num * sizeof(struct BPPD_Struct)); sBoxPartyPokemonDropdownCount = sBoxPartyPokemonDropdownPtr == NULL ? 0 : num; for (i = 0; i < sBoxPartyPokemonDropdownCount; i++) { @@ -64,19 +64,19 @@ void AllocBoxPartyPokemonDropdowns(u8 num) } } -void sub_80F7B2C(void) +void FreeBoxPartyPokemonDropdowns(void) { Free(sBoxPartyPokemonDropdownPtr); } -void sub_80F7B40(void) +void CopyAllBoxPartyPokemonDropdownsToVram(void) { int i; for (i = 0; i < sBoxPartyPokemonDropdownCount; i++) { if (sBoxPartyPokemonDropdownPtr[i].bgUpdateScheduled == TRUE) - sub_80F7E54(i); + CopyBoxPartyPokemonDropdownToBgTilemapBuffer(i); } } @@ -112,12 +112,12 @@ void SetBoxPartyPokemonDropdownMap2(u8 idx, u8 bgId, const void * src, u16 width } } -void sub_80F7C7C(u8 a0, const void * a1) +void SetBoxPartyPokemonDropdownMap1Tiles(u8 idx, const void * src) { - if (a0 < sBoxPartyPokemonDropdownCount) + if (idx < sBoxPartyPokemonDropdownCount) { - sBoxPartyPokemonDropdownPtr[a0].src1 = a1; - sBoxPartyPokemonDropdownPtr[a0].bgUpdateScheduled = TRUE; + sBoxPartyPokemonDropdownPtr[idx].src1 = src; + sBoxPartyPokemonDropdownPtr[idx].bgUpdateScheduled = TRUE; } } @@ -131,82 +131,82 @@ void SetBoxPartyPokemonDropdownMap2Pos(u8 idx, u16 x, u16 y) } } -void sub_80F7CE8(u8 a0, u16 a1, u16 a2, u16 a3, u16 a4) +void SetBoxPartyPokemonDropdownMap2Rect(u8 idx, u16 x, u16 y, u16 width, u16 height) { - if (a0 < sBoxPartyPokemonDropdownCount) + if (idx < sBoxPartyPokemonDropdownCount) { - sBoxPartyPokemonDropdownPtr[a0].map2Rect.destX = a1; - sBoxPartyPokemonDropdownPtr[a0].map2Rect.destY = a2; - sBoxPartyPokemonDropdownPtr[a0].map2Rect.width = a3; - sBoxPartyPokemonDropdownPtr[a0].map2Rect.height = a4; - sBoxPartyPokemonDropdownPtr[a0].bgUpdateScheduled = TRUE; + sBoxPartyPokemonDropdownPtr[idx].map2Rect.destX = x; + sBoxPartyPokemonDropdownPtr[idx].map2Rect.destY = y; + sBoxPartyPokemonDropdownPtr[idx].map2Rect.width = width; + sBoxPartyPokemonDropdownPtr[idx].map2Rect.height = height; + sBoxPartyPokemonDropdownPtr[idx].bgUpdateScheduled = TRUE; } } -void sub_80F7D30(u8 a0, u8 a1, s8 a2) +void AdjustBoxPartyPokemonDropdownPos(u8 idx, u8 op, s8 param) { - if (a0 < sBoxPartyPokemonDropdownCount) + if (idx < sBoxPartyPokemonDropdownCount) { - switch (a1) + switch (op) { - case 0: - sBoxPartyPokemonDropdownPtr[a0].map2Rect.destX2 += a2; - sBoxPartyPokemonDropdownPtr[a0].map2Rect.width -= a2; + case BPPD_MOVE_INNER_LEFT: + sBoxPartyPokemonDropdownPtr[idx].map2Rect.destX2 += param; + sBoxPartyPokemonDropdownPtr[idx].map2Rect.width -= param; break; - case 1: - sBoxPartyPokemonDropdownPtr[a0].map2Rect.destX += a2; - sBoxPartyPokemonDropdownPtr[a0].map2Rect.width += a2; + case BPPD_MOVE_OUTER_LEFT: + sBoxPartyPokemonDropdownPtr[idx].map2Rect.destX += param; + sBoxPartyPokemonDropdownPtr[idx].map2Rect.width += param; break; - case 2: - sBoxPartyPokemonDropdownPtr[a0].map2Rect.destY2 += a2; - sBoxPartyPokemonDropdownPtr[a0].map2Rect.height -= a2; + case BPPD_MOVE_INNER_TOP: + sBoxPartyPokemonDropdownPtr[idx].map2Rect.destY2 += param; + sBoxPartyPokemonDropdownPtr[idx].map2Rect.height -= param; break; - case 3: - sBoxPartyPokemonDropdownPtr[a0].map2Rect.destY -= a2; - sBoxPartyPokemonDropdownPtr[a0].map2Rect.height += a2; + case BPPD_MOVE_OUTER_TOP: + sBoxPartyPokemonDropdownPtr[idx].map2Rect.destY -= param; + sBoxPartyPokemonDropdownPtr[idx].map2Rect.height += param; break; - case 4: - sBoxPartyPokemonDropdownPtr[a0].map2Rect.destX2 += a2; + case BPPD_MOVE_INNER_X: + sBoxPartyPokemonDropdownPtr[idx].map2Rect.destX2 += param; break; - case 5: - sBoxPartyPokemonDropdownPtr[a0].map2Rect.destY2 += a2; + case BPPD_MOVE_INNER_Y: + sBoxPartyPokemonDropdownPtr[idx].map2Rect.destY2 += param; break; } - sBoxPartyPokemonDropdownPtr[a0].bgUpdateScheduled = TRUE; + sBoxPartyPokemonDropdownPtr[idx].bgUpdateScheduled = TRUE; } } -void sub_80F7E54(u8 a0) +void CopyBoxPartyPokemonDropdownToBgTilemapBuffer(u8 idx) { - if (a0 < sBoxPartyPokemonDropdownCount) + if (idx < sBoxPartyPokemonDropdownCount) { - if (sBoxPartyPokemonDropdownPtr[a0].src1 != NULL) - PushMap1(a0); - PushMap2(a0); - sBoxPartyPokemonDropdownPtr[a0].map1Rect = sBoxPartyPokemonDropdownPtr[a0].map2Rect; + if (sBoxPartyPokemonDropdownPtr[idx].src1 != NULL) + PushMap1(idx); + PushMap2(idx); + sBoxPartyPokemonDropdownPtr[idx].map1Rect = sBoxPartyPokemonDropdownPtr[idx].map2Rect; } } -static void PushMap1(u8 a0) +static void PushMap1(u8 idx) { int i; - int r9 = sBoxPartyPokemonDropdownPtr[a0].mapSize * sBoxPartyPokemonDropdownPtr[a0].src1Height; - const void * addr = sBoxPartyPokemonDropdownPtr[a0].src1 + r9 * sBoxPartyPokemonDropdownPtr[a0].map1Rect.destY2 + sBoxPartyPokemonDropdownPtr[a0].map1Rect.destX2 * sBoxPartyPokemonDropdownPtr[a0].mapSize; - for (i = 0; i < sBoxPartyPokemonDropdownPtr[a0].map1Rect.height; i++) + int run = sBoxPartyPokemonDropdownPtr[idx].mapSize * sBoxPartyPokemonDropdownPtr[idx].src1Height; + const void * addr = sBoxPartyPokemonDropdownPtr[idx].src1 + run * sBoxPartyPokemonDropdownPtr[idx].map1Rect.destY2 + sBoxPartyPokemonDropdownPtr[idx].map1Rect.destX2 * sBoxPartyPokemonDropdownPtr[idx].mapSize; + for (i = 0; i < sBoxPartyPokemonDropdownPtr[idx].map1Rect.height; i++) { - CopyToBgTilemapBufferRect(sBoxPartyPokemonDropdownPtr[a0].bgId, addr, sBoxPartyPokemonDropdownPtr[a0].map1Rect.destX2, sBoxPartyPokemonDropdownPtr[a0].map1Rect.destY2 + i, sBoxPartyPokemonDropdownPtr[a0].map1Rect.width, 1); - addr += r9; + CopyToBgTilemapBufferRect(sBoxPartyPokemonDropdownPtr[idx].bgId, addr, sBoxPartyPokemonDropdownPtr[idx].map1Rect.destX2, sBoxPartyPokemonDropdownPtr[idx].map1Rect.destY2 + i, sBoxPartyPokemonDropdownPtr[idx].map1Rect.width, 1); + addr += run; } } -static void PushMap2(u8 a0) +static void PushMap2(u8 idx) { int i; - 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++) + int run = sBoxPartyPokemonDropdownPtr[idx].mapSize * sBoxPartyPokemonDropdownPtr[idx].src2Width; + const void * addr = sBoxPartyPokemonDropdownPtr[idx].src2 + run * sBoxPartyPokemonDropdownPtr[idx].map2Rect.destY + sBoxPartyPokemonDropdownPtr[idx].map2Rect.destX * sBoxPartyPokemonDropdownPtr[idx].mapSize; + for (i = 0; i < sBoxPartyPokemonDropdownPtr[idx].map2Rect.height; i++) { - CopyToBgTilemapBufferRect(sBoxPartyPokemonDropdownPtr[a0].bgId, addr, sBoxPartyPokemonDropdownPtr[a0].map2Rect.destX2, sBoxPartyPokemonDropdownPtr[a0].map2Rect.destY2 + i, sBoxPartyPokemonDropdownPtr[a0].map2Rect.width, 1); - addr += r9; + CopyToBgTilemapBufferRect(sBoxPartyPokemonDropdownPtr[idx].bgId, addr, sBoxPartyPokemonDropdownPtr[idx].map2Rect.destX2, sBoxPartyPokemonDropdownPtr[idx].map2Rect.destY2 + i, sBoxPartyPokemonDropdownPtr[idx].map2Rect.width, 1); + addr += run; } } diff --git a/src/graphics.c b/src/graphics.c index 69e804fd9..5a802cd35 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1247,10 +1247,10 @@ const u32 gUnknown_8E9BF48[] = INCBIN_U32("graphics/interface/link_rfu_status.4b const u16 gUnknown_8E9C14C[] = INCBIN_U16("graphics/interface/pokedex_abc.gbapal"); const u32 gUnknown_8E9C16C[] = INCBIN_U32("graphics/interface/pokedex_abc.4bpp.lz"); -const u16 gUnknown_8E9C3D8[] = INCBIN_U16("graphics/interface/box_tiles_pal1.gbapal"); +const u16 gPSSMenu_Pal[] = INCBIN_U16("graphics/interface/box_tiles_pal1.gbapal"); const u16 gUnknown_8E9C3F8[] = INCBIN_U16("graphics/interface/box_tiles_pal2.gbapal"); const u16 gUnknown_8E9C418[] = INCBIN_U16("graphics/interface/box_tiles_pal3.gbapal"); -const u32 gUnknown_8E9C438[] = INCBIN_U32("graphics/interface/box_tiles.4bpp.lz"); +const u32 gPSSMenu_Gfx[] = INCBIN_U32("graphics/interface/box_tiles.4bpp.lz"); const u32 gUnknown_8E9CAEC[] = INCBIN_U32("graphics/unknown/unknown_E9CAEC.bin.lz"); diff --git a/src/pokemon_storage_system_3.c b/src/pokemon_storage_system_3.c index 8cf2e1953..3378bcef5 100644 --- a/src/pokemon_storage_system_3.c +++ b/src/pokemon_storage_system_3.c @@ -1,6 +1,10 @@ #include "global.h" #include "gflib.h" #include "box_party_pokemon_dropdown.h" +#include "data.h" +#include "decompress.h" +#include "dynamic_placeholder_text_util.h" +#include "graphics.h" #include "help_system.h" #include "item.h" #include "item_menu.h" @@ -11,6 +15,8 @@ #include "pc_screen_effect.h" #include "pokemon_storage_system_internal.h" #include "pokemon_summary_screen.h" +#include "quest_log.h" +#include "strings.h" #include "task.h" #include "text_window.h" #include "constants/items.h" @@ -56,104 +62,297 @@ void Cb_OnCloseBoxPressed(u8 taskId); void Cb_OnBPressed(u8 taskId); void Cb_ChangeScreen(u8 taskId); void GiveChosenBagItem(void); -void sub_80920FC(bool8 a0); -void sub_8094D14(u8 a0); -void Item_FromMonToMoving(u8 cursorArea, u8 cursorPos); -void Item_GiveMovingToMon(u8 cursorArea, u8 cursorPos); -void Item_TakeMons(u8 cursorArea, u8 cursorPos); -void Item_SwitchMonsWithMoving(u8 cursorArea, u8 cursorPos); -u8 GetBoxCursorPosition(void); -void PrintCursorMonInfo(void); -void InitMonPlaceChange(u8 a0); -bool8 DoMonPlaceChange(void); -void SetUpDoShowPartyMenu(void); -bool8 DoShowPartyMenu(void); -bool8 InitPSSWindows(void); +void FreePSSData(void); +void SetScrollingBackground(void); +void ScrollBackground(void); void LoadPSSMenuGfx(void); +bool8 InitPSSWindows(void); void LoadWaveformSpritePalette(void); -void SetScrollingBackground(void); -void SetMonMarkings(u8 markings); -void AddWallpaperSetsMenu(void); -void sub_8095024(void); -void AddWallpapersMenu(u8 wallpaperSet); -void SetWallpaperForCurrentBox(u8 wallpaper); -bool8 DoWallpaperGfxChange(void); -void sub_808EFC8(void); void sub_808F078(void); -bool8 sub_808F258(void); +void sub_808F0F4(void); +void sub_808F164(void); +void RefreshCursorMonData(void); +void BoxSetMosaic(void); +void SpriteCB_CursorMon_Mosaic(struct Sprite * sprite); +bool8 BoxGetMosaic(void); +void LoadCursorMonSprite(void); +void LoadCursorMonGfx(u16 species, u32 pid); +void PrintCursorMonInfo(void); +void sub_808F5E8(void); void sub_808F68C(void); +void SetUpHidePartyMenu(void); +bool8 HidePartyMenu(void); +void sub_808F90C(bool8 species); void sub_808F948(void); void sub_808F974(void); void sub_808F99C(void); +void sub_808F9FC(void); +void sub_808FA30(u8 pos, bool8 isPartyMon); +void sub_808FAA8(void); +void SetUpDoShowPartyMenu(void); +bool8 DoShowPartyMenu(void); void sub_808FB68(void); +void PrintStorageActionText(u8 textId); +void ShowYesNoWindow(s8 species); +void ClearBottomWindow(void); +void AddWallpaperSetsMenu(void); +void AddWallpapersMenu(u8 wallpaperSet); void sub_808FDFC(void); -void sub_808FE54(u8 a0); +void sub_808FE54(u8 species); +bool8 IsCursorOnBox(void); +void sub_808FF70(void); void sub_808FFAC(void); -void sub_80913DC(u8 box); -bool8 sub_809140C(void); -void SetUpHidePartyMenu(void); -bool8 HidePartyMenu(void); -void sub_80922C0(void); -void sub_8092340(void); -void sub_8092B3C(u8 a0); -void sub_8092B50(void); -u8 sub_8092B70(void); -void sub_8093660(void); -void sub_80937B4(void); -bool8 sub_8095050(void); -void sub_8095B5C(void); -void sub_8096BE4(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2); -void sub_8096BF8(void); -void BoxSetMosaic(void); -bool8 CanMovePartyMon(void); -bool8 CanShiftMon(void); -void ClearBottomWindow(void); -u8 HandleInput(void); -bool8 IsCursorOnCloseBox(void); -bool8 IsMonBeingMoved(void); -void PrintStorageActionText(u8 textId); -bool8 ScrollToBox(void); -void SetUpScrollToBox(u8 targetBox); -bool8 sub_80924A8(void); -void sub_8092F54(void); -void sub_8094D60(void); -void sub_8094D84(void); -void sub_80950BC(u8 a0); -bool8 sub_80950D0(void); -bool8 sub_809610C(void); -bool8 IsActiveItemMoving(void); -void AddMenu(void); -bool8 sub_8094F90(void); -s16 sub_8094F94(void); -void sub_8092B5C(void); -void SetMovingMonPriority(u8 priority); -void sub_808FAA8(void); -bool8 TryStorePartyMonInBox(u8 boxId); +void CreatePartyMonsSprites(bool8 species); void sub_80909F4(void); bool8 sub_8090A60(void); -void sub_8093174(void); -void ShowYesNoWindow(u8 a0); -void InitCanReleaseMonVars(void); -void sub_8093194(void); -s8 RunCanReleaseMon(void); -bool8 sub_80931EC(void); -void ReleaseMon(void); -void RefreshCursorMonData(void); +void sub_8090B98(s16 yDelta); +void DestroyAllPartyMonIcons(void); void sub_8091114(void); bool8 sub_8091150(void); -void sub_8093264(void); -void PrintItemDescription(void); -void sub_80966F4(void); -bool8 sub_8096728(void); -bool8 sub_80967C0(void); -void sub_8096088(void); -void sub_8093630(void); -void sub_80936B8(void); -void sub_808FF70(void); -u16 GetMovingItem(void); -void FreePSSData(void); +void sub_80913DC(u8 box); +bool8 sub_809140C(void); +void sub_80920FC(bool8 species); + +const u32 gPokemonStorageScrollingBGTileset[] = INCBIN_U32("graphics/interface/pss_unk_83CE438.4bpp.lz"); +const u32 gPokemonStorageScrollingBGTilemap[] = INCBIN_U32("graphics/interface/pss_unk_83CE4D0.bin.lz"); +const u16 gPokemonStorageScrollingBGPalette[] = INCBIN_U16("graphics/interface/pss_unk_83CE5DC.gbapal"); +const u32 gUnknown_83CE5FC[] = INCBIN_U32("graphics/interface/pss_unk_83CE5FC.bin.lz"); + +const u16 gUnknown_83CE6F8[] = { + 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, + 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118, + 0x2101, 0x2102, 0x2103, 0x2104, 0x2105, 0x2106, 0x2107, 0x2108, + 0x2111, 0x2112, 0x2113, 0x2114, 0x2115, 0x2116, 0x2117, 0x2118, +}; + +const u16 gUnknown_83CE738[] = INCBIN_U16("graphics/interface/pss_unk_83CE738.gbapal"); +const u16 gUnknown_83CE758[] = INCBIN_U16("graphics/interface/pss_unk_83CE758.gbapal"); + +const u16 gUnknown_83CE778[] = { + 0x014c, 0x014d, 0x014e, 0x014f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, + 0x015c, 0x015d, 0x015e, 0x015f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, + 0x0175, 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, + 0x0185, 0x0186, 0x0187, 0x0188, 0x0189, 0x018a, 0x018b, 0x018c, 0x018d, +}; -extern const u16 gUnknown_83CE6F8[]; +const u16 gUnknown_83CE7C0[] = { + 0x1140, 0x1141, 0x1141, 0x1142, + 0x1150, 0x1151, 0x1151, 0x1152, + 0x1160, 0x1161, 0x1161, 0x1162, +}; + +const u16 gUnknown_83CE7D8[] = { + 0x1143, 0x1144, 0x1144, 0x1145, + 0x1153, 0x1154, 0x1154, 0x1155, + 0x1163, 0x1164, 0x1164, 0x1165, +}; + +const u16 gUnknown_83CE7F0[] = INCBIN_U16("graphics/interface/pss_unk_83CE810.gbapal"); +const u16 gUnknown_83CE810[] = INCBIN_U16("graphics/interface/pss_unk_83CE810.4bpp"); +const u16 gUnknown_83CE9D0[] = INCBIN_U16("graphics/interface/pss_unk_83CE9D0.gbapal"); +const u16 gUnknown_83CEA10[] = INCBIN_U16("graphics/interface/pss_unk_83CEA10.gbapal"); + +const struct WindowTemplate gUnknown_83CEA30[] = { + { + .bg = 1, + .tilemapLeft = 0, + .tilemapTop = 11, + .width = 9, + .height = 7, + .paletteNum = 3, + .baseBlock = 0x0c0 + }, { + .bg = 0, + .tilemapLeft = 11, + .tilemapTop = 17, + .width = 18, + .height = 2, + .paletteNum = 13, + .baseBlock = 0x014 + }, { + .bg = 0, + .tilemapLeft = 0, + .tilemapTop = 12, + .width = 25, + .height = 8, + .paletteNum = 15, + .baseBlock = 0x014 + }, DUMMY_WIN_TEMPLATE +}; + +const struct BgTemplate gUnknown_83CEA50[] = { + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 29, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0x000 + }, { + .bg = 1, + .charBaseIndex = 1, + .mapBaseIndex = 30, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0x100 + }, { + .bg = 2, + .charBaseIndex = 2, + .mapBaseIndex = 27, + .screenSize = 1, + .paletteMode = 0, + .priority = 2, + .baseTile = 0x000 + }, { + .bg = 3, + .charBaseIndex = 3, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0x000 + } +}; + +const struct SpritePalette gWaveformSpritePalette = { + gUnknown_83CE7F0, TAG_PAL_WAVEFORM +}; + +const struct SpriteSheet gWaveformSpriteSheet = { + gUnknown_83CE810, 0x01c0, TAG_TILE_WAVEFORM +}; + +const struct OamData gUnknown_83CEB88; + +const struct SpriteTemplate sSpriteTemplate_CursorMon = { + .tileTag = TAG_TILE_2, + .paletteTag = TAG_PAL_DAC6, + .oam = &gUnknown_83CEB88, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +const struct StorageAction gPCStorageActionTexts[] = { + [PC_TEXT_EXIT_BOX] = {gText_ExitFromBox, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_WHAT_YOU_DO] = {gText_WhatDoYouWantToDo, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_PICK_A_THEME] = {gText_PleasePickATheme, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_PICK_A_WALLPAPER] = {gText_PickTheWallpaper, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_IS_SELECTED] = {gText_PkmnIsSelected, PC_TEXT_FMT_MON_NAME_1}, + [PC_TEXT_JUMP_TO_WHICH_BOX] = {gText_JumpToWhichBox, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_DEPOSIT_IN_WHICH_BOX] = {gText_DepositInWhichBox, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_WAS_DEPOSITED] = {gText_PkmnWasDeposited, PC_TEXT_FMT_MON_NAME_1}, + [PC_TEXT_BOX_IS_FULL] = {gText_BoxIsFull2, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_RELEASE_POKE] = {gText_ReleaseThisPokemon, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_WAS_RELEASED] = {gText_PkmnWasReleased, PC_TEXT_FMT_MON_NAME_4}, + [PC_TEXT_BYE_BYE] = {gText_ByeByePkmn, PC_TEXT_FMT_MON_NAME_6}, + [PC_TEXT_MARK_POKE] = {gText_MarkYourPkmn, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_LAST_POKE] = {gText_ThatsYourLastPkmn, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_PARTY_FULL] = {gText_YourPartysFull, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_HOLDING_POKE] = {gText_YoureHoldingAPkmn, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_WHICH_ONE_WILL_TAKE] = {gText_WhichOneWillYouTake, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_CANT_RELEASE_EGG] = {gText_YouCantReleaseAnEgg, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_CONTINUE_BOX] = {gText_ContinueBoxOperations, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_CAME_BACK] = {gText_PkmnCameBack, PC_TEXT_FMT_MON_NAME_1}, + [PC_TEXT_WORRIED] = {gText_WasItWorriedAboutYou, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_SURPRISE] = {gText_FourEllipsesExclamation, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_PLEASE_REMOVE_MAIL] = {gText_PleaseRemoveTheMail, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_IS_SELECTED2] = {gText_PkmnIsSelected, PC_TEXT_FMT_ITEM_NAME}, + [PC_TEXT_GIVE_TO_MON] = {gText_GiveToAPkmn, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_PLACED_IN_BAG] = {gText_PlacedItemInBag, PC_TEXT_FMT_ITEM_NAME}, + [PC_TEXT_BAG_FULL] = {gText_BagIsFull2, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_PUT_IN_BAG] = {gText_PutItemInBag, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_ITEM_IS_HELD] = {gText_ItemIsNowHeld, PC_TEXT_FMT_ITEM_NAME}, + [PC_TEXT_CHANGED_TO_ITEM] = {gText_ChangedToNewItem, PC_TEXT_FMT_ITEM_NAME}, + [PC_TEXT_CANT_STORE_MAIL] = {gText_MailCantBeStored, PC_TEXT_FMT_NORMAL}, +}; + +// Yes/No menu +const struct WindowTemplate sYesNoWindowTemplate = { + .bg = 0, + .tilemapLeft = 24, + .tilemapTop = 11, + .width = 5, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x05c +}; + +const struct OamData gUnknown_83CEB88 = { + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = FALSE, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(64x64), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(64x64), + .tileNum = 0x000, + .priority = 0, + .paletteNum = 0 +}; + +// Waveform + +const struct OamData gUnknown_83CEB90 = { + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = FALSE, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(16x8), + .x = 0, + .matrixNum = 0, + .size = SPRITE_SIZE(16x8), + .tileNum = 0x000, + .priority = 0, + .paletteNum = 0 +}; + +const union AnimCmd gUnknown_83CEB98[] = { + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_83CEBA0[] = { + ANIMCMD_FRAME(2, 8), + ANIMCMD_FRAME(4, 8), + ANIMCMD_FRAME(6, 8), + ANIMCMD_JUMP(0) +}; + +const union AnimCmd gUnknown_83CEBB0[] = { + ANIMCMD_FRAME(8, 5), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_83CEBB8[] = { + ANIMCMD_FRAME(10, 8), + ANIMCMD_FRAME(4, 8), + ANIMCMD_FRAME(12, 8), + ANIMCMD_JUMP(0) +}; + +const union AnimCmd *const gUnknown_83CEBC8[] = { + gUnknown_83CEB98, + gUnknown_83CEBA0, + gUnknown_83CEBB0, + gUnknown_83CEBB8 +}; + +const struct SpriteTemplate sSpriteTemplate_Waveform = { + .tileTag = TAG_TILE_WAVEFORM, + .paletteTag = TAG_PAL_WAVEFORM, + .oam = &gUnknown_83CEB90, + .anims = gUnknown_83CEBC8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; void VblankCb_PSS(void) { @@ -168,7 +367,7 @@ void Cb2_PSS(void) { RunTasks(); DoScheduledBgTilemapCopiesToVram(); - sub_808EFC8(); + ScrollBackground(); sub_808F99C(); AnimateSprites(); BuildOamBuffer(); @@ -237,7 +436,7 @@ void sub_808CF10(void) AllocBoxPartyPokemonDropdowns(3); SetBoxPartyPokemonDropdownMap2(0, 1, gUnknown_83CE6F8, 8, 4); SetBoxPartyPokemonDropdownMap2Pos(0, 1, 0); - sPSSData->unk_02C7 = 0; + sPSSData->unk_02C7 = FALSE; } void sub_808CF94(void) @@ -716,7 +915,7 @@ void Cb_OnSelectedMon(u8 taskId) switch (sPSSData->state) { case 0: - if (!sub_808F258()) + if (!BoxGetMosaic()) { PlaySE(SE_SELECT); if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) @@ -1900,3 +2099,678 @@ void GiveChosenBagItem(void) RemoveBagItem(item, 1); } } + +void FreePSSData(void) +{ + FreeBoxPartyPokemonDropdowns(); + sub_80950A4(); + FREE_AND_SET_NULL(sPSSData); + FreeAllWindowBuffers(); +} + +// ****************************************************************** +// Graphics util +// ****************************************************************** + +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 *)BG_SCREEN_ADDR(31)); +} + +void ScrollBackground(void) +{ + ChangeBgX(3, 128, 1); + ChangeBgY(3, 128, 2); +} + +void LoadPSSMenuGfx(void) +{ + InitBgsFromTemplates(0, gUnknown_83CEA50, NELEMS(gUnknown_83CEA50)); + DecompressAndLoadBgGfxUsingHeap(1, gPSSMenu_Gfx, 0, 0, 0); + LZ77UnCompWram(gUnknown_83CE5FC, sPSSData->field_5AC4); + SetBgTilemapBuffer(1, sPSSData->field_5AC4); + ShowBg(1); + ScheduleBgCopyTilemapToVram(1); +} + +bool8 InitPSSWindows(void) +{ + if (!InitWindows(gUnknown_83CEA30)) + { + return FALSE; + } + else + { + DeactivateAllTextPrinters(); + return TRUE; + } +} + +void LoadWaveformSpritePalette(void) +{ + LoadSpritePalette(&gWaveformSpritePalette); +} + +void sub_808F078(void) +{ + LoadPalette(gUnknown_8E9C3F8, 0, 0x20); + LoadPalette(gUnknown_8E9C418, 0x20, 0x20); + LoadPalette(gUnknown_83CEA10, 0xF0, 0x20); + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + LoadPalette(gUnknown_83CE738, 0x30, 0x20); + else + LoadPalette(gUnknown_83CE758, 0x30, 0x20); + + SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_16COLOR | BGCNT_SCREENBASE(30)); + LoadCursorMonSprite(); + sub_808F0F4(); + sub_808F164(); + RefreshCursorMonData(); +} + +void sub_808F0F4(void) +{ + sPSSData->field_D94 = CreateMonMarkingSprite_AllOff(TAG_TILE_10, TAG_PAL_DAC8, NULL); + sPSSData->field_D94->oam.priority = 1; + sPSSData->field_D94->subpriority = 1; + sPSSData->field_D94->pos1.x = 40; + sPSSData->field_D94->pos1.y = 150; + sPSSData->field_DA0 = (void *)OBJ_VRAM0 + 32 * GetSpriteTileStartByTag(TAG_TILE_10); +} + +void sub_808F164(void) +{ + u16 i; + struct SpriteSheet sheet = gWaveformSpriteSheet; + + LoadSpriteSheet(&sheet); + for (i = 0; i < 2; i++) + { + u8 spriteId = CreateSprite(&sSpriteTemplate_Waveform, i * 63 + 8, 9, 2); + sPSSData->field_D98[i] = &gSprites[spriteId]; + } +} + +void RefreshCursorMonData(void) +{ + LoadCursorMonGfx(sPSSData->cursorMonSpecies, sPSSData->cursorMonPersonality); + PrintCursorMonInfo(); + sub_808F5E8(); + ScheduleBgCopyTilemapToVram(0); +} + +void BoxSetMosaic(void) +{ + RefreshCursorMonData(); + if (sPSSData->cursorMonSprite) + { + sPSSData->cursorMonSprite->oam.mosaic = TRUE; + sPSSData->cursorMonSprite->data[0] = 10; + sPSSData->cursorMonSprite->data[1] = 1; + sPSSData->cursorMonSprite->callback = SpriteCB_CursorMon_Mosaic; + SetGpuReg(REG_OFFSET_MOSAIC, (sPSSData->cursorMonSprite->data[0] << 12) | (sPSSData->cursorMonSprite->data[0] << 8)); + } +} + +u8 BoxGetMosaic(void) +{ + return sPSSData->cursorMonSprite->oam.mosaic; +} + +void SpriteCB_CursorMon_Mosaic(struct Sprite *sprite) +{ + sprite->data[0] -= sprite->data[1]; + if (sprite->data[0] < 0) + sprite->data[0] = 0; + SetGpuReg(REG_OFFSET_MOSAIC, (sprite->data[0] << 12) | (sprite->data[0] << 8)); + if (sprite->data[0] == 0) + { + sprite->oam.mosaic = FALSE; + sprite->callback = SpriteCallbackDummy; + } +} + +void LoadCursorMonSprite(void) +{ + u16 i; + u16 tileStart; + u8 palSlot; + u8 spriteId; + struct SpriteSheet sheet = {sPSSData->field_22C4, 0x800, TAG_TILE_2}; + struct SpritePalette palette = {sPSSData->field_2244, TAG_PAL_DAC6}; + struct SpriteTemplate template = sSpriteTemplate_CursorMon; + + for (i = 0; i < 0x800; i++) + sPSSData->field_22C4[i] = 0; + for (i = 0; i < 0x10; i++) + sPSSData->field_2244[i] = 0; + + sPSSData->cursorMonSprite = NULL; + + do + { + tileStart = LoadSpriteSheet(&sheet); + if (tileStart == 0) + break; + + palSlot = LoadSpritePalette(&palette); + if (palSlot == 0xFF) + break; + + spriteId = CreateSprite(&template, 40, 48, 0); + if (spriteId == MAX_SPRITES) + break; + + sPSSData->cursorMonSprite = &gSprites[spriteId]; + sPSSData->field_223A = palSlot * 16 + 0x100; + sPSSData->field_223C = (void *)OBJ_VRAM0 + tileStart * 32; + } while (0); + + if (sPSSData->cursorMonSprite == NULL) + { + FreeSpriteTilesByTag(TAG_TILE_2); + FreeSpritePaletteByTag(TAG_PAL_DAC6); + } +} + +void LoadCursorMonGfx(u16 species, u32 pid) +{ + if (sPSSData->cursorMonSprite == NULL) + return; + + if (species != SPECIES_NONE) + { + HandleLoadSpecialPokePic(&gMonFrontPicTable[species], sPSSData->field_22C4, species, pid); + LZ77UnCompWram(sPSSData->cursorMonPalette, sPSSData->field_2244); + CpuCopy32(sPSSData->field_22C4, sPSSData->field_223C, 0x800); + LoadPalette(sPSSData->field_2244, sPSSData->field_223A, 0x20); + sPSSData->cursorMonSprite->invisible = FALSE; + } + else + { + sPSSData->cursorMonSprite->invisible = TRUE; + } +} + +void PrintCursorMonInfo(void) +{ + u16 i; + u16 y; + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + { + for (i = 0, y = 0; i < 3; i++, y += 14) + { + AddTextPrinterParameterized(0, 2, sPSSData->cursorMonTexts[i], i == 2 ? 10 : 6, y, TEXT_SPEED_FF, NULL); + } + AddTextPrinterParameterized(0, 0, sPSSData->cursorMonTexts[3], 6, y + 2, TEXT_SPEED_FF, NULL); + } + else + { + AddTextPrinterParameterized(0, 0, sPSSData->cursorMonTexts[3], 6, 0, TEXT_SPEED_FF, NULL); + for (i = 0, y = 15; i < 3; i++, y += 14) + { + AddTextPrinterParameterized(0, 2, sPSSData->cursorMonTexts[i], i == 2 ? 10 : 6, y, TEXT_SPEED_FF, NULL); + } + } + + CopyWindowToVram(0, 2); + if (sPSSData->cursorMonSpecies != SPECIES_NONE) + { + sub_80BEBD0(sPSSData->cursorMonMarkings, sPSSData->field_DA0); + sPSSData->field_D94->invisible = FALSE; + } + else + { + sPSSData->field_D94->invisible = TRUE; + } +} + +void sub_808F5E8(void) +{ + u16 i; + + if (sPSSData->cursorMonSpecies != SPECIES_NONE) + { + SetBoxPartyPokemonDropdownMap2Rect(0, 0, 0, 8, 2); + for (i = 0; i < 2; i++) + StartSpriteAnimIfDifferent(sPSSData->field_D98[i], i * 2 + 1); + } + else + { + SetBoxPartyPokemonDropdownMap2Rect(0, 0, 2, 8, 2); + for (i = 0; i < 2; i++) + StartSpriteAnim(sPSSData->field_D98[i], i * 2); + } + + CopyBoxPartyPokemonDropdownToBgTilemapBuffer(0); + ScheduleBgCopyTilemapToVram(1); +} + +void sub_808F68C(void) +{ + LZ77UnCompWram(gUnknown_8E9CAEC, sPSSData->field_B0); + LoadPalette(gPSSMenu_Pal, 0x10, 0x20); + SetBoxPartyPokemonDropdownMap2(1, 1, sPSSData->field_B0, 12, 22); + SetBoxPartyPokemonDropdownMap2(2, 1, gUnknown_83CE778, 9, 4); + SetBoxPartyPokemonDropdownMap2Pos(1, 10, 0); + SetBoxPartyPokemonDropdownMap2Pos(2, 21, 0); + sub_808F9FC(); + if (sInPartyMenu) + { + sub_808F90C(TRUE); + CreatePartyMonsSprites(TRUE); + CopyBoxPartyPokemonDropdownToBgTilemapBuffer(2); + CopyBoxPartyPokemonDropdownToBgTilemapBuffer(1); + } + else + { + SetBoxPartyPokemonDropdownMap2Rect(1, 0, 20, 12, 2); + sub_808F90C(TRUE); + CopyBoxPartyPokemonDropdownToBgTilemapBuffer(1); + CopyBoxPartyPokemonDropdownToBgTilemapBuffer(2); + } + + ScheduleBgCopyTilemapToVram(1); + sPSSData->unk_02C7 = FALSE; +} + +void SetUpShowPartyMenu(void) +{ + sPSSData->field_2C0 = 20; + sPSSData->field_2C2 = 2; + sPSSData->field_2C5 = 0; + CreatePartyMonsSprites(FALSE); +} + +bool8 ShowPartyMenu(void) +{ + if (sPSSData->field_2C5 == 20) + return FALSE; + + sPSSData->field_2C0--; + sPSSData->field_2C2++; + AdjustBoxPartyPokemonDropdownPos(1, 3, 1); + CopyBoxPartyPokemonDropdownToBgTilemapBuffer(1); + ScheduleBgCopyTilemapToVram(1); + sub_8090B98(8); + if (++sPSSData->field_2C5 == 20) + { + sInPartyMenu = TRUE; + return FALSE; + } + else + { + return TRUE; + } +} + +void SetUpHidePartyMenu(void) +{ + sPSSData->field_2C0 = 0; + sPSSData->field_2C2 = 22; + sPSSData->field_2C5 = 0; + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) + sub_80960C0(); +} + +bool8 HidePartyMenu(void) +{ + if (sPSSData->field_2C5 != 20) + { + sPSSData->field_2C0++; + sPSSData->field_2C2--; + AdjustBoxPartyPokemonDropdownPos(1, 3, -1); + CopyBoxPartyPokemonDropdownToBgTilemapBuffer(1); + FillBgTilemapBufferRect_Palette0(1, 0x100, 10, sPSSData->field_2C2, 12, 1); + sub_8090B98(-8); + if (++sPSSData->field_2C5 != 20) + { + ScheduleBgCopyTilemapToVram(1); + return TRUE; + } + else + { + sInPartyMenu = FALSE; + DestroyAllPartyMonIcons(); + CompactPartySlots(); + SetBoxPartyPokemonDropdownMap2Rect(2, 0, 0, 9, 2); + CopyBoxPartyPokemonDropdownToBgTilemapBuffer(2); + ScheduleBgCopyTilemapToVram(1); + return FALSE; + } + } + + return FALSE; +} + +void sub_808F90C(bool8 arg0) +{ + if (arg0) + SetBoxPartyPokemonDropdownMap2Rect(2, 0, 0, 9, 2); + else + SetBoxPartyPokemonDropdownMap2Rect(2, 0, 2, 9, 2); + + CopyBoxPartyPokemonDropdownToBgTilemapBuffer(2); + ScheduleBgCopyTilemapToVram(1); +} + +void sub_808F948(void) +{ + sPSSData->unk_02C7 = TRUE; + sPSSData->unk_02C8 = 30; + sPSSData->unk_02C9 = TRUE; +} + +void sub_808F974(void) +{ + if (sPSSData->unk_02C7) + { + sPSSData->unk_02C7 = FALSE; + sub_808F90C(TRUE); + } +} + +void sub_808F99C(void) +{ + if (sPSSData->unk_02C7 && ++sPSSData->unk_02C8 > 30) + { + sPSSData->unk_02C8 = 0; + sPSSData->unk_02C9 = (sPSSData->unk_02C9 == FALSE); + sub_808F90C(sPSSData->unk_02C9); + } +} + +void sub_808F9FC(void) +{ + u8 i; + + for (i = 1; i < PARTY_SIZE; i++) + { + s32 species = GetMonData(gPlayerParty + i, MON_DATA_SPECIES); + sub_808FA30(i, (species != SPECIES_NONE)); + } +} + +void sub_808FA30(u8 pos, bool8 isPartyMon) +{ + u16 i, j, index; + const u16 *data; + + if (isPartyMon) + data = gUnknown_83CE7C0; + else + data = gUnknown_83CE7D8; + + index = 3 * (3 * (pos - 1) + 1); + index *= 4; + index += 7; + for (i = 0; i < 3; i++) + { + for (j = 0; j < 4; j++) + { + sPSSData->field_B0[index + j] = data[j]; + } + data += 4; + index += 12; + } +} + +void sub_808FAA8(void) +{ + sub_808F9FC(); + SetBoxPartyPokemonDropdownMap2Rect(1, 0, 0, 12, 22); + CopyBoxPartyPokemonDropdownToBgTilemapBuffer(1); + ScheduleBgCopyTilemapToVram(1); +} + +void SetUpDoShowPartyMenu(void) +{ + sPSSData->showPartyMenuState = 0; + PlaySE(SE_WIN_OPEN); + SetUpShowPartyMenu(); +} + +bool8 DoShowPartyMenu(void) +{ + switch (sPSSData->showPartyMenuState) + { + case 0: + if (!ShowPartyMenu()) + { + sub_8092AE4(); + sPSSData->showPartyMenuState++; + } + break; + case 1: + if (!sub_80924A8()) + { + if (sPSSData->setMosaic) + BoxSetMosaic(); + sPSSData->showPartyMenuState++; + } + break; + case 2: + return FALSE; + } + return TRUE; +} + +void sub_808FB68(void) +{ + SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(29)); + TextWindow_SetStdFrame0_WithPal(1, 2, 208); + FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17); + CopyBgTilemapBufferToVram(0); +} + +void PrintStorageActionText(u8 id) +{ + u8 *txtPtr; + + DynamicPlaceholderTextUtil_Reset(); + switch (gPCStorageActionTexts[id].format) + { + case PC_TEXT_FMT_NORMAL: + break; + case PC_TEXT_FMT_MON_NAME_1: + case PC_TEXT_FMT_MON_NAME_2: + case PC_TEXT_FMT_MON_NAME_3: + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPSSData->cursorMonNick); + break; + case PC_TEXT_FMT_MON_NAME_4: + case PC_TEXT_FMT_MON_NAME_5: + case PC_TEXT_FMT_MON_NAME_6: + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPSSData->field_21E0); + break; + case PC_TEXT_FMT_ITEM_NAME: + if (IsActiveItemMoving()) + txtPtr = StringCopy(sPSSData->itemName, GetMovingItemName()); + else + txtPtr = StringCopy(sPSSData->itemName, sPSSData->cursorMonTexts[3]); + + while (*(txtPtr - 1) == CHAR_SPACE) + txtPtr--; + + *txtPtr = EOS; + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPSSData->itemName); + break; + } + + DynamicPlaceholderTextUtil_ExpandPlaceholders(sPSSData->field_2190, gPCStorageActionTexts[id].text); + FillWindowPixelBuffer(1, PIXEL_FILL(1)); + AddTextPrinterParameterized(1, 1, sPSSData->field_2190, 0, 2, TEXT_SPEED_FF, NULL); + DrawTextBorderOuter(1, 2, 13); + PutWindowTilemap(1); + CopyWindowToVram(1, 2); + ScheduleBgCopyTilemapToVram(0); +} + +void ShowYesNoWindow(s8 cursorPos) +{ + CreateYesNoMenu(&sYesNoWindowTemplate, 1, 0, 2, 0x00b, 14, 1); + Menu_MoveCursorNoWrapAround(cursorPos); +} + +void ClearBottomWindow(void) +{ + ClearStdWindowAndFrameToTransparent(1, FALSE); + ScheduleBgCopyTilemapToVram(0); +} + +void AddWallpaperSetsMenu(void) +{ + InitMenu(); + SetMenuText(18); + SetMenuText(19); + SetMenuText(20); + SetMenuText(21); + AddMenu(); +} +void AddWallpapersMenu(u8 wallpaperSet) +{ + InitMenu(); + switch (wallpaperSet) + { + case 0: + SetMenuText(22); + SetMenuText(23); + SetMenuText(24); + SetMenuText(25); + break; + case 1: + SetMenuText(26); + SetMenuText(27); + SetMenuText(28); + SetMenuText(29); + break; + case 2: + SetMenuText(30); + SetMenuText(31); + SetMenuText(32); + SetMenuText(33); + break; + case 3: + SetMenuText(34); + SetMenuText(35); + SetMenuText(36); + SetMenuText(37); + break; + } + AddMenu(); +} + +u8 GetCurrentBoxOption(void) +{ + return sCurrentBoxOption; +} + +void sub_808FDFC(void) +{ + if (!IsCursorOnBox()) + { + if (sInPartyMenu) + sub_8095C84(CURSOR_AREA_IN_PARTY, GetBoxCursorPosition()); + else + sub_8095C84(CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); + } + + if (gUnknown_20397BA != ITEM_NONE) + { + sub_8095E2C(gUnknown_20397BA); + sub_8094D14(3); + } +} + +void sub_808FE54(u8 action) +{ + u16 event; + u8 fromBox = sub_8094D34(); + u16 species = sPSSData->cursorMonSpecies; + u16 species2; + u8 toBox; + struct PssQuestLogBuffer * qlogBuffer; + if (sInPartyMenu) + { + toBox = 14; + species2 = GetMonData(&gPlayerParty[GetBoxCursorPosition()], MON_DATA_SPECIES2); + } + else + { + toBox = StorageGetCurrentBox(); + species2 = GetCurrentBoxMonData(GetBoxCursorPosition(), MON_DATA_SPECIES2); + } + qlogBuffer = &sPSSData->qlogBuffer; + + switch (action) + { + default: + return; + case 0: + if (sInPartyMenu) + { + if (fromBox == 14) + return; + else + event = QL_EVENT_SWITCHED_PARTY_MON_FOR_PC_MON; + } + else + { + if (fromBox == 14) + // Should upmerge but doesn't + event = QL_EVENT_SWITCHED_PARTY_MON_FOR_PC_MON; + else + event = fromBox != toBox ? QL_EVENT_SWITCHED_MONS_BETWEEN_BOXES : QL_EVENT_SWITCHED_MONS_WITHIN_BOX; + } + qlogBuffer->species = species; + qlogBuffer->species2 = species2; + qlogBuffer->fromBox = fromBox; + qlogBuffer->toBox = toBox; + break; + case 1: + qlogBuffer->species = species; + qlogBuffer->species2 = SPECIES_NONE; + qlogBuffer->fromBox = fromBox; + qlogBuffer->toBox = 0xFF; + if (sInPartyMenu) + { + if (fromBox == 14) + return; + else + event = QL_EVENT_WITHDREW_MON_PC; + } + else + { + if (fromBox == 14) + { + event = QL_EVENT_DEPOSITED_MON_PC; + qlogBuffer->fromBox = toBox; + } + else if (fromBox != toBox) + { + event = QL_EVENT_MOVED_MON_BETWEEN_BOXES; + qlogBuffer->toBox = toBox; + } + else + event = QL_EVENT_MOVED_MON_WITHIN_BOX; + } + break; + case 2: + event = QL_EVENT_DEPOSITED_MON_PC; + qlogBuffer->species = species; + qlogBuffer->species2 = SPECIES_NONE; + qlogBuffer->fromBox = gUnknown_20397B6; + qlogBuffer->toBox = 0xFF; + break; + case 3: + event = QL_EVENT_SWITCHED_MULTIPLE_MONS; + qlogBuffer->species = SPECIES_NONE; + qlogBuffer->species2 = SPECIES_NONE; + qlogBuffer->fromBox = fromBox; + qlogBuffer->toBox = toBox; + break; + } + SetQuestLogEvent(event, (const void *)qlogBuffer); +} diff --git a/src/strings.c b/src/strings.c index ee67c6dae..751d1e7bd 100644 --- a/src/strings.c +++ b/src/strings.c @@ -601,36 +601,36 @@ const u8 gString_BattleRecords_4Dashes[] = _("----"); const u8 gFameCheckerText_FameCheckerWillBeClosed[] = _("The FAME CHECKER will be closed."); const u8 gFameCheckerText_ClearTextbox[] = _("\n "); const u8 gUnknown_8418204[] = _("やめる"); -const u8 gUnknown_8418208[] = _("Exit from the BOX."); -const u8 gUnknown_841821B[] = _("What do you want to do?"); -const u8 gUnknown_8418233[] = _("Please pick a theme."); -const u8 gUnknown_8418248[] = _("Pick the wallpaper."); -const u8 gUnknown_841825C[] = _("{DYNAMIC 0x00} is selected."); -const u8 gUnknown_841826C[] = _("Jump to which BOX?"); -const u8 gUnknown_841827F[] = _("Deposit in which BOX?"); -const u8 gUnknown_8418295[] = _("{DYNAMIC 0x00} was deposited."); -const u8 gUnknown_84182A7[] = _("The BOX is full."); -const u8 gUnknown_84182B8[] = _("Release this POKéMON?"); -const u8 gUnknown_84182CE[] = _("{DYNAMIC 0x00} was released."); -const u8 gUnknown_84182DF[] = _("Bye-bye, {DYNAMIC 0x00}!"); -const u8 gUnknown_84182EC[] = _("Mark your POKéMON."); -const u8 gUnknown_84182FF[] = _("That's your last POKéMON!"); -const u8 gUnknown_8418319[] = _("Your party's full!"); -const u8 gUnknown_841832C[] = _("You're holding a POKéMON!"); -const u8 gUnknown_8418346[] = _("Which one will you take?"); -const u8 gUnknown_841835F[] = _("You can't release an EGG."); -const u8 gUnknown_8418379[] = _("Continue BOX operations?"); -const u8 gUnknown_8418392[] = _("{DYNAMIC 0x00} came back!"); -const u8 gUnknown_84183A0[] = _("Was it worried about you?"); -const u8 gUnknown_84183BA[] = _("‥ ‥ ‥ ‥ ‥!"); -const u8 gUnknown_84183C5[] = _("Please remove the MAIL."); -const u8 gUnknown_84183DD[] = _("GIVE to a POKéMON?"); -const u8 gUnknown_84183F0[] = _("Placed item in the BAG."); -const u8 gUnknown_8418408[] = _("The BAG is full."); -const u8 gUnknown_8418419[] = _("Put this item in the BAG?"); -const u8 gUnknown_8418433[] = _("{DYNAMIC 0x00} is now held."); -const u8 gUnknown_8418443[] = _("Changed to {DYNAMIC 0x00}."); -const u8 gUnknown_8418452[] = _("MAIL can't be stored!"); +const u8 gText_ExitFromBox[] = _("Exit from the BOX."); +const u8 gText_WhatDoYouWantToDo[] = _("What do you want to do?"); +const u8 gText_PleasePickATheme[] = _("Please pick a theme."); +const u8 gText_PickTheWallpaper[] = _("Pick the wallpaper."); +const u8 gText_PkmnIsSelected[] = _("{DYNAMIC 0x00} is selected."); +const u8 gText_JumpToWhichBox[] = _("Jump to which BOX?"); +const u8 gText_DepositInWhichBox[] = _("Deposit in which BOX?"); +const u8 gText_PkmnWasDeposited[] = _("{DYNAMIC 0x00} was deposited."); +const u8 gText_BoxIsFull2[] = _("The BOX is full."); +const u8 gText_ReleaseThisPokemon[] = _("Release this POKéMON?"); +const u8 gText_PkmnWasReleased[] = _("{DYNAMIC 0x00} was released."); +const u8 gText_ByeByePkmn[] = _("Bye-bye, {DYNAMIC 0x00}!"); +const u8 gText_MarkYourPkmn[] = _("Mark your POKéMON."); +const u8 gText_ThatsYourLastPkmn[] = _("That's your last POKéMON!"); +const u8 gText_YourPartysFull[] = _("Your party's full!"); +const u8 gText_YoureHoldingAPkmn[] = _("You're holding a POKéMON!"); +const u8 gText_WhichOneWillYouTake[] = _("Which one will you take?"); +const u8 gText_YouCantReleaseAnEgg[] = _("You can't release an EGG."); +const u8 gText_ContinueBoxOperations[] = _("Continue BOX operations?"); +const u8 gText_PkmnCameBack[] = _("{DYNAMIC 0x00} came back!"); +const u8 gText_WasItWorriedAboutYou[] = _("Was it worried about you?"); +const u8 gText_FourEllipsesExclamation[] = _("‥ ‥ ‥ ‥ ‥!"); +const u8 gText_PleaseRemoveTheMail[] = _("Please remove the MAIL."); +const u8 gText_GiveToAPkmn[] = _("GIVE to a POKéMON?"); +const u8 gText_PlacedItemInBag[] = _("Placed item in the BAG."); +const u8 gText_BagIsFull2[] = _("The BAG is full."); +const u8 gText_PutItemInBag[] = _("Put this item in the BAG?"); +const u8 gText_ItemIsNowHeld[] = _("{DYNAMIC 0x00} is now held."); +const u8 gText_ChangedToNewItem[] = _("Changed to {DYNAMIC 0x00}."); +const u8 gText_MailCantBeStored[] = _("MAIL can't be stored!"); const u8 gUnknown_8418468[] = _("CANCEL"); const u8 gUnknown_841846F[] = _("STORE"); const u8 gUnknown_8418475[] = _("WITHDRAW"); |