Almost there

This commit is contained in:
DizzyEggg 2018-12-19 22:47:27 +01:00
parent 9ffd0c7382
commit 128239d65e
9 changed files with 1223 additions and 2819 deletions

View File

@ -17996,7 +17996,7 @@ _081B9980:
cmp r6, r0
bcc _081B9958
mov r0, r8
bl sub_80D23A8
bl AnyStorageMonWithMove
cmp r0, 0x1
beq _081B999C
ldr r1, =gSpecialVar_Result

File diff suppressed because it is too large Load Diff

View File

@ -12444,7 +12444,7 @@ _081CD174:
adds r1, r3, 0
movs r2, 0x8
mov r3, sp
bl SetBoxMonDataFromAnyBox
bl SetBoxMonDataAt
_081CD180:
ldr r0, =0x00006304
adds r1, r6, r0

View File

@ -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[];

View File

@ -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
struct PokemonStorage
{
u8 (*func)(void);
s8 unk4;
/*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 StorageAction
{
const u8 *text;
u8 format;
};
extern struct PokemonStorage* gPokemonStoragePtr;
struct StorageMenu
{
const u8 *text;
int textId;
};
struct PSS_MenuStringPtrs
{
const u8 *text;
const u8 *desc;
};
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

View File

@ -31,6 +31,7 @@
#include "international_string_util.h"
#include "naming_screen.h"
#include "field_screen.h"
#include "pokemon_storage_system.h"
#include "battle.h" // to get rid of later
struct EggHatchData
@ -61,8 +62,6 @@ extern const u8 gText_HatchedFromEgg[];
extern const u8 gText_NickHatchPrompt[];
extern void play_some_sound(void);
extern u16 sub_80D22D0(void);
extern u8 CountPartyAliveNonEggMonsExcept(u8);
static void Task_EggHatch(u8 taskID);
static void CB2_EggHatch_0(void);
@ -888,7 +887,7 @@ u8 GetEggStepsToSubtract(void)
u16 sub_80722E0(void)
{
u16 value = sub_80D22D0();
value += CountPartyAliveNonEggMonsExcept(6);
return value;
u16 aliveNonEggMonsCount = CountStorageNonEggMons();
aliveNonEggMonsCount += CountPartyAliveNonEggMonsExcept(6);
return aliveNonEggMonsCount;
}

File diff suppressed because it is too large Load Diff

View File

@ -3469,7 +3469,7 @@ void ChangeBoxPokemonNickname(void)
void ChangeBoxPokemonNickname_CB(void)
{
SetBoxMonNickFromAnyBox(gSpecialVar_MonBoxId, gSpecialVar_MonBoxPos, gStringVar2);
SetBoxMonNickAt(gSpecialVar_MonBoxId, gSpecialVar_MonBoxPos, gStringVar2);
CB2_ReturnToFieldContinueScriptPlayMapMusic();
}

View File

@ -7,18 +7,11 @@
#include "text.h"
#include "new_game.h"
#include "overworld.h"
#include "pokemon_storage_system.h"
#include "field_screen.h"
extern const u8 gText_Peekaboo[];
extern u8 *GetWaldaPhrasePtr(void);
extern bool32 IsWaldaPhraseEmpty(void);
extern void sub_80AF168(void);
extern void SetWaldaPhrase(const u8 *src);
extern void SetWaldaWallpaperPatternId(u8 patternId);
extern void SetWaldaWallpaperIconId(u8 iconId);
extern void SetWaldaWallpaperColors(u16 backgroundColor, u16 foregroundColor);
extern void SetWaldaWallpaperLockedOrUnlocked(bool32 unlocked);
// this file's functions
static void CB2_HandleGivenWaldaPhrase(void);
static u32 GetWaldaPhraseInputCase(u8 *inputPtr);