Document special event actions
This commit is contained in:
@@ -22,9 +22,9 @@
|
||||
|
||||
#define QL_IS_PLAYBACK_STATE (gQuestLogState == QL_STATE_PLAYBACK || gQuestLogState == QL_STATE_PLAYBACK_LAST)
|
||||
|
||||
#define QL_EVENT_0 0 // Null
|
||||
#define QL_EVENT_1 1 // Null
|
||||
#define QL_EVENT_2 2 // Null
|
||||
#define QL_EVENT_INPUT 0 // Null
|
||||
#define QL_EVENT_GFX_CHANGE 1 // Null
|
||||
#define QL_EVENT_MOVEMENT 2 // Null
|
||||
#define QL_EVENT_SWITCHED_PARTY_ORDER 3
|
||||
#define QL_EVENT_USED_ITEM 4
|
||||
#define QL_EVENT_GAVE_HELD_ITEM 5
|
||||
@@ -61,9 +61,9 @@
|
||||
#define QL_EVENT_USED_FIELD_MOVE 36
|
||||
#define QL_EVENT_BOUGHT_ITEM 37
|
||||
#define QL_EVENT_SOLD_ITEM 38
|
||||
#define QL_EVENT_39 39 // Null
|
||||
#define QL_EVENT_ACTION_FF 39 // Null
|
||||
#define QL_EVENT_OBTAINED_STORY_ITEM 40
|
||||
#define QL_EVENT_41 41 // Null
|
||||
#define QL_EVENT_ACTION_FE 41 // Null
|
||||
#define QL_EVENT_ARRIVED 42
|
||||
|
||||
#define QL_EVENT_USED_POKEMART (QL_EVENT_BOUGHT_ITEM - 1) // Used as a start pos for QL_EVENT_BOUGHT_ITEM / QL_EVENT_SOLD_ITEM
|
||||
|
||||
+13
-8
@@ -7,6 +7,11 @@
|
||||
#include "constants/quest_log.h"
|
||||
#include "constants/battle.h"
|
||||
|
||||
// Layout of Quest Log script commands
|
||||
#define QL_CMD_EVENT_MASK 0x0FFF
|
||||
#define QL_CMD_UNK_MASK 0xF000
|
||||
#define QL_CMD_UNK_SHIFT 12
|
||||
|
||||
// Parameter to QuestLog_OnEscalatorWarp
|
||||
#define QL_ESCALATOR_OUT 1
|
||||
#define QL_ESCALATOR_IN 2
|
||||
@@ -219,7 +224,7 @@ void sub_8111708(void);
|
||||
void sub_81127F8(struct FieldInput * a0);
|
||||
void sub_8112B3C(void);
|
||||
void RunQuestLogCB(void);
|
||||
void sub_8111C68(void);
|
||||
void HandleQuestLogInput(void);
|
||||
bool8 QuestLogScenePlaybackIsEnding(void);
|
||||
void SetQuestLogEvent_Arrived(void);
|
||||
bool8 QuestLog_ShouldEndSceneOnMapChange(void);
|
||||
@@ -235,16 +240,16 @@ bool8 sub_8110944(const void *a0, size_t cmdSize);
|
||||
|
||||
void sub_8113BD8(void);
|
||||
void ResetUnk203B044(void);
|
||||
u16 *TryRecordEvent39_NoParams(u16 *);
|
||||
u16 *sub_8113C8C(u16 *, struct QuestLogAction *);
|
||||
u16 *sub_8113CC8(u16 *, struct QuestLogAction *);
|
||||
u16 *sub_8113D08(u16 *, struct QuestLogAction *);
|
||||
u16 *sub_8113D48(u16 *, struct QuestLogAction *);
|
||||
u16 *sub_8113D94(u16 *, struct QuestLogAction *);
|
||||
u16 *QL_RecordAction_FF(u16 *);
|
||||
u16 *QL_LoadAction_FE(u16 *, struct QuestLogAction *);
|
||||
u16 *QL_RecordAction_Input(u16 *, struct QuestLogAction *);
|
||||
u16 *QL_LoadAction_Input(u16 *, struct QuestLogAction *);
|
||||
u16 *QL_RecordAction_MovementOrGfxChange(u16 *, struct QuestLogAction *);
|
||||
u16 *QL_LoadAction_MovementOrGfxChange(u16 *, struct QuestLogAction *);
|
||||
void QL_EnableRecordingSteps(void);
|
||||
u16 *QuestLog_SkipCommand(u16 *, u16 **);
|
||||
void sub_8113ABC(const u16 *);
|
||||
u16 *sub_8113C20(u16 *, struct QuestLogAction *);
|
||||
u16 *QL_LoadAction_FF(u16 *, struct QuestLogAction *);
|
||||
bool8 sub_8113AE8(const u16 *);
|
||||
bool8 sub_8113B44(const u16 *);
|
||||
void TryRecordEvent41_IncCursor(u16);
|
||||
|
||||
+1
-1
@@ -1418,7 +1418,7 @@ static void DoCB1_Overworld_QuestLogPlayback(void)
|
||||
|
||||
sub_8112B3C();
|
||||
UpdatePlayerAvatarTransitionState();
|
||||
sub_8111C68();
|
||||
HandleQuestLogInput();
|
||||
FieldClearPlayerInput(&fieldInput);
|
||||
fieldInput = gQuestLogFieldInput;
|
||||
FieldInput_HandleCancelSignpost(&fieldInput);
|
||||
|
||||
+65
-65
@@ -109,7 +109,7 @@ static EWRAM_DATA struct PlaybackControl sPlaybackControl = {0};
|
||||
static EWRAM_DATA struct QuestLogAction sQuestLogActionRecordBuffer[SCRIPT_BUFFER_SIZE] = {0};
|
||||
EWRAM_DATA u16 gQuestLogCurActionIdx = 0;
|
||||
static EWRAM_DATA u8 sMovementScripts[OBJECT_EVENT_TEMPLATES_COUNT][2] = {{0}};
|
||||
static EWRAM_DATA u16 sNextStepDelay = 0;
|
||||
static EWRAM_DATA u16 sNextActionDelay = 0;
|
||||
static EWRAM_DATA u16 sLastQuestLogCursor = 0;
|
||||
static EWRAM_DATA u16 sFlagOrVarPlayhead = 0;
|
||||
|
||||
@@ -121,7 +121,7 @@ static void TryRecordEvent39_GoToNextScene(void);
|
||||
static void BackUpTrainerRematchesToVars(void);
|
||||
static void BackUpMapLayoutToVar(void);
|
||||
static void SetGameStateAtScene(u8);
|
||||
static u8 TryRecordQuestLogActionSequence(struct QuestLogAction *);
|
||||
static u8 TryRecordActionSequence(struct QuestLogAction *);
|
||||
static void Task_BeginQuestLogPlayback(u8);
|
||||
static void QuestLogPlaybackSetObjectEventTemplates(u8);
|
||||
static void QLPlayback_InitOverworldState(void);
|
||||
@@ -272,7 +272,7 @@ static void SetQuestLogState(u8 state)
|
||||
|
||||
static void QLogCB_Recording(void)
|
||||
{
|
||||
if (TryRecordQuestLogActionSequence(sQuestLogActionRecordBuffer) != 1)
|
||||
if (TryRecordActionSequence(sQuestLogActionRecordBuffer) != 1)
|
||||
{
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
TryRecordEvent39_GoToNextScene();
|
||||
@@ -332,7 +332,7 @@ void StartRecordingQuestLogAction(u16 eventId)
|
||||
SetGameStateAtScene(sCurrentSceneNum);
|
||||
gUnknown_203ADFC = 0;
|
||||
SetUpQuestLogAction(2, sQuestLogActionRecordBuffer, sizeof(sQuestLogActionRecordBuffer));
|
||||
TryRecordQuestLogActionSequence(sQuestLogActionRecordBuffer);
|
||||
TryRecordActionSequence(sQuestLogActionRecordBuffer);
|
||||
SetQuestLogState(QL_STATE_RECORDING);
|
||||
}
|
||||
|
||||
@@ -414,12 +414,12 @@ static void BackUpMapLayoutToVar(void)
|
||||
|
||||
static void TryRecordEvent39_GoToNextScene(void)
|
||||
{
|
||||
TryRecordEvent39_NoParams(gQuestLogRecordingPointer);
|
||||
QL_RecordAction_FF(gQuestLogRecordingPointer);
|
||||
if (++sCurrentSceneNum >= QUEST_LOG_SCENE_COUNT)
|
||||
sCurrentSceneNum = 0;
|
||||
}
|
||||
|
||||
static bool8 TryRecordQuestLogActionSequence(struct QuestLogAction * actions)
|
||||
static bool8 TryRecordActionSequence(struct QuestLogAction * actions)
|
||||
{
|
||||
u16 i;
|
||||
|
||||
@@ -431,10 +431,10 @@ static bool8 TryRecordQuestLogActionSequence(struct QuestLogAction * actions)
|
||||
{
|
||||
case QL_ACTION_MOVEMENT:
|
||||
case QL_ACTION_GFX_CHANGE:
|
||||
gQuestLogRecordingPointer = sub_8113D48(gQuestLogRecordingPointer, &actions[i]);
|
||||
gQuestLogRecordingPointer = QL_RecordAction_MovementOrGfxChange(gQuestLogRecordingPointer, &actions[i]);
|
||||
break;
|
||||
default:
|
||||
gQuestLogRecordingPointer = sub_8113CC8(gQuestLogRecordingPointer, &actions[i]);
|
||||
gQuestLogRecordingPointer = QL_RecordAction_Input(gQuestLogRecordingPointer, &actions[i]);
|
||||
break;
|
||||
}
|
||||
if (gQuestLogRecordingPointer == NULL)
|
||||
@@ -446,7 +446,7 @@ static bool8 TryRecordQuestLogActionSequence(struct QuestLogAction * actions)
|
||||
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_0)
|
||||
{
|
||||
gQuestLogRecordingPointer = TryRecordEvent39_NoParams(gQuestLogRecordingPointer);
|
||||
gQuestLogRecordingPointer = QL_RecordAction_FF(gQuestLogRecordingPointer);
|
||||
return FALSE;
|
||||
}
|
||||
gUnknown_203ADFC = gQuestLogCurActionIdx;
|
||||
@@ -782,26 +782,26 @@ static void ReadQuestLogScriptFromSav1(u8 sceneNum, struct QuestLogAction * a1)
|
||||
script = gSaveBlock1Ptr->questLog[sceneNum].script;
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
switch (script[0] & 0xFFF)
|
||||
switch (script[0] & QL_CMD_EVENT_MASK)
|
||||
{
|
||||
case QL_EVENT_0:
|
||||
script = sub_8113D08(script, &a1[r6]);
|
||||
case QL_EVENT_INPUT:
|
||||
script = QL_LoadAction_Input(script, &a1[r6]);
|
||||
r6++;
|
||||
break;
|
||||
case QL_EVENT_1:
|
||||
case QL_EVENT_2:
|
||||
script = sub_8113D94(script, &a1[r6]);
|
||||
case QL_EVENT_GFX_CHANGE:
|
||||
case QL_EVENT_MOVEMENT:
|
||||
script = QL_LoadAction_MovementOrGfxChange(script, &a1[r6]);
|
||||
r6++;
|
||||
break;
|
||||
case QL_EVENT_39:
|
||||
script = sub_8113C20(script, &a1[r6]);
|
||||
case QL_EVENT_ACTION_FF:
|
||||
script = QL_LoadAction_FF(script, &a1[r6]);
|
||||
r6++;
|
||||
break;
|
||||
case QL_EVENT_41:
|
||||
script = sub_8113C8C(script, &a1[r6]);
|
||||
case QL_EVENT_ACTION_FE:
|
||||
script = QL_LoadAction_FE(script, &a1[r6]);
|
||||
r6++;
|
||||
break;
|
||||
default:
|
||||
default: // Normal event
|
||||
script = QuestLog_SkipCommand(script, &gUnknown_203AE0C[r9]);
|
||||
if (r9 == 0)
|
||||
sub_8113ABC(gUnknown_203AE0C[0]);
|
||||
@@ -978,22 +978,22 @@ bool8 sub_8111C2C(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_8111C68(void)
|
||||
void HandleQuestLogInput(void)
|
||||
{
|
||||
if (sPlaybackControl.sceneEndMode == 0)
|
||||
if (sPlaybackControl.sceneEndMode != 0)
|
||||
return;
|
||||
|
||||
if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
sPlaybackControl.sceneEndMode = 2;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
QuestLog_BeginFadeAtEndOfScene(-3);
|
||||
}
|
||||
else if (JOY_NEW(B_BUTTON))
|
||||
{
|
||||
sPlaybackControl.sceneEndMode = 1;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
QuestLog_SkipToEndOfPlayback(-3);
|
||||
}
|
||||
sPlaybackControl.sceneEndMode = 2;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
QuestLog_BeginFadeAtEndOfScene(-3);
|
||||
}
|
||||
else if (JOY_NEW(B_BUTTON))
|
||||
{
|
||||
sPlaybackControl.sceneEndMode = 1;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
QuestLog_SkipToEndOfPlayback(-3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1266,7 +1266,7 @@ void FinishRecordingQuestLogScene(void)
|
||||
{
|
||||
if (gQuestLogState == QL_STATE_RECORDING)
|
||||
{
|
||||
TryRecordQuestLogActionSequence(sQuestLogActionRecordBuffer);
|
||||
TryRecordActionSequence(sQuestLogActionRecordBuffer);
|
||||
TryRecordEvent39_GoToNextScene();
|
||||
gQuestLogState = 0;
|
||||
sQuestLogCB = NULL;
|
||||
@@ -1280,7 +1280,7 @@ void QuestLog_CutRecording(void)
|
||||
{
|
||||
if (gQuestLogPlaybackState != QL_PLAYBACK_STATE_0 && gQuestLogState == QL_STATE_RECORDING)
|
||||
{
|
||||
TryRecordQuestLogActionSequence(sQuestLogActionRecordBuffer);
|
||||
TryRecordActionSequence(sQuestLogActionRecordBuffer);
|
||||
TryRecordEvent41_IncCursor(1);
|
||||
TryRecordEvent39_GoToNextScene();
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
@@ -1354,14 +1354,14 @@ void QuestLogRecordNPCStep(u8 localId, u8 mapNum, u8 mapGroup, u8 movementAction
|
||||
{
|
||||
if (!RecordHeadAtEndOfEntryOrScriptContext2Enabled())
|
||||
{
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextStepDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextActionDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].type = QL_ACTION_MOVEMENT;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.localId = localId;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.mapNum = mapNum;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.mapGroup = mapGroup;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.movementActionId = movementActionId;
|
||||
gQuestLogCurActionIdx++;
|
||||
sNextStepDelay = 0;
|
||||
sNextActionDelay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1369,14 +1369,14 @@ void QuestLogRecordNPCStepWithDuration(u8 localId, u8 mapNum, u8 mapGroup, u8 mo
|
||||
{
|
||||
if (!RecordHeadAtEndOfEntry())
|
||||
{
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextStepDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextActionDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].type = QL_ACTION_MOVEMENT;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.localId = localId;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.mapNum = mapNum;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.mapGroup = mapGroup;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.movementActionId = movementActionId;
|
||||
gQuestLogCurActionIdx++;
|
||||
sNextStepDelay = duration;
|
||||
sNextActionDelay = duration;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1386,13 +1386,13 @@ void QuestLogRecordPlayerStep(u8 movementActionId)
|
||||
{
|
||||
if (movementActionId != sCurSceneActions[sLastQuestLogCursor].data.a.movementActionId || movementActionId > MOVEMENT_ACTION_FACE_RIGHT)
|
||||
{
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextStepDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextActionDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].type = QL_ACTION_MOVEMENT;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.localId = 0;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.movementActionId = movementActionId;
|
||||
sLastQuestLogCursor = gQuestLogCurActionIdx;
|
||||
gQuestLogCurActionIdx++;
|
||||
sNextStepDelay = 0;
|
||||
sNextActionDelay = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1401,13 +1401,13 @@ void QuestLogRecordPlayerStepWithDuration(u8 movementActionId, u8 duration)
|
||||
{
|
||||
if (!RecordHeadAtEndOfEntry())
|
||||
{
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextStepDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextActionDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].type = QL_ACTION_MOVEMENT;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.localId = 0;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.movementActionId = movementActionId;
|
||||
sLastQuestLogCursor = gQuestLogCurActionIdx;
|
||||
gQuestLogCurActionIdx++;
|
||||
sNextStepDelay = duration;
|
||||
sNextActionDelay = duration;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1415,12 +1415,12 @@ void QuestLogRecordPlayerAvatarGfxTransition(u8 gfxState)
|
||||
{
|
||||
if (!RecordHeadAtEndOfEntry())
|
||||
{
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextStepDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextActionDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].type = QL_ACTION_GFX_CHANGE;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.b.localId = 0;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.b.gfxState = gfxState;
|
||||
gQuestLogCurActionIdx++;
|
||||
sNextStepDelay = 0;
|
||||
sNextActionDelay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1428,12 +1428,12 @@ void QuestLogRecordPlayerAvatarGfxTransitionWithDuration(u8 gfxState, u8 duratio
|
||||
{
|
||||
if (!RecordHeadAtEndOfEntry())
|
||||
{
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextStepDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextActionDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].type = QL_ACTION_GFX_CHANGE;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.b.localId = 0;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.b.gfxState = gfxState;
|
||||
gQuestLogCurActionIdx++;
|
||||
sNextStepDelay = duration;
|
||||
sNextActionDelay = duration;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1450,7 +1450,7 @@ void sub_81127F8(struct FieldInput * a0)
|
||||
// - pressedBButton
|
||||
// - dpadDirection
|
||||
u32 r2 = *(u32 *)a0 & 0x00FF00F3;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextStepDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextActionDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].type = QL_ACTION_INPUT;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.fieldInput[0] = r2;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.fieldInput[1] = r2 >> 8; // always 0
|
||||
@@ -1458,9 +1458,9 @@ void sub_81127F8(struct FieldInput * a0)
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.fieldInput[3] = r2 >> 24; // always 0
|
||||
gQuestLogCurActionIdx++;
|
||||
if (ArePlayerFieldControlsLocked())
|
||||
sNextStepDelay = TRUE;
|
||||
sNextActionDelay = 1;
|
||||
else
|
||||
sNextStepDelay = FALSE;
|
||||
sNextActionDelay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1490,10 +1490,10 @@ void QuestLog_OnEscalatorWarp(u8 direction)
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_3;
|
||||
else if (r1 == 2)
|
||||
{
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextStepDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = sNextActionDelay;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].type = QL_ACTION_3;
|
||||
gQuestLogCurActionIdx++;
|
||||
sNextStepDelay = 0;
|
||||
sNextActionDelay = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_4;
|
||||
}
|
||||
break;
|
||||
@@ -1526,7 +1526,7 @@ static void SetUpQuestLogAction(u8 kind, struct QuestLogAction *actions, u16 siz
|
||||
gQuestLogCurActionIdx = 0;
|
||||
sLastQuestLogCursor = 0;
|
||||
gQuestLogFieldInput = (struct FieldInput){};
|
||||
sNextStepDelay = sCurSceneActions[gQuestLogCurActionIdx].duration;
|
||||
sNextActionDelay = sCurSceneActions[gQuestLogCurActionIdx].duration;
|
||||
sMovementScripts[0][0] = sCurSceneActions[gQuestLogCurActionIdx].data.a.movementActionId;
|
||||
sMovementScripts[0][1] = QL_PLAYER_GFX_NONE;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_1;
|
||||
@@ -1542,7 +1542,7 @@ static void SetUpQuestLogAction(u8 kind, struct QuestLogAction *actions, u16 siz
|
||||
};
|
||||
}
|
||||
gQuestLogCurActionIdx = 0;
|
||||
sNextStepDelay = 0;
|
||||
sNextActionDelay = 0;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].duration = 0;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].type = QL_ACTION_MOVEMENT;
|
||||
sCurSceneActions[gQuestLogCurActionIdx].data.a.localId = 0;
|
||||
@@ -1581,12 +1581,16 @@ void sub_8112B3C(void)
|
||||
switch (gQuestLogPlaybackState)
|
||||
{
|
||||
case QL_PLAYBACK_STATE_0:
|
||||
case QL_PLAYBACK_STATE_3:
|
||||
case QL_PLAYBACK_STATE_4:
|
||||
break;
|
||||
case QL_PLAYBACK_STATE_1:
|
||||
if (!RecordHeadAtEndOfEntryOrScriptContext2Enabled())
|
||||
{
|
||||
if (sNextStepDelay != 0)
|
||||
sNextStepDelay--;
|
||||
if (sNextActionDelay != 0)
|
||||
{
|
||||
sNextActionDelay--;
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
@@ -1625,9 +1629,9 @@ void sub_8112B3C(void)
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
break;
|
||||
}
|
||||
sNextStepDelay = sCurSceneActions[gQuestLogCurActionIdx].duration;
|
||||
sNextActionDelay = sCurSceneActions[gQuestLogCurActionIdx].duration;
|
||||
} while (gQuestLogPlaybackState != QL_PLAYBACK_STATE_3
|
||||
&& (sNextStepDelay == 0 || sNextStepDelay == 0xFFFF));
|
||||
&& (sNextActionDelay == 0 || sNextActionDelay == 0xFFFF));
|
||||
}
|
||||
}
|
||||
else if (gQuestLogCurActionIdx >= sMaxActionsInScene)
|
||||
@@ -1638,21 +1642,17 @@ void sub_8112B3C(void)
|
||||
case QL_PLAYBACK_STATE_2:
|
||||
if (ArePlayerFieldControlsLocked() != TRUE)
|
||||
{
|
||||
sNextStepDelay++;
|
||||
sNextActionDelay++;
|
||||
if (gQuestLogCurActionIdx >= sMaxActionsInScene)
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
}
|
||||
break;
|
||||
case QL_PLAYBACK_STATE_3:
|
||||
break;
|
||||
case QL_PLAYBACK_STATE_4:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void QL_AfterRecordFishActionSuccessful(void)
|
||||
{
|
||||
sNextStepDelay++;
|
||||
sNextActionDelay++;
|
||||
}
|
||||
|
||||
u8 sub_8112CAC(void)
|
||||
|
||||
+57
-57
@@ -39,7 +39,7 @@ static bool8 TryDeferLinkEvent(u16, const u16 *);
|
||||
static bool8 TryDeferTrainerBattleEvent(u16, const u16 *);
|
||||
static bool8 IsEventWithSpecialEncounterSpecies(u16, const u16 *);
|
||||
static void SetQuestLogEventToActive(u16);
|
||||
static u16 *TryRecordEvent41(u16 *, u16);
|
||||
static u16 *QL_RecordAction_FE(u16 *, u16);
|
||||
static u16 *RecordEvent_SwitchedPartyOrder(u16 *, const struct QuestLogEvent_SwitchedPartyOrder *);
|
||||
static u16 *RecordEvent_UsedItem(u16 *, const struct QuestLogEvent_Item *);
|
||||
static u16 *RecordEvent_GaveHeldItemFromPartyMenu(u16 *, const struct QuestLogEvent_Item *);
|
||||
@@ -124,9 +124,9 @@ static void TranslateLinkPartnersName(u8 *);
|
||||
typedef u16 *(*RecordEventFunc)(u16 *, const u16 *);
|
||||
|
||||
static const RecordEventFunc sRecordEventFuncs[] = {
|
||||
[QL_EVENT_0] = NULL,
|
||||
[QL_EVENT_1] = NULL,
|
||||
[QL_EVENT_2] = NULL,
|
||||
[QL_EVENT_INPUT] = NULL,
|
||||
[QL_EVENT_GFX_CHANGE] = NULL,
|
||||
[QL_EVENT_MOVEMENT] = NULL,
|
||||
[QL_EVENT_SWITCHED_PARTY_ORDER] = (RecordEventFunc) RecordEvent_SwitchedPartyOrder,
|
||||
[QL_EVENT_USED_ITEM] = (RecordEventFunc) RecordEvent_UsedItem,
|
||||
[QL_EVENT_GAVE_HELD_ITEM] = (RecordEventFunc) RecordEvent_GaveHeldItemFromPartyMenu,
|
||||
@@ -163,16 +163,16 @@ static const RecordEventFunc sRecordEventFuncs[] = {
|
||||
[QL_EVENT_USED_FIELD_MOVE] = (RecordEventFunc) RecordEvent_UsedFieldMove,
|
||||
[QL_EVENT_BOUGHT_ITEM] = (RecordEventFunc) RecordEvent_BoughtItem,
|
||||
[QL_EVENT_SOLD_ITEM] = (RecordEventFunc) RecordEvent_SoldItem,
|
||||
[QL_EVENT_39] = NULL,
|
||||
[QL_EVENT_ACTION_FF] = NULL,
|
||||
[QL_EVENT_OBTAINED_STORY_ITEM] = (RecordEventFunc) RecordEvent_ObtainedStoryItem,
|
||||
[QL_EVENT_41] = NULL,
|
||||
[QL_EVENT_ACTION_FE] = NULL,
|
||||
[QL_EVENT_ARRIVED] = (RecordEventFunc) RecordEvent_ArrivedInLocation
|
||||
};
|
||||
|
||||
static const u16 *(*const sLoadEventFuncs[])(const u16 *) = {
|
||||
[QL_EVENT_0] = NULL,
|
||||
[QL_EVENT_1] = NULL,
|
||||
[QL_EVENT_2] = NULL,
|
||||
[QL_EVENT_INPUT] = NULL,
|
||||
[QL_EVENT_GFX_CHANGE] = NULL,
|
||||
[QL_EVENT_MOVEMENT] = NULL,
|
||||
[QL_EVENT_SWITCHED_PARTY_ORDER] = LoadEvent_SwitchedPartyOrder,
|
||||
[QL_EVENT_USED_ITEM] = LoadEvent_UsedItem,
|
||||
[QL_EVENT_GAVE_HELD_ITEM] = LoadEvent_GaveHeldItemFromPartyMenu,
|
||||
@@ -209,16 +209,16 @@ static const u16 *(*const sLoadEventFuncs[])(const u16 *) = {
|
||||
[QL_EVENT_USED_FIELD_MOVE] = LoadEvent_UsedFieldMove,
|
||||
[QL_EVENT_BOUGHT_ITEM] = LoadEvent_BoughtItem,
|
||||
[QL_EVENT_SOLD_ITEM] = LoadEvent_SoldItem,
|
||||
[QL_EVENT_39] = NULL,
|
||||
[QL_EVENT_ACTION_FF] = NULL,
|
||||
[QL_EVENT_OBTAINED_STORY_ITEM] = LoadEvent_ObtainedStoryItem,
|
||||
[QL_EVENT_41] = NULL,
|
||||
[QL_EVENT_ACTION_FE] = NULL,
|
||||
[QL_EVENT_ARRIVED] = LoadEvent_ArrivedInLocation
|
||||
};
|
||||
|
||||
static const u8 sQuestLogEventCmdSizes[] = {
|
||||
[QL_EVENT_0] = 8,
|
||||
[QL_EVENT_1] = 8,
|
||||
[QL_EVENT_2] = 8,
|
||||
[QL_EVENT_INPUT] = 8,
|
||||
[QL_EVENT_GFX_CHANGE] = 8,
|
||||
[QL_EVENT_MOVEMENT] = 8,
|
||||
[QL_EVENT_SWITCHED_PARTY_ORDER] = 8,
|
||||
[QL_EVENT_USED_ITEM] = 10,
|
||||
[QL_EVENT_GAVE_HELD_ITEM] = 8,
|
||||
@@ -255,9 +255,9 @@ static const u8 sQuestLogEventCmdSizes[] = {
|
||||
[QL_EVENT_USED_FIELD_MOVE] = 8,
|
||||
[QL_EVENT_BOUGHT_ITEM] = 14,
|
||||
[QL_EVENT_SOLD_ITEM] = 14,
|
||||
[QL_EVENT_39] = 2,
|
||||
[QL_EVENT_ACTION_FF] = 2,
|
||||
[QL_EVENT_OBTAINED_STORY_ITEM] = 8,
|
||||
[QL_EVENT_41] = 4,
|
||||
[QL_EVENT_ACTION_FE] = 4,
|
||||
[QL_EVENT_ARRIVED] = 6
|
||||
};
|
||||
|
||||
@@ -688,7 +688,7 @@ void ResetDeferredLinkEvent(void)
|
||||
|
||||
void QuestLog_StartRecordingInputsAfterDeferredEvent(void)
|
||||
{
|
||||
if (sDeferredEvent.id != QL_EVENT_0)
|
||||
if (sDeferredEvent.id != 0)
|
||||
{
|
||||
u16 *resp;
|
||||
sLastDepartedLocation = 0;
|
||||
@@ -718,7 +718,7 @@ static bool8 TryDeferTrainerBattleEvent(u16 eventId, const u16 * data)
|
||||
|
||||
void QuestLogEvents_HandleEndTrainerBattle(void)
|
||||
{
|
||||
if (sDeferredEvent.id != QL_EVENT_0)
|
||||
if (sDeferredEvent.id != 0)
|
||||
{
|
||||
u16 *resp;
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_0)
|
||||
@@ -737,7 +737,7 @@ void QuestLogEvents_HandleEndTrainerBattle(void)
|
||||
|
||||
void TryRecordEvent41_IncCursor(u16 a0)
|
||||
{
|
||||
gQuestLogRecordingPointer = TryRecordEvent41(gQuestLogRecordingPointer, a0);
|
||||
gQuestLogRecordingPointer = QL_RecordAction_FE(gQuestLogRecordingPointer, a0);
|
||||
gQuestLogCurActionIdx++;
|
||||
}
|
||||
|
||||
@@ -761,8 +761,8 @@ static bool8 IsEventWithSpecialEncounterSpecies(u16 eventId, const u16 * generic
|
||||
|
||||
u16 *QuestLog_SkipCommand(u16 *curPtr, u16 **prevPtr_p)
|
||||
{
|
||||
u16 eventId = curPtr[0] & 0xfff;
|
||||
u16 cnt = curPtr[0] >> 12;
|
||||
u16 eventId = curPtr[0] & QL_CMD_EVENT_MASK;
|
||||
u16 cnt = curPtr[0] >> QL_CMD_UNK_SHIFT;
|
||||
|
||||
if (eventId == QL_EVENT_DEFEATED_CHAMPION)
|
||||
cnt = 0;
|
||||
@@ -777,7 +777,7 @@ u16 *QuestLog_SkipCommand(u16 *curPtr, u16 **prevPtr_p)
|
||||
void sub_8113ABC(const u16 *a0)
|
||||
{
|
||||
const u8 *r2 = (const u8 *)(a0 + 2);
|
||||
if ((a0[0] & 0xFFF) != QL_EVENT_DEPARTED)
|
||||
if ((a0[0] & QL_CMD_EVENT_MASK) != QL_EVENT_DEPARTED)
|
||||
sLastDepartedLocation = 0;
|
||||
else
|
||||
sLastDepartedLocation = r2[1] + 1;
|
||||
@@ -792,9 +792,9 @@ bool8 sub_8113AE8(const u16 *a0)
|
||||
if (r0[1] > gQuestLogCurActionIdx)
|
||||
return FALSE;
|
||||
|
||||
sLoadEventFuncs[(r0[0] & 0xFFF)](a0);
|
||||
sLoadEventFuncs[(r0[0] & QL_CMD_EVENT_MASK)](a0);
|
||||
gUnknown_203B044.id = r0[0];
|
||||
gUnknown_203B044.unk_1 = (r0[0] & 0xF000) >> 12;
|
||||
gUnknown_203B044.unk_1 = (r0[0] & QL_CMD_UNK_MASK) >> QL_CMD_UNK_SHIFT;
|
||||
if (gUnknown_203B044.unk_1 != 0)
|
||||
gUnknown_203B044.unk_2 = 1;
|
||||
return TRUE;
|
||||
@@ -836,17 +836,17 @@ void sub_8113BD8(void)
|
||||
sPlayedTheSlots = FALSE;
|
||||
}
|
||||
|
||||
u16 *TryRecordEvent39_NoParams(u16 *a0)
|
||||
u16 *QL_RecordAction_FF(u16 *a0)
|
||||
{
|
||||
if (!WillCommandOfSizeFitInSav1Record(a0, sQuestLogEventCmdSizes[QL_EVENT_39]))
|
||||
if (!WillCommandOfSizeFitInSav1Record(a0, sQuestLogEventCmdSizes[QL_EVENT_ACTION_FF]))
|
||||
return NULL;
|
||||
a0[0] = QL_EVENT_39;
|
||||
a0[0] = QL_EVENT_ACTION_FF;
|
||||
return a0 + 1;
|
||||
}
|
||||
|
||||
u16 *sub_8113C20(u16 *a0, struct QuestLogAction * a1)
|
||||
u16 *QL_LoadAction_FF(u16 *a0, struct QuestLogAction * a1)
|
||||
{
|
||||
if (!WillCommandOfSizeFitInSav1Record(a0, sQuestLogEventCmdSizes[QL_EVENT_39]))
|
||||
if (!WillCommandOfSizeFitInSav1Record(a0, sQuestLogEventCmdSizes[QL_EVENT_ACTION_FF]))
|
||||
return NULL;
|
||||
a1->type = QL_ACTION_FF;
|
||||
a1->duration = 0;
|
||||
@@ -857,18 +857,18 @@ u16 *sub_8113C20(u16 *a0, struct QuestLogAction * a1)
|
||||
return a0 + 1;
|
||||
}
|
||||
|
||||
static u16 *TryRecordEvent41(u16 *a0, u16 a1)
|
||||
static u16 *QL_RecordAction_FE(u16 *a0, u16 a1)
|
||||
{
|
||||
if (!WillCommandOfSizeFitInSav1Record(a0, sQuestLogEventCmdSizes[QL_EVENT_41]))
|
||||
if (!WillCommandOfSizeFitInSav1Record(a0, sQuestLogEventCmdSizes[QL_EVENT_ACTION_FE]))
|
||||
return NULL;
|
||||
a0[0] = QL_EVENT_41;
|
||||
a0[0] = QL_EVENT_ACTION_FE;
|
||||
a0[1] = a1;
|
||||
return a0 + 2;
|
||||
}
|
||||
|
||||
u16 *sub_8113C8C(u16 *a0, struct QuestLogAction * a1)
|
||||
u16 *QL_LoadAction_FE(u16 *a0, struct QuestLogAction * a1)
|
||||
{
|
||||
if (!WillCommandOfSizeFitInSav1Record(a0, sQuestLogEventCmdSizes[QL_EVENT_41]))
|
||||
if (!WillCommandOfSizeFitInSav1Record(a0, sQuestLogEventCmdSizes[QL_EVENT_ACTION_FE]))
|
||||
return NULL;
|
||||
a1->type = QL_ACTION_FE;
|
||||
a1->duration = a0[1];
|
||||
@@ -879,14 +879,14 @@ u16 *sub_8113C8C(u16 *a0, struct QuestLogAction * a1)
|
||||
return a0 + 2;
|
||||
}
|
||||
|
||||
u16 *sub_8113CC8(u16 *a0, struct QuestLogAction * a1)
|
||||
u16 *QL_RecordAction_Input(u16 *script, struct QuestLogAction * a1)
|
||||
{
|
||||
u8 *r6 = (u8 *)a0 + 4;
|
||||
u8 *r6 = (u8 *)script + 4;
|
||||
|
||||
if (!WillCommandOfSizeFitInSav1Record(a0, sQuestLogEventCmdSizes[QL_EVENT_0]))
|
||||
if (!WillCommandOfSizeFitInSav1Record(script, sQuestLogEventCmdSizes[QL_EVENT_INPUT]))
|
||||
return NULL;
|
||||
a0[0] = 0;
|
||||
a0[1] = a1->duration;
|
||||
script[0] = QL_EVENT_INPUT;
|
||||
script[1] = a1->duration;
|
||||
r6[0] = a1->data.raw[0];
|
||||
r6[1] = a1->data.raw[1];
|
||||
r6[2] = a1->data.raw[2];
|
||||
@@ -894,11 +894,11 @@ u16 *sub_8113CC8(u16 *a0, struct QuestLogAction * a1)
|
||||
return (u16 *)(r6 + 4);
|
||||
}
|
||||
|
||||
u16 *sub_8113D08(u16 *a0, struct QuestLogAction * a1)
|
||||
u16 *QL_LoadAction_Input(u16 *a0, struct QuestLogAction * a1)
|
||||
{
|
||||
u8 *r6 = (u8 *)a0 + 4;
|
||||
|
||||
if (!WillCommandOfSizeFitInSav1Record(a0, sQuestLogEventCmdSizes[QL_EVENT_0]))
|
||||
if (!WillCommandOfSizeFitInSav1Record(a0, sQuestLogEventCmdSizes[QL_EVENT_INPUT]))
|
||||
return NULL;
|
||||
a1->type = QL_ACTION_INPUT;
|
||||
a1->duration = a0[1];
|
||||
@@ -909,17 +909,17 @@ u16 *sub_8113D08(u16 *a0, struct QuestLogAction * a1)
|
||||
return (u16 *)(r6 + 4);
|
||||
}
|
||||
|
||||
u16 *sub_8113D48(u16 *a0, struct QuestLogAction * a1)
|
||||
u16 *QL_RecordAction_MovementOrGfxChange(u16 *script, struct QuestLogAction * a1)
|
||||
{
|
||||
u16 *r4 = a0;
|
||||
u8 *r6 = (u8 *)a0 + 4;
|
||||
u16 *r4 = script;
|
||||
u8 *r6 = (u8 *)script + 4;
|
||||
|
||||
if (!WillCommandOfSizeFitInSav1Record(r4, sQuestLogEventCmdSizes[QL_EVENT_2]))
|
||||
if (!WillCommandOfSizeFitInSav1Record(r4, sQuestLogEventCmdSizes[QL_EVENT_MOVEMENT]))
|
||||
return NULL;
|
||||
if (a1->type == QL_ACTION_MOVEMENT)
|
||||
r4[0] = 2;
|
||||
r4[0] = QL_EVENT_MOVEMENT;
|
||||
else
|
||||
r4[0] = 1;
|
||||
r4[0] = QL_EVENT_GFX_CHANGE;
|
||||
r4[1] = a1->duration;
|
||||
r6[0] = a1->data.raw[0];
|
||||
r6[1] = a1->data.raw[1];
|
||||
@@ -928,14 +928,14 @@ u16 *sub_8113D48(u16 *a0, struct QuestLogAction * a1)
|
||||
return (u16 *)(r6 + 4);
|
||||
}
|
||||
|
||||
u16 *sub_8113D94(u16 *a0, struct QuestLogAction * a1)
|
||||
u16 *QL_LoadAction_MovementOrGfxChange(u16 *a0, struct QuestLogAction * a1)
|
||||
{
|
||||
u16 *r5 = a0;
|
||||
u8 *r6 = (u8 *)a0 + 4;
|
||||
|
||||
if (!WillCommandOfSizeFitInSav1Record(r5, sQuestLogEventCmdSizes[QL_EVENT_2]))
|
||||
if (!WillCommandOfSizeFitInSav1Record(r5, sQuestLogEventCmdSizes[QL_EVENT_MOVEMENT]))
|
||||
return NULL;
|
||||
if (r5[0] == 2)
|
||||
if (r5[0] == QL_EVENT_MOVEMENT)
|
||||
a1->type = QL_ACTION_MOVEMENT;
|
||||
else
|
||||
a1->type = QL_ACTION_GFX_CHANGE;
|
||||
@@ -983,7 +983,7 @@ static u16 *RecordEventHeader(u16 eventId, u16 *dest)
|
||||
else
|
||||
r1 = gUnknown_203B044.unk_1;
|
||||
|
||||
record[0] = eventId + (r1 << 12);
|
||||
record[0] = eventId + (r1 << QL_CMD_UNK_SHIFT);
|
||||
record[1] = gQuestLogCurActionIdx;
|
||||
record = (void *)record + (r1 * cmdSize + 4);
|
||||
return record;
|
||||
@@ -1470,15 +1470,15 @@ static u16 *RecordEvent_SwitchedMonsBetweenBoxes(u16 *dest, const struct QuestLo
|
||||
static const u16 *LoadEvent_SwitchedMonsBetweenBoxes(const u16 *eventData)
|
||||
{
|
||||
const u8 *boxIdxs;
|
||||
eventData = LoadEvent(QL_EVENT_SWITCHED_MONS_BETWEEN_BOXES, eventData);
|
||||
boxIdxs = (const u8 *)eventData + 4;
|
||||
const u16 * r0 = LoadEvent(QL_EVENT_SWITCHED_MONS_BETWEEN_BOXES, eventData);
|
||||
boxIdxs = (const u8 *)r0 + 4;
|
||||
DynamicPlaceholderTextUtil_Reset();
|
||||
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, GetBoxNamePtr(boxIdxs[0]));
|
||||
QuestLog_GetSpeciesName(eventData[0], NULL, 1);
|
||||
QuestLog_GetSpeciesName(r0[0], NULL, 1);
|
||||
DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, GetBoxNamePtr(boxIdxs[1]));
|
||||
QuestLog_GetSpeciesName(eventData[1], NULL, 3);
|
||||
QuestLog_GetSpeciesName(r0[1], NULL, 3);
|
||||
DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_QuestLog_SwitchedMonsBetweenBoxes);
|
||||
return eventData + 3;
|
||||
return r0 + 3;
|
||||
}
|
||||
|
||||
static u16 *RecordEvent_SwitchedMonsWithinBox(u16 *dest, const u16 *eventData)
|
||||
@@ -1858,7 +1858,7 @@ static u16 *RecordEvent_DefeatedChampion(u16 *dest, const struct QuestLogEvent_T
|
||||
{
|
||||
if (!sub_8110944(dest, sQuestLogEventCmdSizes[QL_EVENT_DEFEATED_CHAMPION]))
|
||||
return NULL;
|
||||
dest[0] = QL_EVENT_DEFEATED_CHAMPION | (2 << 12);
|
||||
dest[0] = QL_EVENT_DEFEATED_CHAMPION | (2 << QL_CMD_UNK_SHIFT);
|
||||
dest[1] = gQuestLogCurActionIdx;
|
||||
dest[2] = data->speciesOpponent;
|
||||
dest[3] = data->speciesPlayer;
|
||||
|
||||
Reference in New Issue
Block a user