From e0f3de0b7483afe2b751ea9fb8204e7da49a371b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 9 Dec 2018 16:44:01 +0100 Subject: Start pokemon storage system --- include/mon_markings.h | 2 ++ include/pokemon_storage_system.h | 26 +++++++++++++++++++++++++- include/strings.h | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/mon_markings.h b/include/mon_markings.h index 22c3f14a4..00df6815a 100644 --- a/include/mon_markings.h +++ b/include/mon_markings.h @@ -21,6 +21,8 @@ struct PokemonMarkMenu /*0x10B4*/ u8 tileLoadState; }; // 10b8 +void sub_811F90C(struct PokemonMarkMenu *ptr); +void sub_811FA90(void); struct Sprite *sub_811FF94(u16 tileTag, u16 paletteTag, const u16 *palette); #endif //POKEEMERALD_MON_MARKINGS_H diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 9b5358f06..4a3adec78 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -69,8 +69,32 @@ struct PokemonStorageSystemData u8 unk_0002; u8 unk_0003; u8 taskId; - u8 unk_0005[710]; + u8 unk_0005; + struct UnkStruct_2000020 unk_0020; + struct UnkStruct_2000028 unk_0028[8]; + u8 unk_90[567]; + u8 unk_02C7; + u8 unk_02C8; + u8 unk_02C9; + s16 field_2CA; u16 bg2_X; + u8 field_2CE; + u8 field_2CF[1217]; + u8 changeWallpaper; + u8 field_791; + u8 wallpaperTilemap[180 * 4]; + u8 wallpaperChangeState; + u8 field_A63; + u8 field_A64; + u8 field_A65; + u8 field_A66; + u8 field_A67; + u8 *wallpaperTilemapPtr; + u8 field_A6C; + u8 field_A6D[633]; + u16 field_CE6; + u8 field_CE8[188]; + struct PokemonMarkMenu field_DA4; }; extern struct UnkPSSStruct_2002370 *gUnknown_02039D04; diff --git a/include/strings.h b/include/strings.h index e17ea8646..744859c3e 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1403,4 +1403,36 @@ extern const u8 BattleFrontier_BattlePyramidEmptySquare_Text_254F47[]; extern const u8 BattleFrontier_BattlePyramidEmptySquare_Text_254F0E[]; extern const u8 BattleFrontier_BattlePyramidEmptySquare_Text_254ED3[]; +// PC strings +extern const u8 gText_ExitFromBox[]; +extern const u8 gText_WhatDoYouWantToDo[]; +extern const u8 gText_PleasePickATheme[]; +extern const u8 gText_PickTheWallpaper[]; +extern const u8 gText_PkmnIsSelected[]; +extern const u8 gText_JumpToWhichBox[]; +extern const u8 gText_DepositInWhichBox[]; +extern const u8 gText_PkmnWasDeposited[]; +extern const u8 gText_BoxIsFull2[]; +extern const u8 gText_ReleaseThisPokemon[]; +extern const u8 gText_PkmnWasReleased[]; +extern const u8 gText_ByeByePkmn[]; +extern const u8 gText_MarkYourPkmn[]; +extern const u8 gText_ThatsYourLastPkmn[]; +extern const u8 gText_YourPartysFull[]; +extern const u8 gText_YoureHoldingAPkmn[]; +extern const u8 gText_WhichOneWillYouTake[]; +extern const u8 gText_YouCantReleaseAnEgg[]; +extern const u8 gText_ContinueBoxOperations[]; +extern const u8 gText_PkmnCameBack[]; +extern const u8 gText_WasItWorriedAboutYou[]; +extern const u8 gText_FourEllipsesExclamation[]; +extern const u8 gText_PleaseRemoveTheMail[]; +extern const u8 gText_GiveToAPkmn[]; +extern const u8 gText_PlacedItemInBag[]; +extern const u8 gText_BagIsFull2[]; +extern const u8 gText_PutItemInBag[]; +extern const u8 gText_ItemIsNowHeld[]; +extern const u8 gText_ChangedToNewItem[]; +extern const u8 gText_MailCantBeStored[]; + #endif //GUARD_STRINGS_H -- cgit v1.2.3 From 431e7e7e5c390db7fa809f7e8ef1a47c0009468a Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 9 Dec 2018 21:06:43 +0100 Subject: More storage work --- include/mon_markings.h | 7 +++++++ include/pokemon_storage_system.h | 21 +++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/mon_markings.h b/include/mon_markings.h index 00df6815a..8e4ec58bd 100644 --- a/include/mon_markings.h +++ b/include/mon_markings.h @@ -22,7 +22,14 @@ struct PokemonMarkMenu }; // 10b8 void sub_811F90C(struct PokemonMarkMenu *ptr); +void sub_811F918(void); +bool8 sub_811F960(void); void sub_811FA90(void); +void sub_811FAA4(u8 markings, s16 x, s16 y); +void sub_811FAF8(void); +bool8 sub_811FBA4(void); struct Sprite *sub_811FF94(u16 tileTag, u16 paletteTag, const u16 *palette); +struct Sprite *sub_811FFB4(u16 tileTag, u16 paletteTag, const u16 *palette); +void sub_8120084(u8 markings, void *dest); #endif //POKEEMERALD_MON_MARKINGS_H diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 4a3adec78..ed2b20f46 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -76,12 +76,12 @@ struct PokemonStorageSystemData u8 unk_02C7; u8 unk_02C8; u8 unk_02C9; - s16 field_2CA; + s16 newCurrBoxId; u16 bg2_X; u8 field_2CE; - u8 field_2CF[1217]; - u8 changeWallpaper; - u8 field_791; + u8 field_2CF[1215]; + s16 wallpaperSetId; + s16 wallpaperId; u8 wallpaperTilemap[180 * 4]; u8 wallpaperChangeState; u8 field_A63; @@ -92,9 +92,18 @@ struct PokemonStorageSystemData u8 *wallpaperTilemapPtr; u8 field_A6C; u8 field_A6D[633]; - u16 field_CE6; - u8 field_CE8[188]; + u16 selectedItem; + u16 field_CE8; + u8 field_CEA; + u8 field_CEB; + u8 field_CEC; + u8 field_CED; + u8 field_CEE; + u8 field_CEF[181]; struct PokemonMarkMenu field_DA4; + struct UnkPSSStruct_2002370 field_1E5C; + u8 field_20A4[400]; + u16 field_2234; }; extern struct UnkPSSStruct_2002370 *gUnknown_02039D04; -- cgit v1.2.3 From c2d887617492db009694e8715ff606418c691346 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 10 Dec 2018 21:36:52 +0100 Subject: Document PSS functions --- include/item_menu.h | 1 + include/pokemon_storage_system.h | 17 ++++++++++++++--- include/pokemon_summary_screen.h | 3 ++- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/item_menu.h b/include/item_menu.h index 649eb934c..6214c69fc 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -60,5 +60,6 @@ void CB2_BagMenuFromStartMenu(void); u8 sub_81ABB2C(u8 pocketId); bool8 UseRegisteredKeyItemOnField(void); void CB2_GoToSellMenu(void); +void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()); #endif //GUARD_item_menu_H diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index ed2b20f46..c045eb481 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -66,7 +66,7 @@ struct PokemonStorageSystemData { u8 state; u8 boxOption; - u8 unk_0002; + u8 screenChangeType; u8 unk_0003; u8 taskId; u8 unk_0005; @@ -102,8 +102,19 @@ struct PokemonStorageSystemData u8 field_CEF[181]; struct PokemonMarkMenu field_DA4; struct UnkPSSStruct_2002370 field_1E5C; - u8 field_20A4[400]; - u16 field_2234; + u8 field_20A4[220]; + u8 field_2180; + u8 field_2181; + u8 field_2182; + u8 field_2183; + u8 field_2184; + u8 field_2185; + u8 field_2186; + u8 field_2187; + u8 field_2188; + struct BoxPokemon *field_218C; + u8 field_2190[164]; + u16 movingItem; }; extern struct UnkPSSStruct_2002370 *gUnknown_02039D04; diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 5dc37c70d..d0926d388 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -4,6 +4,7 @@ void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); void sub_81C4F98(u8, void(*)(void)); void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16); +void ShowPokemonSummaryScreenSet40EF(u8 mode, struct BoxPokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); // The Pokemon Summary Screen can operate in different modes. Certain features, // such as move re-ordering, are available in the different modes. @@ -11,7 +12,7 @@ enum PokemonSummaryScreenMode { PSS_MODE_NORMAL, PSS_MODE_UNK1, - PSS_MODE_UNK2, + PSS_MODE_BOX, PSS_MODE_SELECT_MOVE, }; -- cgit v1.2.3 From c5b5f4bd777b4b255294818bb1dc7fe01bc38a6d Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 10 Dec 2018 23:42:44 +0100 Subject: More storage --- include/graphics.h | 3 +++ include/pokemon_storage_system.h | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/graphics.h b/include/graphics.h index b51926b8d..a07a669d6 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -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 diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index c045eb481..f582c2dc4 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -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; -- cgit v1.2.3 From 74746603ada01fa9e5d6b355476f67d03c652e9b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 11 Dec 2018 23:09:12 +0100 Subject: More pokemon storage --- include/pokemon_storage_system.h | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index f582c2dc4..d3beb88ab 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -91,7 +91,10 @@ struct PokemonStorageSystemData u8 field_A67; u8 *wallpaperTilemapPtr; u8 field_A6C; - u8 field_A6D[633]; + u8 field_A6D[623]; + u32 *field_CDC; + u32 cursorMonPersonality; + u16 cursorMonSpecies; u16 selectedItem; u16 field_CE8; u8 field_CEA; @@ -99,7 +102,20 @@ struct PokemonStorageSystemData u8 field_CEC; u8 field_CED; u8 field_CEE; - u8 field_CEF[165]; + u8 field_CEF; + u8 field_CF0; + u8 field_CF1; + u8 field_CF2; + u8 field_CF3; + u8 field_CF4; + u8 field_CF5; + u8 field_CF6; + u8 field_CF7; + u8 field_CF8; + u8 cursorMonNick[36]; + u8 cursorMonSpeciesName[36]; + u8 cursorMonGenderLvlText[36]; + u8 cursorMonItemName[47]; struct Sprite *field_D94; struct Sprite *field_D98[2]; u16 *field_DA0; @@ -118,7 +134,17 @@ struct PokemonStorageSystemData struct BoxPokemon *field_218C; u8 field_2190[164]; u16 movingItem; - u8 field_2236[14478]; + u8 field_2236; + u8 field_2237; + u8 field_2238; + u8 field_2239; + u16 field_223A; + u16 *field_223C; + struct Sprite *cursorMonSprite; + u16 field_2244[16]; + u8 field_2264[96]; + u8 field_22C4[0x800]; + u8 field_2AC4[12288]; u8 field_5AC4[0x800]; }; -- cgit v1.2.3 From 59a69eb62769003a81c0f9f50be5ec5abde96242 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 12 Dec 2018 23:19:50 +0100 Subject: Storage up to icon palettes --- include/graphics.h | 2 ++ include/menu.h | 1 + include/pokemon_storage_system.h | 39 ++++++++++++++++++++++----------------- 3 files changed, 25 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/graphics.h b/include/graphics.h index a07a669d6..658239f5c 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4742,5 +4742,7 @@ extern const u16 gPokedexAreaScreenAreaUnknown_Pal[]; // Pokemon Storage System extern const u32 gPSSMenu_Gfx[]; +extern const u16 gPSSMenu_Pal[]; +extern const u32 gUnknown_08DD36C8[]; #endif //GUARD_GRAPHICS_H diff --git a/include/menu.h b/include/menu.h index eb525efe9..e7a78f76e 100644 --- a/include/menu.h +++ b/include/menu.h @@ -72,6 +72,7 @@ u8 sub_8199134(s8, s8); u8 GetStartMenuWindowId(void); void sub_819A2BC(u8, u8); u8 MoveMenuCursor(s8 cursorDelta); +u8 MoveMenuCursorNoWrapAround(s8 cursorDelta); void NewMenuHelpers_DrawStdWindowFrame(u8 windowId, bool8 CopyToVram); u8 sub_81979C4(u8 a1); u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index d3beb88ab..d36f4b358 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -72,14 +72,21 @@ struct PokemonStorageSystemData u8 unk_0005; struct UnkStruct_2000020 unk_0020; struct UnkStruct_2000028 unk_0028[8]; - u8 unk_90[567]; + u16 field_90[16]; + u16 field_B0[528 / 2]; + u16 field_2C0; + u16 field_2C2; + u8 field_2C4; + u8 field_2C5; + u8 showPartyMenuState; u8 unk_02C7; u8 unk_02C8; - u8 unk_02C9; + bool8 unk_02C9; s16 newCurrBoxId; u16 bg2_X; u8 field_2CE; - u8 field_2CF[1215]; + u8 field_2CF[1213]; + u16 field_78C; s16 wallpaperSetId; s16 wallpaperId; u8 wallpaperTilemap[180 * 4]; @@ -90,8 +97,13 @@ struct PokemonStorageSystemData u8 field_A66; u8 field_A67; u8 *wallpaperTilemapPtr; - u8 field_A6C; - u8 field_A6D[623]; + struct Sprite *field_A6C; + struct Sprite *partySprites[PARTY_SIZE]; + struct Sprite *boxMonsSprites[IN_BOX_COUNT]; + u8 field_B00[8]; + u16 field_B08[40]; + u16 field_B58[40]; + u8 field_BA8[308]; u32 *field_CDC; u32 cursorMonPersonality; u16 cursorMonSpecies; @@ -101,17 +113,7 @@ struct PokemonStorageSystemData u8 field_CEB; u8 field_CEC; u8 field_CED; - u8 field_CEE; - u8 field_CEF; - u8 field_CF0; - u8 field_CF1; - u8 field_CF2; - u8 field_CF3; - u8 field_CF4; - u8 field_CF5; - u8 field_CF6; - u8 field_CF7; - u8 field_CF8; + u8 field_CEE[POKEMON_NAME_LENGTH + 1]; u8 cursorMonNick[36]; u8 cursorMonSpeciesName[36]; u8 cursorMonGenderLvlText[36]; @@ -132,7 +134,10 @@ struct PokemonStorageSystemData u8 field_2187; u8 field_2188; struct BoxPokemon *field_218C; - u8 field_2190[164]; + u8 field_2190[80]; + u8 field_21E0[POKEMON_NAME_LENGTH + 1]; + u8 field_21EB[15]; // TODO: ITEM NAME LENGTH + 1 + u8 field_21FA[58]; u16 movingItem; u8 field_2236; u8 field_2237; -- cgit v1.2.3 From f1421d94c384c1bd76304fcb961ca28d7f0e7e20 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 15 Dec 2018 23:58:47 +0100 Subject: Up to sub 0x80ce580 --- include/constants/maps.h | 1 + include/global.h | 6 +-- include/graphics.h | 9 ++++ include/menu.h | 6 +-- include/pokemon.h | 6 +-- include/pokemon_icon.h | 3 ++ include/pokemon_storage_system.h | 113 +++++++++++++++++++++++++++++++++------ include/text.h | 2 +- 8 files changed, 121 insertions(+), 25 deletions(-) (limited to 'include') diff --git a/include/constants/maps.h b/include/constants/maps.h index bcb778422..c65f373af 100644 --- a/include/constants/maps.h +++ b/include/constants/maps.h @@ -587,6 +587,7 @@ // Map Group 33 #define MAP_ROUTE124_DIVING_TREASURE_HUNTERS_HOUSE (0 | (33 << 8)) +#define MAP_GROUPS_COUNT 34 #define MAP_NONE (0x7F | (0x7F << 8)) #define MAP_UNDEFINED (0xFF | (0xFF << 8)) diff --git a/include/global.h b/include/global.h index cc8df049f..c976abd2d 100644 --- a/include/global.h +++ b/include/global.h @@ -858,15 +858,15 @@ typedef union // 3b58 struct WaldaPhrase { - u16 field_0; - u16 field_2; + u16 colors[2]; // Background, foreground. u8 text[16]; u8 iconId; u8 patternId; bool8 patternUnlocked; }; -struct UnkSaveSubstruct_3b98 { +struct UnkSaveSubstruct_3b98 +{ u32 trainerId; u8 trainerName[PLAYER_NAME_LENGTH + 1]; }; diff --git a/include/graphics.h b/include/graphics.h index 658239f5c..bfb57ccb9 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4743,6 +4743,15 @@ extern const u16 gPokedexAreaScreenAreaUnknown_Pal[]; // Pokemon Storage System extern const u32 gPSSMenu_Gfx[]; extern const u16 gPSSMenu_Pal[]; +extern const u32 gWallpaperIcon_Plusle[]; +extern const u32 gWallpaperIcon_Cross[]; +extern const u32 gWallpaperIcon_Bolt[]; extern const u32 gUnknown_08DD36C8[]; +extern const u32 gWallpaperTiles_Ribbon[]; +extern const u32 gWallpaperTilemap_Ribbon[]; +extern const u16 gWallpaperPalettes_Ribbon[][16]; +extern const u32 gWallpaperTiles_Horizontal[]; +extern const u32 gWallpaperTilemap_Horizontal[]; +extern const u16 gWallpaperPalettes_Horizontal[][16]; #endif //GUARD_GRAPHICS_H diff --git a/include/menu.h b/include/menu.h index e7a78f76e..f9b7c52df 100644 --- a/include/menu.h +++ b/include/menu.h @@ -48,11 +48,11 @@ s8 Menu_ProcessInput(void); s8 Menu_ProcessInputNoWrap(void); void blit_move_info_icon(u8 winId, u8 a2, u16 x, u16 y); void reset_temp_tile_data_buffers(void); -void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, int size, u16 offset, u8 mode); +void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); bool8 free_temp_tile_data_buffers_if_possible(void); struct WindowTemplate CreateWindowTemplate(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock); void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos); -void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, int size, u16 offset, u8 mode); +void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); s8 Menu_ProcessInputNoWrapClearOnChoose(void); s8 ProcessMenuInput_other(void); void do_scheduled_bg_tilemap_copies_to_vram(void); @@ -62,7 +62,7 @@ void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a2, u8 a3); void sub_81995E4(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds); void sub_8197DF8(u8 windowId, bool8 copyToVram); u16 sub_8198AA4(u8, u8, u8, u8, u8, u8, u16); -void *malloc_and_decompress(const void *src, int *sizeOut); +void *malloc_and_decompress(const void *src, u32 *sizeOut); u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 offset, u8 mode); void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress); void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8); diff --git a/include/pokemon.h b/include/pokemon.h index 5d7f7f2ae..8807168ef 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -8,9 +8,9 @@ #define MON_DATA_OT_ID 1 #define MON_DATA_NICKNAME 2 #define MON_DATA_LANGUAGE 3 -#define MON_DATA_SANITY_BIT1 4 -#define MON_DATA_SANITY_BIT2 5 -#define MON_DATA_SANITY_BIT3 6 +#define MON_DATA_SANITY_IS_BAD_EGG 4 +#define MON_DATA_SANITY_HAS_SPECIES 5 +#define MON_DATA_SANITY_IS_EGG 6 #define MON_DATA_OT_NAME 7 #define MON_DATA_MARKINGS 8 #define MON_DATA_CHECKSUM 9 diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index f1c8a3e61..5a18109f2 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -1,9 +1,12 @@ #ifndef GUARD_POKEMON_ICON_H #define GUARD_POKEMON_ICON_H +extern const u8 gMonIconPaletteIndices[]; + const u8 *GetMonIconTiles(u16 species, bool32); const u8 *GetMonIconPtr(u16 speciesId, u32 personality, u32 frameNo); const u16 *GetValidMonIconPalettePtr(u16 speciesId); +u16 GetIconSpecies(u16 species, u32 personality); u16 GetUnownLetterByPersonality(u32 personality); u16 sub_80D2E84(u16 speciesId); void LoadMonIconPalettes(void); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index d36f4b358..e9b3302c0 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -2,7 +2,9 @@ #define GUARD_POKEMON_STORAGE_SYSTEM_H #define TOTAL_BOXES_COUNT 14 -#define IN_BOX_COUNT 30 +#define IN_BOX_ROWS 6 +#define IN_BOX_COLUMS 5 +#define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMS) #include "pc_screen_effect.h" #include "mon_markings.h" @@ -69,7 +71,6 @@ struct PokemonStorageSystemData u8 screenChangeType; bool8 isReshowingPSS; u8 taskId; - u8 unk_0005; struct UnkStruct_2000020 unk_0020; struct UnkStruct_2000028 unk_0028[8]; u16 field_90[16]; @@ -84,26 +85,86 @@ struct PokemonStorageSystemData bool8 unk_02C9; s16 newCurrBoxId; u16 bg2_X; - u8 field_2CE; - u8 field_2CF[1213]; + s16 field_2CE; + u16 field_2D0; + u8 field_2D2; + u8 field_2D3; + u8 field_2D4; + u8 field_2D5; + u16 field_2D6; + s16 field_2D8; + u16 field_2DA; + u16 field_2DC; + u16 field_2DE; + u16 field_2E0; + u8 field_2E2; + u8 field_2E3; + u8 field_2E4[20]; + u8 field_2F8[1024]; + u8 field_6F8; + u8 field_6F9; + u8 field_6FA; + s8 field_6FB; + u16 field_6FC[16]; + u16 field_71C; + u16 field_71E; + struct Sprite *field_720[2]; + struct Sprite *field_728[2]; + struct Sprite *field_730[2]; + u32 field_738; + u8 field_73C[80]; u16 field_78C; s16 wallpaperSetId; s16 wallpaperId; - u8 wallpaperTilemap[180 * 4]; + u16 field_792[360]; u8 wallpaperChangeState; u8 field_A63; u8 field_A64; - u8 field_A65; + s8 field_A65; u8 field_A66; u8 field_A67; - u8 *wallpaperTilemapPtr; + u8 *wallpaperTiles; struct Sprite *field_A6C; struct Sprite *partySprites[PARTY_SIZE]; struct Sprite *boxMonsSprites[IN_BOX_COUNT]; - u8 field_B00[8]; + struct Sprite **field_B00; + struct Sprite **field_B04; u16 field_B08[40]; u16 field_B58[40]; - u8 field_BA8[308]; + u16 boxSpecies[IN_BOX_COUNT]; + u32 boxPersonalities[IN_BOX_COUNT]; + u8 field_C5C; + u8 field_C5D; + u8 field_C5E; + u8 field_C5F; + u16 field_C60; + s16 field_C62; + s16 field_C64; + u16 field_C66; + u8 field_C68; + s8 field_C69; + u8 field_C6A; + u8 field_C6B; + u8 field_C6C[72]; + struct Sprite *field_CB4; + struct Sprite *field_CB8; + s32 field_CBC; + s32 field_CC0; + u32 field_CC4; + u32 field_CC8; + s16 field_CCC; + s16 field_CCE; + u16 field_CD0; + s8 field_CD2; + s8 field_CD3; + u8 field_CD4; + u8 field_CD5; + u8 field_CD6; + u8 field_CD7; + u8 field_CD8; + u8 field_CD9; + u8 field_CDA; + u8 field_CDB; u32 *field_CDC; u32 cursorMonPersonality; u16 cursorMonSpecies; @@ -117,13 +178,26 @@ struct PokemonStorageSystemData u8 cursorMonNick[36]; u8 cursorMonSpeciesName[36]; u8 cursorMonGenderLvlText[36]; - u8 cursorMonItemName[47]; + u8 cursorMonItemName[36]; + bool8 (*monPlaceChangeFunc)(void); + u8 monPlaceChangeState; + u8 field_D91; 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]; + struct Pokemon field_20A4; + struct Pokemon field_2108; + s8 field_216C; + u8 field_216D; + s8 field_216E; + s8 field_216F; + s8 field_2170; + s8 field_2171; + u16 field_2172; + u16 field_2174; + u16 field_2176[5]; u8 field_2180; u8 field_2181; u8 field_2182; @@ -134,10 +208,18 @@ struct PokemonStorageSystemData u8 field_2187; u8 field_2188; struct BoxPokemon *field_218C; - u8 field_2190[80]; + u8 field_2190[40]; + u8 field_21B8[40]; u8 field_21E0[POKEMON_NAME_LENGTH + 1]; u8 field_21EB[15]; // TODO: ITEM NAME LENGTH + 1 - u8 field_21FA[58]; + u8 field_21FA; + u8 field_21FB; + u8 field_21FC; + u8 field_21FD; + u8 field_21FE; + u8 field_21FF; + u8 field_2200; + u8 field_2201[51]; u16 movingItem; u8 field_2236; u8 field_2237; @@ -149,7 +231,8 @@ struct PokemonStorageSystemData u16 field_2244[16]; u8 field_2264[96]; u8 field_22C4[0x800]; - u8 field_2AC4[12288]; + u8 field_2AC4[8192]; + u8 field_4AC4[0x1000]; u8 field_5AC4[0x800]; }; @@ -160,7 +243,7 @@ u8* GetBoxNamePtr(u8 boxNumber); struct BoxPokemon *GetBoxedMonPtr(u8, u8); void SetBoxMonNickFromAnyBox(u8, u8, u8 *); void CompactPartySlots(void); -u32 GetBoxMonDataFromAnyBox(u8 boxId, u8 monPosition, u32 request); +u32 GetBoxMonDataAt(u8 boxId, u8 monPosition, u32 request); bool8 CheckFreePokemonStorageSpace(void); u8 StorageGetCurrentBox(void); u8 sub_80D214C(struct BoxPokemon *a, u8 b, u8 c, u8 d); diff --git a/include/text.h b/include/text.h index 69cbb87ed..d9c7a9a2e 100644 --- a/include/text.h +++ b/include/text.h @@ -258,7 +258,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c u16 RenderText(struct TextPrinter *textPrinter); u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing); u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32); -u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing); +s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing); u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str); u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y); u8 GetKeypadIconTileOffset(u8 keypadIconId); -- cgit v1.2.3 From aae36b5653537a063560dc2c7df261cc7b950a4c Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 16 Dec 2018 21:10:01 +0100 Subject: 6k left --- include/menu.h | 6 +++--- include/pokemon_storage_system.h | 43 +++++++++++++++++++++++++--------------- include/pokemon_summary_screen.h | 2 ++ include/strings.h | 39 ++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/include/menu.h b/include/menu.h index f9b7c52df..198e7bd4a 100644 --- a/include/menu.h +++ b/include/menu.h @@ -43,7 +43,7 @@ void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, u16 tileStart, u8 palet void schedule_bg_copy_tilemap_to_vram(u8 bgNum); void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs); u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 numItems, u8 initialCursorPos); -u8 GetMenuCursorPos(void); +u8 Menu_GetCursorPos(void); s8 Menu_ProcessInput(void); s8 Menu_ProcessInputNoWrap(void); void blit_move_info_icon(u8 winId, u8 a2, u16 x, u16 y); @@ -71,8 +71,8 @@ u8 sub_8199944(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount u8 sub_8199134(s8, s8); u8 GetStartMenuWindowId(void); void sub_819A2BC(u8, u8); -u8 MoveMenuCursor(s8 cursorDelta); -u8 MoveMenuCursorNoWrapAround(s8 cursorDelta); +u8 Menu_MoveCursor(s8 cursorDelta); +u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta); void NewMenuHelpers_DrawStdWindowFrame(u8 windowId, bool8 CopyToVram); u8 sub_81979C4(u8 a1); u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index e9b3302c0..530fb7042 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -21,7 +21,7 @@ struct StorageAction u8 format; }; -struct StorageText +struct StorageMenu { const u8 *text; int textId; @@ -124,7 +124,7 @@ struct PokemonStorageSystemData u8 field_A66; u8 field_A67; u8 *wallpaperTiles; - struct Sprite *field_A6C; + struct Sprite *movingMonSprite; struct Sprite *partySprites[PARTY_SIZE]; struct Sprite *boxMonsSprites[IN_BOX_COUNT]; struct Sprite **field_B00; @@ -145,7 +145,15 @@ struct PokemonStorageSystemData s8 field_C69; u8 field_C6A; u8 field_C6B; - u8 field_C6C[72]; + struct WindowTemplate menuWindow; + struct StorageMenu menuItems[7]; + u8 menuItemsCount; + u8 menuWidth; + u8 field_CAE; + u8 field_CAF; + u16 field_CB0; + u8 field_CB2; + u8 field_CB3; struct Sprite *field_CB4; struct Sprite *field_CB8; s32 field_CBC; @@ -161,21 +169,20 @@ struct PokemonStorageSystemData u8 field_CD5; u8 field_CD6; u8 field_CD7; - u8 field_CD8; - u8 field_CD9; + u8 field_CD8[2]; u8 field_CDA; u8 field_CDB; - u32 *field_CDC; + const u32 *cursorMonPalette; u32 cursorMonPersonality; u16 cursorMonSpecies; - u16 selectedItem; + u16 cursorMonItem; u16 field_CE8; u8 field_CEA; - u8 field_CEB; - u8 field_CEC; - u8 field_CED; - u8 field_CEE[POKEMON_NAME_LENGTH + 1]; - u8 cursorMonNick[36]; + u8 cursorMonMarkings; + u8 cursorMonLevel; + bool8 cursorMonIsEgg; + u8 cursorMonNick[POKEMON_NAME_LENGTH + 1]; + u8 cursorMonNickText[36]; u8 cursorMonSpeciesName[36]; u8 cursorMonGenderLvlText[36]; u8 cursorMonItemName[36]; @@ -187,7 +194,7 @@ struct PokemonStorageSystemData u16 *field_DA0; struct PokemonMarkMenu field_DA4; struct UnkPSSStruct_2002370 field_1E5C; - struct Pokemon field_20A4; + struct Pokemon movingMon; struct Pokemon field_2108; s8 field_216C; u8 field_216D; @@ -207,7 +214,11 @@ struct PokemonStorageSystemData u8 field_2186; u8 field_2187; u8 field_2188; - struct BoxPokemon *field_218C; + union + { + struct Pokemon *mon; + struct BoxPokemon *box; + } field_218C; u8 field_2190[40]; u8 field_21B8[40]; u8 field_21E0[POKEMON_NAME_LENGTH + 1]; @@ -217,7 +228,7 @@ struct PokemonStorageSystemData u8 field_21FC; u8 field_21FD; u8 field_21FE; - u8 field_21FF; + u8 inBoxMovingMode; u8 field_2200; u8 field_2201[51]; u16 movingItem; @@ -242,7 +253,7 @@ extern struct PokemonStorageSystemData *gUnknown_02039D08; u8* GetBoxNamePtr(u8 boxNumber); struct BoxPokemon *GetBoxedMonPtr(u8, u8); void SetBoxMonNickFromAnyBox(u8, u8, u8 *); -void CompactPartySlots(void); +s16 CompactPartySlots(void); u32 GetBoxMonDataAt(u8 boxId, u8 monPosition, u32 request); bool8 CheckFreePokemonStorageSpace(void); u8 StorageGetCurrentBox(void); diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index d0926d388..c08c581c3 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -1,6 +1,8 @@ #ifndef GUARD_POKEMON_SUMMARY_SCREEN_H #define GUARD_POKEMON_SUMMARY_SCREEN_H +extern u8 gUnknown_0203CF20; + void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); void sub_81C4F98(u8, void(*)(void)); void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16); diff --git a/include/strings.h b/include/strings.h index 744859c3e..1557baa6b 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1434,5 +1434,44 @@ extern const u8 gText_PutItemInBag[]; extern const u8 gText_ItemIsNowHeld[]; extern const u8 gText_ChangedToNewItem[]; extern const u8 gText_MailCantBeStored[]; +extern const u8 gPCText_Cancel[]; +extern const u8 gPCText_Store[]; +extern const u8 gPCText_Withdraw[]; +extern const u8 gPCText_Move[]; +extern const u8 gPCText_Shift[]; +extern const u8 gPCText_Place[]; +extern const u8 gPCText_Summary[]; +extern const u8 gPCText_Release[]; +extern const u8 gPCText_Mark[]; +extern const u8 gPCText_Jump[]; +extern const u8 gPCText_Wallpaper[]; +extern const u8 gPCText_Name[]; +extern const u8 gPCText_Take[]; +extern const u8 gPCText_Give[]; +extern const u8 gPCText_Give[]; +extern const u8 gPCText_Switch[]; +extern const u8 gPCText_Bag[]; +extern const u8 gPCText_Info[]; +extern const u8 gPCText_Scenery1[]; +extern const u8 gPCText_Scenery2[]; +extern const u8 gPCText_Scenery3[]; +extern const u8 gPCText_Etcetera[]; +extern const u8 gPCText_Friends[]; +extern const u8 gPCText_Forest[]; +extern const u8 gPCText_City[]; +extern const u8 gPCText_Desert[]; +extern const u8 gPCText_Savanna[]; +extern const u8 gPCText_Crag[]; +extern const u8 gPCText_Volcano[]; +extern const u8 gPCText_Snow[]; +extern const u8 gPCText_Cave[]; +extern const u8 gPCText_Beach[]; +extern const u8 gPCText_Seafloor[]; +extern const u8 gPCText_River[]; +extern const u8 gPCText_Sky[]; +extern const u8 gPCText_PolkaDot[]; +extern const u8 gPCText_Pokecenter[]; +extern const u8 gPCText_Machine[]; +extern const u8 gPCText_Simple[]; #endif //GUARD_STRINGS_H -- cgit v1.2.3 From 9ffd0c73829e5a0aded23518887007da9c3fc44c Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 17 Dec 2018 23:00:08 +0100 Subject: 3.5 asm left --- include/bg.h | 10 +++++----- include/blit.h | 2 +- include/decompress.h | 12 ++++++------ include/pokemon_icon.h | 1 + include/pokemon_storage_system.h | 14 ++++++++++++-- include/window.h | 6 +++--- 6 files changed, 28 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/bg.h b/include/bg.h index a10abaa8d..ffcaf43ed 100644 --- a/include/bg.h +++ b/include/bg.h @@ -56,11 +56,11 @@ void ShowBg(u8 bg); void HideBg(u8 bg); void SetBgAttribute(u8 bg, u8 attributeId, u8 value); u16 GetBgAttribute(u8 bg, u8 attributeId); -u32 ChangeBgX(u8 bg, u32 value, u8 op); -u32 GetBgX(u8 bg); -u32 ChangeBgY(u8 bg, u32 value, u8 op); -u32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op); -u32 GetBgY(u8 bg); +s32 ChangeBgX(u8 bg, s32 value, u8 op); +s32 GetBgX(u8 bg); +s32 ChangeBgY(u8 bg, s32 value, u8 op); +s32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op); +s32 GetBgY(u8 bg); void SetBgAffine(u8 bg, u32 srcCenterX, u32 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle); u8 Unused_AdjustBgMosaic(u8 a1, u8 a2); void SetBgTilemapBuffer(u8 bg, void *tilemap); diff --git a/include/blit.h b/include/blit.h index 2fe99d7bd..b6c80b497 100644 --- a/include/blit.h +++ b/include/blit.h @@ -3,7 +3,7 @@ struct Bitmap { - u8* pixels; + const u8 *pixels; u32 width:16; u32 height:16; }; diff --git a/include/decompress.h b/include/decompress.h index 853230aea..02412defb 100644 --- a/include/decompress.h +++ b/include/decompress.h @@ -8,13 +8,13 @@ extern u8 gDecompressionBuffer[0x4000]; void LZDecompressWram(const u32 *src, void *dest); void LZDecompressVram(const u32 *src, void *dest); -u16 LoadCompressedObjectPic(const struct CompressedSpriteSheet *src); -void LoadCompressedObjectPicOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer); -bool8 LoadCompressedObjectPicUsingHeap(const struct CompressedSpriteSheet* src); +u16 LoadCompressedSpriteSheet(const struct CompressedSpriteSheet *src); +void LoadCompressedSpriteSheetOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer); +bool8 LoadCompressedSpriteSheetUsingHeap(const struct CompressedSpriteSheet* src); -void LoadCompressedObjectPalette(const struct CompressedSpritePalette *src); -void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer); -bool8 LoadCompressedObjectPaletteUsingHeap(const struct CompressedSpritePalette *src); +void LoadCompressedSpritePalette(const struct CompressedSpritePalette *src); +void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer); +bool8 LoadCompressedSpritePaletteUsingHeap(const struct CompressedSpritePalette *src); void DecompressPicFromTable(const struct CompressedSpriteSheet *src, void* buffer, s32 species); void DecompressPicFromTable_2(const struct CompressedSpriteSheet *src, void* buffer, s32 species); diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index 5a18109f2..8da0c5958 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -4,6 +4,7 @@ extern const u8 gMonIconPaletteIndices[]; const u8 *GetMonIconTiles(u16 species, bool32); +u8 GetValidMonIconPalIndex(u16 species); const u8 *GetMonIconPtr(u16 speciesId, u32 personality, u32 frameNo); const u16 *GetValidMonIconPalettePtr(u16 speciesId); u16 GetIconSpecies(u16 species, u32 personality); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 530fb7042..9b880b2c9 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -64,6 +64,16 @@ struct UnkPSSStruct_2002370 u8 unk_0246; }; +struct UnkStorageStruct +{ + struct Sprite *sprite; + u8 *tiles; + u16 palIndex; + u8 unk8; + u8 unk9; + u8 unk10; +}; + struct PokemonStorageSystemData { u8 state; @@ -229,8 +239,8 @@ struct PokemonStorageSystemData u8 field_21FD; u8 field_21FE; u8 inBoxMovingMode; - u8 field_2200; - u8 field_2201[51]; + u16 field_2200; + struct UnkStorageStruct field_2204[3]; u16 movingItem; u8 field_2236; u8 field_2237; diff --git a/include/window.h b/include/window.h index 692ca1d81..25573ac3e 100644 --- a/include/window.h +++ b/include/window.h @@ -61,10 +61,10 @@ void ScrollWindow(u8 windowId, u8 direction, u8 distance, u8 fillValue); void CallWindowFunction(u8 windowId, void ( *func)(u8, u8, u8, u8, u8, u8)); bool8 SetWindowAttribute(u8 windowId, u8 attributeId, u32 value); u32 GetWindowAttribute(u8 windowId, u8 attributeId); -u16 AddWindow8Bit(struct WindowTemplate *template); -u16 AddWindow8Bit(struct WindowTemplate *template); +u16 AddWindow8Bit(const struct WindowTemplate *template); +void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue); void FillWindowPixelRect8Bit(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height); -void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 paletteNum); +void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 paletteNum); void CopyWindowToVram8Bit(u8 windowId, u8 mode); extern struct Window gWindows[]; -- cgit v1.2.3 From 128239d65edefc9d290a642c269adcc5b859a6f4 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 19 Dec 2018 22:47:27 +0100 Subject: Almost there --- include/pokemon.h | 9 -- include/pokemon_storage_system.h | 305 +++++++-------------------------------- 2 files changed, 49 insertions(+), 265 deletions(-) (limited to 'include') diff --git a/include/pokemon.h b/include/pokemon.h index 8807168ef..4f30e92ab 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -251,14 +251,6 @@ struct Pokemon u16 spDefense; }; -struct PokemonStorage -{ - /*0x0000*/ u8 currentBox; - /*0x0001*/ struct BoxPokemon boxes[14][30]; - /*0x8344*/ u8 boxNames[14][9]; - /*0x83C2*/ u8 boxWallpapers[14]; -}; - struct Unknown_806F160_Struct { u8 field_0_0:4; @@ -430,7 +422,6 @@ extern struct Pokemon gPlayerParty[PARTY_SIZE]; extern u8 gEnemyPartyCount; extern struct Pokemon gEnemyParty[PARTY_SIZE]; extern struct SpriteTemplate gMultiuseSpriteTemplate; -extern struct PokemonStorage* gPokemonStoragePtr; extern const struct BattleMove gBattleMoves[]; extern const u8 gFacilityClassToPicIndex[]; diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 9b880b2c9..4f882ddaf 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -6,267 +6,60 @@ #define IN_BOX_COLUMS 5 #define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMS) -#include "pc_screen_effect.h" -#include "mon_markings.h" - -struct PokemonStorageSystemFunc -{ - u8 (*func)(void); - s8 unk4; -}; - -struct StorageAction -{ - const u8 *text; - u8 format; -}; - -struct StorageMenu +struct PokemonStorage { - const u8 *text; - int textId; + /*0x0000*/ u8 currentBox; + /*0x0001*/ struct BoxPokemon boxes[TOTAL_BOXES_COUNT][IN_BOX_COUNT]; + /*0x8344*/ u8 boxNames[TOTAL_BOXES_COUNT][9]; + /*0x83C2*/ u8 boxWallpapers[TOTAL_BOXES_COUNT]; }; -struct PSS_MenuStringPtrs -{ - const u8 *text; - const u8 *desc; -}; +extern struct PokemonStorage* gPokemonStoragePtr; -struct UnkStruct_2000028 -{ - const u8 *unk_00; - u8 *unk_04; - u16 unk_08; - u16 unk_0a; - void (*unk_0c)(struct UnkStruct_2000028 *data); -}; - -struct UnkStruct_2000020 -{ - struct UnkStruct_2000028 *unk_00; - u8 unk_04; - u8 unk_05; -}; - -struct UnkPSSStruct_2002370 -{ - struct Sprite *unk_0000; - struct Sprite *unk_0004[4]; - u32 unk_0014[3]; - struct Sprite *unk_0020[2]; - u8 filler_0028[0x214]; - u32 unk_023c; - u16 unk_0240; - u16 unk_0242; - u8 curBox; - u8 unk_0245; - u8 unk_0246; -}; - -struct UnkStorageStruct -{ - struct Sprite *sprite; - u8 *tiles; - u16 palIndex; - u8 unk8; - u8 unk9; - u8 unk10; -}; - -struct PokemonStorageSystemData -{ - u8 state; - u8 boxOption; - u8 screenChangeType; - bool8 isReshowingPSS; - u8 taskId; - struct UnkStruct_2000020 unk_0020; - struct UnkStruct_2000028 unk_0028[8]; - u16 field_90[16]; - u16 field_B0[528 / 2]; - u16 field_2C0; - u16 field_2C2; - u8 field_2C4; - u8 field_2C5; - u8 showPartyMenuState; - u8 unk_02C7; - u8 unk_02C8; - bool8 unk_02C9; - s16 newCurrBoxId; - u16 bg2_X; - s16 field_2CE; - u16 field_2D0; - u8 field_2D2; - u8 field_2D3; - u8 field_2D4; - u8 field_2D5; - u16 field_2D6; - s16 field_2D8; - u16 field_2DA; - u16 field_2DC; - u16 field_2DE; - u16 field_2E0; - u8 field_2E2; - u8 field_2E3; - u8 field_2E4[20]; - u8 field_2F8[1024]; - u8 field_6F8; - u8 field_6F9; - u8 field_6FA; - s8 field_6FB; - u16 field_6FC[16]; - u16 field_71C; - u16 field_71E; - struct Sprite *field_720[2]; - struct Sprite *field_728[2]; - struct Sprite *field_730[2]; - u32 field_738; - u8 field_73C[80]; - u16 field_78C; - s16 wallpaperSetId; - s16 wallpaperId; - u16 field_792[360]; - u8 wallpaperChangeState; - u8 field_A63; - u8 field_A64; - s8 field_A65; - u8 field_A66; - u8 field_A67; - u8 *wallpaperTiles; - struct Sprite *movingMonSprite; - struct Sprite *partySprites[PARTY_SIZE]; - struct Sprite *boxMonsSprites[IN_BOX_COUNT]; - struct Sprite **field_B00; - struct Sprite **field_B04; - u16 field_B08[40]; - u16 field_B58[40]; - u16 boxSpecies[IN_BOX_COUNT]; - u32 boxPersonalities[IN_BOX_COUNT]; - u8 field_C5C; - u8 field_C5D; - u8 field_C5E; - u8 field_C5F; - u16 field_C60; - s16 field_C62; - s16 field_C64; - u16 field_C66; - u8 field_C68; - s8 field_C69; - u8 field_C6A; - u8 field_C6B; - struct WindowTemplate menuWindow; - struct StorageMenu menuItems[7]; - u8 menuItemsCount; - u8 menuWidth; - u8 field_CAE; - u8 field_CAF; - u16 field_CB0; - u8 field_CB2; - u8 field_CB3; - struct Sprite *field_CB4; - struct Sprite *field_CB8; - s32 field_CBC; - s32 field_CC0; - u32 field_CC4; - u32 field_CC8; - s16 field_CCC; - s16 field_CCE; - u16 field_CD0; - s8 field_CD2; - s8 field_CD3; - u8 field_CD4; - u8 field_CD5; - u8 field_CD6; - u8 field_CD7; - u8 field_CD8[2]; - u8 field_CDA; - u8 field_CDB; - const u32 *cursorMonPalette; - u32 cursorMonPersonality; - u16 cursorMonSpecies; - u16 cursorMonItem; - u16 field_CE8; - u8 field_CEA; - u8 cursorMonMarkings; - u8 cursorMonLevel; - bool8 cursorMonIsEgg; - u8 cursorMonNick[POKEMON_NAME_LENGTH + 1]; - u8 cursorMonNickText[36]; - u8 cursorMonSpeciesName[36]; - u8 cursorMonGenderLvlText[36]; - u8 cursorMonItemName[36]; - bool8 (*monPlaceChangeFunc)(void); - u8 monPlaceChangeState; - u8 field_D91; - struct Sprite *field_D94; - struct Sprite *field_D98[2]; - u16 *field_DA0; - struct PokemonMarkMenu field_DA4; - struct UnkPSSStruct_2002370 field_1E5C; - struct Pokemon movingMon; - struct Pokemon field_2108; - s8 field_216C; - u8 field_216D; - s8 field_216E; - s8 field_216F; - s8 field_2170; - s8 field_2171; - u16 field_2172; - u16 field_2174; - u16 field_2176[5]; - u8 field_2180; - u8 field_2181; - u8 field_2182; - u8 field_2183; - u8 field_2184; - u8 field_2185; - u8 field_2186; - u8 field_2187; - u8 field_2188; - union - { - struct Pokemon *mon; - struct BoxPokemon *box; - } field_218C; - u8 field_2190[40]; - u8 field_21B8[40]; - u8 field_21E0[POKEMON_NAME_LENGTH + 1]; - u8 field_21EB[15]; // TODO: ITEM NAME LENGTH + 1 - u8 field_21FA; - u8 field_21FB; - u8 field_21FC; - u8 field_21FD; - u8 field_21FE; - u8 inBoxMovingMode; - u16 field_2200; - struct UnkStorageStruct field_2204[3]; - u16 movingItem; - u8 field_2236; - u8 field_2237; - u8 field_2238; - u8 field_2239; - u16 field_223A; - u16 *field_223C; - struct Sprite *cursorMonSprite; - u16 field_2244[16]; - u8 field_2264[96]; - u8 field_22C4[0x800]; - u8 field_2AC4[8192]; - u8 field_4AC4[0x1000]; - u8 field_5AC4[0x800]; -}; - -extern struct UnkPSSStruct_2002370 *gUnknown_02039D04; -extern struct PokemonStorageSystemData *gUnknown_02039D08; - -u8* GetBoxNamePtr(u8 boxNumber); -struct BoxPokemon *GetBoxedMonPtr(u8, u8); -void SetBoxMonNickFromAnyBox(u8, u8, u8 *); +u8 CountMonsInBox(u8 boxId); +s16 GetFirstFreeBoxSpot(u8 boxId); +u8 CountPartyAliveNonEggMonsExcept(u8 slotToIgnore); +u16 CountPartyAliveNonEggMons_IgnoreVar0x8004Slot(void); +u8 CountPartyMons(void); +u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n); +void ShowPokemonStorageSystemPC(void); +void ResetPokemonStorageSystem(void); s16 CompactPartySlots(void); -u32 GetBoxMonDataAt(u8 boxId, u8 monPosition, u32 request); -bool8 CheckFreePokemonStorageSpace(void); u8 StorageGetCurrentBox(void); -u8 sub_80D214C(struct BoxPokemon *a, u8 b, u8 c, u8 d); +u32 GetBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request); +void SetBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request, const void *value); +u32 GetCurrentBoxMonData(u8 boxPosition, s32 request); +void SetCurrentBoxMonData(u8 boxPosition, s32 request, const void *value); +void GetBoxMonNickAt(u8 boxId, u8 boxPosition, u8 *dst); +u32 GetBoxMonLevelAt(u8 boxId, u8 boxPosition); +void SetBoxMonNickAt(u8 boxId, u8 boxPosition, const u8 *nick); +u32 GetAndCopyBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request, void *dst); +void SetBoxMonAt(u8 boxId, u8 boxPosition, struct BoxPokemon *src); +void CopyBoxMonAt(u8 boxId, u8 boxPosition, struct BoxPokemon *dst); +void CreateBoxMonAt(u8 boxId, u8 boxPosition, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 personality, u8 otIDType, u32 otID); +void ZeroBoxMonAt(u8 boxId, u8 boxPosition); +void BoxMonAtToMon(u8 boxId, u8 boxPosition, struct Pokemon *dst); +struct BoxPokemon *GetBoxedMonPtr(u8 boxId, u8 boxPosition); +u8 *GetBoxNamePtr(u8 boxId); +u8 GetBoxWallpaper(u8 boxId); +void SetBoxWallpaper(u8 boxId, u8 wallpaperId); +s16 sub_80D214C(struct BoxPokemon *boxMons, s8 currIndex, u8 maxIndex, u8 arg3); +bool8 CheckFreePokemonStorageSpace(void); +bool32 CheckBoxedMonSanity(u32 boxId, u32 boxPosition); +u32 CountStorageNonEggMons(void); +u32 CountAllStorageMons(void); +bool32 AnyStorageMonWithMove(u16 moveId); +void ResetWaldaWallpaper(void); +void SetWaldaWallpaperLockedOrUnlocked(bool32 unlocked); +bool32 IsWaldaWallpaperUnlocked(void); +u32 GetWaldaWallpaperPatternId(void); +void SetWaldaWallpaperPatternId(u8 id); +u32 GetWaldaWallpaperIconId(void); +void SetWaldaWallpaperIconId(u8 id); +u16 *GetWaldaWallpaperColorsPtr(void); +void SetWaldaWallpaperColors(u16 color1, u16 color2); +u8 *GetWaldaPhrasePtr(void); +void SetWaldaPhrase(const u8 *src); +bool32 IsWaldaPhraseEmpty(void); #endif // GUARD_POKEMON_STORAGE_SYSTEM_H -- cgit v1.2.3 From 7dcb614cca6d61c5e51960826dddc004858ed9f1 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 20 Dec 2018 22:14:36 +0100 Subject: PSS is done --- include/pokemon_icon.h | 1 + include/pokemon_storage_system.h | 9 +++++++++ include/strings.h | 3 +++ 3 files changed, 13 insertions(+) (limited to 'include') diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index 8da0c5958..9d6e88685 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -4,6 +4,7 @@ extern const u8 gMonIconPaletteIndices[]; const u8 *GetMonIconTiles(u16 species, bool32); +void sub_80D304C(u16 offset); u8 GetValidMonIconPalIndex(u16 species); const u8 *GetMonIconPtr(u16 speciesId, u32 personality, u32 frameNo); const u16 *GetValidMonIconPalettePtr(u16 speciesId); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 4f882ddaf..afc0516b6 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -6,6 +6,15 @@ #define IN_BOX_COLUMS 5 #define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMS) +/* + ROWS +COLUMNS 0 1 2 3 4 5 + 6 7 8 9 10 11 + 12 13 14 15 16 17 + 18 19 20 21 22 23 + 24 25 26 27 28 29 +*/ + struct PokemonStorage { /*0x0000*/ u8 currentBox; diff --git a/include/strings.h b/include/strings.h index 1557baa6b..71392eb6a 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1473,5 +1473,8 @@ extern const u8 gPCText_PolkaDot[]; extern const u8 gPCText_Pokecenter[]; extern const u8 gPCText_Machine[]; extern const u8 gPCText_Simple[]; +extern const u8 gText_PartyFull[]; +extern const u8 gText_Box[]; +extern const u8 gText_JustOnePkmn[]; #endif //GUARD_STRINGS_H -- cgit v1.2.3 From c805bab48324f946845e1f81002035e4bdb07e62 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 22 Dec 2018 23:00:22 +0100 Subject: Storage - review changes --- include/dma3.h | 45 ++++++++++++++++++++++++++++++++++++++++ include/pokemon_storage_system.h | 8 +++---- 2 files changed, 49 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/dma3.h b/include/dma3.h index 19a69ea80..8eff34f55 100644 --- a/include/dma3.h +++ b/include/dma3.h @@ -1,6 +1,51 @@ #ifndef GUARD_DMA3_H #define GUARD_DMA3_H +// Maximum amount of data we will transfer in one operation +#define MAX_DMA_BLOCK_SIZE 0x1000 + +#define Dma3CopyLarge_(src, dest, size, bit) \ +{ \ + const void *_src = src; \ + void *_dest = dest; \ + u32 _size = size; \ + while (1) \ + { \ + if (_size <= MAX_DMA_BLOCK_SIZE) \ + { \ + DmaCopy##bit(3, _src, _dest, _size); \ + break; \ + } \ + DmaCopy##bit(3, _src, _dest, MAX_DMA_BLOCK_SIZE); \ + _src += MAX_DMA_BLOCK_SIZE; \ + _dest += MAX_DMA_BLOCK_SIZE; \ + _size -= MAX_DMA_BLOCK_SIZE; \ + } \ +} + +#define Dma3CopyLarge16_(src, dest, size) Dma3CopyLarge_(src, dest, size, 16) +#define Dma3CopyLarge32_(src, dest, size) Dma3CopyLarge_(src, dest, size, 32) + +#define Dma3FillLarge_(value, dest, size, bit) \ +{ \ + void *_dest = dest; \ + u32 _size = size; \ + while (1) \ + { \ + if (_size <= MAX_DMA_BLOCK_SIZE) \ + { \ + DmaFill##bit(3, value, _dest, _size); \ + break; \ + } \ + DmaFill##bit(3, value, _dest, MAX_DMA_BLOCK_SIZE); \ + _dest += MAX_DMA_BLOCK_SIZE; \ + _size -= MAX_DMA_BLOCK_SIZE; \ + } \ +} + +#define Dma3FillLarge16_(value, dest, size) Dma3FillLarge_(value, dest, size, 16) +#define Dma3FillLarge32_(value, dest, size) Dma3FillLarge_(value, dest, size, 32) + void ClearDma3Requests(void); void ProcessDma3Requests(void); s16 RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 4b84856bb..a85ee5ff4 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -3,8 +3,8 @@ #define TOTAL_BOXES_COUNT 14 #define IN_BOX_ROWS 6 -#define IN_BOX_COLUMS 5 -#define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMS) +#define IN_BOX_COLUMNS 5 +#define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMNS) /* ROWS @@ -23,7 +23,7 @@ struct PokemonStorage /*0x83C2*/ u8 boxWallpapers[TOTAL_BOXES_COUNT]; }; -extern struct PokemonStorage* gPokemonStoragePtr; +extern struct PokemonStorage *gPokemonStoragePtr; u8 CountMonsInBox(u8 boxId); s16 GetFirstFreeBoxSpot(u8 boxId); @@ -54,7 +54,7 @@ u8 GetBoxWallpaper(u8 boxId); void SetBoxWallpaper(u8 boxId, u8 wallpaperId); s16 sub_80D214C(struct BoxPokemon *boxMons, u8 currIndex, u8 maxIndex, u8 arg3); bool8 CheckFreePokemonStorageSpace(void); -bool32 CheckBoxedMonSanity(u32 boxId, u32 boxPosition); +bool32 CheckBoxMonSanityAt(u32 boxId, u32 boxPosition); u32 CountStorageNonEggMons(void); u32 CountAllStorageMons(void); bool32 AnyStorageMonWithMove(u16 moveId); -- cgit v1.2.3