Merge pull request #351 from DizzyEggg/apprentice

Decompile apprentice
This commit is contained in:
Diegoisawesome
2018-10-14 13:20:38 -05:00
committed by GitHub
23 changed files with 5408 additions and 7374 deletions

24
include/apprentice.h Normal file
View File

@@ -0,0 +1,24 @@
#ifndef GUARD_APPRENTICE_H
#define GUARD_APPRENTICE_H
#define APPRENTICE_SPECIES_COUNT 10
struct ApprenticeTrainer
{
u8 name[6][PLAYER_NAME_LENGTH + 1]; // For all six languages.
u16 otId;
u8 facilityClass;
u16 species[APPRENTICE_SPECIES_COUNT];
u8 rest[14];
};
extern const struct ApprenticeTrainer gApprentices[];
void CopyFriendsApprenticeChallengeText(u8 saveblockApprenticeId);
void Apprentice_EnableBothScriptContexts(void);
void ResetApprenticeStruct(struct Apprentice *apprentice);
void ResetAllApprenticeData(void);
void CallApprenticeFunction(void);
const u8 *GetApprenticeNameInLanguage(u32 apprenticeId, s32 language);
#endif // GUARD_APPRENTICE_H

View File

@@ -11,7 +11,6 @@ void sub_81A895C(void);
u16 sub_81A89A0(u8);
void sub_81A8AF8(void);
bool8 InBattlePike(void);
void sub_819FA50(void);
void sub_81AA078(u16*, u8);
void sub_81A4C30(void);
bool8 sub_81A6BF4(void);

View File

@@ -0,0 +1,22 @@
#ifndef GUARD_CONSTANTS_APPRENTICE_H
#define GUARD_CONSTANTS_APPRENTICE_H
#define APPRENTICE_ASK_WHICH_LEVEL 0
#define APPRENTICE_ASK_3SPECIES 1
#define APPRENTICE_ASK_2SPECIES 2
#define APPRENTICE_ASK_MOVES 3
#define APPRENTICE_ASK_GIVE 4
#define APPRENTICE_ASK_YES_NO 6
#define APPRENTICE_BUFF_SPECIES1 0
#define APPRENTICE_BUFF_SPECIES2 1
#define APPRENTICE_BUFF_SPECIES3 2
#define APPRENTICE_BUFF_MOVE1 3
#define APPRENTICE_BUFF_MOVE2 4
#define APPRENTICE_BUFF_ITEM 5
#define APPRENTICE_BUFF_NAME 6
#define APPRENTICE_BUFF_EASY_CHAT 7
#define APPRENTICE_BUFF_LEVEL 8
#define APPRENTICE_BUFF_SPECIES4 9
#endif // GUARD_CONSTANTS_APPRENTICE_H

View File

@@ -176,12 +176,14 @@ enum
OPTIONS_BATTLE_STYLE_SET
};
struct Coords8 {
struct Coords8
{
s8 x;
s8 y;
};
struct UCoords8 {
struct UCoords8
{
u8 x;
u8 y;
};
@@ -293,11 +295,25 @@ struct UnknownSaveBlock2Struct
u8 field_EB;
}; // sizeof = 0xEC
struct UnkRecordMixingStruct
struct ApprenticeMon
{
u8 field_0[0x34];
u16 species;
u16 moves[4];
u16 item;
};
struct Apprentice
{
u8 id:5;
u8 lvlMode:2; // + 1
u8 field_1;
u8 number;
struct ApprenticeMon monData[3];
u16 easyChatWords[6];
u8 playerId[4];
u8 field_38[10];
u8 playerName[PLAYER_NAME_LENGTH];
u8 language;
u32 unk40;
};
struct UnknownPokemonStruct
@@ -464,6 +480,28 @@ struct BattleFrontier
/*0xEFC*/ struct FrontierMonData field_EFC[3];
};
struct Sav2_B8
{
u8 unk0_0:2;
u8 unk0_1:2;
u8 unk0_2:2;
u8 unk0_3:2;
u16 unk2;
};
struct PlayersApprentice
{
/*0xB0*/ u8 id;
/*0xB1*/ u8 activeLvlMode:2; // +1, 0 means not active
/*0xB1*/ u8 field_B1_1:4;
/*0xB1*/ u8 field_B1_2:2;
/*0xB2*/ u8 field_B2_0:3;
/*0xB2*/ u8 field_B2_1:2;
/*0xB3*/ u8 field_B3;
/*0xB4*/ u8 monIds[3];
/*0xB8*/ struct Sav2_B8 field_B8[9];
};
struct SaveBlock2
{
/*0x00*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
@@ -487,14 +525,8 @@ struct SaveBlock2
/*0xA0*/ struct Time lastBerryTreeUpdate;
/*0xA8*/ u32 field_A8;
/*0xAC*/ u32 encryptionKey;
// TODO: fix and verify labels
/*0xB0*/ u8 field_B0;
/*0xB1*/ u8 field_B1;
/*0xB2*/ u8 field_B2_0:3;
/*0xB2*/ u8 field_B2_1:2;
/*0xB3*/ u8 field_B3[0x29];
/*0xDC*/ struct UnkRecordMixingStruct field_DC[4];
/*0xB0*/ struct PlayersApprentice playerApprentice;
/*0xDC*/ struct Apprentice apprentices[4];
/*0x1EC*/ struct BerryCrush berryCrush;
/*0x1FC*/ struct PokemonJumpResults pokeJump;
/*0x20C*/ struct BerryPickingResults berryPick;

View File

@@ -54,6 +54,7 @@ extern u16 gSpecialVar_ItemId;
void sub_81AAC14(void);
void sub_81AAC50(void);
void sub_81AAC70(void);
void sub_81AAC28(void);
void bag_menu_mail_related(void);
void CB2_BagMenuFromStartMenu(void);
u8 sub_81ABB2C(u8 pocketId);

View File

@@ -50,7 +50,7 @@ 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);
bool8 free_temp_tile_data_buffers_if_possible(void);
struct WindowTemplate CreateWindowTemplate(u8, u8, u8, u8, u8, u8, u16);
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);
s8 Menu_ProcessInputNoWrap_(void);

View File

@@ -240,32 +240,6 @@ struct PokemonStorage
/*0x83C2*/ u8 boxWallpapers[14];
};
struct UnknownPokemonSubStruct2
{
u16 species;
u16 moves[4];
u16 item;
};
struct UnknownPokemonStruct2
{
u8 field_0_0 : 5;
u8 field_0_1 : 2;
u8 field_1;
u8 field_2;
u8 field_3;
struct UnknownPokemonSubStruct2 mons[3];
u8 field_28[23];
u8 language;
};
struct UnknownPokemonStruct3
{
u8 field_0[48];
u16 field_30;
u8 field_32[38];
};
struct Unknown_806F160_Struct
{
u8 field_0_0:4;
@@ -472,7 +446,7 @@ void CreateMonWithIVsOTID(struct Pokemon *mon, u16 species, u8 level, u8 *ivs, u
void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 evSpread);
void sub_806819C(struct Pokemon *mon, struct UnknownPokemonStruct *src);
void sub_8068338(struct Pokemon *mon, struct UnknownPokemonStruct *src, bool8 lvl50);
void sub_8068528(struct Pokemon *mon, const struct UnknownPokemonStruct2 *src, u8 monId);
void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId);
void CreateMonWithEVSpreadPersonalityOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId);
void sub_80686FC(struct Pokemon *mon, struct UnknownPokemonStruct *dest);
void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId);

View File

@@ -13,5 +13,6 @@ s32 convert_pixel_width_to_tile_width(s32);
u8 CreateWindowFromRect(u8, u8, u8, u8);
void sub_80E2A78(u8);
u32 display_text_and_get_width(const u8*, u32);
u8 sub_80E2D5C(u8 arg0, u8 tileWidth);
#endif //GUARD_SCRIPT_MENU_H