Merge pull request #909 from GriffinRichards/doc-apprentice

Document Apprentice
This commit is contained in:
huderlem
2019-11-23 09:27:02 -06:00
committed by GitHub
24 changed files with 4526 additions and 4291 deletions

View File

@@ -1,21 +1,21 @@
#ifndef GUARD_APPRENTICE_H
#define GUARD_APPRENTICE_H
#define APPRENTICE_SPECIES_COUNT 10
#include "constants/apprentice.h"
struct ApprenticeTrainer
{
u8 name[6][PLAYER_NAME_LENGTH + 1]; // For all six languages.
u8 name[NUM_LANGUAGES - 1][PLAYER_NAME_LENGTH + 1]; // For all languages except the unused one.
u16 otId;
u8 facilityClass;
u16 species[APPRENTICE_SPECIES_COUNT];
u8 id;
u16 easyChatWords[6];
u16 speechLost[EASY_CHAT_BATTLE_WORDS_COUNT];
};
extern const struct ApprenticeTrainer gApprentices[];
void CopyFriendsApprenticeChallengeText(u8 saveblockApprenticeId);
void BufferApprenticeChallengeText(u8 saveApprenticeId);
void Apprentice_EnableBothScriptContexts(void);
void ResetApprenticeStruct(struct Apprentice *apprentice);
void ResetAllApprenticeData(void);

View File

@@ -1,22 +1,88 @@
#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 NUM_APPRENTICES 16
#define APPRENTICE_SPECIES_COUNT 10
#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
#define NUM_WHICH_MON_QUESTIONS MULTI_PARTY_SIZE
#define NUM_WHICH_MOVE_QUESTIONS 5
#define APPRENTICE_LVL_MODE_50 (FRONTIER_LVL_50 + 1)
#define APPRENTICE_LVL_MODE_OPEN (FRONTIER_LVL_OPEN + 1)
#define APPRENTICE_FUNC_GAVE_LVLMODE 0
#define APPRENTICE_FUNC_SET_LVLMODE 1
#define APPRENTICE_FUNC_SET_ID 2
#define APPRENTICE_FUNC_SHUFFLE_SPECIES 3
#define APPRENTICE_FUNC_RANDOMIZE_QUESTIONS 4
#define APPRENTICE_FUNC_ANSWERED_QUESTION 5
#define APPRENTICE_FUNC_IS_FINAL_QUESTION 6
#define APPRENTICE_FUNC_MENU 7
#define APPRENTICE_FUNC_PRINT_MSG 8
#define APPRENTICE_FUNC_RESET 9
#define APPRENTICE_FUNC_CHECK_GONE 10
#define APPRENTICE_FUNC_GET_QUESTION 11
#define APPRENTICE_FUNC_GET_NUM_PARTY_MONS 12
#define APPRENTICE_FUNC_SET_PARTY_MON 13
#define APPRENTICE_FUNC_INIT_QUESTION_DATA 14
#define APPRENTICE_FUNC_FREE_QUESTION_DATA 15
#define APPRENTICE_FUNC_BUFFER_STRING 16
#define APPRENTICE_FUNC_SET_MOVE 17
#define APPRENTICE_FUNC_SET_LEAD_MON 18
#define APPRENTICE_FUNC_OPEN_BAG 19
#define APPRENTICE_FUNC_TRY_SET_HELD_ITEM 20
#define APPRENTICE_FUNC_SAVE 21
#define APPRENTICE_FUNC_SET_GFX_SAVED 22
#define APPRENTICE_FUNC_SET_GFX 23
#define APPRENTICE_FUNC_SHOULD_LEAVE 24
#define APPRENTICE_FUNC_SHIFT_SAVED 25
#define APPRENTICE_MSG_PLEASE_TEACH 0
#define APPRENTICE_MSG_REJECT 1
#define APPRENTICE_MSG_WHICH_LVL_MODE 2
#define APPRENTICE_MSG_THANKS_LVL_MODE 3
#define APPRENTICE_MSG_WHICH_MON_FIRST 4
#define APPRENTICE_MSG_THANKS_MON_FIRST 5
#define APPRENTICE_MSG_WHICH_MON 6
#define APPRENTICE_MSG_THANKS_MON 7
#define APPRENTICE_MSG_WHICH_MOVE 8
#define APPRENTICE_MSG_THANKS_MOVE 9
#define APPRENTICE_MSG_WHAT_HELD_ITEM 10
#define APPRENTICE_MSG_PICK_WIN_SPEECH 11
#define APPRENTICE_MSG_THANKS_HELD_ITEM 12
#define APPRENTICE_MSG_HOLD_NOTHING 13
#define APPRENTICE_MSG_THANKS_NO_HELD_ITEM 14
#define APPRENTICE_MSG_THANKS_WIN_SPEECH 15
#define APPRENTICE_MSG_ITEM_ALREADY_SUGGESTED 16
#define APPRENTICE_QUESTION_WHICH_FIRST 1
#define APPRENTICE_QUESTION_WHICH_MON 2
#define APPRENTICE_QUESTION_WHICH_MOVE 3
#define APPRENTICE_QUESTION_WHAT_ITEM 4
#define APPRENTICE_QUESTION_WIN_SPEECH 5
// Would be redundant with the above set if they used the same values
#define QUESTION_ID_WIN_SPEECH 0
#define QUESTION_ID_WHAT_ITEM 1
#define QUESTION_ID_WHICH_MOVE 2
#define QUESTION_ID_WHICH_FIRST 3
#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_WIN_SPEECH 7
#define APPRENTICE_BUFF_LEVEL 8
#define APPRENTICE_BUFF_LEAD_MON_SPECIES 9
#endif // GUARD_CONSTANTS_APPRENTICE_H

View File

@@ -18,12 +18,13 @@
#define VERSION_GAMECUBE 15
#define LANGUAGE_JAPANESE 1
#define LANGUAGE_ENGLISH 2
#define LANGUAGE_FRENCH 3
#define LANGUAGE_ITALIAN 4
#define LANGUAGE_GERMAN 5
#define LANGUAGE_KOREAN 6 // 6 goes unused but the theory is it was meant to be Korean
#define LANGUAGE_SPANISH 7
#define LANGUAGE_ENGLISH 2
#define LANGUAGE_FRENCH 3
#define LANGUAGE_ITALIAN 4
#define LANGUAGE_GERMAN 5
#define LANGUAGE_KOREAN 6 // 6 goes unused but the theory is it was meant to be Korean
#define LANGUAGE_SPANISH 7
#define NUM_LANGUAGES 7
#define GAME_VERSION (VERSION_EMERALD)
#define GAME_LANGUAGE (LANGUAGE_ENGLISH)
@@ -48,6 +49,8 @@
#define EVENT_OBJECT_TEMPLATES_COUNT 64
#define DECOR_MAX_SECRET_BASE 16
#define DECOR_MAX_PLAYERS_HOUSE 12
#define APPRENTICE_COUNT 4
#define APPRENTICE_MAX_QUESTIONS 9
#define PYRAMID_BAG_ITEMS_COUNT 10
#define HALL_FACILITIES_COUNT 9 // 7 facilities for single mode + tower double mode + tower multi mode.
@@ -63,6 +66,7 @@
#define POKEMON_NAME_LENGTH 10
#define PLAYER_NAME_LENGTH 7
#define MAIL_WORDS_COUNT 9
#define EASY_CHAT_BATTLE_WORDS_COUNT 6
#define MOVE_NAME_LENGTH 12
#define MALE 0

View File

@@ -195,6 +195,10 @@
#define MON_ALREADY_KNOWS_MOVE 0xFFFE
#define MON_HAS_MAX_MOVES 0xFFFF
#define LEVEL_UP_MOVE_ID 0x01FF
#define LEVEL_UP_MOVE_LV 0xFE00
#define LEVEL_UP_END 0xFFFF
#define MON_MALE 0x00
#define MON_FEMALE 0xFE
#define MON_GENDERLESS 0xFF

View File

@@ -214,14 +214,16 @@ struct ApprenticeMon
u16 item;
};
// This is for past players Apprentices or Apprentices received via Record Mix.
// For the current Apprentice, see struct PlayersApprentice
struct Apprentice
{
u8 id:5;
u8 lvlMode:2; // + 1
u8 field_1;
u8 numQuestions;
u8 number;
struct ApprenticeMon party[MULTI_PARTY_SIZE];
u16 easyChatWords[6];
u16 speechWon[EASY_CHAT_BATTLE_WORDS_COUNT];
u8 playerId[TRAINER_ID_LENGTH];
u8 playerName[PLAYER_NAME_LENGTH];
u8 language;
@@ -264,9 +266,9 @@ struct EmeraldBattleTowerRecord
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 trainerId[TRAINER_ID_LENGTH];
/*0x10*/ u16 greeting[6];
/*0x1C*/ u16 speechWon[6];
/*0x28*/ u16 speechLost[6];
/*0x10*/ u16 greeting[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x1C*/ u16 speechWon[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x28*/ u16 speechLost[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x34*/ struct BattleTowerPokemon party[4];
/*0xE4*/ u8 language;
/*0xE8*/ u32 checksum;
@@ -279,9 +281,9 @@ struct BattleTowerEReaderTrainer
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 trainerId[TRAINER_ID_LENGTH];
/*0x10*/ u16 greeting[6];
/*0x1C*/ u16 farewellPlayerLost[6];
/*0x28*/ u16 farewellPlayerWon[6];
/*0x10*/ u16 greeting[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x1C*/ u16 farewellPlayerLost[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x28*/ u16 farewellPlayerWon[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x34*/ struct BattleTowerPokemon party[FRONTIER_PARTY_SIZE];
/*0xB8*/ u32 checksum;
};
@@ -401,26 +403,26 @@ struct BattleFrontier
/*0xEFC*/ struct FrontierMonData field_EFC[3];
};
struct Sav2_B8
struct ApprenticeQuestion
{
u8 unk0_0:2;
u8 unk0_1:2;
u8 unk0_2:2;
u8 unk0_3:2;
u16 unk2;
u8 questionId:2;
u8 monId:2;
u8 moveSlot:2;
u8 suggestedChange:2; // TRUE if told to use held item or second move, FALSE if told to use no item or first move
u16 data; // used both as an itemId and a moveId
};
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[MULTI_PARTY_SIZE];
/*0xB8*/ struct Sav2_B8 field_B8[9];
/*0xB1*/ u8 lvlMode:2; //0: Unassigned, 1: Lv 50, 2: Open Lv
/*0xB1*/ u8 questionsAnswered:4;
/*0xB1*/ u8 leadMonId:2;
/*0xB2*/ u8 party:3;
/*0xB2*/ u8 saveId:2;
/*0xB3*/ u8 unused;
/*0xB4*/ u8 speciesIds[MULTI_PARTY_SIZE];
/*0xB8*/ struct ApprenticeQuestion questions[APPRENTICE_MAX_QUESTIONS];
};
struct RankingHall1P
@@ -465,7 +467,7 @@ struct SaveBlock2
/*0xA8*/ u32 field_A8; // Written to, but never read.
/*0xAC*/ u32 encryptionKey;
/*0xB0*/ struct PlayersApprentice playerApprentice;
/*0xDC*/ struct Apprentice apprentices[4]; // From record mixing.
/*0xDC*/ struct Apprentice apprentices[APPRENTICE_COUNT];
/*0x1EC*/ struct BerryCrush berryCrush;
/*0x1FC*/ struct PokemonJumpResults pokeJump;
/*0x20C*/ struct BerryPickingResults berryPick;
@@ -949,10 +951,10 @@ struct SaveBlock1
/*0x2BA1*/ u8 outbreakPokemonProbability;
/*0x2BA2*/ u16 outbreakDaysLeft;
/*0x2BA4*/ struct GabbyAndTyData gabbyAndTyData;
/*0x2BB0*/ u16 easyChatProfile[6];
/*0x2BBC*/ u16 easyChatBattleStart[6];
/*0x2BC8*/ u16 easyChatBattleWon[6];
/*0x2BD4*/ u16 easyChatBattleLost[6];
/*0x2BB0*/ u16 easyChatProfile[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x2BBC*/ u16 easyChatBattleStart[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x2BC8*/ u16 easyChatBattleWon[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x2BD4*/ u16 easyChatBattleLost[EASY_CHAT_BATTLE_WORDS_COUNT];
/*0x2BE0*/ struct MailStruct mail[MAIL_COUNT];
/*0x2E20*/ u8 additionalPhrases[8]; // bitfield for 33 additional phrases in easy chat system
/*0x2E28*/ OldMan oldMan;

View File

@@ -71,7 +71,7 @@ extern u16 gSpecialVar_ItemId;
void sub_81AAC14(void);
void FavorLadyOpenBagMenu(void);
void QuizLadyOpenBagMenu(void);
void sub_81AAC28(void);
void ApprenticeOpenBagMenu(void);
void sub_81AABB0(void);
void SetInitialScrollAndCursorPositions(u8 pocketId);
void bag_menu_mail_related(void);

View File

@@ -2400,6 +2400,10 @@ extern const u8 gUnknown_085EDC45[];
extern const u8 gUnknown_085EDB00[];
extern const u8 gUnknown_085EDC84[];
// Apprentice
extern const u8 gText_Give[];
extern const u8 gText_NoNeed[];
// Easy Chat Entry
extern const u8 gText_StopGivingPkmnMail[];
extern const u8 gText_LikeToQuitQuiz[];