Address review comments
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#ifndef GUARD_CONSTANTS_QUEST_LOG_H
|
||||
#define GUARD_CONSTANTS_QUEST_LOG_H
|
||||
|
||||
// TODO: Name and use state constants
|
||||
#define QL_STATE_RECORDING 1
|
||||
#define QL_STATE_PLAYBACK 2
|
||||
#define QL_STATE_PLAYBACK_LAST 3
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
#define TRAINER_TYPE_NONE 0
|
||||
#define TRAINER_TYPE_NORMAL 1
|
||||
#define TRAINER_TYPE_SEE_ALL_DIRECTIONS 2
|
||||
#define TRAINER_TYPE_BURIED 3
|
||||
|
||||
#endif // GUARD_CONSTANTS_TRAINER_TYPES_H
|
||||
|
||||
@@ -9,7 +9,7 @@ bool8 NativeScript_WaitPlayerAndTargetNPCStopMoving(void);
|
||||
void LockSelectedObjectEvent(void);
|
||||
void sub_8098630(void);
|
||||
bool8 sub_8098734(void);
|
||||
void sub_80696C0(void);
|
||||
void ClearPlayerHeldMovementAndUnfreezeObjectEvents(void);
|
||||
bool8 walkrun_is_standing_still(void);
|
||||
void UnionRoom_UnlockPlayerAndChatPartner(void);
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void sub_80A1E0C(u8);
|
||||
void Task_ItemUse_CloseMessageBoxAndReturnToField_VsSeeker(u8);
|
||||
void ItemUse_SetQuestLogEvent(u8, struct Pokemon *, u16, u16);
|
||||
|
||||
void FieldUseFunc_OrangeMail(u8 taskId);
|
||||
|
||||
@@ -37,7 +37,7 @@ void SetStdWindowBorderStyle(u8 windowId, bool8 copyToVram);
|
||||
void sub_80F7768(u8 windowId, bool8 copyToVram);
|
||||
void Menu_LoadStdPal(void);
|
||||
void Menu_LoadStdPalAt(u16 offset);
|
||||
void DisplayItemMessageOnField(u8 taskId, u8 bgId, const u8 *src, TaskFunc callback);
|
||||
void DisplayItemMessageOnField(u8 taskId, u8 textSpeed, const u8 *src, TaskFunc callback);
|
||||
void DisplayYesNoMenuDefaultYes(void);
|
||||
void DisplayYesNoMenuDefaultNo(void);
|
||||
u8 GetTextSpeedSetting(void);
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef GUARD_SCRCMD_H
|
||||
#define GUARD_SCRCMD_H
|
||||
|
||||
extern struct ScriptContext * sQuestLogScriptContextPtr;
|
||||
|
||||
#endif //GUARD_SCRCMD_H
|
||||
+1
-1
@@ -169,7 +169,7 @@ extern const u8 gText_WithdrawItem[];
|
||||
extern const u8 gText_Withdraw[];
|
||||
extern const u8 gText_ReturnToPC[];
|
||||
|
||||
extern const u8 gUnknown_8416425[];
|
||||
extern const u8 gText_OakForbidsUseOfItemHere[];
|
||||
extern const u8 gUnknown_8416451[];
|
||||
extern const u8 gUnknown_8416537[];
|
||||
extern const u8 gUnknown_841658C[];
|
||||
|
||||
+3
-6
@@ -4,13 +4,10 @@
|
||||
#include "global.h"
|
||||
|
||||
void Task_VsSeeker_0(u8 taskId);
|
||||
void sub_810CB90(void);
|
||||
void sub_810CDE8(void);
|
||||
void ClearRematchStateByTrainerId(void);
|
||||
void ClearRematchStateOfLastTalked(void);
|
||||
int GetRematchTrainerId(u16 a0);
|
||||
bool8 sub_810CF04(u8 a0);
|
||||
void sub_810D0D0(void);
|
||||
void sub_810CB90(void);
|
||||
bool8 UpdateVsSeekerStepCounter(void);
|
||||
void TryUpdateRandomTrainerRematches(u16 mapGroup, u16 mapNum);
|
||||
void MapResetTrainerRematches(u16 mapGroup, u16 mapNum);
|
||||
|
||||
#endif //GUARD_VS_SEEKER_H
|
||||
|
||||
+1
-1
@@ -3771,7 +3771,7 @@ static void HandleEndTurn_FinishBattle(void)
|
||||
}
|
||||
TrySetQuestLogBattleEvent();
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||
sub_810CB90();
|
||||
ClearRematchStateByTrainerId();
|
||||
BeginFastPaletteFade(3);
|
||||
FadeOutMapMusic(5);
|
||||
gBattleMainFunc = FreeResetData_ReturnToOvOrDoEvolutions;
|
||||
|
||||
+1
-1
@@ -951,7 +951,7 @@ static void CB2_EndRematchBattle(void)
|
||||
{
|
||||
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||
SetBattledTrainerFlag();
|
||||
sub_810CDE8();
|
||||
ClearRematchStateOfLastTalked();
|
||||
ResetDeferredLinkEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ void LockSelectedObjectEvent(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80696C0(void)
|
||||
void ClearPlayerHeldMovementAndUnfreezeObjectEvents(void)
|
||||
{
|
||||
u8 objectEventId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
||||
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[objectEventId]);
|
||||
|
||||
@@ -503,7 +503,7 @@ static void Task_SafariZoneRanOutOfBalls(u8 taskId)
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
DestroyTask(taskId);
|
||||
sub_80696C0();
|
||||
ClearPlayerHeldMovementAndUnfreezeObjectEvents();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -287,7 +287,7 @@ static void SpriteCallback_CutGrass_Cleanup(struct Sprite * sprite)
|
||||
}
|
||||
FieldEffectStop(&gSprites[sCutGrassSpriteArrayPtr[0]], FLDEFF_CUT_GRASS);
|
||||
Free(sCutGrassSpriteArrayPtr);
|
||||
sub_80696C0();
|
||||
ClearPlayerHeldMovementAndUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
}
|
||||
|
||||
|
||||
+37
-37
@@ -41,9 +41,9 @@
|
||||
|
||||
static EWRAM_DATA void (*sItemUseOnFieldCB)(u8 taskId) = NULL;
|
||||
|
||||
static void sub_80A1084(void);
|
||||
static void sub_80A109C(u8 taskId);
|
||||
static void sub_80A112C(u8 taskId);
|
||||
static void FieldCB_FadeInFromBlack(void);
|
||||
static void Task_WaitFadeIn_CallItemUseOnFieldCB(u8 taskId);
|
||||
static void Task_ItemUse_CloseMessageBoxAndReturnToField(u8 taskId);
|
||||
static void sub_80A11C0(u8 taskId);
|
||||
static bool8 sub_80A1194(void);
|
||||
static void sub_80A1208(void);
|
||||
@@ -126,14 +126,14 @@ static const u8 sUnref_83E27B4[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
static void (*const gUnknown_83E2954[])(void) = {
|
||||
static void (*const sExitCallbackByItemType[])(void) = {
|
||||
CB2_ShowPartyMenuForItemUse,
|
||||
CB2_ReturnToField,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static void sub_80A0FBC(u8 taskId)
|
||||
static void Task_FadeOuFromBackToField(u8 taskId)
|
||||
{
|
||||
u8 itemType;
|
||||
if (gSpecialVar_ItemId == ITEM_ENIGMA_BERRY)
|
||||
@@ -142,12 +142,12 @@ static void sub_80A0FBC(u8 taskId)
|
||||
itemType = ItemId_GetType(gSpecialVar_ItemId) - 1;
|
||||
if (GetPocketByItemId(gSpecialVar_ItemId) == POCKET_BERRY_POUCH)
|
||||
{
|
||||
BerryPouch_SetExitCallback(gUnknown_83E2954[itemType]);
|
||||
BerryPouch_SetExitCallback(sExitCallbackByItemType[itemType]);
|
||||
BerryPouch_StartFadeToExitCallback(taskId);
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemMenu_SetExitCallback(gUnknown_83E2954[itemType]);
|
||||
ItemMenu_SetExitCallback(sExitCallbackByItemType[itemType]);
|
||||
if (itemType == 1)
|
||||
Bag_BeginCloseWin0Animation();
|
||||
ItemMenu_StartFadeToExitCallback(taskId);
|
||||
@@ -158,20 +158,20 @@ static void sub_80A103C(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[3] != 1)
|
||||
{
|
||||
gFieldCallback = sub_80A1084;
|
||||
sub_80A0FBC(taskId);
|
||||
gFieldCallback = FieldCB_FadeInFromBlack;
|
||||
Task_FadeOuFromBackToField(taskId);
|
||||
}
|
||||
else
|
||||
sItemUseOnFieldCB(taskId);
|
||||
}
|
||||
|
||||
static void sub_80A1084(void)
|
||||
static void FieldCB_FadeInFromBlack(void)
|
||||
{
|
||||
FadeInFromBlack();
|
||||
CreateTask(sub_80A109C, 8);
|
||||
CreateTask(Task_WaitFadeIn_CallItemUseOnFieldCB, 8);
|
||||
}
|
||||
|
||||
static void sub_80A109C(u8 taskId)
|
||||
static void Task_WaitFadeIn_CallItemUseOnFieldCB(u8 taskId)
|
||||
{
|
||||
if (IsWeatherNotFadingIn() == TRUE)
|
||||
{
|
||||
@@ -179,25 +179,25 @@ static void sub_80A109C(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_80A10C4(u8 taskId, bool8 a1, u8 a2, const u8 * str)
|
||||
static void DisplayItemMessageInCurrentContext(u8 taskId, bool8 inField, u8 textSpeed, const u8 * str)
|
||||
{
|
||||
StringExpandPlaceholders(gStringVar4, str);
|
||||
if (a1 == FALSE)
|
||||
DisplayItemMessageInBag(taskId, a2, gStringVar4, Task_ReturnToBagFromContextMenu);
|
||||
if (inField == FALSE)
|
||||
DisplayItemMessageInBag(taskId, textSpeed, gStringVar4, Task_ReturnToBagFromContextMenu);
|
||||
else
|
||||
DisplayItemMessageOnField(taskId, a2, gStringVar4, sub_80A112C);
|
||||
DisplayItemMessageOnField(taskId, textSpeed, gStringVar4, Task_ItemUse_CloseMessageBoxAndReturnToField);
|
||||
}
|
||||
|
||||
static void sub_80A1110(u8 taskId, bool8 a1)
|
||||
static void PrintNotTheTimeToUseThat(u8 taskId, bool8 inField)
|
||||
{
|
||||
sub_80A10C4(taskId, a1, 4, gUnknown_8416425);
|
||||
DisplayItemMessageInCurrentContext(taskId, inField, 4, gText_OakForbidsUseOfItemHere);
|
||||
}
|
||||
|
||||
static void sub_80A112C(u8 taskId)
|
||||
static void Task_ItemUse_CloseMessageBoxAndReturnToField(u8 taskId)
|
||||
{
|
||||
ClearDialogWindowAndFrame(0, 1);
|
||||
DestroyTask(taskId);
|
||||
sub_80696C0();
|
||||
ClearPlayerHeldMovementAndUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
}
|
||||
|
||||
@@ -263,14 +263,14 @@ void FieldUseFunc_MachBike(u8 taskId)
|
||||
|| MetatileBehavior_IsHorizontalRail(behavior) == TRUE
|
||||
|| MetatileBehavior_IsIsolatedVerticalRail(behavior) == TRUE
|
||||
|| MetatileBehavior_IsIsolatedHorizontalRail(behavior) == TRUE)
|
||||
sub_80A10C4(taskId, gTasks[taskId].data[3], 2, gUnknown_8416451);
|
||||
DisplayItemMessageInCurrentContext(taskId, gTasks[taskId].data[3], 2, gUnknown_8416451);
|
||||
else if (Overworld_IsBikingAllowed() == TRUE && !MetatileAtPlayerPositionForbidsBiking())
|
||||
{
|
||||
sItemUseOnFieldCB = ItemUseOnFieldCB_Bicycle;
|
||||
sub_80A103C(taskId);
|
||||
}
|
||||
else
|
||||
sub_80A1110(taskId, gTasks[taskId].data[3]);
|
||||
PrintNotTheTimeToUseThat(taskId, gTasks[taskId].data[3]);
|
||||
}
|
||||
|
||||
static void ItemUseOnFieldCB_Bicycle(u8 taskId)
|
||||
@@ -278,7 +278,7 @@ static void ItemUseOnFieldCB_Bicycle(u8 taskId)
|
||||
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
|
||||
PlaySE(SE_JITENSYA);
|
||||
StartTransitionToFlipBikeState(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE);
|
||||
sub_80696C0();
|
||||
ClearPlayerHeldMovementAndUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
@@ -291,7 +291,7 @@ void FieldUseFunc_OldRod(u8 taskId)
|
||||
sub_80A103C(taskId);
|
||||
}
|
||||
else
|
||||
sub_80A1110(taskId, gTasks[taskId].data[3]);
|
||||
PrintNotTheTimeToUseThat(taskId, gTasks[taskId].data[3]);
|
||||
}
|
||||
|
||||
static bool8 ItemUseCheckFunc_Rod(void)
|
||||
@@ -342,7 +342,7 @@ void FieldUseFunc_CoinCase(u8 taskId)
|
||||
if (gTasks[taskId].data[3] == 0)
|
||||
DisplayItemMessageInBag(taskId, 2, gStringVar4, Task_ReturnToBagFromContextMenu);
|
||||
else
|
||||
DisplayItemMessageOnField(taskId, 2, gStringVar4, sub_80A112C);
|
||||
DisplayItemMessageOnField(taskId, 2, gStringVar4, Task_ItemUse_CloseMessageBoxAndReturnToField);
|
||||
}
|
||||
|
||||
void FieldUseFunc_PowderJar(u8 taskId)
|
||||
@@ -353,7 +353,7 @@ void FieldUseFunc_PowderJar(u8 taskId)
|
||||
if (gTasks[taskId].data[3] == 0)
|
||||
DisplayItemMessageInBag(taskId, 2, gStringVar4, Task_ReturnToBagFromContextMenu);
|
||||
else
|
||||
DisplayItemMessageOnField(taskId, 2, gStringVar4, sub_80A112C);
|
||||
DisplayItemMessageOnField(taskId, 2, gStringVar4, Task_ItemUse_CloseMessageBoxAndReturnToField);
|
||||
}
|
||||
|
||||
void FieldUseFunc_PokeFlute(u8 taskId)
|
||||
@@ -381,7 +381,7 @@ void FieldUseFunc_PokeFlute(u8 taskId)
|
||||
if (gTasks[taskId].data[3] == 0)
|
||||
DisplayItemMessageInBag(taskId, 2, gUnknown_841665C, Task_ReturnToBagFromContextMenu);
|
||||
else
|
||||
DisplayItemMessageOnField(taskId, 2, gUnknown_841665C, sub_80A112C);
|
||||
DisplayItemMessageOnField(taskId, 2, gUnknown_841665C, Task_ItemUse_CloseMessageBoxAndReturnToField);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,13 +398,13 @@ static void sub_80A1674(u8 taskId)
|
||||
if (gTasks[taskId].data[3] == 0)
|
||||
DisplayItemMessageInBag(taskId, 2, gUnknown_84166A7, Task_ReturnToBagFromContextMenu);
|
||||
else
|
||||
DisplayItemMessageOnField(taskId, 2, gUnknown_84166A7, sub_80A112C);
|
||||
DisplayItemMessageOnField(taskId, 2, gUnknown_84166A7, Task_ItemUse_CloseMessageBoxAndReturnToField);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_80A16D0(u8 taskId)
|
||||
{
|
||||
sub_80A0FBC(taskId);
|
||||
Task_FadeOuFromBackToField(taskId);
|
||||
}
|
||||
|
||||
void FieldUseFunc_Medicine(u8 taskId)
|
||||
@@ -440,7 +440,7 @@ void FieldUseFunc_EvoItem(u8 taskId)
|
||||
void FieldUseFunc_SacredAsh(u8 taskId)
|
||||
{
|
||||
gItemUseCB = ItemUseCB_SacredAsh;
|
||||
sub_80A0FBC(taskId);
|
||||
Task_FadeOuFromBackToField(taskId);
|
||||
}
|
||||
|
||||
void FieldUseFunc_TmCase(u8 taskId)
|
||||
@@ -629,7 +629,7 @@ void ItemUseOutOfBattle_EscapeRope(u8 taskId)
|
||||
sub_80A103C(taskId);
|
||||
}
|
||||
else
|
||||
sub_80A1110(taskId, gTasks[taskId].data[3]);
|
||||
PrintNotTheTimeToUseThat(taskId, gTasks[taskId].data[3]);
|
||||
}
|
||||
|
||||
static void sub_80A1C08(u8 taskId)
|
||||
@@ -721,7 +721,7 @@ void FieldUseFunc_VsSeeker(u8 taskId)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(THREE_ISLAND_BERRY_FOREST)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(SIX_ISLAND_PATTERN_BUSH))))
|
||||
{
|
||||
sub_80A1110(taskId, gTasks[taskId].data[3]);
|
||||
PrintNotTheTimeToUseThat(taskId, gTasks[taskId].data[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -730,9 +730,9 @@ void FieldUseFunc_VsSeeker(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80A1E0C(u8 taskId)
|
||||
void Task_ItemUse_CloseMessageBoxAndReturnToField_VsSeeker(u8 taskId)
|
||||
{
|
||||
sub_80A112C(taskId);
|
||||
Task_ItemUse_CloseMessageBoxAndReturnToField(taskId);
|
||||
}
|
||||
|
||||
void BattleUseFunc_PokeBallEtc(u8 taskId)
|
||||
@@ -831,7 +831,7 @@ void BattleUseFunc_PokeDoll(u8 taskId)
|
||||
DisplayItemMessageInBag(taskId, 2, gStringVar4, ItemMenu_StartFadeToExitCallback);
|
||||
}
|
||||
else
|
||||
sub_80A1110(taskId, 0);
|
||||
PrintNotTheTimeToUseThat(taskId, 0);
|
||||
}
|
||||
|
||||
void ItemUseOutOfBattle_EnigmaBerry(u8 taskId)
|
||||
@@ -907,11 +907,11 @@ void FieldUseFunc_OakStopsYou(u8 taskId)
|
||||
{
|
||||
if (GetPocketByItemId(gSpecialVar_ItemId) == POCKET_BERRY_POUCH)
|
||||
{
|
||||
StringExpandPlaceholders(gStringVar4, gUnknown_8416425);
|
||||
StringExpandPlaceholders(gStringVar4, gText_OakForbidsUseOfItemHere);
|
||||
DisplayItemMessageInBerryPouch(taskId, 4, gStringVar4, Task_BerryPouch_DestroyDialogueWindowAndRefreshListMenu);
|
||||
}
|
||||
else
|
||||
sub_80A1110(taskId, gTasks[taskId].data[3]);
|
||||
PrintNotTheTimeToUseThat(taskId, gTasks[taskId].data[3]);
|
||||
}
|
||||
|
||||
void ItemUse_SetQuestLogEvent(u8 eventId, struct Pokemon * pokemon, u16 itemId, u16 param)
|
||||
|
||||
+2
-2
@@ -150,7 +150,7 @@ void ItemUseOnFieldCB_Itemfinder(u8 taskId)
|
||||
static void Task_NoResponse_CleanUp(u8 taskId)
|
||||
{
|
||||
ClearDialogWindowAndFrame(0, TRUE);
|
||||
sub_80696C0();
|
||||
ClearPlayerHeldMovementAndUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
@@ -486,7 +486,7 @@ static void Task_ItemfinderResponseCleanUp(u8 taskId)
|
||||
{
|
||||
DestroyArrowAndStarTiles();
|
||||
ClearDialogWindowAndFrame(0, TRUE);
|
||||
sub_80696C0();
|
||||
ClearPlayerHeldMovementAndUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
@@ -640,10 +640,10 @@ static u16 GetStdPalColor(u8 colorNum)
|
||||
return gTMCaseMainWindowPalette[colorNum];
|
||||
}
|
||||
|
||||
void DisplayItemMessageOnField(u8 taskId, u8 bgId, const u8 *string, TaskFunc callback)
|
||||
void DisplayItemMessageOnField(u8 taskId, u8 textSpeed, const u8 *string, TaskFunc callback)
|
||||
{
|
||||
LoadStdWindowFrameGfx();
|
||||
DisplayMessageAndContinueTask(taskId, 0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM, bgId, GetTextSpeedSetting(), string, callback);
|
||||
DisplayMessageAndContinueTask(taskId, 0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM, textSpeed, GetTextSpeedSetting(), string, callback);
|
||||
CopyWindowToVram(0, 3);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -763,7 +763,7 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum)
|
||||
ClearTempFieldEventData();
|
||||
ResetCyclingRoadChallengeData();
|
||||
RestartWildEncounterImmunitySteps();
|
||||
TryUpdateRandomTrainerRematches(mapGroup, mapNum);
|
||||
MapResetTrainerRematches(mapGroup, mapNum);
|
||||
SetSav1WeatherFromCurrMapHeader();
|
||||
ChooseAmbientCrySpecies();
|
||||
SetDefaultFlashLevel();
|
||||
@@ -798,7 +798,7 @@ static void mli0_load_map(bool32 a1)
|
||||
ClearTempFieldEventData();
|
||||
ResetCyclingRoadChallengeData();
|
||||
RestartWildEncounterImmunitySteps();
|
||||
TryUpdateRandomTrainerRematches(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum);
|
||||
MapResetTrainerRematches(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum);
|
||||
SetSav1WeatherFromCurrMapHeader();
|
||||
ChooseAmbientCrySpecies();
|
||||
if (isOutdoors)
|
||||
|
||||
+1
-1
@@ -1182,7 +1182,7 @@ static void Task_EndQuestLog(u8 taskId)
|
||||
CpuCopy16(gUnknown_203AE90, gPlttBufferUnfaded, 0x400);
|
||||
Free(gUnknown_203AE90);
|
||||
sQuestLogCurrentScene = (struct UnkStruct_203AE94){};
|
||||
sub_80696C0();
|
||||
ClearPlayerHeldMovementAndUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
gTextFlags.autoScroll = FALSE;
|
||||
gUnknown_2036E28 = 0;
|
||||
|
||||
+7
-7
@@ -1957,7 +1957,7 @@ static bool8 SlotsTask_GraphicsInit(u8 * state, struct SlotMachineSetupTaskData
|
||||
RequestDma3Fill(0, (void *)(VRAM + 0xC000), 0x20, 1);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, 0);
|
||||
ResetBgPositions();
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
ResetBgsAndClearDma3BusyFlags(FALSE);
|
||||
InitBgsFromTemplates(0, sBgTemplates, NELEMS(sBgTemplates));
|
||||
InitWindows(sWindowTemplates);
|
||||
|
||||
@@ -2206,10 +2206,10 @@ static bool8 SlotsTask_ShowHelp(u8 * state, struct SlotMachineSetupTaskData * pt
|
||||
{
|
||||
case 0:
|
||||
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
|
||||
SetGpuReg(REG_OFFSET_WININ, 0x3F);
|
||||
SetGpuReg(REG_OFFSET_WINOUT, 0x3D);
|
||||
SetGpuReg(REG_OFFSET_WIN0H, 0x00);
|
||||
SetGpuReg(REG_OFFSET_WIN1H, 0xA0);
|
||||
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR);
|
||||
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR);
|
||||
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, 0));
|
||||
SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE(0, 160));
|
||||
ShowBg(1);
|
||||
PlaySE(SE_WIN_OPEN);
|
||||
ptr->bg1X = 0;
|
||||
@@ -2223,7 +2223,7 @@ static bool8 SlotsTask_ShowHelp(u8 * state, struct SlotMachineSetupTaskData * pt
|
||||
(*state)++;
|
||||
}
|
||||
ChangeBgX(1, 256 * (256 - ptr->bg1X), 0);
|
||||
SetGpuReg(REG_OFFSET_WIN0H, ptr->bg1X);
|
||||
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, ptr->bg1X));
|
||||
break;
|
||||
case 2:
|
||||
return FALSE;
|
||||
@@ -2247,7 +2247,7 @@ static bool8 SlotsTask_HideHelp(u8 * state, struct SlotMachineSetupTaskData * pt
|
||||
(*state)++;
|
||||
}
|
||||
ChangeBgX(1, 256 * (256 - ptr->bg1X), 0);
|
||||
SetGpuReg(REG_OFFSET_WIN0H, ptr->bg1X);
|
||||
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, ptr->bg1X));
|
||||
break;
|
||||
case 2:
|
||||
HideBg(1);
|
||||
|
||||
+3
-3
@@ -575,7 +575,7 @@ static bool8 StartCB_Save2(void)
|
||||
break;
|
||||
case SAVECB_RETURN_OKAY:
|
||||
ClearDialogWindowAndFrameToTransparent(0, TRUE);
|
||||
sub_80696C0();
|
||||
ClearPlayerHeldMovementAndUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
RestoreHelpContext();
|
||||
return TRUE;
|
||||
@@ -587,7 +587,7 @@ static bool8 StartCB_Save2(void)
|
||||
break;
|
||||
case SAVECB_RETURN_ERROR:
|
||||
ClearDialogWindowAndFrameToTransparent(0, TRUE);
|
||||
sub_80696C0();
|
||||
ClearPlayerHeldMovementAndUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
RestoreHelpContext();
|
||||
return TRUE;
|
||||
@@ -995,7 +995,7 @@ static void CloseStartMenu(void)
|
||||
PlaySE(SE_SELECT);
|
||||
ClearStdWindowAndFrame(GetStartMenuWindowId(), TRUE);
|
||||
RemoveStartMenuWindow();
|
||||
sub_80696C0();
|
||||
ClearPlayerHeldMovementAndUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -185,7 +185,7 @@ const u8 gText_NoRoomToStoreItems[] = _("There's no room to\nstore items.");
|
||||
const u8 gText_TossOutHowManyStrVar1s[] = _("Toss out how many\n{STR_VAR_1}(s)?");
|
||||
const u8 gText_ThrewAwayStrVar2StrVar1s[] = _("Threw away {STR_VAR_2}\n{STR_VAR_1}(s).");
|
||||
const u8 gText_ThrowAwayStrVar2OfThisItemQM[] = _("Throw away {STR_VAR_2} of\nthis item?");
|
||||
const u8 gUnknown_8416425[] = _("OAK: {PLAYER}!\nThis isn't the time to use that!{PAUSE_UNTIL_PRESS}");
|
||||
const u8 gText_OakForbidsUseOfItemHere[] = _("OAK: {PLAYER}!\nThis isn't the time to use that!{PAUSE_UNTIL_PRESS}");
|
||||
const u8 gUnknown_8416451[] = _("You can't dismount your BIKE here.{PAUSE_UNTIL_PRESS}");
|
||||
const u8 gText_ItemfinderResponding[] = _("Huh?\nThe ITEMFINDER's responding!\pThere's an item buried around here!{PAUSE_UNTIL_PRESS}");
|
||||
const u8 gText_ItemfinderShakingWildly[] = _("Oh!\nThe ITEMFINDER's shaking wildly!\pThere's an item buried underfoot!\p‥ ‥ ‥ ‥ ‥ ‥{PAUSE_UNTIL_PRESS}");
|
||||
|
||||
+13
-13
@@ -34,9 +34,9 @@ struct TradeMenuResources
|
||||
/*0x0035*/ u8 tradeMenuCursorPosition;
|
||||
/*0x0036*/ u8 partyCounts[2];
|
||||
/*0x0038*/ bool8 tradeMenuOptionsActive[13];
|
||||
/*0x0045*/ u8 battleableFlags[2][PARTY_SIZE];
|
||||
/*0x0051*/ u8 eggFlags[2][PARTY_SIZE];
|
||||
/*0x005D*/ u8 unk_5D[2][PARTY_SIZE];
|
||||
/*0x0045*/ bool8 battleableFlags[2][PARTY_SIZE];
|
||||
/*0x0051*/ bool8 eggFlags[2][PARTY_SIZE];
|
||||
/*0x005D*/ u8 hpBarLevels[2][PARTY_SIZE];
|
||||
/*0x0069*/ u8 state;
|
||||
/*0x006A*/ u8 filler_6A[0x6F - 0x6A];
|
||||
/*0x006F*/ u8 tradeMenuCBnum;
|
||||
@@ -54,7 +54,7 @@ struct TradeMenuResources
|
||||
/*0x007F*/ u8 filler_7F;
|
||||
/*0x0080*/ u16 linkData[20];
|
||||
/*0x00A8*/ u8 loadUiSpritesState;
|
||||
/*0x00A9*/ u8 unk_A9[11];
|
||||
/*0x00A9*/ u8 giftRibbons[11];
|
||||
/*0x00B4*/ u8 filler_B4[0x8D0-0xB4];
|
||||
/*0x08D0*/ struct {
|
||||
bool8 active;
|
||||
@@ -110,7 +110,7 @@ static void RenderTextToVramViaBuffer(const u8 *name, u8 *a1, u8 unused);
|
||||
static void sub_804F748(u8 side);
|
||||
static void sub_804F890(u8 side);
|
||||
static void sub_804F964(void);
|
||||
static void sub_804F9D8(void);
|
||||
static void CopyGiftRibbonsToSav1(void);
|
||||
static u32 TestWhetherSelectedMonCanBeTraded(struct Pokemon * party, int partyCount, int cursorPos);
|
||||
|
||||
static const size_t gUnknown_8260814[] = {
|
||||
@@ -836,7 +836,7 @@ static void sub_804C728(void)
|
||||
case 6:
|
||||
if (shedinja_maker_maybe())
|
||||
{
|
||||
sub_804F9D8();
|
||||
CopyGiftRibbonsToSav1();
|
||||
gMain.state++;
|
||||
}
|
||||
break;
|
||||
@@ -1440,7 +1440,7 @@ static bool8 shedinja_maker_maybe(void)
|
||||
case 20:
|
||||
if (GetBlockReceivedStatus() == 3)
|
||||
{
|
||||
Trade_Memcpy(sTradeMenuResourcesPtr->unk_A9, gBlockRecvBuffer[id ^ 1], 11);
|
||||
Trade_Memcpy(sTradeMenuResourcesPtr->giftRibbons, gBlockRecvBuffer[id ^ 1], 11);
|
||||
ResetBlockReceivedFlags();
|
||||
sTradeMenuResourcesPtr->state++;
|
||||
}
|
||||
@@ -2565,7 +2565,7 @@ static void sub_804F890(u8 who)
|
||||
{
|
||||
curHp = GetMonData(&gPlayerParty[i], MON_DATA_HP);
|
||||
maxHp = GetMonData(&gPlayerParty[i], MON_DATA_MAX_HP);
|
||||
sTradeMenuResourcesPtr->unk_5D[0][i] = GetHPBarLevel(curHp, maxHp);
|
||||
sTradeMenuResourcesPtr->hpBarLevels[0][i] = GetHPBarLevel(curHp, maxHp);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
@@ -2573,7 +2573,7 @@ static void sub_804F890(u8 who)
|
||||
{
|
||||
curHp = GetMonData(&gEnemyParty[i], MON_DATA_HP);
|
||||
maxHp = GetMonData(&gEnemyParty[i], MON_DATA_MAX_HP);
|
||||
sTradeMenuResourcesPtr->unk_5D[1][i] = GetHPBarLevel(curHp, maxHp);
|
||||
sTradeMenuResourcesPtr->hpBarLevels[1][i] = GetHPBarLevel(curHp, maxHp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2586,18 +2586,18 @@ static void sub_804F964(void)
|
||||
{
|
||||
for (j = 0; j < sTradeMenuResourcesPtr->partyCounts[i]; j++)
|
||||
{
|
||||
SetPartyHPBarSprite(&gSprites[sTradeMenuResourcesPtr->partyIcons[i][j]], 4 - sTradeMenuResourcesPtr->unk_5D[i][j]);
|
||||
SetPartyHPBarSprite(&gSprites[sTradeMenuResourcesPtr->partyIcons[i][j]], 4 - sTradeMenuResourcesPtr->hpBarLevels[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_804F9D8(void)
|
||||
static void CopyGiftRibbonsToSav1(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 11; i++)
|
||||
{
|
||||
if (gSaveBlock1Ptr->giftRibbons[i] == 0 && sTradeMenuResourcesPtr->unk_A9[i] != 0)
|
||||
gSaveBlock1Ptr->giftRibbons[i] = sTradeMenuResourcesPtr->unk_A9[i];
|
||||
if (gSaveBlock1Ptr->giftRibbons[i] == 0 && sTradeMenuResourcesPtr->giftRibbons[i] != 0)
|
||||
gSaveBlock1Ptr->giftRibbons[i] = sTradeMenuResourcesPtr->giftRibbons[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+82
-81
@@ -25,6 +25,7 @@
|
||||
#include "constants/maps.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/quest_log.h"
|
||||
#include "constants/trainer_types.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -82,28 +83,30 @@ static EWRAM_DATA struct VsSeekerStruct *sVsSeeker = NULL;
|
||||
static void VsSeekerResetInBagStepCounter(void);
|
||||
static void VsSeekerResetChargingStepCounter(void);
|
||||
static void Task_ResetObjectsRematchWantedState(u8 taskId);
|
||||
static void sub_810C594(void);
|
||||
static void ResetMovementOfRematchableTrainers(void);
|
||||
static void Task_VsSeeker_1(u8 taskId);
|
||||
static void Task_VsSeeker_2(u8 taskId);
|
||||
static void GatherNearbyTrainerInfo(void);
|
||||
static void Task_VsSeeker_3(u8 taskId);
|
||||
static bool8 CanUseVsSeeker(void);
|
||||
static u8 GetVsSeekerResponseInArea(const VsSeekerData *);
|
||||
static u8 GetRematchTrainerIdGivenGameState(const u16 *, u8);
|
||||
static u8 sub_810CD80(const VsSeekerData *, u16);
|
||||
static u8 GetRematchTrainerIdGivenGameState(const u16 *trainerIdxs, u8 rematchIdx);
|
||||
static u8 ShouldTryRematchBattleInternal(const VsSeekerData *, u16);
|
||||
static u8 HasRematchTrainerAlreadyBeenFought(const VsSeekerData *, u16);
|
||||
static s32 sub_810CE10(const VsSeekerData * a0, u16 a1);
|
||||
static bool8 sub_810CED0(const VsSeekerData *, u16);
|
||||
static int LookupVsSeekerOpponentInArray(const VsSeekerData * array, u16 trainerId);
|
||||
static bool8 IsTrainerReadyForRematchInternal(const VsSeekerData *, u16);
|
||||
static u8 GetRunningBehaviorFromGraphicsId(u8);
|
||||
static u16 GetTrainerFlagFromScript(const u8 *);
|
||||
static s32 GetRematchIdx(const VsSeekerData *, u16);
|
||||
static int GetRematchIdx(const VsSeekerData *, u16);
|
||||
static bool32 IsThisTrainerRematchable(u32);
|
||||
static void ClearAllTrainerRematchStates(void);
|
||||
static bool8 IsTrainerVisibleOnScreen(struct VsSeekerTrainerInfo *);
|
||||
static u8 GetNextAvailableRematchTrainer(const VsSeekerData *, u16, u8 *);
|
||||
static u8 GetRematchableTrainerLocalId(void);
|
||||
static void StartTrainerObjectMovementScript(struct VsSeekerTrainerInfo *, const u8 *);
|
||||
static u8 GetCurVsSeekerResponse(s32, u16);
|
||||
static void StartAllRespondantIdleMovements(void);
|
||||
static bool8 ObjectEventIdIsSane(u8 a0);
|
||||
static u8 GetRandomFaceDirectionMovementType();
|
||||
|
||||
// rodata
|
||||
@@ -552,14 +555,14 @@ static const VsSeekerData sVsSeekerData[] = {
|
||||
MAP_GROUP(SEVEN_ISLAND_TANOBY_RUINS), MAP_NUM(SEVEN_ISLAND_TANOBY_RUINS) },
|
||||
};
|
||||
|
||||
static const u8 gUnknown_8453F5C[] = {
|
||||
static const u8 sMovementScript_Wait48[] = {
|
||||
MOVEMENT_ACTION_DELAY_16,
|
||||
MOVEMENT_ACTION_DELAY_16,
|
||||
MOVEMENT_ACTION_DELAY_16,
|
||||
MOVEMENT_ACTION_STEP_END
|
||||
};
|
||||
|
||||
static const u8 gUnknown_8453F60[] = {
|
||||
static const u8 sMovementScript_TrainerUnfought[] = {
|
||||
MOVEMENT_ACTION_EMOTE_EXCLAMATION_MARK,
|
||||
MOVEMENT_ACTION_STEP_END
|
||||
};
|
||||
@@ -575,7 +578,7 @@ static const u8 sMovementScript_TrainerRematch[] = {
|
||||
MOVEMENT_ACTION_STEP_END
|
||||
};
|
||||
|
||||
static const u8 gUnknown_8453F67[] = {
|
||||
static const u8 sFaceDirectionMovementTypeByFacingDirection[] = {
|
||||
MOVEMENT_TYPE_FACE_DOWN,
|
||||
MOVEMENT_TYPE_FACE_DOWN,
|
||||
MOVEMENT_TYPE_FACE_UP,
|
||||
@@ -605,7 +608,7 @@ static void Task_ResetObjectsRematchWantedState(u8 taskId)
|
||||
{
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||
{
|
||||
if (sub_810CF04(i) == TRUE)
|
||||
if (ObjectEventIdIsSane(i) == TRUE)
|
||||
{
|
||||
if (gObjectEvents[i].singleMovementActive)
|
||||
return;
|
||||
@@ -638,7 +641,7 @@ void VsSeekerResetObjectMovementAfterChargeComplete(void)
|
||||
movementType = GetRandomFaceDirectionMovementType();
|
||||
TryGetObjectEventIdByLocalIdAndMap(templates[i].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objEventId);
|
||||
objectEvent = &gObjectEvents[objEventId];
|
||||
if (sub_810CF04(objEventId) == TRUE)
|
||||
if (ObjectEventIdIsSane(objEventId) == TRUE)
|
||||
{
|
||||
SetTrainerMovementType(objectEvent, movementType);
|
||||
}
|
||||
@@ -673,7 +676,7 @@ bool8 UpdateVsSeekerStepCounter(void)
|
||||
{
|
||||
FlagClear(FLAG_SYS_VS_SEEKER_CHARGING);
|
||||
VsSeekerResetChargingStepCounter();
|
||||
sub_810D0D0();
|
||||
ClearAllTrainerRematchStates();
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -681,15 +684,15 @@ bool8 UpdateVsSeekerStepCounter(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void TryUpdateRandomTrainerRematches(u16 mapGroup, u16 mapNum)
|
||||
void MapResetTrainerRematches(u16 mapGroup, u16 mapNum)
|
||||
{
|
||||
FlagClear(FLAG_SYS_VS_SEEKER_CHARGING);
|
||||
VsSeekerResetChargingStepCounter();
|
||||
sub_810D0D0();
|
||||
sub_810C594();
|
||||
ClearAllTrainerRematchStates();
|
||||
ResetMovementOfRematchableTrainers();
|
||||
}
|
||||
|
||||
static void sub_810C594(void)
|
||||
static void ResetMovementOfRematchableTrainers(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
@@ -745,12 +748,12 @@ void Task_VsSeeker_0(u8 taskId)
|
||||
if (respval == VSSEEKER_NOT_CHARGED)
|
||||
{
|
||||
Free(sVsSeeker);
|
||||
DisplayItemMessageOnField(taskId, 2, VSSeeker_Text_BatteryNotChargedNeedXSteps, sub_80A1E0C);
|
||||
DisplayItemMessageOnField(taskId, 2, VSSeeker_Text_BatteryNotChargedNeedXSteps, Task_ItemUse_CloseMessageBoxAndReturnToField_VsSeeker);
|
||||
}
|
||||
else if (respval == VSSEEKER_NO_ONE_IN_RANGE)
|
||||
{
|
||||
Free(sVsSeeker);
|
||||
DisplayItemMessageOnField(taskId, 2, VSSeeker_Text_NoTrainersWithinRange, sub_80A1E0C);
|
||||
DisplayItemMessageOnField(taskId, 2, VSSeeker_Text_NoTrainersWithinRange, Task_ItemUse_CloseMessageBoxAndReturnToField_VsSeeker);
|
||||
}
|
||||
else if (respval == VSSEEKER_CAN_USE)
|
||||
{
|
||||
@@ -787,7 +790,7 @@ static void Task_VsSeeker_2(u8 taskId)
|
||||
data[2] = 0;
|
||||
VsSeekerResetInBagStepCounter();
|
||||
sVsSeeker->responseCode = GetVsSeekerResponseInArea(sVsSeekerData);
|
||||
ScriptMovement_StartObjectMovementScript(0xFF, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, gUnknown_8453F5C);
|
||||
ScriptMovement_StartObjectMovementScript(0xFF, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, sMovementScript_Wait48);
|
||||
gTasks[taskId].func = Task_VsSeeker_3;
|
||||
}
|
||||
}
|
||||
@@ -823,14 +826,14 @@ static void Task_VsSeeker_3(u8 taskId)
|
||||
{
|
||||
if (sVsSeeker->responseCode == VSSEEKER_RESPONSE_NO_RESPONSE)
|
||||
{
|
||||
DisplayItemMessageOnField(taskId, 2, VSSeeker_Text_TrainersNotReady, sub_80A1E0C);
|
||||
DisplayItemMessageOnField(taskId, 2, VSSeeker_Text_TrainersNotReady, Task_ItemUse_CloseMessageBoxAndReturnToField_VsSeeker);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sVsSeeker->responseCode == VSSEEKER_RESPONSE_FOUND_REMATCHES)
|
||||
StartAllRespondantIdleMovements();
|
||||
ClearDialogWindowAndFrame(0, 1);
|
||||
sub_80696C0();
|
||||
ClearDialogWindowAndFrame(0, TRUE);
|
||||
ClearPlayerHeldMovementAndUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
@@ -874,7 +877,7 @@ static u8 GetVsSeekerResponseInArea(const VsSeekerData * a0)
|
||||
r8 = sVsSeeker->trainerInfo[vsSeekerIdx].trainerIdx;
|
||||
if (!HasTrainerBeenFought(r8))
|
||||
{
|
||||
StartTrainerObjectMovementScript(&sVsSeeker->trainerInfo[vsSeekerIdx], gUnknown_8453F60);
|
||||
StartTrainerObjectMovementScript(&sVsSeeker->trainerInfo[vsSeekerIdx], sMovementScript_TrainerUnfought);
|
||||
sVsSeeker->trainerInfo[vsSeekerIdx].trainerIdx += 0;
|
||||
sVsSeeker->trainerHasNotYetBeenFought = 1;
|
||||
}
|
||||
@@ -942,86 +945,86 @@ static u8 GetVsSeekerResponseInArea(const VsSeekerData * a0)
|
||||
return VSSEEKER_RESPONSE_NO_RESPONSE;
|
||||
}
|
||||
|
||||
void sub_810CB90(void)
|
||||
void ClearRematchStateByTrainerId(void)
|
||||
{
|
||||
u8 objEventId = 0;
|
||||
struct ObjectEventTemplate *r4 = gSaveBlock1Ptr->objectEventTemplates;
|
||||
s32 r9 = sub_810CE10(sVsSeekerData, gTrainerBattleOpponent_A);
|
||||
struct ObjectEventTemplate *objectEventTemplates = gSaveBlock1Ptr->objectEventTemplates;
|
||||
int vsSeekerDataIdx = LookupVsSeekerOpponentInArray(sVsSeekerData, gTrainerBattleOpponent_A);
|
||||
|
||||
if (r9 != -1)
|
||||
if (vsSeekerDataIdx != -1)
|
||||
{
|
||||
s32 r8;
|
||||
int i;
|
||||
|
||||
for (r8 = 0; r8 < gMapHeader.events->objectEventCount; r8++)
|
||||
for (i = 0; i < gMapHeader.events->objectEventCount; i++)
|
||||
{
|
||||
if ((r4[r8].trainerType == 1 || r4[r8].trainerType == 3) && r9 == sub_810CE10(sVsSeekerData, GetTrainerFlagFromScript(r4[r8].script)))
|
||||
if ((objectEventTemplates[i].trainerType == TRAINER_TYPE_NORMAL || objectEventTemplates[i].trainerType == TRAINER_TYPE_BURIED) && vsSeekerDataIdx == LookupVsSeekerOpponentInArray(sVsSeekerData, GetTrainerFlagFromScript(objectEventTemplates[i].script)))
|
||||
{
|
||||
struct ObjectEvent *r4_2;
|
||||
struct ObjectEvent *objectEvent;
|
||||
|
||||
TryGetObjectEventIdByLocalIdAndMap(r4[r8].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objEventId);
|
||||
r4_2 = &gObjectEvents[objEventId];
|
||||
GetRandomFaceDirectionMovementType(&r4[r8]); // You are using this function incorrectly. Please consult the manual.
|
||||
OverrideMovementTypeForObjectEvent(r4_2, gUnknown_8453F67[r4_2->facingDirection]);
|
||||
gSaveBlock1Ptr->trainerRematches[r4[r8].localId] = 0;
|
||||
TryGetObjectEventIdByLocalIdAndMap(objectEventTemplates[i].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objEventId);
|
||||
objectEvent = &gObjectEvents[objEventId];
|
||||
GetRandomFaceDirectionMovementType(&objectEventTemplates[i]); // You are using this function incorrectly. Please consult the manual.
|
||||
OverrideMovementTypeForObjectEvent(objectEvent, sFaceDirectionMovementTypeByFacingDirection[objectEvent->facingDirection]);
|
||||
gSaveBlock1Ptr->trainerRematches[objectEventTemplates[i].localId] = 0;
|
||||
if (gSelectedObjectEvent == objEventId)
|
||||
r4_2->movementType = gUnknown_8453F67[r4_2->facingDirection];
|
||||
objectEvent->movementType = sFaceDirectionMovementTypeByFacingDirection[objectEvent->facingDirection];
|
||||
else
|
||||
r4_2->movementType = MOVEMENT_TYPE_FACE_DOWN;
|
||||
objectEvent->movementType = MOVEMENT_TYPE_FACE_DOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void TryGetRematchTrainerIdGivenGameState(const u16 * a0, u8 * a1)
|
||||
static void TryGetRematchTrainerIdGivenGameState(const u16 * trainerIdxs, u8 * rematchIdx_p)
|
||||
{
|
||||
switch (*a1)
|
||||
switch (*rematchIdx_p)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
if (!FlagGet(FLAG_GOT_VS_SEEKER))
|
||||
*a1 = GetRematchTrainerIdGivenGameState(a0, *a1);
|
||||
*rematchIdx_p = GetRematchTrainerIdGivenGameState(trainerIdxs, *rematchIdx_p);
|
||||
break;
|
||||
case 2:
|
||||
if (!FlagGet(FLAG_WORLD_MAP_CELADON_CITY))
|
||||
*a1 = GetRematchTrainerIdGivenGameState(a0, *a1);
|
||||
*rematchIdx_p = GetRematchTrainerIdGivenGameState(trainerIdxs, *rematchIdx_p);
|
||||
break;
|
||||
case 3:
|
||||
if (!FlagGet(FLAG_WORLD_MAP_FUCHSIA_CITY))
|
||||
*a1 = GetRematchTrainerIdGivenGameState(a0, *a1);
|
||||
*rematchIdx_p = GetRematchTrainerIdGivenGameState(trainerIdxs, *rematchIdx_p);
|
||||
break;
|
||||
case 4:
|
||||
if (!FlagGet(FLAG_SYS_GAME_CLEAR))
|
||||
*a1 = GetRematchTrainerIdGivenGameState(a0, *a1);
|
||||
*rematchIdx_p = GetRematchTrainerIdGivenGameState(trainerIdxs, *rematchIdx_p);
|
||||
break;
|
||||
case 5:
|
||||
if (!FlagGet(FLAG_SYS_CAN_LINK_WITH_RS))
|
||||
*a1 = GetRematchTrainerIdGivenGameState(a0, *a1);
|
||||
*rematchIdx_p = GetRematchTrainerIdGivenGameState(trainerIdxs, *rematchIdx_p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static u8 GetRematchTrainerIdGivenGameState(const u16 * a0, u8 a1)
|
||||
static u8 GetRematchTrainerIdGivenGameState(const u16 *trainerIdxs, u8 rematchIdx)
|
||||
{
|
||||
while (--a1 != 0)
|
||||
while (--rematchIdx != 0)
|
||||
{
|
||||
const u16 *r0 = a0 + a1;
|
||||
if (*r0 != 0xFFFF)
|
||||
return a1;
|
||||
const u16 *rematch_p = trainerIdxs + rematchIdx;
|
||||
if (*rematch_p != 0xFFFF)
|
||||
return rematchIdx;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 ShouldTryRematchBattle(void)
|
||||
{
|
||||
if (sub_810CD80(sVsSeekerData, gTrainerBattleOpponent_A))
|
||||
if (ShouldTryRematchBattleInternal(sVsSeekerData, gTrainerBattleOpponent_A))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return HasRematchTrainerAlreadyBeenFought(sVsSeekerData, gTrainerBattleOpponent_A);
|
||||
}
|
||||
|
||||
static bool8 sub_810CD80(const VsSeekerData *vsSeekerData, u16 trainerBattleOpponent)
|
||||
static bool8 ShouldTryRematchBattleInternal(const VsSeekerData *vsSeekerData, u16 trainerBattleOpponent)
|
||||
{
|
||||
s32 rematchIdx = GetRematchIdx(vsSeekerData, trainerBattleOpponent);
|
||||
|
||||
@@ -1046,40 +1049,39 @@ static bool8 HasRematchTrainerAlreadyBeenFought(const VsSeekerData *vsSeekerData
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_810CDE8(void)
|
||||
void ClearRematchStateOfLastTalked(void)
|
||||
{
|
||||
gSaveBlock1Ptr->trainerRematches[gSpecialVar_LastTalked] = 0;
|
||||
SetBattledTrainerFlag();
|
||||
}
|
||||
|
||||
static s32 sub_810CE10(const VsSeekerData * a0, u16 a1)
|
||||
static int LookupVsSeekerOpponentInArray(const VsSeekerData * array, u16 trainerId)
|
||||
{
|
||||
u32 r1;
|
||||
s32 r3;
|
||||
int i, j;
|
||||
|
||||
for (r1 = 0; r1 < NELEMS(sVsSeekerData); r1++)
|
||||
for (i = 0; i < NELEMS(sVsSeekerData); i++)
|
||||
{
|
||||
for (r3 = 0; r3 < 6; r3++)
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
u16 r0;
|
||||
if (a0[r1].trainerIdxs[r3] == 0)
|
||||
u16 testTrainerId;
|
||||
if (array[i].trainerIdxs[j] == 0)
|
||||
break;
|
||||
r0 = a0[r1].trainerIdxs[r3];
|
||||
if (r0 == 0xFFFF)
|
||||
testTrainerId = array[i].trainerIdxs[j];
|
||||
if (testTrainerId == 0xFFFF)
|
||||
continue;
|
||||
if (r0 == a1)
|
||||
return r1;
|
||||
if (testTrainerId == trainerId)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
s32 GetRematchTrainerId(u16 a0)
|
||||
int GetRematchTrainerId(u16 trainerId)
|
||||
{
|
||||
u8 i;
|
||||
u8 j;
|
||||
j = GetNextAvailableRematchTrainer(sVsSeekerData, a0, &i);
|
||||
j = GetNextAvailableRematchTrainer(sVsSeekerData, trainerId, &i);
|
||||
if (!j)
|
||||
return 0;
|
||||
TryGetRematchTrainerIdGivenGameState(sVsSeekerData[i].trainerIdxs, &j);
|
||||
@@ -1088,27 +1090,27 @@ s32 GetRematchTrainerId(u16 a0)
|
||||
|
||||
u8 IsTrainerReadyForRematch(void)
|
||||
{
|
||||
return sub_810CED0(sVsSeekerData, gTrainerBattleOpponent_A);
|
||||
return IsTrainerReadyForRematchInternal(sVsSeekerData, gTrainerBattleOpponent_A);
|
||||
}
|
||||
|
||||
static bool8 sub_810CED0(const VsSeekerData * a0, u16 a1)
|
||||
static bool8 IsTrainerReadyForRematchInternal(const VsSeekerData * array, u16 trainerId)
|
||||
{
|
||||
s32 r1 = sub_810CE10(a0, a1);
|
||||
int rematchTrainerIdx = LookupVsSeekerOpponentInArray(array, trainerId);
|
||||
|
||||
if (r1 == -1)
|
||||
if (rematchTrainerIdx == -1)
|
||||
return FALSE;
|
||||
if ((u32)r1 >= NELEMS(sVsSeekerData))
|
||||
if (rematchTrainerIdx >= NELEMS(sVsSeekerData))
|
||||
return FALSE;
|
||||
if (!IsThisTrainerRematchable(gSpecialVar_LastTalked))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_810CF04(u8 a0)
|
||||
static bool8 ObjectEventIdIsSane(u8 objectEventId)
|
||||
{
|
||||
struct ObjectEvent *r1 = &gObjectEvents[a0];
|
||||
struct ObjectEvent *objectEvent = &gObjectEvents[objectEventId];
|
||||
|
||||
if (r1->active && gMapHeader.events->objectEventCount >= r1->localId && gSprites[r1->spriteId].data[0] == a0)
|
||||
if (objectEvent->active && gMapHeader.events->objectEventCount >= objectEvent->localId && gSprites[objectEvent->spriteId].data[0] == objectEventId)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1189,9 +1191,9 @@ static u16 GetTrainerFlagFromScript(const u8 *script)
|
||||
return trainerFlag;
|
||||
}
|
||||
|
||||
static s32 GetRematchIdx(const VsSeekerData * vsSeekerData, u16 trainerFlagIdx)
|
||||
static int GetRematchIdx(const VsSeekerData * vsSeekerData, u16 trainerFlagIdx)
|
||||
{
|
||||
u32 i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NELEMS(sVsSeekerData); i++)
|
||||
{
|
||||
@@ -1209,7 +1211,7 @@ static bool32 IsThisTrainerRematchable(u32 a0)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_810D0D0(void)
|
||||
static void ClearAllTrainerRematchStates(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
@@ -1230,15 +1232,14 @@ static bool8 IsTrainerVisibleOnScreen(struct VsSeekerTrainerInfo * trainerInfo)
|
||||
&& x + 7 >= trainerInfo->xCoord
|
||||
&& y - 5 <= trainerInfo->yCoord
|
||||
&& y + 5 >= trainerInfo->yCoord
|
||||
&& sub_810CF04(trainerInfo->objectEventId) == 1)
|
||||
&& ObjectEventIdIsSane(trainerInfo->objectEventId) == 1)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static u8 GetNextAvailableRematchTrainer(const VsSeekerData * vsSeekerData, u16 trainerFlagNo, u8 * idxPtr)
|
||||
{
|
||||
u32 i;
|
||||
s32 j;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < NELEMS(sVsSeekerData); i++)
|
||||
{
|
||||
@@ -1320,7 +1321,7 @@ static void StartAllRespondantIdleMovements(void)
|
||||
{
|
||||
struct ObjectEvent *r4 = &gObjectEvents[sVsSeeker->trainerInfo[j].objectEventId];
|
||||
|
||||
if (sub_810CF04(sVsSeeker->trainerInfo[j].objectEventId) == 1)
|
||||
if (ObjectEventIdIsSane(sVsSeeker->trainerInfo[j].objectEventId) == 1)
|
||||
SetTrainerMovementType(r4, sVsSeeker->runningBehaviourEtcArray[i]);
|
||||
OverrideMovementTypeForObjectEvent(r4, sVsSeeker->runningBehaviourEtcArray[i]);
|
||||
gSaveBlock1Ptr->trainerRematches[sVsSeeker->trainerInfo[j].localId] = GetNextAvailableRematchTrainer(sVsSeekerData, sVsSeeker->trainerInfo[j].trainerIdx, &dummy);
|
||||
|
||||
Reference in New Issue
Block a user