mirror of
https://github.com/pret/pokefirered.git
synced 2024-11-26 23:00:28 +00:00
Start documenting quest log
This commit is contained in:
parent
6a613b67b9
commit
78b07aace5
@ -5,6 +5,12 @@
|
||||
#define QL_STATE_PLAYBACK 2
|
||||
#define QL_STATE_PLAYBACK_LAST 3
|
||||
|
||||
#define QL_PLAYBACK_STATE_0 0
|
||||
#define QL_PLAYBACK_STATE_1 1
|
||||
#define QL_PLAYBACK_STATE_2 2
|
||||
#define QL_PLAYBACK_STATE_3 3
|
||||
#define QL_PLAYBACK_STATE_4 4
|
||||
|
||||
#define QL_START_NORMAL 1
|
||||
#define QL_START_WARP 2
|
||||
|
||||
@ -128,17 +134,17 @@
|
||||
#define QL_DEPARTED_MISC_BUILDING_1 8
|
||||
#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_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 QL_INPUT_A 9
|
||||
#define QL_INPUT_B 10
|
||||
|
||||
|
||||
#define FANCLUB_MEMBER1 0
|
||||
|
@ -550,7 +550,7 @@ struct RecordMixingDayCareMail
|
||||
bool16 holdsItem[DAYCARE_MON_COUNT];
|
||||
};
|
||||
|
||||
struct QuestLogNPCData
|
||||
struct QuestLogObjectEventTemplate
|
||||
{
|
||||
u32 x:8;
|
||||
u32 negx:1;
|
||||
@ -579,12 +579,12 @@ struct QuestLogObjectEvent
|
||||
/*0x01*/ u8 spriteAffineAnimPausedBackup:1;
|
||||
/*0x01*/ u8 disableJumpLandingGroundEffect:1;
|
||||
/*0x02*/ u8 fixedPriority:1;
|
||||
/*0x02*/ u8 mapobj_unk_18:4;
|
||||
/*0x02*/ u8 unused_02_5:3;
|
||||
/*0x03*/ u8 mapobj_unk_0B_0:4;
|
||||
/*0x03*/ u8 elevation:4;
|
||||
/*0x02*/ u8 facingDirection:4;
|
||||
/*0x02*/ u8 unused:3;
|
||||
/*0x03*/ u8 currentElevation:4;
|
||||
/*0x03*/ u8 previousElevation:4;
|
||||
/*0x04*/ u8 graphicsId;
|
||||
/*0x05*/ u8 animPattern;
|
||||
/*0x05*/ u8 movementType;
|
||||
/*0x06*/ u8 trainerType;
|
||||
/*0x07*/ u8 localId;
|
||||
/*0x08*/ u8 mapNum;
|
||||
@ -597,21 +597,20 @@ struct QuestLogObjectEvent
|
||||
/*0x11*/ u8 animId;
|
||||
};
|
||||
|
||||
struct QuestLog
|
||||
// This represents all the data needed to display a single scene for the "Quest Log" when the player resumes playing.
|
||||
//
|
||||
struct QuestLogScene
|
||||
{
|
||||
/*0x0000*/ u8 startType;
|
||||
/*0x0000*/ u8 startType; // QL_START_NORMAL / QL_START_WARP
|
||||
/*0x0001*/ u8 mapGroup;
|
||||
/*0x0002*/ u8 mapNum;
|
||||
/*0x0003*/ u8 warpId;
|
||||
/*0x0004*/ s16 x;
|
||||
/*0x0006*/ s16 y;
|
||||
/*0x0008*/ struct QuestLogObjectEvent unk_008[OBJECT_EVENTS_COUNT];
|
||||
|
||||
// These arrays hold the game state for
|
||||
// playing back the quest log
|
||||
/*0x0008*/ struct QuestLogObjectEvent objectEvents[OBJECT_EVENTS_COUNT];
|
||||
/*0x0148*/ u8 flags[NUM_FLAG_BYTES];
|
||||
/*0x02c8*/ u16 vars[VARS_COUNT];
|
||||
/*0x0468*/ struct QuestLogNPCData npcData[64];
|
||||
/*0x0468*/ struct QuestLogObjectEventTemplate objectEventTemplates[OBJECT_EVENT_TEMPLATES_COUNT];
|
||||
/*0x0568*/ u16 script[128];
|
||||
/*0x0668*/ u16 end[0];
|
||||
};
|
||||
@ -780,7 +779,7 @@ struct SaveBlock1
|
||||
/*0x0EE0*/ u8 flags[NUM_FLAG_BYTES];
|
||||
/*0x1000*/ u16 vars[VARS_COUNT];
|
||||
/*0x1200*/ u32 gameStats[NUM_GAME_STATS];
|
||||
/*0x1300*/ struct QuestLog questLog[QUEST_LOG_SCENE_COUNT];
|
||||
/*0x1300*/ struct QuestLogScene questLog[QUEST_LOG_SCENE_COUNT];
|
||||
/*0x2CA0*/ u16 easyChatProfile[EASY_CHAT_BATTLE_WORDS_COUNT];
|
||||
/*0x2CAC*/ u16 easyChatBattleStart[EASY_CHAT_BATTLE_WORDS_COUNT];
|
||||
/*0x2CB8*/ u16 easyChatBattleWon[EASY_CHAT_BATTLE_WORDS_COUNT];
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
void SetQuestLogObjectEventsData(struct QuestLog *);
|
||||
void SetSav1ObjectEventsFromQuestLog(struct QuestLog *, struct ObjectEventTemplate *);
|
||||
void QL_RecordObjects(struct QuestLogScene *);
|
||||
void QL_LoadObjects(struct QuestLogScene *, struct ObjectEventTemplate *);
|
||||
void sub_815A540(void);
|
||||
|
||||
#endif //GUARD_QUEST_LOG_OBJECTS_H
|
||||
|
@ -3,15 +3,19 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define QL_PLAYER_GFX_NORMAL 0
|
||||
#define QL_PLAYER_GFX_BIKE 1
|
||||
#define QL_PLAYER_GFX_FISH 2
|
||||
#define QL_PLAYER_GFX_SURF 3
|
||||
#define QL_PLAYER_GFX_STOP_SURF_S 4
|
||||
#define QL_PLAYER_GFX_STOP_SURF_N 5
|
||||
#define QL_PLAYER_GFX_STOP_SURF_W 6
|
||||
#define QL_PLAYER_GFX_STOP_SURF_E 7
|
||||
#define QL_PLAYER_GFX_VSSEEKER 8
|
||||
enum {
|
||||
QL_PLAYER_GFX_NORMAL,
|
||||
QL_PLAYER_GFX_BIKE,
|
||||
QL_PLAYER_GFX_FISH,
|
||||
QL_PLAYER_GFX_SURF,
|
||||
QL_PLAYER_GFX_STOP_SURF_S,
|
||||
QL_PLAYER_GFX_STOP_SURF_N,
|
||||
QL_PLAYER_GFX_STOP_SURF_W,
|
||||
QL_PLAYER_GFX_STOP_SURF_E,
|
||||
QL_PLAYER_GFX_VSSEEKER,
|
||||
QL_PLAYER_GFX_NONE = 0xFF
|
||||
};
|
||||
|
||||
|
||||
void QuestLogUpdatePlayerSprite(u8 state);
|
||||
bool32 QuestLogTryRecordPlayerAvatarGfxTransition(u8 state);
|
||||
|
@ -192,15 +192,15 @@ u16 *GetVarPointer(u16 idx)
|
||||
{
|
||||
switch (gQuestLogPlaybackState)
|
||||
{
|
||||
case 0:
|
||||
case QL_PLAYBACK_STATE_0:
|
||||
default:
|
||||
break;
|
||||
case 1:
|
||||
case QL_PLAYBACK_STATE_1:
|
||||
ptr = QuestLogGetFlagOrVarPtr(FALSE, idx);
|
||||
if (ptr != NULL)
|
||||
gSaveBlock1Ptr->vars[idx - VARS_START] = *ptr;
|
||||
break;
|
||||
case 2:
|
||||
case QL_PLAYBACK_STATE_2:
|
||||
if (IsFlagOrVarStoredInQuestLog(idx - VARS_START, TRUE) == TRUE)
|
||||
{
|
||||
gLastQuestLogStoredFlagOrVarIdx = idx - VARS_START;
|
||||
@ -263,15 +263,15 @@ u8 *GetFlagAddr(u16 idx)
|
||||
{
|
||||
switch (gQuestLogPlaybackState)
|
||||
{
|
||||
case 0:
|
||||
case QL_PLAYBACK_STATE_0:
|
||||
default:
|
||||
break;
|
||||
case 1:
|
||||
case QL_PLAYBACK_STATE_1:
|
||||
ptr = QuestLogGetFlagOrVarPtr(TRUE, idx);
|
||||
if (ptr != NULL)
|
||||
gSaveBlock1Ptr->flags[idx >> 3] = *ptr;
|
||||
gSaveBlock1Ptr->flags[idx / 8] = *ptr;
|
||||
break;
|
||||
case 2:
|
||||
case QL_PLAYBACK_STATE_2:
|
||||
if (IsFlagOrVarStoredInQuestLog(idx, FALSE) == TRUE)
|
||||
{
|
||||
gLastQuestLogStoredFlagOrVarIdx = idx;
|
||||
|
@ -5267,10 +5267,8 @@ static void ObjectEventSetSingleMovement(struct ObjectEvent *objectEvent, struct
|
||||
objectEvent->movementActionId = animId;
|
||||
sprite->data[2] = 0;
|
||||
|
||||
if (gQuestLogPlaybackState == 2)
|
||||
{
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_2)
|
||||
QuestLogRecordNPCStep(objectEvent->localId, objectEvent->mapNum, objectEvent->mapGroup, animId);
|
||||
}
|
||||
}
|
||||
|
||||
static void FaceDirection(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction)
|
||||
|
@ -1602,7 +1602,7 @@ void CreateStopSurfingTask_NoMusicChange(u8 direction)
|
||||
|
||||
void SeafoamIslandsB4F_CurrentDumpsPlayerOnLand(void)
|
||||
{
|
||||
if (gQuestLogPlaybackState != 1 && gQuestLogPlaybackState != 3)
|
||||
if (gQuestLogPlaybackState != QL_PLAYBACK_STATE_1 && gQuestLogPlaybackState != QL_PLAYBACK_STATE_3)
|
||||
{
|
||||
QuestLogRecordPlayerAvatarGfxTransitionWithDuration(sQuestLogSurfDismountActionIds[DIR_NORTH], 16);
|
||||
CreateStopSurfingTask(DIR_NORTH);
|
||||
|
@ -210,7 +210,7 @@ static void InitMainCallbacks(void)
|
||||
gSaveBlock2Ptr = &gSaveBlock2;
|
||||
gSaveBlock1Ptr = &gSaveBlock1;
|
||||
gSaveBlock2.encryptionKey = 0;
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
}
|
||||
|
||||
static void CallCallbacks(void)
|
||||
|
@ -1399,7 +1399,7 @@ static void DoCB1_Overworld(u16 newKeys, u16 heldKeys)
|
||||
{
|
||||
if (ProcessPlayerFieldInput(&fieldInput) == TRUE)
|
||||
{
|
||||
if (gQuestLogPlaybackState == 2)
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_2)
|
||||
sub_81127F8(&gInputToStoreInQuestLogMaybe);
|
||||
LockPlayerFieldControls();
|
||||
DismissMapNamePopup();
|
||||
|
186
src/quest_log.c
186
src/quest_log.c
@ -81,7 +81,7 @@ static EWRAM_DATA u16 *sPalettesBackup = NULL;
|
||||
static EWRAM_DATA struct UnkStruct_203AE94 sQuestLogCurrentScene = {0};
|
||||
static EWRAM_DATA struct QuestLogEntry sQuestLogSceneRecordBuffer[32] = {0};
|
||||
EWRAM_DATA u16 sQuestLogCursor = 0;
|
||||
static EWRAM_DATA u8 sMovementScripts[64][2] = {{0}};
|
||||
static EWRAM_DATA u8 sMovementScripts[OBJECT_EVENT_TEMPLATES_COUNT][2] = {{0}};
|
||||
static EWRAM_DATA u16 sNextStepDelay = 0;
|
||||
static EWRAM_DATA u16 sLastQuestLogCursor = 0;
|
||||
static EWRAM_DATA u16 sFlagOrVarPlayhead = 0;
|
||||
@ -186,7 +186,7 @@ void ResetQuestLog(void)
|
||||
|
||||
static void DestroySav1QuestLogEntry(u8 a0)
|
||||
{
|
||||
memset(gSaveBlock1Ptr->questLog + a0, 0, sizeof(struct QuestLog));
|
||||
memset(gSaveBlock1Ptr->questLog + a0, 0, sizeof(struct QuestLogScene));
|
||||
gUnknown_203AE04 = NULL;
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ static void QLogCB_Recording(void)
|
||||
{
|
||||
if (TryRecordQuestLogEntrySequence(sQuestLogSceneRecordBuffer) != 1)
|
||||
{
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
TryRecordEvent39_GoToNextScene();
|
||||
gQuestLogState = 0;
|
||||
sQuestLogCB = NULL;
|
||||
@ -248,7 +248,7 @@ static void QLogCB_Playback(void)
|
||||
|
||||
if (sQuestLogCurrentScene.sceneEndMode == 0)
|
||||
{
|
||||
if (gQuestLogPlaybackState != 0
|
||||
if (gQuestLogPlaybackState != QL_PLAYBACK_STATE_0
|
||||
|| sQuestLogCurrentScene.playbackSubstate == 1
|
||||
|| (sQuestLogCurrentScene.cursor < NELEMS(gUnknown_203AE0C)
|
||||
&& gUnknown_203AE0C[sQuestLogCurrentScene.cursor] != NULL))
|
||||
@ -298,7 +298,7 @@ void StartRecordingQuestLogEntry(u16 eventId)
|
||||
|
||||
static void SetPlayerInitialCoordsAtScene(u8 sceneNum)
|
||||
{
|
||||
struct QuestLog * questLog = &gSaveBlock1Ptr->questLog[sceneNum];
|
||||
struct QuestLogScene * questLog = &gSaveBlock1Ptr->questLog[sceneNum];
|
||||
questLog->mapGroup = gSaveBlock1Ptr->location.mapGroup;
|
||||
questLog->mapNum = gSaveBlock1Ptr->location.mapNum;
|
||||
questLog->warpId = gSaveBlock1Ptr->location.warpId;
|
||||
@ -308,41 +308,41 @@ static void SetPlayerInitialCoordsAtScene(u8 sceneNum)
|
||||
|
||||
static void SetNPCInitialCoordsAtScene(u8 sceneNum)
|
||||
{
|
||||
struct QuestLog * questLog = &gSaveBlock1Ptr->questLog[sceneNum];
|
||||
struct QuestLogScene * questLog = &gSaveBlock1Ptr->questLog[sceneNum];
|
||||
u16 i;
|
||||
|
||||
SetQuestLogObjectEventsData(questLog);
|
||||
QL_RecordObjects(questLog);
|
||||
|
||||
for (i = 0; i < NELEMS(gSaveBlock1Ptr->objectEventTemplates); i++)
|
||||
for (i = 0; i < OBJECT_EVENT_TEMPLATES_COUNT; i++)
|
||||
{
|
||||
if (gSaveBlock1Ptr->objectEventTemplates[i].x < 0)
|
||||
{
|
||||
questLog->npcData[i].x = -1 * gSaveBlock1Ptr->objectEventTemplates[i].x;
|
||||
questLog->npcData[i].negx = TRUE;
|
||||
questLog->objectEventTemplates[i].x = -1 * gSaveBlock1Ptr->objectEventTemplates[i].x;
|
||||
questLog->objectEventTemplates[i].negx = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
questLog->npcData[i].x = (u8)gSaveBlock1Ptr->objectEventTemplates[i].x;
|
||||
questLog->npcData[i].negx = FALSE;
|
||||
questLog->objectEventTemplates[i].x = (u8)gSaveBlock1Ptr->objectEventTemplates[i].x;
|
||||
questLog->objectEventTemplates[i].negx = FALSE;
|
||||
}
|
||||
if (gSaveBlock1Ptr->objectEventTemplates[i].y < 0)
|
||||
{
|
||||
questLog->npcData[i].y = (-gSaveBlock1Ptr->objectEventTemplates[i].y << 24) >> 24;
|
||||
questLog->npcData[i].negy = TRUE;
|
||||
questLog->objectEventTemplates[i].y = (-gSaveBlock1Ptr->objectEventTemplates[i].y << 24) >> 24;
|
||||
questLog->objectEventTemplates[i].negy = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
questLog->npcData[i].y = (u8)gSaveBlock1Ptr->objectEventTemplates[i].y;
|
||||
questLog->npcData[i].negy = FALSE;
|
||||
questLog->objectEventTemplates[i].y = (u8)gSaveBlock1Ptr->objectEventTemplates[i].y;
|
||||
questLog->objectEventTemplates[i].negy = FALSE;
|
||||
}
|
||||
questLog->npcData[i].elevation = gSaveBlock1Ptr->objectEventTemplates[i].objUnion.normal.elevation;
|
||||
questLog->npcData[i].movementType = gSaveBlock1Ptr->objectEventTemplates[i].objUnion.normal.movementType;
|
||||
questLog->objectEventTemplates[i].elevation = gSaveBlock1Ptr->objectEventTemplates[i].objUnion.normal.elevation;
|
||||
questLog->objectEventTemplates[i].movementType = gSaveBlock1Ptr->objectEventTemplates[i].objUnion.normal.movementType;
|
||||
}
|
||||
}
|
||||
|
||||
static void SetGameStateAtScene(u8 sceneNum)
|
||||
{
|
||||
struct QuestLog * questLog = &gSaveBlock1Ptr->questLog[sceneNum];
|
||||
struct QuestLogScene * questLog = &gSaveBlock1Ptr->questLog[sceneNum];
|
||||
|
||||
CpuCopy16(gSaveBlock1Ptr->flags, questLog->flags, NUM_FLAG_BYTES * sizeof(u8));
|
||||
CpuCopy16(gSaveBlock1Ptr->vars, questLog->vars, VARS_COUNT * sizeof(u16));
|
||||
@ -399,12 +399,12 @@ static bool8 TryRecordQuestLogEntrySequence(struct QuestLogEntry * entry)
|
||||
}
|
||||
if (sEventRecordingPointer == NULL)
|
||||
{
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (gQuestLogPlaybackState == 0)
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_0)
|
||||
{
|
||||
sEventRecordingPointer = TryRecordEvent39_NoParams(sEventRecordingPointer);
|
||||
return FALSE;
|
||||
@ -512,24 +512,24 @@ void CommitQuestLogWindow1(void)
|
||||
|
||||
static void QuestLogPlaybackSetObjectEventTemplates(u8 sceneNum)
|
||||
{
|
||||
struct QuestLog *questLog = &gSaveBlock1Ptr->questLog[sceneNum];
|
||||
struct QuestLogScene *questLog = &gSaveBlock1Ptr->questLog[sceneNum];
|
||||
u16 i;
|
||||
|
||||
for (i = 0; i < 64; i++)
|
||||
for (i = 0; i < OBJECT_EVENT_TEMPLATES_COUNT; i++)
|
||||
{
|
||||
if (questLog->npcData[i].negx)
|
||||
gSaveBlock1Ptr->objectEventTemplates[i].x = -questLog->npcData[i].x;
|
||||
if (questLog->objectEventTemplates[i].negx)
|
||||
gSaveBlock1Ptr->objectEventTemplates[i].x = -questLog->objectEventTemplates[i].x;
|
||||
else
|
||||
gSaveBlock1Ptr->objectEventTemplates[i].x = questLog->npcData[i].x;
|
||||
if (questLog->npcData[i].negy)
|
||||
gSaveBlock1Ptr->objectEventTemplates[i].y = -(u8)questLog->npcData[i].y;
|
||||
gSaveBlock1Ptr->objectEventTemplates[i].x = questLog->objectEventTemplates[i].x;
|
||||
if (questLog->objectEventTemplates[i].negy)
|
||||
gSaveBlock1Ptr->objectEventTemplates[i].y = -(u8)questLog->objectEventTemplates[i].y;
|
||||
else
|
||||
gSaveBlock1Ptr->objectEventTemplates[i].y = questLog->npcData[i].y;
|
||||
gSaveBlock1Ptr->objectEventTemplates[i].objUnion.normal.elevation = questLog->npcData[i].elevation;
|
||||
gSaveBlock1Ptr->objectEventTemplates[i].objUnion.normal.movementType = questLog->npcData[i].movementType;
|
||||
gSaveBlock1Ptr->objectEventTemplates[i].y = questLog->objectEventTemplates[i].y;
|
||||
gSaveBlock1Ptr->objectEventTemplates[i].objUnion.normal.elevation = questLog->objectEventTemplates[i].elevation;
|
||||
gSaveBlock1Ptr->objectEventTemplates[i].objUnion.normal.movementType = questLog->objectEventTemplates[i].movementType;
|
||||
}
|
||||
|
||||
SetSav1ObjectEventsFromQuestLog(questLog, gSaveBlock1Ptr->objectEventTemplates);
|
||||
QL_LoadObjects(questLog, gSaveBlock1Ptr->objectEventTemplates);
|
||||
}
|
||||
|
||||
static void QLPlayback_SetInitialPlayerPosition(u8 sceneNum, bool8 isWarp)
|
||||
@ -578,7 +578,7 @@ static void QLPlayback_InitOverworldState(void)
|
||||
|
||||
void sub_81113E4(void)
|
||||
{
|
||||
struct QuestLog * questLog = &gSaveBlock1Ptr->questLog[sCurrentSceneNum];
|
||||
struct QuestLogScene * questLog = &gSaveBlock1Ptr->questLog[sCurrentSceneNum];
|
||||
|
||||
CpuCopy16(questLog->flags, gSaveBlock1Ptr->flags, NUM_FLAG_BYTES * sizeof(u8));
|
||||
CpuCopy16(questLog->vars, gSaveBlock1Ptr->vars, VARS_COUNT * sizeof(u16));
|
||||
@ -737,7 +737,7 @@ void sub_8111708(void)
|
||||
static void ReadQuestLogScriptFromSav1(u8 sceneNum, struct QuestLogEntry * a1)
|
||||
{
|
||||
u16 i;
|
||||
u16 *r4;
|
||||
u16 *script;
|
||||
u16 r6 = 0;
|
||||
u16 r9 = 0;
|
||||
|
||||
@ -747,36 +747,36 @@ static void ReadQuestLogScriptFromSav1(u8 sceneNum, struct QuestLogEntry * a1)
|
||||
gUnknown_203AE0C[i] = NULL;
|
||||
}
|
||||
|
||||
r4 = gSaveBlock1Ptr->questLog[sceneNum].script;
|
||||
script = gSaveBlock1Ptr->questLog[sceneNum].script;
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
switch (r4[0] & 0xFFF)
|
||||
switch (script[0] & 0xFFF)
|
||||
{
|
||||
case QL_EVENT_0:
|
||||
r4 = sub_8113D08(r4, &a1[r6]);
|
||||
script = sub_8113D08(script, &a1[r6]);
|
||||
r6++;
|
||||
break;
|
||||
case QL_EVENT_1:
|
||||
case QL_EVENT_2:
|
||||
r4 = sub_8113D94(r4, &a1[r6]);
|
||||
script = sub_8113D94(script, &a1[r6]);
|
||||
r6++;
|
||||
break;
|
||||
case QL_EVENT_39:
|
||||
r4 = sub_8113C20(r4, &a1[r6]);
|
||||
script = sub_8113C20(script, &a1[r6]);
|
||||
r6++;
|
||||
break;
|
||||
case QL_EVENT_41:
|
||||
r4 = sub_8113C8C(r4, &a1[r6]);
|
||||
script = sub_8113C8C(script, &a1[r6]);
|
||||
r6++;
|
||||
break;
|
||||
default:
|
||||
r4 = QuestLog_SkipCommand(r4, &gUnknown_203AE0C[r9]);
|
||||
script = QuestLog_SkipCommand(script, &gUnknown_203AE0C[r9]);
|
||||
if (r9 == 0)
|
||||
sub_8113ABC(gUnknown_203AE0C[0]);
|
||||
r9++;
|
||||
break;
|
||||
}
|
||||
if (r4 == NULL)
|
||||
if (script == NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -799,7 +799,7 @@ static void QuestLog_AdvancePlayhead(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
QuestLog_StartFinalScene();
|
||||
}
|
||||
}
|
||||
@ -832,7 +832,7 @@ bool8 QuestLog_SchedulePlaybackCB(void (*callback)(void))
|
||||
QuestLog_CutRecording();
|
||||
break;
|
||||
case QL_STATE_PLAYBACK:
|
||||
gQuestLogPlaybackState = 3;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_3;
|
||||
taskId = CreateTask(Task_RunPlaybackCB, 80);
|
||||
gTasks[taskId].data[0] = 0;
|
||||
gTasks[taskId].data[1] = 0;
|
||||
@ -860,7 +860,7 @@ static void Task_RunPlaybackCB(u8 taskId)
|
||||
case 1:
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
routine = (void (*)(void)) GetWordTaskArg(taskId, 14);
|
||||
if (routine != NULL)
|
||||
routine();
|
||||
@ -941,7 +941,7 @@ bool8 sub_8111C2C(void)
|
||||
{
|
||||
if (gQuestLogState != QL_STATE_PLAYBACK)
|
||||
return FALSE;
|
||||
if (gQuestLogPlaybackState == 0 || sQuestLogCurrentScene.playbackSubstate == 1 || sQuestLogCurrentScene.playbackSubstate == 2)
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_0 || sQuestLogCurrentScene.playbackSubstate == 1 || sQuestLogCurrentScene.playbackSubstate == 2)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
@ -953,13 +953,13 @@ void sub_8111C68(void)
|
||||
if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
sQuestLogCurrentScene.sceneEndMode = 2;
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
QuestLog_BeginFadeAtEndOfScene(-3);
|
||||
}
|
||||
else if (JOY_NEW(B_BUTTON))
|
||||
{
|
||||
sQuestLogCurrentScene.sceneEndMode = 1;
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
QuestLog_SkipToEndOfPlayback(-3);
|
||||
}
|
||||
}
|
||||
@ -1058,7 +1058,7 @@ static void QuestLog_WaitFadeAndCancelPlayback(void)
|
||||
break;
|
||||
ReadQuestLogScriptFromSav1(sCurrentSceneNum, sQuestLogSceneRecordBuffer);
|
||||
}
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
QuestLog_StartFinalScene();
|
||||
}
|
||||
}
|
||||
@ -1232,18 +1232,18 @@ void FinishRecordingQuestLogScene(void)
|
||||
sQuestLogCB = NULL;
|
||||
gUnknown_203AE04 = NULL;
|
||||
sEventRecordingPointer = NULL;
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
}
|
||||
}
|
||||
|
||||
void QuestLog_CutRecording(void)
|
||||
{
|
||||
if (gQuestLogPlaybackState != 0 && gQuestLogState == QL_STATE_RECORDING)
|
||||
if (gQuestLogPlaybackState != QL_PLAYBACK_STATE_0 && gQuestLogState == QL_STATE_RECORDING)
|
||||
{
|
||||
TryRecordQuestLogEntrySequence(sQuestLogSceneRecordBuffer);
|
||||
TryRecordEvent41_IncCursor(1);
|
||||
TryRecordEvent39_GoToNextScene();
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
gQuestLogState = 0;
|
||||
sQuestLogCB = NULL;
|
||||
}
|
||||
@ -1253,7 +1253,7 @@ void QuestLog_CutRecording(void)
|
||||
|
||||
static void SortQuestLogInSav1(void)
|
||||
{
|
||||
struct QuestLog * buffer = AllocZeroed(QUEST_LOG_SCENE_COUNT * sizeof(struct QuestLog));
|
||||
struct QuestLogScene * buffer = AllocZeroed(QUEST_LOG_SCENE_COUNT * sizeof(struct QuestLogScene));
|
||||
u8 i;
|
||||
u8 sceneNum = sCurrentSceneNum;
|
||||
u8 count = 0;
|
||||
@ -1269,7 +1269,7 @@ static void SortQuestLogInSav1(void)
|
||||
sceneNum++;
|
||||
}
|
||||
sCurrentSceneNum = count % QUEST_LOG_SCENE_COUNT;
|
||||
CpuCopy16(buffer, gSaveBlock1Ptr->questLog, QUEST_LOG_SCENE_COUNT * sizeof(struct QuestLog));
|
||||
CpuCopy16(buffer, gSaveBlock1Ptr->questLog, QUEST_LOG_SCENE_COUNT * sizeof(struct QuestLogScene));
|
||||
Free(buffer);
|
||||
}
|
||||
|
||||
@ -1287,24 +1287,24 @@ void sub_811246C(struct Sprite *sprite)
|
||||
struct ObjectEvent *objectEvent = &gObjectEvents[sprite->data[0]];
|
||||
if (objectEvent->localId == OBJ_EVENT_ID_PLAYER)
|
||||
{
|
||||
if (sMovementScripts[0][0] != 0xFF)
|
||||
if (sMovementScripts[0][0] != MOVEMENT_ACTION_NONE)
|
||||
{
|
||||
ObjectEventSetHeldMovement(objectEvent, sMovementScripts[0][0]);
|
||||
sMovementScripts[0][0] = 0xFF;
|
||||
sMovementScripts[0][0] = MOVEMENT_ACTION_NONE;
|
||||
}
|
||||
if (sMovementScripts[0][1] != 0xFF)
|
||||
if (sMovementScripts[0][1] != QL_PLAYER_GFX_NONE)
|
||||
{
|
||||
QuestLogUpdatePlayerSprite(sMovementScripts[0][1]);
|
||||
sMovementScripts[0][1] = 0xFF;
|
||||
sMovementScripts[0][1] = QL_PLAYER_GFX_NONE;
|
||||
}
|
||||
UpdateQuestLogObjectEventCurrentMovement(objectEvent, sprite);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sMovementScripts[objectEvent->localId][0] != 0xFF)
|
||||
if (sMovementScripts[objectEvent->localId][0] != MOVEMENT_ACTION_NONE)
|
||||
{
|
||||
ObjectEventSetHeldMovement(objectEvent, sMovementScripts[objectEvent->localId][0]);
|
||||
sMovementScripts[objectEvent->localId][0] = 0xFF;
|
||||
sMovementScripts[objectEvent->localId][0] = MOVEMENT_ACTION_NONE;
|
||||
}
|
||||
UpdateQuestLogObjectEventCurrentMovement(objectEvent, sprite);
|
||||
}
|
||||
@ -1429,12 +1429,12 @@ static void TogglePlaybackStateForOverworldLock(u8 a0)
|
||||
switch (a0)
|
||||
{
|
||||
case 1:
|
||||
if (gQuestLogPlaybackState == 1)
|
||||
gQuestLogPlaybackState = 3; // Message visible, overworld locked
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_1)
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_3; // Message visible, overworld locked
|
||||
break;
|
||||
case 2:
|
||||
if (gQuestLogPlaybackState == 3)
|
||||
gQuestLogPlaybackState = 1; // Overworld unlocked
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_3)
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_1; // Overworld unlocked
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1447,21 +1447,21 @@ void QuestLog_OnEscalatorWarp(u8 direction)
|
||||
{
|
||||
case QL_ESCALATOR_OUT: // warp out
|
||||
if (r1 == 1)
|
||||
gQuestLogPlaybackState = 3;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_3;
|
||||
else if (r1 == 2)
|
||||
{
|
||||
sCurQuestLogEntry[sQuestLogCursor].duration = sNextStepDelay;
|
||||
sCurQuestLogEntry[sQuestLogCursor].command = 3;
|
||||
sQuestLogCursor++;
|
||||
sNextStepDelay = 0;
|
||||
gQuestLogPlaybackState = 4;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_4;
|
||||
}
|
||||
break;
|
||||
case QL_ESCALATOR_IN: // warp in
|
||||
if (r1 == 1)
|
||||
gQuestLogPlaybackState = 1;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_1;
|
||||
else if (r1 == 2)
|
||||
gQuestLogPlaybackState = 2;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1473,23 +1473,23 @@ static void SetUpQuestLogEntry(u8 kind, struct QuestLogEntry *entry, u16 size)
|
||||
switch (kind)
|
||||
{
|
||||
default:
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
break;
|
||||
case 1:
|
||||
sCurQuestLogEntry = entry;
|
||||
sNumEventsInLogEntry = size / sizeof(*sCurQuestLogEntry);
|
||||
for (i = 0; i < (s32)NELEMS(sMovementScripts); i++)
|
||||
for (i = 0; i < (s32)ARRAY_COUNT(sMovementScripts); i++)
|
||||
{
|
||||
sMovementScripts[i][0] |= 0xFF;
|
||||
sMovementScripts[i][1] |= 0xFF;
|
||||
sMovementScripts[i][0] |= MOVEMENT_ACTION_NONE;
|
||||
sMovementScripts[i][1] |= QL_PLAYER_GFX_NONE;
|
||||
}
|
||||
sQuestLogCursor = 0;
|
||||
sLastQuestLogCursor = 0;
|
||||
gQuestLogFieldInput = (struct FieldInput){};
|
||||
sNextStepDelay = sCurQuestLogEntry[sQuestLogCursor].duration;
|
||||
sMovementScripts[0][0] = sCurQuestLogEntry[sQuestLogCursor].animId;
|
||||
sMovementScripts[0][1] = 0xFF;
|
||||
gQuestLogPlaybackState = 1;
|
||||
sMovementScripts[0][1] = QL_PLAYER_GFX_NONE;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_1;
|
||||
break;
|
||||
case 2:
|
||||
sCurQuestLogEntry = entry;
|
||||
@ -1528,7 +1528,7 @@ static void SetUpQuestLogEntry(u8 kind, struct QuestLogEntry *entry, u16 size)
|
||||
sCurQuestLogEntry[sQuestLogCursor].mapGroup = 0;
|
||||
sCurQuestLogEntry[sQuestLogCursor].animId = 0;
|
||||
sQuestLogCursor++;
|
||||
gQuestLogPlaybackState = 2;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1537,9 +1537,9 @@ void sub_8112B3C(void)
|
||||
{
|
||||
switch (gQuestLogPlaybackState)
|
||||
{
|
||||
case 0:
|
||||
case QL_PLAYBACK_STATE_0:
|
||||
break;
|
||||
case 1:
|
||||
case QL_PLAYBACK_STATE_1:
|
||||
if (!RecordHeadAtEndOfEntryOrScriptContext2Enabled())
|
||||
{
|
||||
if (sNextStepDelay != 0)
|
||||
@ -1564,42 +1564,42 @@ void sub_8112B3C(void)
|
||||
break;
|
||||
case 3:
|
||||
// End
|
||||
gQuestLogPlaybackState = 3;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_3;
|
||||
break;
|
||||
case 0xFE:
|
||||
break;
|
||||
case 0xFF:
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
break;
|
||||
}
|
||||
if (gQuestLogPlaybackState == 0)
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_0)
|
||||
break;
|
||||
if (++sQuestLogCursor >= sNumEventsInLogEntry)
|
||||
{
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
break;
|
||||
}
|
||||
sNextStepDelay = sCurQuestLogEntry[sQuestLogCursor].duration;
|
||||
} while (gQuestLogPlaybackState != 3
|
||||
} while (gQuestLogPlaybackState != QL_PLAYBACK_STATE_3
|
||||
&& (sNextStepDelay == 0 || sNextStepDelay == 0xFFFF));
|
||||
}
|
||||
}
|
||||
else if (sQuestLogCursor >= sNumEventsInLogEntry)
|
||||
{
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case QL_PLAYBACK_STATE_2:
|
||||
if (ArePlayerFieldControlsLocked() != TRUE)
|
||||
{
|
||||
sNextStepDelay++;
|
||||
if (sQuestLogCursor >= sNumEventsInLogEntry)
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
case QL_PLAYBACK_STATE_3:
|
||||
break;
|
||||
case 4:
|
||||
case QL_PLAYBACK_STATE_4:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1613,14 +1613,14 @@ u8 sub_8112CAC(void)
|
||||
{
|
||||
switch (gQuestLogPlaybackState)
|
||||
{
|
||||
case 0:
|
||||
case QL_PLAYBACK_STATE_0:
|
||||
default:
|
||||
return 0;
|
||||
case 1:
|
||||
case 3:
|
||||
case QL_PLAYBACK_STATE_1:
|
||||
case QL_PLAYBACK_STATE_3:
|
||||
return 1;
|
||||
case 2:
|
||||
case 4:
|
||||
case QL_PLAYBACK_STATE_2:
|
||||
case QL_PLAYBACK_STATE_4:
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
@ -1683,7 +1683,7 @@ void sub_8112E3C(u8 state, struct FlagOrVarRecord * records, u16 size)
|
||||
s32 i;
|
||||
|
||||
if (state == 0 || state > QL_STATE_PLAYBACK)
|
||||
gQuestLogPlaybackState = 0;
|
||||
gQuestLogPlaybackState = QL_PLAYBACK_STATE_0;
|
||||
else
|
||||
{
|
||||
sFlagOrVarRecords = records;
|
||||
|
@ -204,7 +204,7 @@ void SetQuestLogEvent(u16 eventId, const u16 *eventData)
|
||||
if (ShouldRegisterEvent_HandleGameCorner(eventId, eventData) == FALSE)
|
||||
return;
|
||||
|
||||
if (gQuestLogPlaybackState == 0)
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_0)
|
||||
{
|
||||
if (ShouldRegisterEvent_HandlePartyActions(eventId, eventData) == TRUE)
|
||||
return;
|
||||
@ -258,33 +258,34 @@ static bool8 InQuestLogDisabledLocation(void)
|
||||
// In Trainer Tower
|
||||
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRAINER_TOWER_1F)
|
||||
&& (gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_1F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_2F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_3F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_4F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_5F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_6F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_7F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_8F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_ROOF)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_LOBBY)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_ELEVATOR)))
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_2F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_3F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_4F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_5F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_6F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_7F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_8F)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_ROOF)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_LOBBY)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_ELEVATOR)))
|
||||
return TRUE;
|
||||
|
||||
// In pokemon trainer fan club
|
||||
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB))
|
||||
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB)
|
||||
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(SAFFRON_CITY_POKEMON_TRAINER_FAN_CLUB))
|
||||
return TRUE;
|
||||
|
||||
// In E-Reader house
|
||||
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SEVEN_ISLAND_HOUSE_ROOM1) &&
|
||||
(gSaveBlock1Ptr->location.mapNum == MAP_NUM(SEVEN_ISLAND_HOUSE_ROOM1)
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(SEVEN_ISLAND_HOUSE_ROOM2)))
|
||||
|| gSaveBlock1Ptr->location.mapNum == MAP_NUM(SEVEN_ISLAND_HOUSE_ROOM2)))
|
||||
return TRUE;
|
||||
|
||||
// In elevator
|
||||
if ((gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(ROCKET_HIDEOUT_ELEVATOR) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROCKET_HIDEOUT_ELEVATOR))
|
||||
|| (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SILPH_CO_ELEVATOR) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(SILPH_CO_ELEVATOR))
|
||||
|| (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRAINER_TOWER_ELEVATOR) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_ELEVATOR))
|
||||
|| (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(CELADON_CITY_DEPARTMENT_STORE_ELEVATOR) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(CELADON_CITY_DEPARTMENT_STORE_ELEVATOR)))
|
||||
|| (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SILPH_CO_ELEVATOR) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(SILPH_CO_ELEVATOR))
|
||||
|| (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRAINER_TOWER_ELEVATOR) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_TOWER_ELEVATOR))
|
||||
|| (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(CELADON_CITY_DEPARTMENT_STORE_ELEVATOR) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(CELADON_CITY_DEPARTMENT_STORE_ELEVATOR)))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
@ -318,15 +319,15 @@ static bool8 ShouldRegisterEvent_HandlePartyActions(u16 eventId, const u16 *even
|
||||
if (!FlagGet(FLAG_SYS_CAN_LINK_WITH_RS))
|
||||
{
|
||||
if (eventId == QL_EVENT_USED_ITEM
|
||||
|| eventId == QL_EVENT_GAVE_HELD_ITEM
|
||||
|| eventId == QL_EVENT_GAVE_HELD_ITEM_BAG
|
||||
|| eventId == QL_EVENT_GAVE_HELD_ITEM_PC
|
||||
|| eventId == QL_EVENT_TOOK_HELD_ITEM
|
||||
|| eventId == QL_EVENT_SWAPPED_HELD_ITEM
|
||||
|| eventId == QL_EVENT_SWAPPED_HELD_ITEM_PC
|
||||
|| eventId == QL_EVENT_SWITCHED_PARTY_MON_FOR_PC_MON
|
||||
|| eventId == QL_EVENT_WITHDREW_MON_PC
|
||||
|| eventId == QL_EVENT_DEPOSITED_MON_PC)
|
||||
|| eventId == QL_EVENT_GAVE_HELD_ITEM
|
||||
|| eventId == QL_EVENT_GAVE_HELD_ITEM_BAG
|
||||
|| eventId == QL_EVENT_GAVE_HELD_ITEM_PC
|
||||
|| eventId == QL_EVENT_TOOK_HELD_ITEM
|
||||
|| eventId == QL_EVENT_SWAPPED_HELD_ITEM
|
||||
|| eventId == QL_EVENT_SWAPPED_HELD_ITEM_PC
|
||||
|| eventId == QL_EVENT_SWITCHED_PARTY_MON_FOR_PC_MON
|
||||
|| eventId == QL_EVENT_WITHDREW_MON_PC
|
||||
|| eventId == QL_EVENT_DEPOSITED_MON_PC)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -417,7 +418,7 @@ static bool8 TrySetTrainerBattleQuestLogEvent(u16 eventId, const u16 *eventData)
|
||||
return FALSE;
|
||||
|
||||
ResetDeferredLinkEvent();
|
||||
if (gQuestLogPlaybackState != 0 || FlagGet(FLAG_SYS_GAME_CLEAR) || ShouldRegisterEvent_HandleBeatStoryTrainer(eventId, eventData) != TRUE)
|
||||
if (gQuestLogPlaybackState != QL_PLAYBACK_STATE_0 || FlagGet(FLAG_SYS_GAME_CLEAR) || ShouldRegisterEvent_HandleBeatStoryTrainer(eventId, eventData) != TRUE)
|
||||
{
|
||||
sDeferredEvent.id = eventId;
|
||||
memcpy(sDeferredEvent.data, eventData, 8);
|
||||
@ -430,7 +431,7 @@ void QuestLogEvents_HandleEndTrainerBattle(void)
|
||||
if (sDeferredEvent.id != QL_EVENT_0)
|
||||
{
|
||||
u16 *resp;
|
||||
if (gQuestLogPlaybackState == 0)
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_0)
|
||||
{
|
||||
sLastDepartedMap = 0;
|
||||
StartRecordingQuestLogEntry(sDeferredEvent.id);
|
||||
|
@ -4,95 +4,95 @@
|
||||
#include "field_player_avatar.h"
|
||||
#include "metatile_behavior.h"
|
||||
|
||||
void SetQuestLogObjectEventsData(struct QuestLog * questLog)
|
||||
void QL_RecordObjects(struct QuestLogScene * questLog)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||
{
|
||||
questLog->unk_008[i].active = gObjectEvents[i].active;
|
||||
questLog->unk_008[i].triggerGroundEffectsOnStop = gObjectEvents[i].triggerGroundEffectsOnStop;
|
||||
questLog->unk_008[i].disableCoveringGroundEffects = gObjectEvents[i].disableCoveringGroundEffects;
|
||||
questLog->unk_008[i].landingJump = gObjectEvents[i].landingJump;
|
||||
questLog->unk_008[i].frozen = gObjectEvents[i].frozen;
|
||||
questLog->unk_008[i].facingDirectionLocked = gObjectEvents[i].facingDirectionLocked;
|
||||
questLog->unk_008[i].disableAnim = gObjectEvents[i].disableAnim;
|
||||
questLog->unk_008[i].enableAnim = gObjectEvents[i].enableAnim;
|
||||
questLog->unk_008[i].inanimate = gObjectEvents[i].inanimate;
|
||||
questLog->unk_008[i].invisible = gObjectEvents[i].invisible;
|
||||
questLog->unk_008[i].offScreen = gObjectEvents[i].offScreen;
|
||||
questLog->unk_008[i].trackedByCamera = gObjectEvents[i].trackedByCamera;
|
||||
questLog->unk_008[i].isPlayer = gObjectEvents[i].isPlayer;
|
||||
questLog->unk_008[i].spriteAnimPausedBackup = gObjectEvents[i].spriteAnimPausedBackup;
|
||||
questLog->unk_008[i].spriteAffineAnimPausedBackup = gObjectEvents[i].spriteAffineAnimPausedBackup;
|
||||
questLog->unk_008[i].disableJumpLandingGroundEffect = gObjectEvents[i].disableJumpLandingGroundEffect;
|
||||
questLog->unk_008[i].fixedPriority = gObjectEvents[i].fixedPriority;
|
||||
questLog->unk_008[i].mapobj_unk_18 = gObjectEvents[i].facingDirection;
|
||||
questLog->unk_008[i].mapobj_unk_0B_0 = gObjectEvents[i].currentElevation;
|
||||
questLog->unk_008[i].elevation = gObjectEvents[i].previousElevation;
|
||||
questLog->unk_008[i].graphicsId = gObjectEvents[i].graphicsId;
|
||||
questLog->unk_008[i].animPattern = gObjectEvents[i].movementType;
|
||||
questLog->unk_008[i].trainerType = gObjectEvents[i].trainerType;
|
||||
questLog->unk_008[i].localId = gObjectEvents[i].localId;
|
||||
questLog->unk_008[i].mapNum = gObjectEvents[i].mapNum;
|
||||
questLog->unk_008[i].mapGroup = gObjectEvents[i].mapGroup;
|
||||
questLog->unk_008[i].x = gObjectEvents[i].currentCoords.x;
|
||||
questLog->unk_008[i].y = gObjectEvents[i].currentCoords.y;
|
||||
questLog->unk_008[i].trainerRange_berryTreeId = gObjectEvents[i].trainerRange_berryTreeId;
|
||||
questLog->unk_008[i].previousMetatileBehavior = gObjectEvents[i].previousMetatileBehavior;
|
||||
questLog->unk_008[i].directionSequenceIndex = gObjectEvents[i].directionSequenceIndex;
|
||||
questLog->unk_008[i].animId = gObjectEvents[i].playerCopyableMovement;
|
||||
questLog->objectEvents[i].active = gObjectEvents[i].active;
|
||||
questLog->objectEvents[i].triggerGroundEffectsOnStop = gObjectEvents[i].triggerGroundEffectsOnStop;
|
||||
questLog->objectEvents[i].disableCoveringGroundEffects = gObjectEvents[i].disableCoveringGroundEffects;
|
||||
questLog->objectEvents[i].landingJump = gObjectEvents[i].landingJump;
|
||||
questLog->objectEvents[i].frozen = gObjectEvents[i].frozen;
|
||||
questLog->objectEvents[i].facingDirectionLocked = gObjectEvents[i].facingDirectionLocked;
|
||||
questLog->objectEvents[i].disableAnim = gObjectEvents[i].disableAnim;
|
||||
questLog->objectEvents[i].enableAnim = gObjectEvents[i].enableAnim;
|
||||
questLog->objectEvents[i].inanimate = gObjectEvents[i].inanimate;
|
||||
questLog->objectEvents[i].invisible = gObjectEvents[i].invisible;
|
||||
questLog->objectEvents[i].offScreen = gObjectEvents[i].offScreen;
|
||||
questLog->objectEvents[i].trackedByCamera = gObjectEvents[i].trackedByCamera;
|
||||
questLog->objectEvents[i].isPlayer = gObjectEvents[i].isPlayer;
|
||||
questLog->objectEvents[i].spriteAnimPausedBackup = gObjectEvents[i].spriteAnimPausedBackup;
|
||||
questLog->objectEvents[i].spriteAffineAnimPausedBackup = gObjectEvents[i].spriteAffineAnimPausedBackup;
|
||||
questLog->objectEvents[i].disableJumpLandingGroundEffect = gObjectEvents[i].disableJumpLandingGroundEffect;
|
||||
questLog->objectEvents[i].fixedPriority = gObjectEvents[i].fixedPriority;
|
||||
questLog->objectEvents[i].facingDirection = gObjectEvents[i].facingDirection;
|
||||
questLog->objectEvents[i].currentElevation = gObjectEvents[i].currentElevation;
|
||||
questLog->objectEvents[i].previousElevation = gObjectEvents[i].previousElevation;
|
||||
questLog->objectEvents[i].graphicsId = gObjectEvents[i].graphicsId;
|
||||
questLog->objectEvents[i].movementType = gObjectEvents[i].movementType;
|
||||
questLog->objectEvents[i].trainerType = gObjectEvents[i].trainerType;
|
||||
questLog->objectEvents[i].localId = gObjectEvents[i].localId;
|
||||
questLog->objectEvents[i].mapNum = gObjectEvents[i].mapNum;
|
||||
questLog->objectEvents[i].mapGroup = gObjectEvents[i].mapGroup;
|
||||
questLog->objectEvents[i].x = gObjectEvents[i].currentCoords.x;
|
||||
questLog->objectEvents[i].y = gObjectEvents[i].currentCoords.y;
|
||||
questLog->objectEvents[i].trainerRange_berryTreeId = gObjectEvents[i].trainerRange_berryTreeId;
|
||||
questLog->objectEvents[i].previousMetatileBehavior = gObjectEvents[i].previousMetatileBehavior;
|
||||
questLog->objectEvents[i].directionSequenceIndex = gObjectEvents[i].directionSequenceIndex;
|
||||
questLog->objectEvents[i].animId = gObjectEvents[i].playerCopyableMovement;
|
||||
}
|
||||
}
|
||||
|
||||
void SetSav1ObjectEventsFromQuestLog(const struct QuestLog * questLog, const struct ObjectEventTemplate * templates)
|
||||
void QL_LoadObjects(const struct QuestLogScene * questLog, const struct ObjectEventTemplate * templates)
|
||||
{
|
||||
u32 i, j;
|
||||
const struct QuestLogObjectEvent * questLogObjectEvents = questLog->unk_008;
|
||||
const struct QuestLogObjectEvent * questLogObjectEvents = questLog->objectEvents;
|
||||
|
||||
CpuFill16(0, gObjectEvents, sizeof(gObjectEvents));
|
||||
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||
{
|
||||
gObjectEvents[i].active = questLogObjectEvents[i].active;
|
||||
gObjectEvents[i].triggerGroundEffectsOnStop = questLogObjectEvents[i].triggerGroundEffectsOnStop;
|
||||
gObjectEvents[i].disableCoveringGroundEffects = questLogObjectEvents[i].disableCoveringGroundEffects;
|
||||
gObjectEvents[i].landingJump = questLogObjectEvents[i].landingJump;
|
||||
gObjectEvents[i].frozen = questLogObjectEvents[i].frozen;
|
||||
gObjectEvents[i].facingDirectionLocked = questLogObjectEvents[i].facingDirectionLocked;
|
||||
gObjectEvents[i].disableAnim = questLogObjectEvents[i].disableAnim;
|
||||
gObjectEvents[i].enableAnim = questLogObjectEvents[i].enableAnim;
|
||||
gObjectEvents[i].inanimate = questLogObjectEvents[i].inanimate;
|
||||
gObjectEvents[i].invisible = questLogObjectEvents[i].invisible;
|
||||
gObjectEvents[i].offScreen = questLogObjectEvents[i].offScreen;
|
||||
gObjectEvents[i].trackedByCamera = questLogObjectEvents[i].trackedByCamera;
|
||||
gObjectEvents[i].isPlayer = questLogObjectEvents[i].isPlayer;
|
||||
gObjectEvents[i].spriteAnimPausedBackup = questLogObjectEvents[i].spriteAnimPausedBackup;
|
||||
gObjectEvents[i].spriteAffineAnimPausedBackup = questLogObjectEvents[i].spriteAffineAnimPausedBackup;
|
||||
gObjectEvents[i].active = questLogObjectEvents[i].active;
|
||||
gObjectEvents[i].triggerGroundEffectsOnStop = questLogObjectEvents[i].triggerGroundEffectsOnStop;
|
||||
gObjectEvents[i].disableCoveringGroundEffects = questLogObjectEvents[i].disableCoveringGroundEffects;
|
||||
gObjectEvents[i].landingJump = questLogObjectEvents[i].landingJump;
|
||||
gObjectEvents[i].frozen = questLogObjectEvents[i].frozen;
|
||||
gObjectEvents[i].facingDirectionLocked = questLogObjectEvents[i].facingDirectionLocked;
|
||||
gObjectEvents[i].disableAnim = questLogObjectEvents[i].disableAnim;
|
||||
gObjectEvents[i].enableAnim = questLogObjectEvents[i].enableAnim;
|
||||
gObjectEvents[i].inanimate = questLogObjectEvents[i].inanimate;
|
||||
gObjectEvents[i].invisible = questLogObjectEvents[i].invisible;
|
||||
gObjectEvents[i].offScreen = questLogObjectEvents[i].offScreen;
|
||||
gObjectEvents[i].trackedByCamera = questLogObjectEvents[i].trackedByCamera;
|
||||
gObjectEvents[i].isPlayer = questLogObjectEvents[i].isPlayer;
|
||||
gObjectEvents[i].spriteAnimPausedBackup = questLogObjectEvents[i].spriteAnimPausedBackup;
|
||||
gObjectEvents[i].spriteAffineAnimPausedBackup = questLogObjectEvents[i].spriteAffineAnimPausedBackup;
|
||||
gObjectEvents[i].disableJumpLandingGroundEffect = questLogObjectEvents[i].disableJumpLandingGroundEffect;
|
||||
gObjectEvents[i].fixedPriority = questLogObjectEvents[i].fixedPriority;
|
||||
gObjectEvents[i].facingDirection = questLogObjectEvents[i].mapobj_unk_18;
|
||||
gObjectEvents[i].currentElevation = questLogObjectEvents[i].mapobj_unk_0B_0;
|
||||
gObjectEvents[i].previousElevation = questLogObjectEvents[i].elevation;
|
||||
gObjectEvents[i].graphicsId = questLogObjectEvents[i].graphicsId;
|
||||
gObjectEvents[i].movementType = questLogObjectEvents[i].animPattern;
|
||||
gObjectEvents[i].trainerType = questLogObjectEvents[i].trainerType;
|
||||
gObjectEvents[i].localId = questLogObjectEvents[i].localId;
|
||||
gObjectEvents[i].mapNum = questLogObjectEvents[i].mapNum;
|
||||
gObjectEvents[i].mapGroup = questLogObjectEvents[i].mapGroup;
|
||||
gObjectEvents[i].currentCoords.x = questLogObjectEvents[i].x;
|
||||
gObjectEvents[i].currentCoords.y = questLogObjectEvents[i].y;
|
||||
gObjectEvents[i].trainerRange_berryTreeId = questLogObjectEvents[i].trainerRange_berryTreeId;
|
||||
gObjectEvents[i].previousMetatileBehavior = questLogObjectEvents[i].previousMetatileBehavior;
|
||||
gObjectEvents[i].directionSequenceIndex = questLogObjectEvents[i].directionSequenceIndex;
|
||||
gObjectEvents[i].playerCopyableMovement = questLogObjectEvents[i].animId;
|
||||
gObjectEvents[i].fixedPriority = questLogObjectEvents[i].fixedPriority;
|
||||
gObjectEvents[i].facingDirection = questLogObjectEvents[i].facingDirection;
|
||||
gObjectEvents[i].currentElevation = questLogObjectEvents[i].currentElevation;
|
||||
gObjectEvents[i].previousElevation = questLogObjectEvents[i].previousElevation;
|
||||
gObjectEvents[i].graphicsId = questLogObjectEvents[i].graphicsId;
|
||||
gObjectEvents[i].movementType = questLogObjectEvents[i].movementType;
|
||||
gObjectEvents[i].trainerType = questLogObjectEvents[i].trainerType;
|
||||
gObjectEvents[i].localId = questLogObjectEvents[i].localId;
|
||||
gObjectEvents[i].mapNum = questLogObjectEvents[i].mapNum;
|
||||
gObjectEvents[i].mapGroup = questLogObjectEvents[i].mapGroup;
|
||||
gObjectEvents[i].currentCoords.x = questLogObjectEvents[i].x;
|
||||
gObjectEvents[i].currentCoords.y = questLogObjectEvents[i].y;
|
||||
gObjectEvents[i].trainerRange_berryTreeId = questLogObjectEvents[i].trainerRange_berryTreeId;
|
||||
gObjectEvents[i].previousMetatileBehavior = questLogObjectEvents[i].previousMetatileBehavior;
|
||||
gObjectEvents[i].directionSequenceIndex = questLogObjectEvents[i].directionSequenceIndex;
|
||||
gObjectEvents[i].playerCopyableMovement = questLogObjectEvents[i].animId;
|
||||
|
||||
for (j = 0; j < 0x40; j++)
|
||||
for (j = 0; j < OBJECT_EVENT_TEMPLATES_COUNT; j++)
|
||||
{
|
||||
if (gObjectEvents[i].localId == templates[j].localId)
|
||||
{
|
||||
gObjectEvents[i].initialCoords.x = templates[j].x + 7;
|
||||
gObjectEvents[i].initialCoords.y = templates[j].y + 7;
|
||||
gObjectEvents[i].initialCoords.x = templates[j].x + MAP_OFFSET;
|
||||
gObjectEvents[i].initialCoords.y = templates[j].y + MAP_OFFSET;
|
||||
gObjectEvents[i].rangeX = templates[j].objUnion.normal.movementRangeX;
|
||||
gObjectEvents[i].rangeY = templates[j].objUnion.normal.movementRangeY;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ void QuestLogUpdatePlayerSprite(u8 state)
|
||||
|
||||
bool32 QuestLogTryRecordPlayerAvatarGfxTransition(u8 state)
|
||||
{
|
||||
if (gQuestLogPlaybackState == 2)
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_2)
|
||||
{
|
||||
QuestLogRecordPlayerAvatarGfxTransition(state);
|
||||
return TRUE;
|
||||
@ -77,7 +77,7 @@ static void QL_GfxTransition_Fish(void)
|
||||
struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||
struct Sprite *sprite = &gSprites[objectEvent->spriteId];
|
||||
|
||||
if (gQuestLogPlaybackState == 1 || gQuestLogPlaybackState == 3)
|
||||
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_1 || gQuestLogPlaybackState == QL_PLAYBACK_STATE_3)
|
||||
{
|
||||
u8 taskId;
|
||||
LockPlayerFieldControls();
|
||||
|
Loading…
Reference in New Issue
Block a user