Some documentation of field_control_avatar and related routines
This commit is contained in:
+4
-4
@@ -3265,7 +3265,7 @@ sub_805644C: @ 805644C
|
|||||||
adds r2, r4, 0
|
adds r2, r4, 0
|
||||||
bl FieldGetPlayerInput
|
bl FieldGetPlayerInput
|
||||||
mov r0, sp
|
mov r0, sp
|
||||||
bl sub_806CD30
|
bl FieldInput_HandleCancelSignpost
|
||||||
bl ScriptContext2_IsEnabled
|
bl ScriptContext2_IsEnabled
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
cmp r0, 0
|
cmp r0, 0
|
||||||
@@ -3278,7 +3278,7 @@ sub_805644C: @ 805644C
|
|||||||
ldrb r0, [r0]
|
ldrb r0, [r0]
|
||||||
cmp r0, 0x2
|
cmp r0, 0x2
|
||||||
bne _0805649E
|
bne _0805649E
|
||||||
ldr r0, _080564AC @ =gUnknown_3005078
|
ldr r0, _080564AC @ =gInputToStoreInQuestLogMaybe
|
||||||
bl sub_81127F8
|
bl sub_81127F8
|
||||||
_0805649E:
|
_0805649E:
|
||||||
bl ScriptContext2_Enable
|
bl ScriptContext2_Enable
|
||||||
@@ -3286,7 +3286,7 @@ _0805649E:
|
|||||||
b _080564BA
|
b _080564BA
|
||||||
.align 2, 0
|
.align 2, 0
|
||||||
_080564A8: .4byte gUnknown_3005E88
|
_080564A8: .4byte gUnknown_3005E88
|
||||||
_080564AC: .4byte gUnknown_3005078
|
_080564AC: .4byte gInputToStoreInQuestLogMaybe
|
||||||
_080564B0:
|
_080564B0:
|
||||||
ldrb r0, [r6, 0x2]
|
ldrb r0, [r6, 0x2]
|
||||||
adds r1, r5, 0
|
adds r1, r5, 0
|
||||||
@@ -3313,7 +3313,7 @@ sub_80564C8: @ 80564C8
|
|||||||
ldr r0, [r0]
|
ldr r0, [r0]
|
||||||
str r0, [sp]
|
str r0, [sp]
|
||||||
mov r0, sp
|
mov r0, sp
|
||||||
bl sub_806CD30
|
bl FieldInput_HandleCancelSignpost
|
||||||
bl ScriptContext2_IsEnabled
|
bl ScriptContext2_IsEnabled
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
cmp r0, 0
|
cmp r0, 0
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
gSelectedObjectEvent
|
gInputToStoreInQuestLogMaybe
|
||||||
gUnknown_3005078
|
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
gUnknown_3005070
|
gUnknown_3005070
|
||||||
|
gSelectedObjectEvent
|
||||||
|
|||||||
@@ -1161,8 +1161,8 @@ EventScript_GetElevatorFloor:: @ 81A7AB9
|
|||||||
|
|
||||||
.include "data/scripts/aide.inc"
|
.include "data/scripts/aide.inc"
|
||||||
|
|
||||||
gUnknown_81A7ADB:: @ 81A7ADB
|
EventScript_CancelMessageBox:: @ 81A7ADB
|
||||||
special sub_80CADC4
|
special DoPicboxCancel
|
||||||
release
|
release
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ PalletTown_EventScript_SignLadyShowSign:: @ 8165894
|
|||||||
setflag FLAG_OPENED_START_MENU
|
setflag FLAG_OPENED_START_MENU
|
||||||
setvar VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 1
|
setvar VAR_MAP_SCENE_PALLET_TOWN_SIGN_LADY, 1
|
||||||
setvar SIGN_LADY_READY, FALSE
|
setvar SIGN_LADY_READY, FALSE
|
||||||
special sub_80699E0
|
special SetWalkingIntoSignVars
|
||||||
special sub_80699BC
|
special sub_80699BC
|
||||||
signmsg
|
signmsg
|
||||||
msgbox PalletTown_Text_PressStartToOpenMenuCopy
|
msgbox PalletTown_Text_PressStartToOpenMenuCopy
|
||||||
|
|||||||
@@ -96,18 +96,18 @@ gUnknown_81A76D5:: @ 81A76D5
|
|||||||
msgbox gUnknown_81C124B, MSGBOX_SIGN
|
msgbox gUnknown_81C124B, MSGBOX_SIGN
|
||||||
end
|
end
|
||||||
|
|
||||||
gUnknown_81A76DE:: @ 81A76DE
|
EventScript_PokemartSign:: @ 81A76DE
|
||||||
msgbox gUnknown_81C0ECB, MSGBOX_SIGN
|
msgbox Text_PokemartSign, MSGBOX_SIGN
|
||||||
end
|
end
|
||||||
|
|
||||||
gUnknown_81A76E7:: @ 81A76E7
|
EventScript_PokecenterSign:: @ 81A76E7
|
||||||
msgbox gUnknown_81C0EF7, MSGBOX_SIGN
|
msgbox Text_PokecenterSign, MSGBOX_SIGN
|
||||||
end
|
end
|
||||||
|
|
||||||
gUnknown_81A76F0:: @ 81A76F0
|
EventScript_Indigo_UltimateGoal:: @ 81A76F0
|
||||||
msgbox gUnknown_81C0F19, MSGBOX_SIGN
|
msgbox Text_Indigo_UltimateGoal, MSGBOX_SIGN
|
||||||
end
|
end
|
||||||
|
|
||||||
gUnknown_81A76F9:: @ 81A76F9
|
EventScript_Indigo_HighestAuthority:: @ 81A76F9
|
||||||
msgbox gUnknown_81C0F59, MSGBOX_SIGN
|
msgbox Text_Indigo_HighestAuthority, MSGBOX_SIGN
|
||||||
end
|
end
|
||||||
|
|||||||
+2
-2
@@ -354,7 +354,7 @@ gSpecials:: @ 815FD60
|
|||||||
def_special ForcePlayerOntoBike
|
def_special ForcePlayerOntoBike
|
||||||
def_special ListMenu
|
def_special ListMenu
|
||||||
def_special ReturnToListMenu
|
def_special ReturnToListMenu
|
||||||
def_special sub_80CADC4
|
def_special DoPicboxCancel
|
||||||
def_special SetVermilionTrashCans
|
def_special SetVermilionTrashCans
|
||||||
def_special sub_805D1A8
|
def_special sub_805D1A8
|
||||||
def_special SampleResortGorgeousMonAndReward
|
def_special SampleResortGorgeousMonAndReward
|
||||||
@@ -376,7 +376,7 @@ gSpecials:: @ 815FD60
|
|||||||
def_special UnionRoomSpecial
|
def_special UnionRoomSpecial
|
||||||
def_special ShowWirelessCommunicationScreen
|
def_special ShowWirelessCommunicationScreen
|
||||||
def_special EnableNationalPokedex
|
def_special EnableNationalPokedex
|
||||||
def_special sub_80699E0
|
def_special SetWalkingIntoSignVars
|
||||||
def_special sub_80699BC
|
def_special sub_80699BC
|
||||||
def_special sub_810C3A4
|
def_special sub_810C3A4
|
||||||
def_special SetFlavorTextFlagFromSpecialVars
|
def_special SetFlavorTextFlagFromSpecialVars
|
||||||
|
|||||||
@@ -30,20 +30,20 @@ gUnknown_81C0E73:: @ 81C0E73
|
|||||||
gUnknown_81C0EAC:: @ 81C0EAC
|
gUnknown_81C0EAC:: @ 81C0EAC
|
||||||
.string "There's a pile of snacks here.$"
|
.string "There's a pile of snacks here.$"
|
||||||
|
|
||||||
gUnknown_81C0ECB:: @ 81C0ECB
|
Text_PokemartSign:: @ 81C0ECB
|
||||||
.string "All your item needs fulfilled!\n"
|
.string "All your item needs fulfilled!\n"
|
||||||
.string "POKéMON MART$"
|
.string "POKéMON MART$"
|
||||||
|
|
||||||
gUnknown_81C0EF7:: @ 81C0EF7
|
Text_PokecenterSign:: @ 81C0EF7
|
||||||
.string "Heal Your POKéMON!\n"
|
.string "Heal Your POKéMON!\n"
|
||||||
.string "POKéMON CENTER$"
|
.string "POKéMON CENTER$"
|
||||||
|
|
||||||
gUnknown_81C0F19:: @ 81C0F19
|
Text_Indigo_UltimateGoal:: @ 81C0F19
|
||||||
.string "INDIGO PLATEAU\p"
|
.string "INDIGO PLATEAU\p"
|
||||||
.string "The ultimate goal of TRAINERS!\n"
|
.string "The ultimate goal of TRAINERS!\n"
|
||||||
.string "POKéMON LEAGUE HQ$"
|
.string "POKéMON LEAGUE HQ$"
|
||||||
|
|
||||||
gUnknown_81C0F59:: @ 81C0F59
|
Text_Indigo_HighestAuthority:: @ 81C0F59
|
||||||
.string "INDIGO PLATEAU\p"
|
.string "INDIGO PLATEAU\p"
|
||||||
.string "The highest POKéMON authority!\n"
|
.string "The highest POKéMON authority!\n"
|
||||||
.string "POKéMON LEAGUE HQ$"
|
.string "POKéMON LEAGUE HQ$"
|
||||||
|
|||||||
@@ -118,6 +118,18 @@
|
|||||||
#define QL_DEPARTED_MISC_BUILDING_1 8
|
#define QL_DEPARTED_MISC_BUILDING_1 8
|
||||||
#define QL_DEPARTED_MISC_BUILDING_2 9
|
#define QL_DEPARTED_MISC_BUILDING_2 9
|
||||||
|
|
||||||
|
#define QL_INPUT_OFF 0
|
||||||
|
#define QL_INPUT_UP 1
|
||||||
|
#define QL_INPUT_DOWN 2
|
||||||
|
#define QL_INPUT_LEFT 3
|
||||||
|
#define QL_INPUT_RIGHT 4
|
||||||
|
#define QL_INPUT_L 5
|
||||||
|
#define QL_INPUT_R 6
|
||||||
|
#define QL_INPUT_START 7
|
||||||
|
#define QL_INPUT_SELECT 8
|
||||||
|
#define QL_INPUT_A 9
|
||||||
|
#define QL_INPUT_B 10
|
||||||
|
|
||||||
|
|
||||||
#define FANCLUB_MEMBER1 0
|
#define FANCLUB_MEMBER1 0
|
||||||
#define FANCLUB_MEMBER2 1
|
#define FANCLUB_MEMBER2 1
|
||||||
|
|||||||
@@ -51,7 +51,12 @@
|
|||||||
// every party poke gets a slight boost.
|
// every party poke gets a slight boost.
|
||||||
#define VAR_HAPPINESS_STEP_COUNTER 0x4021
|
#define VAR_HAPPINESS_STEP_COUNTER 0x4021
|
||||||
|
|
||||||
// Maybe unused?
|
// Counts up every step while a party Pokemon is
|
||||||
|
// poisoned. Wraps around at 5. When wraparound
|
||||||
|
// occurs, every party Pokemon with the PSN status
|
||||||
|
// takes 1 point of damage.
|
||||||
|
// This is a deviation from the typical rate in
|
||||||
|
// the series, which is 1 damage every 4 steps.
|
||||||
#define VAR_POISON_STEP_COUNTER 0x4022
|
#define VAR_POISON_STEP_COUNTER 0x4022
|
||||||
|
|
||||||
// Step counter. Caps at 1500. If you enter a map with
|
// Step counter. Caps at 1500. If you enter a map with
|
||||||
|
|||||||
@@ -1213,7 +1213,7 @@ extern const u8 CableClub_Text_PleaseWaitBCancel[];
|
|||||||
extern const u8 EventScript_FldEffFlash[];
|
extern const u8 EventScript_FldEffFlash[];
|
||||||
|
|
||||||
// field_control_avatar
|
// field_control_avatar
|
||||||
extern const u8 gUnknown_81A7ADB[];
|
extern const u8 EventScript_CancelMessageBox[];
|
||||||
extern const u8 PalletTown_PlayersHouse_2F_EventScript_PC[];
|
extern const u8 PalletTown_PlayersHouse_2F_EventScript_PC[];
|
||||||
extern const u8 EventScript_HiddenItemScript[];
|
extern const u8 EventScript_HiddenItemScript[];
|
||||||
extern const u8 EventScript_PC[];
|
extern const u8 EventScript_PC[];
|
||||||
@@ -1246,10 +1246,10 @@ extern const u8 gUnknown_81A76D5[];
|
|||||||
extern const u8 CableClub_EventScript_81BBFD8[];
|
extern const u8 CableClub_EventScript_81BBFD8[];
|
||||||
extern const u8 EventScript_Questionnaire[];
|
extern const u8 EventScript_Questionnaire[];
|
||||||
extern const u8 CableClub_EventScript_ShowBattleRecords[];
|
extern const u8 CableClub_EventScript_ShowBattleRecords[];
|
||||||
extern const u8 gUnknown_81A76F0[];
|
extern const u8 EventScript_Indigo_UltimateGoal[];
|
||||||
extern const u8 gUnknown_81A76F9[];
|
extern const u8 EventScript_Indigo_HighestAuthority[];
|
||||||
extern const u8 gUnknown_81A76DE[];
|
extern const u8 EventScript_PokemartSign[];
|
||||||
extern const u8 gUnknown_81A76E7[];
|
extern const u8 EventScript_PokecenterSign[];
|
||||||
extern const u8 EventScript_CurrentTooFast[];
|
extern const u8 EventScript_CurrentTooFast[];
|
||||||
extern const u8 EventScript_UseSurf[];
|
extern const u8 EventScript_UseSurf[];
|
||||||
extern const u8 EventScript_Waterfall[];
|
extern const u8 EventScript_Waterfall[];
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ struct FieldInput
|
|||||||
u8 dpadDirection;
|
u8 dpadDirection;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct FieldInput gUnknown_3005078;
|
extern struct FieldInput gInputToStoreInQuestLogMaybe;
|
||||||
|
|
||||||
void RestartWildEncounterImmunitySteps(void);
|
void RestartWildEncounterImmunitySteps(void);
|
||||||
void ClearPoisonStepCounter(void);
|
void ClearPoisonStepCounter(void);
|
||||||
@@ -33,7 +33,7 @@ const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatil
|
|||||||
const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position);
|
const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position);
|
||||||
void FieldClearPlayerInput(struct FieldInput *input);
|
void FieldClearPlayerInput(struct FieldInput *input);
|
||||||
int ProcessPlayerFieldInput(struct FieldInput *input);
|
int ProcessPlayerFieldInput(struct FieldInput *input);
|
||||||
void sub_806CD30(struct FieldInput * input);
|
void FieldInput_HandleCancelSignpost(struct FieldInput * input);
|
||||||
void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys);
|
void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys);
|
||||||
|
|
||||||
#endif //GUARD_FIELD_CONTROL_AVATAR_H
|
#endif //GUARD_FIELD_CONTROL_AVATAR_H
|
||||||
|
|||||||
+13
-13
@@ -65,22 +65,22 @@ void sub_80992A0(u8 *script, u16 scriptSize);
|
|||||||
bool32 ValidateRamScript(void);
|
bool32 ValidateRamScript(void);
|
||||||
void MEventSetRamScript(u8 * script, u16 scriptSize);
|
void MEventSetRamScript(u8 * script, u16 scriptSize);
|
||||||
u8 * sub_8069E48(void);
|
u8 * sub_8069E48(void);
|
||||||
void sub_8069998(u8 var);
|
void RegisterQuestLogInput(u8 var);
|
||||||
void sub_80699F8(void);
|
void ClearMsgBoxCancelableState(void);
|
||||||
void sub_8069964(void);
|
void SetQuestLogInputIsDpadFlag(void);
|
||||||
void sub_80699A4(void);
|
void ClearQuestLogInput(void);
|
||||||
void sub_8069970(void);
|
void ClearQuestLogInputIsDpadFlag(void);
|
||||||
void sub_8069A20(void);
|
void MsgSetSignPost(void);
|
||||||
void sub_8069A2C(void);
|
void MsgSetNotSignPost(void);
|
||||||
bool8 IsMsgSignPost(void);
|
bool8 IsMsgSignPost(void);
|
||||||
bool8 sub_806997C(void);
|
bool8 IsQuestLogInputDpad(void);
|
||||||
u8 sub_80699B0(void);
|
u8 GetRegisteredQuestLogInput(void);
|
||||||
void sub_8069A54(void);
|
void ResetFacingNpcOrSignPostVars(void);
|
||||||
bool8 sub_8069A04(void);
|
bool8 CanWalkAwayToCancelMsgBox(void);
|
||||||
void sub_80699E0(void);
|
void SetWalkingIntoSignVars(void);
|
||||||
bool8 sub_80699D4(void);
|
bool8 sub_80699D4(void);
|
||||||
|
|
||||||
extern const u8 *gRAMScriptPtr;
|
extern const u8 *gRAMScriptPtr;
|
||||||
extern u8 gUnknown_20370A0;
|
extern u8 gWalkAwayFromSignInhibitTimer;
|
||||||
|
|
||||||
#endif // GUARD_SCRIPT_H
|
#endif // GUARD_SCRIPT_H
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ void ScriptMenu_DisplayPCStartupPrompt(void);
|
|||||||
|
|
||||||
bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void);
|
bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void);
|
||||||
void QLPlaybackCB_DestroyScriptMenuMonPicSprites(void);
|
void QLPlaybackCB_DestroyScriptMenuMonPicSprites(void);
|
||||||
void sub_809D424(void);
|
void PicboxCancel(void);
|
||||||
|
|
||||||
#endif //GUARD_SCRIPT_MENU_H
|
#endif //GUARD_SCRIPT_MENU_H
|
||||||
|
|||||||
+93
-87
@@ -31,8 +31,15 @@
|
|||||||
#include "constants/maps.h"
|
#include "constants/maps.h"
|
||||||
#include "constants/metatile_behaviors.h"
|
#include "constants/metatile_behaviors.h"
|
||||||
|
|
||||||
static void sub_806CA4C(struct FieldInput *input, u16 *newKeys, u16 *heldKeys);
|
#define SIGNPOST_POKECENTER 0
|
||||||
static void sub_806CDF8(u8 taskId);
|
#define SIGNPOST_POKEMART 1
|
||||||
|
#define SIGNPOST_INDIGO_1 2
|
||||||
|
#define SIGNPOST_INDIGO_2 3
|
||||||
|
#define SIGNPOST_SCRIPTED 240
|
||||||
|
#define SIGNPOST_NA 255
|
||||||
|
|
||||||
|
static void QuestLogOverrideJoyVars(struct FieldInput *input, u16 *newKeys, u16 *heldKeys);
|
||||||
|
static void Task_QuestLogPlayback_OpenStartMenu(u8 taskId);
|
||||||
static void GetPlayerPosition(struct MapPosition * position);
|
static void GetPlayerPosition(struct MapPosition * position);
|
||||||
static void GetInFrontOfPlayerPosition(struct MapPosition * position);
|
static void GetInFrontOfPlayerPosition(struct MapPosition * position);
|
||||||
static u16 GetPlayerCurMetatileBehavior(void);
|
static u16 GetPlayerCurMetatileBehavior(void);
|
||||||
@@ -50,10 +57,10 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior);
|
|||||||
static void UpdateHappinessStepCounter(void);
|
static void UpdateHappinessStepCounter(void);
|
||||||
static bool8 UpdatePoisonStepCounter(void);
|
static bool8 UpdatePoisonStepCounter(void);
|
||||||
static bool8 CheckStandardWildEncounter(u32 encounter);
|
static bool8 CheckStandardWildEncounter(u32 encounter);
|
||||||
static bool8 sub_806D804(struct MapPosition * position, u16 metatileBehavior, u8 playerDirection);
|
static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition * position, u16 metatileBehavior, u8 playerDirection);
|
||||||
static void sub_806D908(const u8 *script, u8 playerDirection);
|
static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection);
|
||||||
static u8 sub_806D898(u16 metatileBehvaior, u8 direction);
|
static u8 GetFacingSignpostType(u16 metatileBehvaior, u8 direction);
|
||||||
static const u8 *sub_806D928(struct MapPosition * position);
|
static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition * position);
|
||||||
static bool8 TryArrowWarp(struct MapPosition * position, u16 metatileBehavior, u8 playerDirection);
|
static bool8 TryArrowWarp(struct MapPosition * position, u16 metatileBehavior, u8 playerDirection);
|
||||||
static bool8 TryStartWarpEventScript(struct MapPosition * position, u16 metatileBehavior);
|
static bool8 TryStartWarpEventScript(struct MapPosition * position, u16 metatileBehavior);
|
||||||
static bool8 IsWarpMetatileBehavior(u16 metatileBehavior);
|
static bool8 IsWarpMetatileBehavior(u16 metatileBehavior);
|
||||||
@@ -64,8 +71,7 @@ static bool8 TryDoorWarp(struct MapPosition * position, u16 metatileBehavior, u8
|
|||||||
static s8 GetWarpEventAtPosition(struct MapHeader * mapHeader, u16 x, u16 y, u8 z);
|
static s8 GetWarpEventAtPosition(struct MapHeader * mapHeader, u16 x, u16 y, u8 z);
|
||||||
static const u8 *GetCoordEventScriptAtPosition(struct MapHeader * mapHeader, u16 x, u16 y, u8 z);
|
static const u8 *GetCoordEventScriptAtPosition(struct MapHeader * mapHeader, u16 x, u16 y, u8 z);
|
||||||
|
|
||||||
u8 gSelectedObjectEvent;
|
struct FieldInput gInputToStoreInQuestLogMaybe;
|
||||||
struct FieldInput gUnknown_3005078;
|
|
||||||
|
|
||||||
void FieldClearPlayerInput(struct FieldInput *input)
|
void FieldClearPlayerInput(struct FieldInput *input)
|
||||||
{
|
{
|
||||||
@@ -91,9 +97,9 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys)
|
|||||||
u8 tileTransitionState = gPlayerAvatar.tileTransitionState;
|
u8 tileTransitionState = gPlayerAvatar.tileTransitionState;
|
||||||
bool8 forcedMove = MetatileBehavior_IsForcedMovementTile(GetPlayerCurMetatileBehavior());
|
bool8 forcedMove = MetatileBehavior_IsForcedMovementTile(GetPlayerCurMetatileBehavior());
|
||||||
|
|
||||||
if (!ScriptContext1_IsScriptSetUp() && sub_806997C() == TRUE)
|
if (!ScriptContext1_IsScriptSetUp() && IsQuestLogInputDpad() == TRUE)
|
||||||
{
|
{
|
||||||
sub_806CA4C(input, &newKeys, &heldKeys);
|
QuestLogOverrideJoyVars(input, &newKeys, &heldKeys);
|
||||||
}
|
}
|
||||||
if ((tileTransitionState == T_TILE_CENTER && forcedMove == FALSE) || tileTransitionState == T_NOT_MOVING)
|
if ((tileTransitionState == T_TILE_CENTER && forcedMove == FALSE) || tileTransitionState == T_NOT_MOVING)
|
||||||
{
|
{
|
||||||
@@ -149,39 +155,39 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_806CA4C(struct FieldInput *input, u16 *newKeys, u16 *heldKeys)
|
static void QuestLogOverrideJoyVars(struct FieldInput *input, u16 *newKeys, u16 *heldKeys)
|
||||||
{
|
{
|
||||||
switch (sub_80699B0())
|
switch (GetRegisteredQuestLogInput())
|
||||||
{
|
{
|
||||||
case 0:
|
case QL_INPUT_OFF:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case QL_INPUT_UP:
|
||||||
*heldKeys = *newKeys = DPAD_UP;
|
*heldKeys = *newKeys = DPAD_UP;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case QL_INPUT_DOWN:
|
||||||
*heldKeys = *newKeys = DPAD_DOWN;
|
*heldKeys = *newKeys = DPAD_DOWN;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case QL_INPUT_LEFT:
|
||||||
*heldKeys = *newKeys = DPAD_LEFT;
|
*heldKeys = *newKeys = DPAD_LEFT;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case QL_INPUT_RIGHT:
|
||||||
*heldKeys = *newKeys = DPAD_RIGHT;
|
*heldKeys = *newKeys = DPAD_RIGHT;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case QL_INPUT_L:
|
||||||
*heldKeys = *newKeys = L_BUTTON;
|
*heldKeys = *newKeys = L_BUTTON;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case QL_INPUT_R:
|
||||||
*heldKeys = *newKeys = R_BUTTON;
|
*heldKeys = *newKeys = R_BUTTON;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case QL_INPUT_START:
|
||||||
*heldKeys = *newKeys = START_BUTTON;
|
*heldKeys = *newKeys = START_BUTTON;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case QL_INPUT_SELECT:
|
||||||
*heldKeys = *newKeys = SELECT_BUTTON;
|
*heldKeys = *newKeys = SELECT_BUTTON;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sub_8069970();
|
ClearQuestLogInputIsDpadFlag();
|
||||||
sub_80699A4();
|
ClearQuestLogInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProcessPlayerFieldInput(struct FieldInput *input)
|
int ProcessPlayerFieldInput(struct FieldInput *input)
|
||||||
@@ -191,14 +197,14 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
|||||||
u16 metatileBehavior;
|
u16 metatileBehavior;
|
||||||
u32 r8;
|
u32 r8;
|
||||||
|
|
||||||
sub_8069A54();
|
ResetFacingNpcOrSignPostVars();
|
||||||
playerDirection = GetPlayerFacingDirection();
|
playerDirection = GetPlayerFacingDirection();
|
||||||
GetPlayerPosition(&position);
|
GetPlayerPosition(&position);
|
||||||
r8 = MapGridGetMetatileAttributeAt(position.x, position.y, 0xFF);
|
r8 = MapGridGetMetatileAttributeAt(position.x, position.y, 0xFF);
|
||||||
metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y);
|
metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y);
|
||||||
|
|
||||||
FieldClearPlayerInput(&gUnknown_3005078);
|
FieldClearPlayerInput(&gInputToStoreInQuestLogMaybe);
|
||||||
gUnknown_3005078.dpadDirection = input->dpadDirection;
|
gInputToStoreInQuestLogMaybe.dpadDirection = input->dpadDirection;
|
||||||
|
|
||||||
if (CheckForTrainersWantingBattle() == TRUE)
|
if (CheckForTrainersWantingBattle() == TRUE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -216,7 +222,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
|||||||
IncrementBirthIslandRockStepCount();
|
IncrementBirthIslandRockStepCount();
|
||||||
if (TryStartStepBasedScript(&position, metatileBehavior, playerDirection) == TRUE)
|
if (TryStartStepBasedScript(&position, metatileBehavior, playerDirection) == TRUE)
|
||||||
{
|
{
|
||||||
gUnknown_3005078.tookStep = TRUE;
|
gInputToStoreInQuestLogMaybe.tookStep = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,9 +232,9 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
|||||||
{
|
{
|
||||||
GetInFrontOfPlayerPosition(&position);
|
GetInFrontOfPlayerPosition(&position);
|
||||||
metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y);
|
metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y);
|
||||||
if (sub_806D804(&position, metatileBehavior, playerDirection) == TRUE)
|
if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE)
|
||||||
{
|
{
|
||||||
gUnknown_3005078.checkStandardWildEncounter = TRUE;
|
gInputToStoreInQuestLogMaybe.checkStandardWildEncounter = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
GetPlayerPosition(&position);
|
GetPlayerPosition(&position);
|
||||||
@@ -237,14 +243,14 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
|||||||
}
|
}
|
||||||
if (input->checkStandardWildEncounter && CheckStandardWildEncounter(r8) == TRUE)
|
if (input->checkStandardWildEncounter && CheckStandardWildEncounter(r8) == TRUE)
|
||||||
{
|
{
|
||||||
gUnknown_3005078.checkStandardWildEncounter = TRUE;
|
gInputToStoreInQuestLogMaybe.checkStandardWildEncounter = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (input->heldDirection && input->dpadDirection == playerDirection)
|
if (input->heldDirection && input->dpadDirection == playerDirection)
|
||||||
{
|
{
|
||||||
if (TryArrowWarp(&position, metatileBehavior, playerDirection) == TRUE)
|
if (TryArrowWarp(&position, metatileBehavior, playerDirection) == TRUE)
|
||||||
{
|
{
|
||||||
gUnknown_3005078.heldDirection = TRUE;
|
gInputToStoreInQuestLogMaybe.heldDirection = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -253,16 +259,16 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
|||||||
metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y);
|
metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y);
|
||||||
if (input->heldDirection && input->dpadDirection == playerDirection)
|
if (input->heldDirection && input->dpadDirection == playerDirection)
|
||||||
{
|
{
|
||||||
if (sub_806D804(&position, metatileBehavior, playerDirection) == TRUE)
|
if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE)
|
||||||
{
|
{
|
||||||
gUnknown_3005078.heldDirection = TRUE;
|
gInputToStoreInQuestLogMaybe.heldDirection = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input->pressedAButton && TryStartInteractionScript(&position, metatileBehavior, playerDirection) == TRUE)
|
if (input->pressedAButton && TryStartInteractionScript(&position, metatileBehavior, playerDirection) == TRUE)
|
||||||
{
|
{
|
||||||
gUnknown_3005078.pressedAButton = TRUE;
|
gInputToStoreInQuestLogMaybe.pressedAButton = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,14 +276,14 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
|||||||
{
|
{
|
||||||
if (TryDoorWarp(&position, metatileBehavior, playerDirection) == TRUE)
|
if (TryDoorWarp(&position, metatileBehavior, playerDirection) == TRUE)
|
||||||
{
|
{
|
||||||
gUnknown_3005078.heldDirection2 = TRUE;
|
gInputToStoreInQuestLogMaybe.heldDirection2 = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input->pressedStartButton)
|
if (input->pressedStartButton)
|
||||||
{
|
{
|
||||||
gUnknown_3005078.pressedStartButton = TRUE;
|
gInputToStoreInQuestLogMaybe.pressedStartButton = TRUE;
|
||||||
FlagSet(FLAG_OPENED_START_MENU);
|
FlagSet(FLAG_OPENED_START_MENU);
|
||||||
PlaySE(SE_WIN_OPEN);
|
PlaySE(SE_WIN_OPEN);
|
||||||
ShowStartMenu();
|
ShowStartMenu();
|
||||||
@@ -285,48 +291,48 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
|||||||
}
|
}
|
||||||
if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE)
|
if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE)
|
||||||
{
|
{
|
||||||
gUnknown_3005078.pressedSelectButton = TRUE;
|
gInputToStoreInQuestLogMaybe.pressedSelectButton = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_806CD30(struct FieldInput * input)
|
void FieldInput_HandleCancelSignpost(struct FieldInput * input)
|
||||||
{
|
{
|
||||||
if (ScriptContext1_IsScriptSetUp() == TRUE)
|
if (ScriptContext1_IsScriptSetUp() == TRUE)
|
||||||
{
|
{
|
||||||
if (gUnknown_20370A0 != 0)
|
if (gWalkAwayFromSignInhibitTimer != 0)
|
||||||
gUnknown_20370A0--;
|
gWalkAwayFromSignInhibitTimer--;
|
||||||
else if (sub_8069A04() == TRUE)
|
else if (CanWalkAwayToCancelMsgBox() == TRUE)
|
||||||
{
|
{
|
||||||
if (input->dpadDirection != 0 && GetPlayerFacingDirection() != input->dpadDirection)
|
if (input->dpadDirection != 0 && GetPlayerFacingDirection() != input->dpadDirection)
|
||||||
{
|
{
|
||||||
if (sub_80699D4() == TRUE)
|
if (sub_80699D4() == TRUE)
|
||||||
return;
|
return;
|
||||||
if (input->dpadDirection == DIR_NORTH)
|
if (input->dpadDirection == DIR_NORTH)
|
||||||
sub_8069998(1);
|
RegisterQuestLogInput(QL_INPUT_UP);
|
||||||
else if (input->dpadDirection == DIR_SOUTH)
|
else if (input->dpadDirection == DIR_SOUTH)
|
||||||
sub_8069998(2);
|
RegisterQuestLogInput(QL_INPUT_DOWN);
|
||||||
else if (input->dpadDirection == DIR_WEST)
|
else if (input->dpadDirection == DIR_WEST)
|
||||||
sub_8069998(3);
|
RegisterQuestLogInput(QL_INPUT_LEFT);
|
||||||
else if (input->dpadDirection == DIR_EAST)
|
else if (input->dpadDirection == DIR_EAST)
|
||||||
sub_8069998(4);
|
RegisterQuestLogInput(QL_INPUT_RIGHT);
|
||||||
ScriptContext1_SetupScript(gUnknown_81A7ADB);
|
ScriptContext1_SetupScript(EventScript_CancelMessageBox);
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
}
|
}
|
||||||
else if (input->pressedStartButton)
|
else if (input->pressedStartButton)
|
||||||
{
|
{
|
||||||
ScriptContext1_SetupScript(gUnknown_81A7ADB);
|
ScriptContext1_SetupScript(EventScript_CancelMessageBox);
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
if (!FuncIsActiveTask(sub_806CDF8))
|
if (!FuncIsActiveTask(Task_QuestLogPlayback_OpenStartMenu))
|
||||||
CreateTask(sub_806CDF8, 8);
|
CreateTask(Task_QuestLogPlayback_OpenStartMenu, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_806CDF8(u8 taskId)
|
static void Task_QuestLogPlayback_OpenStartMenu(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!ScriptContext2_IsEnabled())
|
if (!ScriptContext2_IsEnabled())
|
||||||
{
|
{
|
||||||
@@ -411,7 +417,7 @@ const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatil
|
|||||||
if (objectEventId == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_ID_PLAYER)
|
if (objectEventId == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_ID_PLAYER)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < MAX_LINK_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (gLinkPlayerObjectEvents[i].active == TRUE && gLinkPlayerObjectEvents[i].objEventId == objectEventId)
|
if (gLinkPlayerObjectEvents[i].active == TRUE && gLinkPlayerObjectEvents[i].objEventId == objectEventId)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -455,7 +461,7 @@ static const u8 *GetInteractedObjectEventScript(struct MapPosition *position, u8
|
|||||||
|
|
||||||
static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction)
|
static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction)
|
||||||
{
|
{
|
||||||
u8 r2;
|
u8 signpostType;
|
||||||
const struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height);
|
const struct BgEvent *bgEvent = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height);
|
||||||
|
|
||||||
if (bgEvent == NULL)
|
if (bgEvent == NULL)
|
||||||
@@ -463,7 +469,7 @@ static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position
|
|||||||
if (bgEvent->bgUnion.script == NULL)
|
if (bgEvent->bgUnion.script == NULL)
|
||||||
return EventScript_TestSignpostMsg;
|
return EventScript_TestSignpostMsg;
|
||||||
|
|
||||||
r2 = sub_806D898(metatileBehavior, direction);
|
signpostType = GetFacingSignpostType(metatileBehavior, direction);
|
||||||
|
|
||||||
switch (bgEvent->kind)
|
switch (bgEvent->kind)
|
||||||
{
|
{
|
||||||
@@ -500,8 +506,8 @@ static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position
|
|||||||
return EventScript_HiddenItemScript;
|
return EventScript_HiddenItemScript;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r2 != 0xFF)
|
if (signpostType != SIGNPOST_NA)
|
||||||
sub_8069A20();
|
MsgSetSignPost();
|
||||||
gSpecialVar_Facing = direction;
|
gSpecialVar_Facing = direction;
|
||||||
return bgEvent->bgUnion.script;
|
return bgEvent->bgUnion.script;
|
||||||
}
|
}
|
||||||
@@ -571,23 +577,23 @@ static const u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 me
|
|||||||
return CableClub_EventScript_ShowBattleRecords;
|
return CableClub_EventScript_ShowBattleRecords;
|
||||||
if (MetatileBehavior_IsIndigoPlateauMark(metatileBehavior) == TRUE)
|
if (MetatileBehavior_IsIndigoPlateauMark(metatileBehavior) == TRUE)
|
||||||
{
|
{
|
||||||
sub_8069A20();
|
MsgSetSignPost();
|
||||||
return gUnknown_81A76F0;
|
return EventScript_Indigo_UltimateGoal;
|
||||||
}
|
}
|
||||||
if (MetatileBehavior_IsIndigoPlateauMark2(metatileBehavior) == TRUE)
|
if (MetatileBehavior_IsIndigoPlateauMark2(metatileBehavior) == TRUE)
|
||||||
{
|
{
|
||||||
sub_8069A20();
|
MsgSetSignPost();
|
||||||
return gUnknown_81A76F9;
|
return EventScript_Indigo_HighestAuthority;
|
||||||
}
|
}
|
||||||
if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, direction) == TRUE)
|
if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, direction) == TRUE)
|
||||||
{
|
{
|
||||||
sub_8069A20();
|
MsgSetSignPost();
|
||||||
return gUnknown_81A76DE;
|
return EventScript_PokemartSign;
|
||||||
}
|
}
|
||||||
if (MetatileBehavior_IsPlayerFacingPokemonCenterSign(metatileBehavior, direction) == TRUE)
|
if (MetatileBehavior_IsPlayerFacingPokemonCenterSign(metatileBehavior, direction) == TRUE)
|
||||||
{
|
{
|
||||||
sub_8069A20();
|
MsgSetSignPost();
|
||||||
return gUnknown_81A76E7;
|
return EventScript_PokecenterSign;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -736,7 +742,7 @@ static bool8 CheckStandardWildEncounter(u32 encounter)
|
|||||||
return TryStandardWildEncounter(encounter);
|
return TryStandardWildEncounter(encounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 sub_806D804(struct MapPosition * position, u16 metatileBehavior, u8 playerDirection)
|
static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition * position, u16 metatileBehavior, u8 playerDirection)
|
||||||
{
|
{
|
||||||
u8 r4;
|
u8 r4;
|
||||||
const u8 * script;
|
const u8 * script;
|
||||||
@@ -745,68 +751,68 @@ static bool8 sub_806D804(struct MapPosition * position, u16 metatileBehavior, u8
|
|||||||
if (playerDirection == DIR_EAST || playerDirection == DIR_WEST)
|
if (playerDirection == DIR_EAST || playerDirection == DIR_WEST)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
r4 = sub_806D898(metatileBehavior, playerDirection);
|
r4 = GetFacingSignpostType(metatileBehavior, playerDirection);
|
||||||
if (r4 == 0)
|
if (r4 == SIGNPOST_POKECENTER)
|
||||||
{
|
{
|
||||||
sub_806D908(gUnknown_81A76E7, playerDirection);
|
SetUpWalkIntoSignScript(EventScript_PokecenterSign, playerDirection);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (r4 == 1)
|
else if (r4 == SIGNPOST_POKEMART)
|
||||||
{
|
{
|
||||||
sub_806D908(gUnknown_81A76DE, playerDirection);
|
SetUpWalkIntoSignScript(EventScript_PokemartSign, playerDirection);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (r4 == 2)
|
else if (r4 == SIGNPOST_INDIGO_1)
|
||||||
{
|
{
|
||||||
sub_806D908(gUnknown_81A76F0, playerDirection);
|
SetUpWalkIntoSignScript(EventScript_Indigo_UltimateGoal, playerDirection);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (r4 == 3)
|
else if (r4 == SIGNPOST_INDIGO_2)
|
||||||
{
|
{
|
||||||
sub_806D908(gUnknown_81A76F9, playerDirection);
|
SetUpWalkIntoSignScript(EventScript_Indigo_HighestAuthority, playerDirection);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
script = sub_806D928(position);
|
script = GetSignpostScriptAtMapPosition(position);
|
||||||
if (script == NULL)
|
if (script == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (r4 != 0xF0)
|
if (r4 != SIGNPOST_SCRIPTED)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
sub_806D908(script, playerDirection);
|
SetUpWalkIntoSignScript(script, playerDirection);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sub_806D898(u16 metatileBehavior, u8 playerDirection)
|
static u8 GetFacingSignpostType(u16 metatileBehavior, u8 playerDirection)
|
||||||
{
|
{
|
||||||
if (MetatileBehavior_IsPlayerFacingPokemonCenterSign(metatileBehavior, playerDirection) == TRUE)
|
if (MetatileBehavior_IsPlayerFacingPokemonCenterSign(metatileBehavior, playerDirection) == TRUE)
|
||||||
return 0;
|
return SIGNPOST_POKECENTER;
|
||||||
|
|
||||||
if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, playerDirection) == TRUE)
|
if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, playerDirection) == TRUE)
|
||||||
return 1;
|
return SIGNPOST_POKEMART;
|
||||||
|
|
||||||
if (MetatileBehavior_IsIndigoPlateauMark(metatileBehavior) == TRUE)
|
if (MetatileBehavior_IsIndigoPlateauMark(metatileBehavior) == TRUE)
|
||||||
return 2;
|
return SIGNPOST_INDIGO_1;
|
||||||
|
|
||||||
if (MetatileBehavior_IsIndigoPlateauMark2(metatileBehavior) == TRUE)
|
if (MetatileBehavior_IsIndigoPlateauMark2(metatileBehavior) == TRUE)
|
||||||
return 3;
|
return SIGNPOST_INDIGO_2;
|
||||||
|
|
||||||
if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE)
|
if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE)
|
||||||
return 0xF0;
|
return SIGNPOST_SCRIPTED;
|
||||||
|
|
||||||
return 0xFF;
|
return SIGNPOST_NA;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_806D908(const u8 *script, u8 playerDirection)
|
static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection)
|
||||||
{
|
{
|
||||||
gSpecialVar_Facing = playerDirection;
|
gSpecialVar_Facing = playerDirection;
|
||||||
ScriptContext1_SetupScript(script);
|
ScriptContext1_SetupScript(script);
|
||||||
sub_80699E0();
|
SetWalkingIntoSignVars();
|
||||||
sub_8069A20();
|
MsgSetSignPost();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const u8 *sub_806D928(struct MapPosition * position)
|
static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition * position)
|
||||||
{
|
{
|
||||||
const struct BgEvent * event = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height);
|
const struct BgEvent * event = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->height);
|
||||||
if (event == NULL)
|
if (event == NULL)
|
||||||
|
|||||||
@@ -547,11 +547,11 @@ void NullFieldSpecial(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80CADC4(void)
|
void DoPicboxCancel(void)
|
||||||
{
|
{
|
||||||
u8 t = EOS;
|
u8 t = EOS;
|
||||||
AddTextPrinterParameterized(0, 2, &t, 0, 1, 0, NULL);
|
AddTextPrinterParameterized(0, 2, &t, 0, 1, 0, NULL);
|
||||||
sub_809D424();
|
PicboxCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVermilionTrashCans(void)
|
void SetVermilionTrashCans(void)
|
||||||
@@ -1545,7 +1545,7 @@ void SetSeenMon(void)
|
|||||||
GetSetPokedexFlag(SpeciesToNationalPokedexNum(gSpecialVar_0x8004), 2);
|
GetSetPokedexFlag(SpeciesToNationalPokedexNum(gSpecialVar_0x8004), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80CBDE8(void)
|
void ResetContextNpcTextColor(void)
|
||||||
{
|
{
|
||||||
gSelectedObjectEvent = 0;
|
gSelectedObjectEvent = 0;
|
||||||
gSpecialVar_TextColor = 0xFF;
|
gSpecialVar_TextColor = 0xFF;
|
||||||
|
|||||||
+35
-36
@@ -55,8 +55,7 @@ static EWRAM_DATA u16 sMovingNpcMapId = 0;
|
|||||||
static EWRAM_DATA u16 sFieldEffectScriptId = 0;
|
static EWRAM_DATA u16 sFieldEffectScriptId = 0;
|
||||||
|
|
||||||
struct ScriptContext * gUnknown_3005070;
|
struct ScriptContext * gUnknown_3005070;
|
||||||
|
u8 gSelectedObjectEvent;
|
||||||
extern u8 gSelectedObjectEvent;
|
|
||||||
|
|
||||||
// This is defined in here so the optimizer can't see its value when compiling
|
// This is defined in here so the optimizer can't see its value when compiling
|
||||||
// script.c.
|
// script.c.
|
||||||
@@ -1315,32 +1314,32 @@ bool8 ScrCmd_closemessage(struct ScriptContext * ctx)
|
|||||||
|
|
||||||
static bool8 WaitForAorBPress(void)
|
static bool8 WaitForAorBPress(void)
|
||||||
{
|
{
|
||||||
if (gMain.newKeys & A_BUTTON)
|
if (JOY_NEW(A_BUTTON))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (gMain.newKeys & B_BUTTON)
|
if (JOY_NEW(B_BUTTON))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (sub_806B93C(gUnknown_3005070) == TRUE)
|
if (sub_806B93C(gUnknown_3005070) == TRUE)
|
||||||
{
|
{
|
||||||
u8 r4 = sub_806B96C(gUnknown_3005070);
|
u8 r4 = sub_806B96C(gUnknown_3005070);
|
||||||
sub_8069998(r4);
|
RegisterQuestLogInput(r4);
|
||||||
if (r4)
|
if (r4 != QL_INPUT_OFF)
|
||||||
{
|
{
|
||||||
if (gQuestLogState != 2)
|
if (gQuestLogState != QL_STATE_2)
|
||||||
{
|
{
|
||||||
sub_80699F8();
|
ClearMsgBoxCancelableState();
|
||||||
if (r4 < 9 || r4 > 10)
|
if (r4 != QL_INPUT_A && r4 != QL_INPUT_B)
|
||||||
sub_8069964();
|
SetQuestLogInputIsDpadFlag();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sub_80699A4();
|
ClearQuestLogInput();
|
||||||
sub_8069970();
|
ClearQuestLogInputIsDpadFlag();
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sub_8112CAC() == 1 || gQuestLogState == 2)
|
if (sub_8112CAC() == 1 || gQuestLogState == QL_STATE_2)
|
||||||
{
|
{
|
||||||
if (gUnknown_20370AC == 120)
|
if (gUnknown_20370AC == 120)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1368,37 +1367,37 @@ static bool8 sub_806B93C(struct ScriptContext * ctx)
|
|||||||
|
|
||||||
static u8 sub_806B96C(struct ScriptContext * ctx)
|
static u8 sub_806B96C(struct ScriptContext * ctx)
|
||||||
{
|
{
|
||||||
if (gMain.heldKeys & DPAD_UP && gSpecialVar_Facing != 2)
|
if (JOY_HELD(DPAD_UP) && gSpecialVar_Facing != DIR_NORTH)
|
||||||
return 1;
|
return QL_INPUT_UP;
|
||||||
|
|
||||||
if (gMain.heldKeys & DPAD_DOWN && gSpecialVar_Facing != 1)
|
if (JOY_HELD(DPAD_DOWN) && gSpecialVar_Facing != DIR_SOUTH)
|
||||||
return 2;
|
return QL_INPUT_DOWN;
|
||||||
|
|
||||||
if (gMain.heldKeys & DPAD_LEFT && gSpecialVar_Facing != 3)
|
if (JOY_HELD(DPAD_LEFT) && gSpecialVar_Facing != DIR_WEST)
|
||||||
return 3;
|
return QL_INPUT_LEFT;
|
||||||
|
|
||||||
if (gMain.heldKeys & DPAD_RIGHT && gSpecialVar_Facing != 4)
|
if (JOY_HELD(DPAD_RIGHT) && gSpecialVar_Facing != DIR_EAST)
|
||||||
return 4;
|
return QL_INPUT_RIGHT;
|
||||||
|
|
||||||
if (gMain.newKeys & L_BUTTON)
|
if (JOY_NEW(L_BUTTON))
|
||||||
return 5;
|
return QL_INPUT_L;
|
||||||
|
|
||||||
if (gMain.heldKeys & R_BUTTON)
|
if (JOY_HELD(R_BUTTON))
|
||||||
return 6;
|
return QL_INPUT_R;
|
||||||
|
|
||||||
if (gMain.heldKeys & START_BUTTON)
|
if (JOY_HELD(START_BUTTON))
|
||||||
return 7;
|
return QL_INPUT_START;
|
||||||
|
|
||||||
if (gMain.heldKeys & SELECT_BUTTON)
|
if (JOY_HELD(SELECT_BUTTON))
|
||||||
return 8;
|
return QL_INPUT_SELECT;
|
||||||
|
|
||||||
if (gMain.newKeys & A_BUTTON)
|
if (JOY_NEW(A_BUTTON))
|
||||||
return 9;
|
return QL_INPUT_A;
|
||||||
|
|
||||||
if (gMain.newKeys & B_BUTTON)
|
if (JOY_NEW(B_BUTTON))
|
||||||
return 10;
|
return QL_INPUT_B;
|
||||||
|
|
||||||
return 0;
|
return QL_INPUT_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ScrCmd_waitbuttonpress(struct ScriptContext * ctx)
|
bool8 ScrCmd_waitbuttonpress(struct ScriptContext * ctx)
|
||||||
@@ -2224,13 +2223,13 @@ bool8 ScrCmd_removecoins(struct ScriptContext * ctx)
|
|||||||
|
|
||||||
bool8 ScrCmd_signmsg(struct ScriptContext * ctx)
|
bool8 ScrCmd_signmsg(struct ScriptContext * ctx)
|
||||||
{
|
{
|
||||||
sub_8069A20();
|
MsgSetSignPost();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ScrCmd_normalmsg(struct ScriptContext * ctx)
|
bool8 ScrCmd_normalmsg(struct ScriptContext * ctx)
|
||||||
{
|
{
|
||||||
sub_8069A2C();
|
MsgSetNotSignPost();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+38
-38
@@ -7,7 +7,7 @@
|
|||||||
#define SCRIPT_STACK_SIZE 20
|
#define SCRIPT_STACK_SIZE 20
|
||||||
|
|
||||||
|
|
||||||
extern void sub_80CBDE8(void); // field_specials
|
extern void ResetContextNpcTextColor(void); // field_specials
|
||||||
extern u16 CalcCRC16WithTable(u8 *data, int length); // util
|
extern u16 CalcCRC16WithTable(u8 *data, int length); // util
|
||||||
extern bool32 ValidateReceivedWonderCard(void); // mevent
|
extern bool32 ValidateReceivedWonderCard(void); // mevent
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ enum
|
|||||||
SCRIPT_MODE_NATIVE,
|
SCRIPT_MODE_NATIVE,
|
||||||
};
|
};
|
||||||
|
|
||||||
EWRAM_DATA u8 gUnknown_20370A0 = 0;
|
EWRAM_DATA u8 gWalkAwayFromSignInhibitTimer = 0;
|
||||||
EWRAM_DATA const u8 *gRAMScriptPtr = NULL;
|
EWRAM_DATA const u8 *gRAMScriptPtr = NULL;
|
||||||
|
|
||||||
// iwram bss
|
// iwram bss
|
||||||
@@ -29,10 +29,10 @@ static u32 sUnusedVariable2;
|
|||||||
static struct ScriptContext sScriptContext2;
|
static struct ScriptContext sScriptContext2;
|
||||||
static bool8 sScriptContext2Enabled;
|
static bool8 sScriptContext2Enabled;
|
||||||
static u8 gUnknown_3000F9D;
|
static u8 gUnknown_3000F9D;
|
||||||
static u8 gUnknown_3000F9E;
|
static u8 sMsgBoxIsCancelable;
|
||||||
static u8 gUnknown_3000F9F;
|
static u8 sQuestLogInput;
|
||||||
static u8 gUnknown_3000FA0;
|
static u8 sQuestLogInputIsDpad;
|
||||||
static u8 gUnknown_3000FA1;
|
static u8 sMsgIsSignPost;
|
||||||
|
|
||||||
extern ScrCmdFunc gScriptCmdTable[];
|
extern ScrCmdFunc gScriptCmdTable[];
|
||||||
extern ScrCmdFunc gScriptCmdTableEnd[];
|
extern ScrCmdFunc gScriptCmdTableEnd[];
|
||||||
@@ -202,95 +202,95 @@ bool8 ScriptContext2_IsEnabled(void)
|
|||||||
return sScriptContext2Enabled;
|
return sScriptContext2Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8069964(void)
|
void SetQuestLogInputIsDpadFlag(void)
|
||||||
{
|
{
|
||||||
gUnknown_3000FA0 = 1;
|
sQuestLogInputIsDpad = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8069970(void)
|
void ClearQuestLogInputIsDpadFlag(void)
|
||||||
{
|
{
|
||||||
gUnknown_3000FA0 = 0;
|
sQuestLogInputIsDpad = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_806997C(void)
|
bool8 IsQuestLogInputDpad(void)
|
||||||
{
|
{
|
||||||
if(gUnknown_3000FA0 == TRUE)
|
if(sQuestLogInputIsDpad == TRUE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8069998(u8 var)
|
void RegisterQuestLogInput(u8 var)
|
||||||
{
|
{
|
||||||
gUnknown_3000F9F = var;
|
sQuestLogInput = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80699A4(void)
|
void ClearQuestLogInput(void)
|
||||||
{
|
{
|
||||||
gUnknown_3000F9F = 0;
|
sQuestLogInput = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 sub_80699B0(void)
|
u8 GetRegisteredQuestLogInput(void)
|
||||||
{
|
{
|
||||||
return gUnknown_3000F9F;
|
return sQuestLogInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80699BC(void)
|
void sub_80699BC(void)
|
||||||
{
|
{
|
||||||
gUnknown_3000F9D = 1;
|
gUnknown_3000F9D = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80699C8(void)
|
void sub_80699C8(void)
|
||||||
{
|
{
|
||||||
gUnknown_3000F9D = 0;
|
gUnknown_3000F9D = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 sub_80699D4(void)
|
bool8 sub_80699D4(void)
|
||||||
{
|
{
|
||||||
return gUnknown_3000F9D;
|
return gUnknown_3000F9D;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80699E0(void)
|
void SetWalkingIntoSignVars(void)
|
||||||
{
|
{
|
||||||
gUnknown_20370A0 = 6;
|
gWalkAwayFromSignInhibitTimer = 6;
|
||||||
gUnknown_3000F9E = 1;
|
sMsgBoxIsCancelable = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80699F8(void)
|
void ClearMsgBoxCancelableState(void)
|
||||||
{
|
{
|
||||||
gUnknown_3000F9E = 0;
|
sMsgBoxIsCancelable = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_8069A04(void)
|
bool8 CanWalkAwayToCancelMsgBox(void)
|
||||||
{
|
{
|
||||||
if(gUnknown_3000F9E == TRUE)
|
if(sMsgBoxIsCancelable == TRUE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8069A20(void)
|
void MsgSetSignPost(void)
|
||||||
{
|
{
|
||||||
gUnknown_3000FA1 = 1;
|
sMsgIsSignPost = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8069A2C(void)
|
void MsgSetNotSignPost(void)
|
||||||
{
|
{
|
||||||
gUnknown_3000FA1 = 0;
|
sMsgIsSignPost = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 IsMsgSignPost(void)
|
bool8 IsMsgSignPost(void)
|
||||||
{
|
{
|
||||||
if(gUnknown_3000FA1 == TRUE)
|
if(sMsgIsSignPost == TRUE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8069A54(void)
|
void ResetFacingNpcOrSignPostVars(void)
|
||||||
{
|
{
|
||||||
sub_80CBDE8();
|
ResetContextNpcTextColor();
|
||||||
sub_8069A2C();
|
MsgSetNotSignPost();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ScriptContext1_IsScriptSetUp(void)
|
bool8 ScriptContext1_IsScriptSetUp(void)
|
||||||
@@ -329,9 +329,9 @@ bool8 ScriptContext2_RunScript(void)
|
|||||||
|
|
||||||
void ScriptContext1_SetupScript(const u8 *ptr)
|
void ScriptContext1_SetupScript(const u8 *ptr)
|
||||||
{
|
{
|
||||||
sub_80699F8();
|
ClearMsgBoxCancelableState();
|
||||||
sub_80699C8();
|
sub_80699C8();
|
||||||
sub_8069970();
|
ClearQuestLogInputIsDpadFlag();
|
||||||
InitScriptContext(&sScriptContext1, gScriptCmdTable, gScriptCmdTableEnd);
|
InitScriptContext(&sScriptContext1, gScriptCmdTable, gScriptCmdTableEnd);
|
||||||
SetupBytecodeScript(&sScriptContext1, ptr);
|
SetupBytecodeScript(&sScriptContext1, ptr);
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
|
|||||||
+1
-1
@@ -1070,7 +1070,7 @@ static bool8 PicboxWait(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_809D424(void)
|
void PicboxCancel(void)
|
||||||
{
|
{
|
||||||
u8 taskId = FindTaskIdByFunc(Task_ScriptShowMonPic);
|
u8 taskId = FindTaskIdByFunc(Task_ScriptShowMonPic);
|
||||||
struct Task * task;
|
struct Task * task;
|
||||||
|
|||||||
Reference in New Issue
Block a user