Document Apprentice

This commit is contained in:
GriffinR 2019-11-20 17:36:52 -05:00
parent 4e6a69c297
commit a05006421b
11 changed files with 430 additions and 354 deletions

View File

@ -60,8 +60,13 @@ special CallApprenticeFunction
waitstate waitstate
.endm .endm
.macro apprentice_3 .macro apprentice_shufflespecies
setvar VAR_0x8004, APPRENTICE_FUNC_3 setvar VAR_0x8004, APPRENTICE_FUNC_SHUFFLE_SPECIES
special CallApprenticeFunction
.endm
.macro apprentice_randomizequestions
setvar VAR_0x8004, APPRENTICE_FUNC_RANDOMIZE_QUESTIONS
special CallApprenticeFunction special CallApprenticeFunction
.endm .endm
@ -129,9 +134,9 @@ setvar VAR_0x8004, APPRENTICE_FUNC_SET_MOVE
special CallApprenticeFunction special CallApprenticeFunction
.endm .endm
.macro apprentice_setfirstmon monId:req .macro apprentice_setleadmon monId:req
copyvar VAR_0x8005, \monId copyvar VAR_0x8005, \monId
setvar VAR_0x8004, APPRENTICE_FUNC_SET_FIRST_MON setvar VAR_0x8004, APPRENTICE_FUNC_SET_LEAD_MON
special CallApprenticeFunction special CallApprenticeFunction
.endm .endm
@ -141,6 +146,16 @@ special CallApprenticeFunction
waitstate waitstate
.endm .endm
.macro apprentice_trysetitem
setvar VAR_0x8004, APPRENTICE_FUNC_TRY_SET_HELD_ITEM
special CallApprenticeFunction
.endm
.macro apprentice_save
setvar VAR_0x8004, APPRENTICE_FUNC_SAVE
special CallApprenticeFunction
.endm
.macro apprentice_setgfx .macro apprentice_setgfx
setvar VAR_0x8004, APPRENTICE_FUNC_SET_GFX setvar VAR_0x8004, APPRENTICE_FUNC_SET_GFX
special CallApprenticeFunction special CallApprenticeFunction
@ -150,3 +165,8 @@ special CallApprenticeFunction
setvar VAR_0x8004, APPRENTICE_FUNC_SHOULD_LEAVE setvar VAR_0x8004, APPRENTICE_FUNC_SHOULD_LEAVE
special CallApprenticeFunction special CallApprenticeFunction
.endm .endm
.macro apprentice_shiftsaved
setvar VAR_0x8004, APPRENTICE_FUNC_SHIFT_SAVED
special CallApprenticeFunction
.endm

View File

@ -1,3 +1,3 @@
gUnknown_030062EC gApprenticePartyMovesData
gUnknown_030062F0 gApprenticeQuestionData
gUnknown_030062F4 gApprenticeFunc

View File

@ -34,10 +34,10 @@ Apprentice_EventScript_WhichLvlMode: @ 82B6925
apprentice_msg FALSE, APPRENTICE_MSG_WHICH_LVL_MODE apprentice_msg FALSE, APPRENTICE_MSG_WHICH_LVL_MODE
apprentice_menu APPRENTICE_ASK_WHICH_LEVEL apprentice_menu APPRENTICE_ASK_WHICH_LEVEL
apprentice_setlvlmode VAR_RESULT apprentice_setlvlmode VAR_RESULT
apprentice_3 apprentice_shufflespecies
apprentice_buff 0, APPRENTICE_BUFF_LEVEL apprentice_buff 0, APPRENTICE_BUFF_LEVEL
apprentice_msg TRUE, APPRENTICE_MSG_THANKS_LVL_MODE apprentice_msg TRUE, APPRENTICE_MSG_THANKS_LVL_MODE
call Apprentice_EventScript_Hide call Apprentice_EventScript_SetHideFlags
release release
releaseall releaseall
switch VAR_FACING switch VAR_FACING
@ -70,7 +70,7 @@ Apprentice_EventScript_UseWhichMon: @ 82B69D3
apprentice_buffv 0, VAR_0x8007 apprentice_buffv 0, VAR_0x8007
apprentice_freequestion apprentice_freequestion
apprentice_msg TRUE, APPRENTICE_MSG_THANKS_MON apprentice_msg TRUE, APPRENTICE_MSG_THANKS_MON
call Apprentice_EventScript_Hide call Apprentice_EventScript_SetHideFlags
release release
releaseall releaseall
switch VAR_FACING switch VAR_FACING
@ -87,8 +87,7 @@ Apprentice_EventScript_ChoseSecondMon: @ 82B6AC0
return return
Apprentice_EventScript_LastMonSelected: @ 82B6AC6 Apprentice_EventScript_LastMonSelected: @ 82B6AC6
setvar VAR_0x8004, APPRENTICE_FUNC_4 apprentice_randomizequestions
special CallApprenticeFunction
return return
Apprentice_EventScript_UseWhatHeldItem: @ 82B6ACF Apprentice_EventScript_UseWhatHeldItem: @ 82B6ACF
@ -100,16 +99,15 @@ Apprentice_EventScript_ChooseHoldItem: @ 82B6B09
fadescreen 1 fadescreen 1
setvar VAR_RESULT, 0 setvar VAR_RESULT, 0
apprentice_openbag apprentice_openbag
compare VAR_RESULT, 0 compare VAR_RESULT, FALSE
goto_if_eq Apprentice_EventScript_ConfirmHoldNothing goto_if_eq Apprentice_EventScript_ConfirmHoldNothing
setvar VAR_0x8004, APPRENTICE_FUNC_20 apprentice_trysetitem
special CallApprenticeFunction
compare VAR_RESULT, FALSE compare VAR_RESULT, FALSE
goto_if_eq Apprentice_EventScript_AlreadySuggestedItem goto_if_eq Apprentice_EventScript_AlreadySuggestedItem
apprentice_buff 0, APPRENTICE_BUFF_ITEM apprentice_buff 0, APPRENTICE_BUFF_ITEM
apprentice_msg TRUE, APPRENTICE_MSG_THANKS_HELD_ITEM apprentice_msg TRUE, APPRENTICE_MSG_THANKS_HELD_ITEM
apprentice_answeredquestion apprentice_answeredquestion
call Apprentice_EventScript_Hide call Apprentice_EventScript_SetHideFlags
release release
releaseall releaseall
switch VAR_FACING switch VAR_FACING
@ -128,7 +126,7 @@ Apprentice_EventScript_ConfirmHoldNothing: @ 82B6B81
Apprentice_EventScript_HoldNothing: @ 82B6BD4 Apprentice_EventScript_HoldNothing: @ 82B6BD4
apprentice_msg TRUE, APPRENTICE_MSG_THANKS_NO_HELD_ITEM apprentice_msg TRUE, APPRENTICE_MSG_THANKS_NO_HELD_ITEM
apprentice_answeredquestion apprentice_answeredquestion
call Apprentice_EventScript_Hide call Apprentice_EventScript_SetHideFlags
release release
releaseall releaseall
switch VAR_FACING switch VAR_FACING
@ -136,6 +134,8 @@ Apprentice_EventScript_HoldNothing: @ 82B6BD4
goto Apprentice_EventScript_Leave goto Apprentice_EventScript_Leave
end end
@ Because Battle Tower mons may not hold the same item, the player must suggest a
@ different item if theyve already told the Apprentice to use it for another mon
Apprentice_EventScript_AlreadySuggestedItem: @ 82B6C0C Apprentice_EventScript_AlreadySuggestedItem: @ 82B6C0C
apprentice_initquestion APPRENTICE_QUESTION_WHAT_ITEM apprentice_initquestion APPRENTICE_QUESTION_WHAT_ITEM
apprentice_buff 0, APPRENTICE_BUFF_ITEM apprentice_buff 0, APPRENTICE_BUFF_ITEM
@ -157,15 +157,15 @@ Apprentice_EventScript_UseWhichMove: @ 82B6C77
apprentice_menu APPRENTICE_ASK_MOVES apprentice_menu APPRENTICE_ASK_MOVES
copyvar VAR_0x8005, VAR_RESULT copyvar VAR_0x8005, VAR_RESULT
compare VAR_0x8005, 0 compare VAR_0x8005, 0
call_if_eq Apprentice_EventScript_ChoseFirstMove call_if_eq Apprentice_EventScript_ChoseMove1
compare VAR_0x8005, 1 compare VAR_0x8005, 1
call_if_eq Apprentice_EventScript_ChoseSecondMove call_if_eq Apprentice_EventScript_ChoseMove2
apprentice_setmove apprentice_setmove
apprentice_answeredquestion apprentice_answeredquestion
apprentice_buffv 0, VAR_0x8007 apprentice_buffv 0, VAR_0x8007
apprentice_freequestion apprentice_freequestion
apprentice_msg TRUE, APPRENTICE_MSG_THANKS_MOVE apprentice_msg TRUE, APPRENTICE_MSG_THANKS_MOVE
call Apprentice_EventScript_Hide call Apprentice_EventScript_SetHideFlags
release release
releaseall releaseall
switch VAR_FACING switch VAR_FACING
@ -173,22 +173,22 @@ Apprentice_EventScript_UseWhichMove: @ 82B6C77
goto Apprentice_EventScript_Leave goto Apprentice_EventScript_Leave
end end
Apprentice_EventScript_ChoseFirstMove: @ 82B6D50 Apprentice_EventScript_ChoseMove1: @ 82B6D50
setvar VAR_0x8007, APPRENTICE_BUFF_MOVE1 setvar VAR_0x8007, APPRENTICE_BUFF_MOVE1
return return
Apprentice_EventScript_ChoseSecondMove: @ 82B6D56 Apprentice_EventScript_ChoseMove2: @ 82B6D56
setvar VAR_0x8007, APPRENTICE_BUFF_MOVE2 setvar VAR_0x8007, APPRENTICE_BUFF_MOVE2
return return
Apprentice_EventScript_PutWhichMonFirst: @ 82B6D5C Apprentice_EventScript_PutWhichMonFirst: @ 82B6D5C
apprentice_msg FALSE, APPRENTICE_MSG_WHICH_MON_FIRST apprentice_msg FALSE, APPRENTICE_MSG_WHICH_MON_FIRST
apprentice_menu APPRENTICE_ASK_3SPECIES apprentice_menu APPRENTICE_ASK_3SPECIES
apprentice_setfirstmon VAR_RESULT apprentice_setleadmon VAR_RESULT
apprentice_answeredquestion apprentice_answeredquestion
apprentice_buff 0, APPRENTICE_BUFF_FIRST_MON_SPECIES apprentice_buff 0, APPRENTICE_BUFF_LEAD_MON_SPECIES
apprentice_msg TRUE, APPRENTICE_MSG_THANKS_MON_FIRST apprentice_msg TRUE, APPRENTICE_MSG_THANKS_MON_FIRST
call Apprentice_EventScript_Hide call Apprentice_EventScript_SetHideFlags
release release
releaseall releaseall
switch VAR_FACING switch VAR_FACING
@ -199,18 +199,16 @@ Apprentice_EventScript_PutWhichMonFirst: @ 82B6D5C
@ Last question, after which the Apprentice leaves (and is saved) to be replaced by another @ Last question, after which the Apprentice leaves (and is saved) to be replaced by another
Apprentice_EventScript_PickWinSpeech: @ 82B6DD4 Apprentice_EventScript_PickWinSpeech: @ 82B6DD4
apprentice_msg TRUE, APPRENTICE_MSG_PICK_WIN_SPEECH apprentice_msg TRUE, APPRENTICE_MSG_PICK_WIN_SPEECH
setvar VAR_0x8004, APPRENTICE_FUNC_25 apprentice_shiftsaved
special CallApprenticeFunction
setvar VAR_0x8004, EASY_CHAT_TYPE_APPRENTICE setvar VAR_0x8004, EASY_CHAT_TYPE_APPRENTICE
call Common_ShowEasyChatScreen call Common_ShowEasyChatScreen
lock lock
faceplayer faceplayer
setvar VAR_0x8004, APPRENTICE_FUNC_21 apprentice_save
special CallApprenticeFunction
apprentice_buff 0, APPRENTICE_BUFF_WIN_SPEECH apprentice_buff 0, APPRENTICE_BUFF_WIN_SPEECH
apprentice_msg TRUE, APPRENTICE_MSG_THANKS_WIN_SPEECH apprentice_msg TRUE, APPRENTICE_MSG_THANKS_WIN_SPEECH
apprentice_reset apprentice_reset
call Apprentice_EventScript_Hide call Apprentice_EventScript_SetHideFlags
release release
releaseall releaseall
switch VAR_FACING switch VAR_FACING
@ -218,7 +216,7 @@ Apprentice_EventScript_PickWinSpeech: @ 82B6DD4
goto Apprentice_EventScript_Leave goto Apprentice_EventScript_Leave
end end
Apprentice_EventScript_Hide: @ 82B6E4D Apprentice_EventScript_SetHideFlags: @ 82B6E4D
setflag FLAG_HIDE_APPRENTICE setflag FLAG_HIDE_APPRENTICE
setflag FLAG_DAILY_APPRENTICE_LEAVES setflag FLAG_DAILY_APPRENTICE_LEAVES
return return

View File

@ -5,7 +5,7 @@
struct ApprenticeTrainer 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; u16 otId;
u8 facilityClass; u8 facilityClass;
u16 species[APPRENTICE_SPECIES_COUNT]; u16 species[APPRENTICE_SPECIES_COUNT];
@ -15,7 +15,7 @@ struct ApprenticeTrainer
extern const struct ApprenticeTrainer gApprentices[]; extern const struct ApprenticeTrainer gApprentices[];
void CopyFriendsApprenticeChallengeText(u8 saveblockApprenticeId); void BufferApprenticeChallengeText(u8 saveApprenticeId);
void Apprentice_EnableBothScriptContexts(void); void Apprentice_EnableBothScriptContexts(void);
void ResetApprenticeStruct(struct Apprentice *apprentice); void ResetApprenticeStruct(struct Apprentice *apprentice);
void ResetAllApprenticeData(void); void ResetAllApprenticeData(void);

View File

@ -1,8 +1,11 @@
#ifndef GUARD_CONSTANTS_APPRENTICE_H #ifndef GUARD_CONSTANTS_APPRENTICE_H
#define GUARD_CONSTANTS_APPRENTICE_H #define GUARD_CONSTANTS_APPRENTICE_H
#define APPRENTICE_SPECIES_COUNT 10
#define NUM_APPRENTICES 16 #define NUM_APPRENTICES 16
#define APPRENTICE_SPECIES_COUNT 10
#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_50 (FRONTIER_LVL_50 + 1)
#define APPRENTICE_LVL_MODE_OPEN (FRONTIER_LVL_OPEN + 1) #define APPRENTICE_LVL_MODE_OPEN (FRONTIER_LVL_OPEN + 1)
@ -10,10 +13,10 @@
#define APPRENTICE_FUNC_GAVE_LVLMODE 0 #define APPRENTICE_FUNC_GAVE_LVLMODE 0
#define APPRENTICE_FUNC_SET_LVLMODE 1 #define APPRENTICE_FUNC_SET_LVLMODE 1
#define APPRENTICE_FUNC_SET_ID 2 #define APPRENTICE_FUNC_SET_ID 2
#define APPRENTICE_FUNC_3 3 #define APPRENTICE_FUNC_SHUFFLE_SPECIES 3
#define APPRENTICE_FUNC_4 4 #define APPRENTICE_FUNC_RANDOMIZE_QUESTIONS 4
#define APPRENTICE_FUNC_ANSWERED_QUESTION 5 #define APPRENTICE_FUNC_ANSWERED_QUESTION 5
#define APPRENTICE_FUNC_6 6 #define APPRENTICE_FUNC_IS_FINAL_QUESTION 6
#define APPRENTICE_FUNC_MENU 7 #define APPRENTICE_FUNC_MENU 7
#define APPRENTICE_FUNC_PRINT_MSG 8 #define APPRENTICE_FUNC_PRINT_MSG 8
#define APPRENTICE_FUNC_RESET 9 #define APPRENTICE_FUNC_RESET 9
@ -25,14 +28,14 @@
#define APPRENTICE_FUNC_FREE_QUESTION_DATA 15 #define APPRENTICE_FUNC_FREE_QUESTION_DATA 15
#define APPRENTICE_FUNC_BUFFER_STRING 16 #define APPRENTICE_FUNC_BUFFER_STRING 16
#define APPRENTICE_FUNC_SET_MOVE 17 #define APPRENTICE_FUNC_SET_MOVE 17
#define APPRENTICE_FUNC_SET_FIRST_MON 18 #define APPRENTICE_FUNC_SET_LEAD_MON 18
#define APPRENTICE_FUNC_OPEN_BAG 19 #define APPRENTICE_FUNC_OPEN_BAG 19
#define APPRENTICE_FUNC_20 20 #define APPRENTICE_FUNC_TRY_SET_HELD_ITEM 20
#define APPRENTICE_FUNC_21 21 #define APPRENTICE_FUNC_SAVE 21
#define APPRENTICE_FUNC_SET_GFX_SAVED 22 #define APPRENTICE_FUNC_SET_GFX_SAVED 22
#define APPRENTICE_FUNC_SET_GFX 23 #define APPRENTICE_FUNC_SET_GFX 23
#define APPRENTICE_FUNC_SHOULD_LEAVE 24 #define APPRENTICE_FUNC_SHOULD_LEAVE 24
#define APPRENTICE_FUNC_25 25 #define APPRENTICE_FUNC_SHIFT_SAVED 25
#define APPRENTICE_MSG_PLEASE_TEACH 0 #define APPRENTICE_MSG_PLEASE_TEACH 0
#define APPRENTICE_MSG_REJECT 1 #define APPRENTICE_MSG_REJECT 1
@ -58,6 +61,15 @@
#define APPRENTICE_QUESTION_WHAT_ITEM 4 #define APPRENTICE_QUESTION_WHAT_ITEM 4
#define APPRENTICE_QUESTION_WIN_SPEECH 5 #define APPRENTICE_QUESTION_WIN_SPEECH 5
// Would be redundant with the above if they used the same values
// but they do this to skip the "which mon" questions and store the below id in a 2 bit field
// These IDs are randomly shuffled in an array to determine the order of questions asked by the Apprentice
// The last question asked is always picking their win speech
#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_WHICH_LEVEL 0
#define APPRENTICE_ASK_3SPECIES 1 #define APPRENTICE_ASK_3SPECIES 1
#define APPRENTICE_ASK_2SPECIES 2 #define APPRENTICE_ASK_2SPECIES 2
@ -74,6 +86,6 @@
#define APPRENTICE_BUFF_NAME 6 #define APPRENTICE_BUFF_NAME 6
#define APPRENTICE_BUFF_WIN_SPEECH 7 #define APPRENTICE_BUFF_WIN_SPEECH 7
#define APPRENTICE_BUFF_LEVEL 8 #define APPRENTICE_BUFF_LEVEL 8
#define APPRENTICE_BUFF_FIRST_MON_SPECIES 9 #define APPRENTICE_BUFF_LEAD_MON_SPECIES 9
#endif // GUARD_CONSTANTS_APPRENTICE_H #endif // GUARD_CONSTANTS_APPRENTICE_H

View File

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

View File

@ -220,7 +220,7 @@ struct Apprentice
{ {
u8 id:5; u8 id:5;
u8 lvlMode:2; // + 1 u8 lvlMode:2; // + 1
u8 field_1; u8 numQuestions;
u8 number; u8 number;
struct ApprenticeMon party[MULTI_PARTY_SIZE]; struct ApprenticeMon party[MULTI_PARTY_SIZE];
u16 speechWon[EASY_CHAT_BATTLE_WORDS_COUNT]; u16 speechWon[EASY_CHAT_BATTLE_WORDS_COUNT];
@ -403,13 +403,13 @@ struct BattleFrontier
/*0xEFC*/ struct FrontierMonData field_EFC[3]; /*0xEFC*/ struct FrontierMonData field_EFC[3];
}; };
struct Sav2_B8 struct ApprenticeQuestion
{ {
u8 unk0_0:2; u8 questionId:2;
u8 unk0_1:2; u8 monId:2;
u8 unk0_2:2; u8 moveSlot:2;
u8 unk0_3: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 unk2; u16 data; // used both as an itemId and a moveId
}; };
struct PlayersApprentice struct PlayersApprentice
@ -417,12 +417,12 @@ struct PlayersApprentice
/*0xB0*/ u8 id; /*0xB0*/ u8 id;
/*0xB1*/ u8 lvlMode:2; //0: Unassigned, 1: Lv 50, 2: Open Lv /*0xB1*/ u8 lvlMode:2; //0: Unassigned, 1: Lv 50, 2: Open Lv
/*0xB1*/ u8 questionsAnswered:4; /*0xB1*/ u8 questionsAnswered:4;
/*0xB1*/ u8 firstMonId:2; /*0xB1*/ u8 leadMonId:2;
/*0xB2*/ u8 field_B2_0:3; /*0xB2*/ u8 party:3;
/*0xB2*/ u8 field_B2_1:2; /*0xB2*/ u8 field_B2_1:2;
/*0xB3*/ u8 field_B3; /*0xB3*/ u8 unused;
/*0xB4*/ u8 monIds[MULTI_PARTY_SIZE]; /*0xB4*/ u8 speciesIds[MULTI_PARTY_SIZE];
/*0xB8*/ struct Sav2_B8 field_B8[9]; /*0xB8*/ struct ApprenticeQuestion questions[APPRENTICE_MAX_QUESTIONS];
}; };
struct RankingHall1P struct RankingHall1P

File diff suppressed because it is too large Load Diff

View File

@ -1272,10 +1272,10 @@ static bool8 ChooseSpecialBattleTowerTrainer(void)
if (battleMode == FRONTIER_MODE_SINGLES) if (battleMode == FRONTIER_MODE_SINGLES)
{ {
ValidateApprenticesChecksums(); ValidateApprenticesChecksums();
for (i = 0; i < 4; i++) for (i = 0; i < APPRENTICE_COUNT; i++)
{ {
if (gSaveBlock2Ptr->apprentices[i].lvlMode != 0 if (gSaveBlock2Ptr->apprentices[i].lvlMode != 0
&& gUnknown_085DF9EC[gSaveBlock2Ptr->apprentices[i].field_1] == winStreak && gUnknown_085DF9EC[gSaveBlock2Ptr->apprentices[i].numQuestions] == winStreak
&& gSaveBlock2Ptr->apprentices[i].lvlMode - 1 == lvlMode) && gSaveBlock2Ptr->apprentices[i].lvlMode - 1 == lvlMode)
{ {
trainerIds[idsCount] = i + TRAINER_RECORD_MIXING_APPRENTICE; trainerIds[idsCount] = i + TRAINER_RECORD_MIXING_APPRENTICE;
@ -2000,7 +2000,7 @@ static void Unused_CreateApprenticeMons(u16 trainerId, u8 firstMonId)
u8 fixedIV = 0; u8 fixedIV = 0;
struct Apprentice *apprentice = &gSaveBlock2Ptr->apprentices[0]; struct Apprentice *apprentice = &gSaveBlock2Ptr->apprentices[0];
if (apprentice->field_1 < 5) if (apprentice->numQuestions < 5)
fixedIV = 6; fixedIV = 6;
else else
fixedIV = 9; fixedIV = 9;
@ -2178,7 +2178,7 @@ static void sub_8163914(void)
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].greeting); FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].greeting);
else else
CopyFriendsApprenticeChallengeText(trainerId - TRAINER_RECORD_MIXING_APPRENTICE); BufferApprenticeChallengeText(trainerId - TRAINER_RECORD_MIXING_APPRENTICE);
} }
static void HandleSpecialTrainerBattleEnd(void) static void HandleSpecialTrainerBattleEnd(void)
@ -2569,10 +2569,10 @@ static void sub_81642A0(void)
r10 = 0; r10 = 0;
ValidateApprenticesChecksums(); ValidateApprenticesChecksums();
for (i = 0; i < 4; i++) for (i = 0; i < APPRENTICE_COUNT; i++)
{ {
if (gSaveBlock2Ptr->apprentices[i].lvlMode != 0 if (gSaveBlock2Ptr->apprentices[i].lvlMode != 0
&& gUnknown_085DF9EC[gSaveBlock2Ptr->apprentices[i].field_1] / 7 <= challengeNum && gUnknown_085DF9EC[gSaveBlock2Ptr->apprentices[i].numQuestions] / 7 <= challengeNum
&& gSaveBlock2Ptr->apprentices[i].lvlMode - 1 == lvlMode) && gSaveBlock2Ptr->apprentices[i].lvlMode - 1 == lvlMode)
{ {
k = 0; k = 0;
@ -3393,7 +3393,7 @@ static void ValidateApprenticesChecksums(void)
{ {
s32 i, j; s32 i, j;
for (i = 0; i < 4; i++) for (i = 0; i < APPRENTICE_COUNT; i++)
{ {
u32 *data = (u32*) &gSaveBlock2Ptr->apprentices[i]; u32 *data = (u32*) &gSaveBlock2Ptr->apprentices[i];
u32 checksum = 0; u32 checksum = 0;

View File

@ -1698,7 +1698,7 @@ void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].greeting); FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].greeting);
else else
CopyFriendsApprenticeChallengeText(trainerId - TRAINER_RECORD_MIXING_APPRENTICE); BufferApprenticeChallengeText(trainerId - TRAINER_RECORD_MIXING_APPRENTICE);
break; break;
case FRONTIER_PLAYER_LOST_TEXT: case FRONTIER_PLAYER_LOST_TEXT:
if (trainerId == TRAINER_EREADER) if (trainerId == TRAINER_EREADER)

View File

@ -495,20 +495,20 @@ void sub_81AAC14(void)
void ApprenticeOpenBagMenu(void) void ApprenticeOpenBagMenu(void)
{ {
GoToBagMenu(RETURN_LOCATION_FIELD_6, POCKETS_COUNT, CB2_ApprenticeExitBagMenu); GoToBagMenu(RETURN_LOCATION_FIELD_6, POCKETS_COUNT, CB2_ApprenticeExitBagMenu);
gSpecialVar_0x8005 = 0; gSpecialVar_0x8005 = ITEM_NONE;
gSpecialVar_Result = 0; gSpecialVar_Result = FALSE;
} }
void FavorLadyOpenBagMenu(void) void FavorLadyOpenBagMenu(void)
{ {
GoToBagMenu(RETURN_LOCATION_FIELD_4, POCKETS_COUNT, CB2_FavorLadyExitBagMenu); GoToBagMenu(RETURN_LOCATION_FIELD_4, POCKETS_COUNT, CB2_FavorLadyExitBagMenu);
gSpecialVar_Result = 0; gSpecialVar_Result = FALSE;
} }
void QuizLadyOpenBagMenu(void) void QuizLadyOpenBagMenu(void)
{ {
GoToBagMenu(RETURN_LOCATION_FIELD_5, POCKETS_COUNT, CB2_QuizLadyExitBagMenu); GoToBagMenu(RETURN_LOCATION_FIELD_5, POCKETS_COUNT, CB2_QuizLadyExitBagMenu);
gSpecialVar_Result = 0; gSpecialVar_Result = FALSE;
} }
void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()) void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)())