diff --git a/assets/xml/objects/object_bba.xml b/assets/xml/objects/object_bba.xml
index 144c685e43..c3c5a5c1b2 100644
--- a/assets/xml/objects/object_bba.xml
+++ b/assets/xml/objects/object_bba.xml
@@ -18,7 +18,7 @@
-
+
diff --git a/include/functions.h b/include/functions.h
index 63f9eadd8a..2572768069 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -2247,7 +2247,7 @@ s32 Entrance_GetSceneNum(u16 entranceIndex);
s32 Entrance_GetSceneNumAbsolute(u16 entranceIndex);
s32 Entrance_GetSpawnNum(u16 entranceIndex);
s32 Entrance_GetTransitionFlags(u16 entranceIndex);
-s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleResult* result);
+s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleOutput* output);
void SkelAnime_DrawLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod);
void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, Actor* actor, s32 lod);
void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDrawFlex overrideLimbDraw, PostLimbDrawFlex postLimbDraw, Actor* actor, s32 lod, Mtx** mtx);
diff --git a/include/z64schedule.h b/include/z64schedule.h
index f5dfb2be87..6a0a32638c 100644
--- a/include/z64schedule.h
+++ b/include/z64schedule.h
@@ -3,37 +3,45 @@
#include "ultra64.h"
-/*
- Schedule is a subsystem that acts as a way to make decisions based on the
- time and scene (and a limited selection of items). It is utilized by writing
- a script that is encoded into bytecode and ran, returning the result in a
- struct. The returned result can be a value or a encoded time value.
+/**
+ * Schedule is a subsystem that acts as a way to make decisions based on the
+ * time and scene (and a limited selection of items). It is utilized by writing
+ * a script that is encoded into bytecode and ran, returning the result in a
+ * struct. The returned result can be a value or a encoded time value.
+ *
+ * The scripts contain 2 kinds of instructions:
+ * - Checks with branches (relative offsets, either 1-byte offsets (short, *_S),
+ * or 2-byte offsets (long, *_L))
+ * - Returns
+ *
+ * Scripts are stored as u8[]. They are built using the macros are the bottom of
+ * this file. The scheduledis.py script can be used to convert any scripts in
+ * actor data into the macros.
+ */
- The scripts contain 2 kinds of instructions:
- - Checks with branches (relative offsets, either 1-byte offsets (short, *_S),
- or 2-byte offsets (long, *_L))
- - Returns
-
- Scripts are stored as u8[]. They are built using the macros are the bottom of
- this file. The scheduledis.py script can be used to convert any scripts in
- actor data into the macros.
-*/
+/**
+ * Actors that use this system generally create 3 functions to interact with it.
+ *
+ * - FollowSchedule: The action function an actor sets to follow the schedule.
+ * - ProcessScheduleOutput: Holds the logic of processing the output received by running the schedule script, called by FollowSchedule
+ * - HandleSchedule: Holds the actual logic of how to actually follow the schedule based on the processed output, called by FollowSchedule
+ */
// Macro to convert the time format used in the save struct into the format used in Schedule
#define SCHEDULE_CONVERT_TIME(time) ((time) - 0x10000 / 360 * 90)
#define SCHEDULE_TIME_NOW SCHEDULE_CONVERT_TIME(gSaveContext.save.time)
typedef enum {
- /* 00 */ SCHEDULE_CMD_ID_CHECK_FLAG_S, // Checks if a weekEventReg flag is set and branches if so, short range branch
- /* 01 */ SCHEDULE_CMD_ID_CHECK_FLAG_L, // Checks if a weekEventReg flag is set and branches if so, long range branch
- /* 02 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_S, // Checks if the current time is within the range of the two provided times and branches if so, short range branch
- /* 03 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_L, // Checks if the current time is within the range of the two provided times and branches if so, long range branch
- /* 04 */ SCHEDULE_CMD_ID_RET_VAL_L, // Ends script and returns 2-byte value (Note: bugged as the return value size is only 1 byte in the struct)
- /* 05 */ SCHEDULE_CMD_ID_RET_NONE, // Ends script without returning anything
- /* 06 */ SCHEDULE_CMD_ID_RET_EMPTY, // Ends script and indicates return without changing existing value
- /* 07 */ SCHEDULE_CMD_ID_NOP, // No-Op
- /* 08 */ SCHEDULE_CMD_ID_CHECK_MISC_S, // Special check based on items or masks and branches if check passes, short range branch
- /* 09 */ SCHEDULE_CMD_ID_RET_VAL_S, // Ends script and returns byte value
+ /* 0 */ SCHEDULE_CMD_ID_CHECK_FLAG_S, // Checks if a weekEventReg flag is set and branches if so, short range branch
+ /* 1 */ SCHEDULE_CMD_ID_CHECK_FLAG_L, // Checks if a weekEventReg flag is set and branches if so, long range branch
+ /* 2 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_S, // Checks if the current time is within the range of the two provided times and branches if so, short range branch
+ /* 3 */ SCHEDULE_CMD_ID_CHECK_TIME_RANGE_L, // Checks if the current time is within the range of the two provided times and branches if so, long range branch
+ /* 4 */ SCHEDULE_CMD_ID_RET_VAL_L, // Ends script and returns 2-byte value (Note: bugged as the return value size is only 1 byte in the struct)
+ /* 5 */ SCHEDULE_CMD_ID_RET_NONE, // Ends script without returning anything
+ /* 6 */ SCHEDULE_CMD_ID_RET_EMPTY, // Ends script and indicates return without changing existing value
+ /* 7 */ SCHEDULE_CMD_ID_NOP, // No-Op
+ /* 8 */ SCHEDULE_CMD_ID_CHECK_MISC_S, // Special check based on items or masks and branches if check passes, short range branch
+ /* 9 */ SCHEDULE_CMD_ID_RET_VAL_S, // Ends script and returns byte value
/* 10 */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_S, // Checks if the current scene is not SceneNum and branches if so, short range branch
/* 11 */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_L, // Checks if the current scene is not SceneNum and branches if so, long range branch
/* 12 */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_S, // Checks if the current day is not Day and branches if so, short range branch
@@ -56,7 +64,7 @@ typedef struct {
/* 0x4 */ s32 time0;
/* 0x8 */ s32 time1;
/* 0xC */ s32 hasResult;
-} ScheduleResult; // size = 0x10
+} ScheduleOutput; // size = 0x10
typedef struct {
/* 0x0 */ u8 cmd;
diff --git a/include/z64subs.h b/include/z64subs.h
index 60c3e7151f..ff9404e9d5 100644
--- a/include/z64subs.h
+++ b/include/z64subs.h
@@ -122,7 +122,7 @@ void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween
void SubS_DrawShadowTex(Actor* actor, struct GameState* gameState, u8* tex);
s16 SubS_ComputeTrackPointRot(s16* rot, s16 rotMax, s16 target, f32 slowness, f32 stepMin, f32 stepMax);
-s32 SubS_TrackPoint(Vec3f* point, Vec3f* focusPos, Vec3s* shapeRot, Vec3s* turnTarget, Vec3s* headRot, Vec3s* torsoRot, TrackOptionsSet* options);
+s32 SubS_TrackPoint(Vec3f* point, Vec3f* focusPos, Vec3s* shapeRot, Vec3s* trackTarget, Vec3s* headRot, Vec3s* torsoRot, TrackOptionsSet* options);
s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB);
diff --git a/src/code/z_schedule.c b/src/code/z_schedule.c
index 2380cef137..cfc6293ba4 100644
--- a/src/code/z_schedule.c
+++ b/src/code/z_schedule.c
@@ -6,7 +6,7 @@
(dest) = (temp) * (0x10000 / 60 / 24.0f); \
(dest) = SCHEDULE_CONVERT_TIME(dest);
-s32 Schedule_CheckFlagS(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_CheckFlagS(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdCheckFlagS* cmd = (ScheduleCmdCheckFlagS*)*script;
u16 flag = (cmd->flagByte << 8) | cmd->flagMask;
@@ -17,7 +17,7 @@ s32 Schedule_CheckFlagS(PlayState* play, u8** script, ScheduleResult* result) {
return false;
}
-s32 Schedule_CheckFlagL(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_CheckFlagL(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdCheckFlagL* cmd = (ScheduleCmdCheckFlagL*)*script;
u16 flag = (cmd->flagByte << 8) | cmd->flagMask;
@@ -28,7 +28,7 @@ s32 Schedule_CheckFlagL(PlayState* play, u8** script, ScheduleResult* result) {
return false;
}
-s32 Schedule_CheckTimeRangeS(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_CheckTimeRangeS(PlayState* play, u8** script, ScheduleOutput* output) {
s32 inRange = false;
ScheduleCmdCheckTimeRangeS* cmd = (ScheduleCmdCheckTimeRangeS*)*script;
f32 f;
@@ -54,7 +54,7 @@ s32 Schedule_CheckTimeRangeS(PlayState* play, u8** script, ScheduleResult* resul
return false;
}
-s32 Schedule_CheckTimeRangeL(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_CheckTimeRangeL(PlayState* play, u8** script, ScheduleOutput* output) {
s32 inRange = false;
ScheduleCmdCheckTimeRangeL* cmd = (ScheduleCmdCheckTimeRangeL*)*script;
f32 f;
@@ -80,33 +80,33 @@ s32 Schedule_CheckTimeRangeL(PlayState* play, u8** script, ScheduleResult* resul
return false;
}
-s32 Schedule_ReturnValueL(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_ReturnValueL(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdReturnValueL* cmd = (ScheduleCmdReturnValueL*)*script;
//! @bug result is a u8, value is truncated
- result->result = (cmd->retH << 8) | cmd->retL;
- result->hasResult = true;
+ output->result = (cmd->retH << 8) | cmd->retL;
+ output->hasResult = true;
return true;
}
-s32 Schedule_ReturnNone(PlayState* play, u8** script, ScheduleResult* result) {
- result->hasResult = false;
+s32 Schedule_ReturnNone(PlayState* play, u8** script, ScheduleOutput* output) {
+ output->hasResult = false;
return true;
}
-s32 Schedule_ReturnEmpty(PlayState* play, u8** script, ScheduleResult* result) {
- result->hasResult = true;
+s32 Schedule_ReturnEmpty(PlayState* play, u8** script, ScheduleOutput* output) {
+ output->hasResult = true;
return true;
}
-s32 Schedule_Nop(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_Nop(PlayState* play, u8** script, ScheduleOutput* output) {
return false;
}
-s32 Schedule_CheckMiscS(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_CheckMiscS(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdCheckMiscS* cmd = (ScheduleCmdCheckMiscS*)*script;
if (((cmd->which == SCHEDULE_CHECK_MISC_ROOM_KEY) && (INV_CONTENT(ITEM_ROOM_KEY) == ITEM_ROOM_KEY)) ||
@@ -119,16 +119,16 @@ s32 Schedule_CheckMiscS(PlayState* play, u8** script, ScheduleResult* result) {
return false;
}
-s32 Schedule_ReturnValueS(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_ReturnValueS(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdReturnValueS* cmd = (ScheduleCmdReturnValueS*)*script;
- result->result = cmd->result;
- result->hasResult = true;
+ output->result = cmd->result;
+ output->hasResult = true;
return true;
}
-s32 Schedule_CheckNotInSceneS(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_CheckNotInSceneS(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdCheckNotInSceneS* cmd = (ScheduleCmdCheckNotInSceneS*)*script;
s16 scene = (cmd->sceneH << 8) | cmd->sceneL;
@@ -139,7 +139,7 @@ s32 Schedule_CheckNotInSceneS(PlayState* play, u8** script, ScheduleResult* resu
return false;
}
-s32 Schedule_CheckNotInSceneL(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_CheckNotInSceneL(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdCheckNotInSceneL* cmd = (ScheduleCmdCheckNotInSceneL*)*script;
s16 scene = (cmd->sceneH << 8) | cmd->sceneL;
@@ -150,7 +150,7 @@ s32 Schedule_CheckNotInSceneL(PlayState* play, u8** script, ScheduleResult* resu
return false;
}
-s32 Schedule_CheckNotInDayS(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_CheckNotInDayS(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdCheckNotInDayS* cmd = (ScheduleCmdCheckNotInDayS*)*script;
s16 day = (cmd->dayH << 8) | cmd->dayL;
@@ -161,7 +161,7 @@ s32 Schedule_CheckNotInDayS(PlayState* play, u8** script, ScheduleResult* result
return false;
}
-s32 Schedule_CheckNotInDayL(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_CheckNotInDayL(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdCheckNotInDayL* cmd = (ScheduleCmdCheckNotInDayL*)*script;
s16 day = (cmd->dayH << 8) | cmd->dayL;
@@ -172,7 +172,7 @@ s32 Schedule_CheckNotInDayL(PlayState* play, u8** script, ScheduleResult* result
return false;
}
-s32 Schedule_ReturnTime(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_ReturnTime(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdReturnTime* cmd = (ScheduleCmdReturnTime*)*script;
f32 f;
u16 time0;
@@ -183,15 +183,15 @@ s32 Schedule_ReturnTime(PlayState* play, u8** script, ScheduleResult* result) {
SCHEDULE_CALC_TIME(cmd->time1Hr, cmd->time1Min, time1, f);
time1--;
- result->result = cmd->result;
- result->time0 = time0;
- result->time1 = time1;
- result->hasResult = true;
+ output->result = cmd->result;
+ output->time0 = time0;
+ output->time1 = time1;
+ output->hasResult = true;
return true;
}
-s32 Schedule_CheckBeforeTimeS(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_CheckBeforeTimeS(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdCheckBeforeTimeS* cmd = (ScheduleCmdCheckBeforeTimeS*)*script;
f32 f;
u16 testTime;
@@ -208,7 +208,7 @@ s32 Schedule_CheckBeforeTimeS(PlayState* play, u8** script, ScheduleResult* resu
return false;
}
-s32 Schedule_CheckBeforeTimeL(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_CheckBeforeTimeL(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdCheckBeforeTimeL* cmd = (ScheduleCmdCheckBeforeTimeL*)*script;
f32 f;
u16 testTime;
@@ -225,21 +225,21 @@ s32 Schedule_CheckBeforeTimeL(PlayState* play, u8** script, ScheduleResult* resu
return false;
}
-s32 Schedule_BranchS(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_BranchS(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdBranchS* cmd = (ScheduleCmdBranchS*)*script;
*script += cmd->offset;
return false;
}
-s32 Schedule_BranchL(PlayState* play, u8** script, ScheduleResult* result) {
+s32 Schedule_BranchL(PlayState* play, u8** script, ScheduleOutput* output) {
ScheduleCmdBranchL* cmd = (ScheduleCmdBranchL*)*script;
*script += (s16)((cmd->offsetH << 8) | cmd->offsetL);
return false;
}
-static s32 (*sScheduleCmdFuncs[])(PlayState*, u8**, ScheduleResult*) = {
+static s32 (*sScheduleCmdFuncs[])(PlayState*, u8**, ScheduleOutput*) = {
Schedule_CheckFlagS, Schedule_CheckFlagL, Schedule_CheckTimeRangeS, Schedule_CheckTimeRangeL,
Schedule_ReturnValueL, Schedule_ReturnNone, Schedule_ReturnEmpty, Schedule_Nop,
Schedule_CheckMiscS, Schedule_ReturnValueS, Schedule_CheckNotInSceneS, Schedule_CheckNotInSceneL,
@@ -269,15 +269,15 @@ static u8 sScheduleCmdSizes[] = {
sizeof(ScheduleCmdBranchL),
};
-s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleResult* result) {
+s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleOutput* output) {
u8 size;
s32 stop;
do {
size = sScheduleCmdSizes[*script];
- stop = (*sScheduleCmdFuncs[*script])(play, &script, result);
+ stop = (*sScheduleCmdFuncs[*script])(play, &script, output);
script += size;
} while (!stop);
- return result->hasResult;
+ return output->hasResult;
}
diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c
index f8c6b1a212..e7491a8308 100644
--- a/src/code/z_sub_s.c
+++ b/src/code/z_sub_s.c
@@ -480,13 +480,13 @@ void SubS_TimePathing_ComputeInitialY(PlayState* play, Path* path, s32 waypoint,
}
}
-Path* SubS_GetAdditionalPath(PlayState* play, u8 pathIndex, s32 max) {
+Path* SubS_GetAdditionalPath(PlayState* play, u8 pathIndex, s32 limit) {
Path* path;
s32 i = 0;
do {
path = &play->setupPathList[pathIndex];
- if (i >= max) {
+ if (i >= limit) {
break;
}
pathIndex = path->unk1;
diff --git a/src/overlays/actors/ovl_En_Ah/z_en_ah.c b/src/overlays/actors/ovl_En_Ah/z_en_ah.c
index fae0025d20..bfc6d197bd 100644
--- a/src/overlays/actors/ovl_En_Ah/z_en_ah.c
+++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.c
@@ -376,7 +376,7 @@ s32 func_80BD3320(EnAh* this, PlayState* play, u8 actorCat, s16 actorId) {
return ret;
}
-s32 func_80BD3374(EnAh* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BD3374(EnAh* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 pad;
Math_Vec3f_Copy(&this->actor.world.pos, &D_80BD3EC4.pos);
@@ -388,7 +388,7 @@ s32 func_80BD3374(EnAh* this, PlayState* play, ScheduleResult* arg2) {
return true;
}
-s32 func_80BD33FC(EnAh* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BD33FC(EnAh* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 pad;
Math_Vec3f_Copy(&this->actor.world.pos, &D_80BD3ED8.pos);
@@ -400,7 +400,7 @@ s32 func_80BD33FC(EnAh* this, PlayState* play, ScheduleResult* arg2) {
return true;
}
-s32 func_80BD3484(EnAh* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BD3484(EnAh* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
if (func_80BD3320(this, play, ACTORCAT_NPC, ACTOR_EN_AN)) {
@@ -419,26 +419,26 @@ s32 func_80BD3484(EnAh* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80BD3548(EnAh* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BD3548(EnAh* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret;
this->unk_2D8 = 0;
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
default:
ret = false;
break;
case 1:
- ret = func_80BD3374(this, play, arg2);
+ ret = func_80BD3374(this, play, scheduleOutput);
break;
case 2:
- ret = func_80BD33FC(this, play, arg2);
+ ret = func_80BD33FC(this, play, scheduleOutput);
break;
case 3:
- ret = func_80BD3484(this, play, arg2);
+ ret = func_80BD3484(this, play, scheduleOutput);
break;
}
return ret;
@@ -472,7 +472,7 @@ void func_80BD3658(EnAh* this, PlayState* play) {
}
void func_80BD36B8(EnAh* this, PlayState* play) {
- ScheduleResult sp18;
+ ScheduleOutput sp18;
if (!Schedule_RunScript(play, D_80BD3DB0, &sp18) ||
((this->unk_1DC != sp18.result) && !func_80BD3548(this, play, &sp18))) {
diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c
index 8b56bdc644..2a7776c6f6 100644
--- a/src/overlays/actors/ovl_En_Al/z_en_al.c
+++ b/src/overlays/actors/ovl_En_Al/z_en_al.c
@@ -635,7 +635,7 @@ s32 func_80BDF064(EnAl* this, PlayState* play) {
return false;
}
-s32 func_80BDF244(EnAl* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BDF244(EnAl* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
Actor* sp20 = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_GM);
Actor* temp_v0 = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO);
@@ -650,10 +650,10 @@ s32 func_80BDF244(EnAl* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80BDF308(EnAl* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BDF308(EnAl* this, PlayState* play, ScheduleOutput* scheduleOutput) {
SubS_UpdateFlags(&this->unk_4C2, 3, 7);
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
case 1:
func_80BDE27C(this, 0);
break;
@@ -667,7 +667,7 @@ s32 func_80BDF308(EnAl* this, PlayState* play, ScheduleResult* arg2) {
return true;
}
-s32 func_80BDF390(EnAl* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BDF390(EnAl* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret;
this->actor.flags |= ACTOR_FLAG_1;
@@ -676,14 +676,14 @@ s32 func_80BDF390(EnAl* this, PlayState* play, ScheduleResult* arg2) {
this->unk_4C2 = 0;
this->unk_4D4 = 40.0f;
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
case 3:
- ret = func_80BDF244(this, play, arg2);
+ ret = func_80BDF244(this, play, scheduleOutput);
break;
case 1:
case 2:
- ret = func_80BDF308(this, play, arg2);
+ ret = func_80BDF308(this, play, scheduleOutput);
break;
default:
@@ -746,7 +746,7 @@ void func_80BDF578(EnAl* this, PlayState* play) {
}
void func_80BDF5E8(EnAl* this, PlayState* play) {
- ScheduleResult sp20;
+ ScheduleOutput sp20;
this->unk_4E0 = REG(15) + ((void)0, gSaveContext.save.daySpeed);
if (!Schedule_RunScript(play, D_80BDFC70, &sp20) ||
diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c
index c7386e403c..9c35fcda89 100644
--- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c
+++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c
@@ -5,29 +5,50 @@
*/
#include "z_en_baba.h"
-#include "overlays/actors/ovl_En_Ossan/z_en_ossan.h"
-#include "objects/object_bba/object_bba.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10)
#define THIS ((EnBaba*)thisx)
+#define BOMB_SHOP_LADY_STATE_END_CONVERSATION (1 << 0)
+#define BOMB_SHOP_LADY_STATE_VISIBLE (1 << 1)
+#define BOMB_SHOP_LADY_STATE_KNOCKED_OVER (1 << 2) // Don't track player
+#define BOMB_SHOP_LADY_STATE_AUTOTALK (1 << 3)
+#define BOMB_SHOP_LADY_STATE_GIVE_BLAST_MASK (1 << 5)
+#define BOMB_SHOP_LADY_STATE_GAVE_BLAST_MASK (1 << 6)
+#define BOMB_SHOP_LADY_STATE_DRAW_SHADOW (1 << 7)
+
void EnBaba_Init(Actor* thisx, PlayState* play);
void EnBaba_Destroy(Actor* thisx, PlayState* play);
void EnBaba_Update(Actor* thisx, PlayState* play);
void EnBaba_Draw(Actor* thisx, PlayState* play);
-void func_80BA9480(EnBaba* this, PlayState* play);
-void func_80BA9758(EnBaba* this, PlayState* play);
-void func_80BA9848(EnBaba* this, PlayState* play);
-void func_80BA98EC(EnBaba* this, PlayState* play);
-void func_80BA9AB8(EnBaba* this, PlayState* play);
-void func_80BA9B24(EnBaba* this, PlayState* play);
-void func_80BA9B80(EnBaba* this, PlayState* play);
-void func_80BA9CD4(EnBaba* this, PlayState* play);
-void func_80BA9E00(EnBaba* this, PlayState* play);
-void func_80BA9E10(EnBaba* this, PlayState* play);
-void func_80BA9E48(EnBaba* this, PlayState* play);
+void EnBaba_FinishInit(EnBaba* this, PlayState* play);
+void EnBaba_Idle(EnBaba* this, PlayState* play);
+void EnBaba_FollowSchedule_Talk(EnBaba* this, PlayState* play);
+void EnBaba_Talk(EnBaba* this, PlayState* play);
+void EnBaba_GiveBlastMask(EnBaba* this, PlayState* play);
+void EnBaba_GaveBlastMask(EnBaba* this, PlayState* play);
+void EnBaba_FollowSchedule(EnBaba* this, PlayState* play);
+void EnBaba_KnockedOver(EnBaba* this, PlayState* play);
+void EnBaba_DoNothing(EnBaba* this, PlayState* play);
+void EnBaba_Walk(EnBaba* this, PlayState* play);
+void EnBaba_FaceForward(EnBaba* this, PlayState* play);
+
+typedef enum {
+ /* 0 */ BOMB_SHOP_LADY_ANIM_IDLE_HOLDING_BAG,
+ /* 1 */ BOMB_SHOP_LADY_ANIM_IDLE,
+ /* 2 */ BOMB_SHOP_LADY_ANIM_WALKING_HOLDING_BAG,
+ /* 3 */ BOMB_SHOP_LADY_ANIM_KNOCKED_OVER,
+ /* 4 */ BOMB_SHOP_LADY_ANIM_LYING_DOWN,
+ /* 5 */ BOMB_SHOP_LADY_ANIM_SWAY
+} BombShopLadyAnimation;
+
+typedef enum {
+ /* 0 */ BOMB_SHOP_LADY_SCH_NONE,
+ /* 1 */ BOMB_SHOP_LADY_SCH_KNOCKED_OVER,
+ /* 2 */ BOMB_SHOP_LADY_SCH_FOLLOW_TIME_PATH
+} BombShopLadyScheduleResult;
const ActorInit En_Baba_InitVars = {
ACTOR_EN_BABA,
@@ -47,7 +68,7 @@ static AnimationInfo sAnimations[] = {
{ &gBbaWalkingHoldingBagAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f },
{ &gBbaKnockedOverAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f },
{ &gBbaLyingDownAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f },
- { &gBbaWalkingAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f },
+ { &gBbaSwayAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f },
};
static ColliderCylinderInit sCylinderInit = {
@@ -107,19 +128,19 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(1, 0x0),
};
-static u8 D_80BAA488[] = {
+static u8 sSchedule[] = {
/* 0x00 */ SCHEDULE_CMD_CHECK_NOT_IN_DAY_S(1, 0x1D - 0x04),
/* 0x04 */ SCHEDULE_CMD_CHECK_NOT_IN_SCENE_S(SCENE_BACKTOWN, 0x1C - 0x08),
/* 0x08 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(0, 0, 0, 30, 0x16 - 0x0E),
/* 0x0E */ SCHEDULE_CMD_CHECK_BEFORE_TIME_S(0, 30, 0x15 - 0x12),
- /* 0x12 */ SCHEDULE_CMD_RET_VAL_L(1),
+ /* 0x12 */ SCHEDULE_CMD_RET_VAL_L(BOMB_SHOP_LADY_SCH_KNOCKED_OVER),
/* 0x15 */ SCHEDULE_CMD_RET_NONE(),
- /* 0x16 */ SCHEDULE_CMD_RET_TIME(0, 0, 0, 30, 2),
+ /* 0x16 */ SCHEDULE_CMD_RET_TIME(0, 0, 0, 30, BOMB_SHOP_LADY_SCH_FOLLOW_TIME_PATH),
/* 0x1C */ SCHEDULE_CMD_RET_NONE(),
/* 0x1D */ SCHEDULE_CMD_RET_NONE(),
};
-s32 D_80BAA4A8[] = { -1, -1, 0 };
+static s32 sSearchTimePathLimit[] = { -1, -1, 0 };
static TrackOptionsSet sTrackOptions = {
{ 0xFA0, 4, 1, 3 },
@@ -128,142 +149,164 @@ static TrackOptionsSet sTrackOptions = {
{ 0x1770, 4, 1, 6 },
};
-s32 func_80BA8820(EnBaba* this, PlayState* play) {
- this->unk_144 = (EnOssan*)SubS_FindActor(play, &this->unk_144->actor, ACTORCAT_NPC, ACTOR_EN_OSSAN);
+s32 EnBaba_FindBombShopkeeper(EnBaba* this, PlayState* play) {
+ //! The bomb shopkeeper is an EnSob1, but initalizes itself with id `ACTOR_EN_OSSAN`
+ //! Note if there are other `EnOssan` actors, it may find that instance instead
+ //! in which case `EnSob1` struct acceses would be incorrect
+ this->bombShopkeeper = (EnSob1*)SubS_FindActor(play, &this->bombShopkeeper->actor, ACTORCAT_NPC, ACTOR_EN_OSSAN);
- if (this->unk_144 != NULL) {
+ if (this->bombShopkeeper != NULL) {
return true;
}
return false;
}
-void func_80BA886C(EnBaba* this, PlayState* play) {
+void EnBaba_HandleConversation(EnBaba* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- switch (this->unk_1E0) {
+ switch (this->textId) {
case 0:
- if (this->unk_40A & 8) {
+ if (this->stateFlags & BOMB_SHOP_LADY_STATE_AUTOTALK) {
if (gSaveContext.save.weekEventReg[33] & 8) {
- this->unk_1E0 = 0x2A34;
+ // Thanks. Can stock Bomb Bags tomorrow
+ this->textId = 0x2A34;
break;
}
if (gSaveContext.save.weekEventReg[79] & 0x40) {
- this->unk_40A |= 1;
- this->unk_1E0 = 0x2A33;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION;
+ // Oh my, learned my lesson. Can't stock Bomb Bags tomorrow
+ this->textId = 0x2A33;
break;
}
- this->unk_40A |= 1;
- this->unk_1E0 = 0x2A32;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION;
+ // Can't stock Bomb Bags tomorrow
+ this->textId = 0x2A32;
break;
} else if (player->transformation == PLAYER_FORM_DEKU) {
if (!(gSaveContext.save.weekEventReg[79] & 0x20)) {
gSaveContext.save.weekEventReg[79] |= 0x20;
- this->unk_40A |= 1;
- this->unk_1E0 = 0x2A37;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION;
+ // Small customer, use bombs as adult
+ this->textId = 0x2A37;
break;
} else {
- this->unk_40A |= 1;
- this->unk_1E0 = 0x2A38;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION;
+ // use bombs as adult
+ this->textId = 0x2A38;
}
break;
} else if (!(gSaveContext.save.weekEventReg[33] & 8)) {
if (!(gSaveContext.save.weekEventReg[73] & 1)) {
- this->unk_1E0 = 0x660;
+ // Thought could sell Big Bomb Bags
+ this->textId = 0x660;
break;
}
- this->unk_1E0 = 0x662;
+ // Can't judge people
+ this->textId = 0x662;
break;
} else {
if (!(gSaveContext.save.weekEventReg[73] & 2)) {
- this->unk_1E0 = 0x65A;
+ // Someone helped me out
+ this->textId = 0x65A;
break;
}
- this->unk_1E0 = 0x65E;
+ // Buy Big Bomb Bag
+ this->textId = 0x65E;
break;
}
break;
case 0x660:
- Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor);
- this->unk_1E0 = 0x661;
+ Actor_ChangeFocus(&this->actor, play, &this->bombShopkeeper->actor);
+ // Don't go by yourself
+ this->textId = 0x661;
break;
case 0x661:
- Actor_ChangeFocus(&this->unk_144->actor, play, &this->actor);
- this->unk_1E0 = 0x662;
+ Actor_ChangeFocus(&this->bombShopkeeper->actor, play, &this->actor);
+ // Can't judge people
+ this->textId = 0x662;
break;
case 0x662:
- Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor);
- this->unk_1E0 = 0x663;
+ Actor_ChangeFocus(&this->actor, play, &this->bombShopkeeper->actor);
+ // I'll go next time
+ this->textId = 0x663;
gSaveContext.save.weekEventReg[73] |= 1;
- this->unk_40A |= 1;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION;
break;
case 0x65A:
- Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor);
- this->unk_1E0 = 0x65B;
+ Actor_ChangeFocus(&this->actor, play, &this->bombShopkeeper->actor);
+ // Don't pick up Bomb bags at night
+ this->textId = 0x65B;
break;
case 0x65B:
- Actor_ChangeFocus(&this->unk_144->actor, play, &this->actor);
- this->unk_1E0 = 0x65C;
+ Actor_ChangeFocus(&this->bombShopkeeper->actor, play, &this->actor);
+ // Lifelong dream to sell Big Bomb Bags
+ this->textId = 0x65C;
break;
case 0x65C:
- Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor);
- this->unk_1E0 = 0x65D;
+ Actor_ChangeFocus(&this->actor, play, &this->bombShopkeeper->actor);
+ // I worry about you
+ this->textId = 0x65D;
gSaveContext.save.weekEventReg[73] |= 2;
- this->unk_40A |= 1;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION;
break;
case 0x65E:
- Actor_ChangeFocus(&this->actor, play, &this->unk_144->actor);
- this->unk_1E0 = 0x65F;
- this->unk_40A |= 1;
+ Actor_ChangeFocus(&this->actor, play, &this->bombShopkeeper->actor);
+ // I worry about you
+ this->textId = 0x65F;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION;
break;
case 0x2A34:
if (INV_CONTENT(ITEM_MASK_BLAST) == ITEM_MASK_BLAST) {
- this->unk_40A |= 1;
- this->unk_1E0 = 0x2A36;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION;
+ // Thank you
+ this->textId = 0x2A36;
break;
}
- this->unk_40A |= 0x20;
- this->unk_1E0 = 0x2A35;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_GIVE_BLAST_MASK;
+ // It's a dangerous mask
+ this->textId = 0x2A35;
break;
case 0x2A35:
- this->unk_40A |= 1;
- this->unk_1E0 = 0x2A36;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION;
+ // Thank you
+ this->textId = 0x2A36;
break;
case 0x2A30:
case 0x2A31:
- this->unk_40A |= 1;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION;
break;
}
- Message_StartTextbox(play, this->unk_1E0, &this->actor);
- if (this->unk_40A & 1) {
- if (this->unk_40A & 0x40) {
- this->unk_40A &= ~0x40;
+ Message_StartTextbox(play, this->textId, &this->actor);
+ if (this->stateFlags & BOMB_SHOP_LADY_STATE_END_CONVERSATION) {
+ if (this->stateFlags & BOMB_SHOP_LADY_STATE_GAVE_BLAST_MASK) {
+ this->stateFlags &= ~BOMB_SHOP_LADY_STATE_GAVE_BLAST_MASK;
func_80151BB4(play, 0x33);
}
func_80151BB4(play, 4);
}
}
-void func_80BA8C4C(PlayState* play, u16 nextEntrance) {
+void EnBaba_TriggerTransition(PlayState* play, u16 nextEntrance) {
play->nextEntranceIndex = nextEntrance;
play->unk_1887F = 0x40;
gSaveContext.nextTransition = 0x40;
play->sceneLoadFlag = 0x14;
}
-void func_80BA8C90(EnBaba* this, PlayState* play) {
+void EnBaba_UpdateCollider(EnBaba* this, PlayState* play) {
this->collider.dim.pos.x = this->actor.world.pos.x + 5.0f;
this->collider.dim.pos.y = this->actor.world.pos.y;
this->collider.dim.pos.z = this->actor.world.pos.z + 22.0f;
@@ -272,30 +315,31 @@ void func_80BA8C90(EnBaba* this, PlayState* play) {
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
}
-s32 func_80BA8D2C(EnBaba* this, f32 arg1) {
- s16 sp3E;
- s32 ret = false;
- Vec3f sp2C;
+s32 EnBaba_MoveForward(EnBaba* this, f32 speedTarget) {
+ s16 rotStep;
+ s32 reachedEnd = false;
+ Vec3f point;
- Math_SmoothStepToF(&this->actor.speedXZ, arg1, 0.4f, 1000.0f, 0.0f);
- sp3E = this->actor.speedXZ * 400.0f;
- if (SubS_CopyPointFromPath(this->path, this->unk_1E8, &sp2C) && SubS_MoveActorToPoint(&this->actor, &sp2C, sp3E)) {
- this->unk_1E8++;
- if (this->unk_1E8 >= this->path->count) {
- ret = true;
+ Math_SmoothStepToF(&this->actor.speedXZ, speedTarget, 0.4f, 1000.0f, 0.0f);
+ rotStep = this->actor.speedXZ * 400.0f;
+ if (SubS_CopyPointFromPath(this->path, this->waypoint, &point) &&
+ SubS_MoveActorToPoint(&this->actor, &point, rotStep)) {
+ this->waypoint++;
+ if (this->waypoint >= this->path->count) {
+ reachedEnd = true;
}
}
- return ret;
+ return reachedEnd;
}
-void func_80BA8DF4(EnBaba* this, PlayState* play) {
+void EnBaba_UpdateModel(EnBaba* this, PlayState* play) {
Player* player = GET_PLAYER(play);
Vec3f point;
SkelAnime_Update(&this->skelAnime);
if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer) &&
- !(this->unk_40A & 4)) {
+ !(this->stateFlags & BOMB_SHOP_LADY_STATE_KNOCKED_OVER)) {
point.x = player->actor.world.pos.x;
point.y = player->bodyPartsPos[7].y + 3.0f;
point.z = player->actor.world.pos.z;
@@ -311,214 +355,223 @@ void func_80BA8DF4(EnBaba* this, PlayState* play) {
Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1);
}
- SubS_FillLimbRotTables(play, this->unk_302, this->unk_326, ARRAY_COUNT(this->unk_302));
+ SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY));
- if (this->unk_40A & 2) {
- func_80BA8C90(this, play);
+ if (this->stateFlags & BOMB_SHOP_LADY_STATE_VISIBLE) {
+ EnBaba_UpdateCollider(this, play);
}
}
-s32 func_80BA8F88(EnBaba* this, PlayState* play, ScheduleResult* arg2) {
- u16 sp26 = SCHEDULE_TIME_NOW;
- u16 temp;
- u8 sp23 = ENBABA_GET_3F00(&this->actor);
+s32 EnBaba_InitTimePath(EnBaba* this, PlayState* play, ScheduleOutput* scheduleOutput) {
+ u16 now = SCHEDULE_TIME_NOW;
+ u16 startTime;
+ u8 pathIndex = BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor);
+ u16 numWaypoints;
- if (D_80BAA4A8[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp23, D_80BAA4A8[arg2->result]);
+ if (sSearchTimePathLimit[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, pathIndex, sSearchTimePathLimit[scheduleOutput->result]);
}
if (this->timePath == NULL) {
return false;
}
- if ((this->unk_434 != 0) && (this->timePathTimeSpeed >= 0)) {
- temp = sp26;
+ if ((this->scheduleResult != BOMB_SHOP_LADY_SCH_NONE) && (this->timePathTimeSpeed >= 0)) {
+ startTime = now;
} else {
- temp = arg2->time0;
+ startTime = scheduleOutput->time0;
}
- if (arg2->time1 < temp) {
- this->timePathTotalTime = (temp - arg2->time1) + 0xFFFF;
+ if (scheduleOutput->time1 < startTime) {
+ this->timePathTotalTime = (startTime - scheduleOutput->time1) + (DAY_LENGTH - 1);
} else {
- this->timePathTotalTime = arg2->time1 - temp;
+ this->timePathTotalTime = scheduleOutput->time1 - startTime;
}
- this->timePathElapsedTime = sp26 - temp;
- temp = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1);
- this->timePathWaypointTime = this->timePathTotalTime / temp;
- this->unk_438 = 0;
+ this->timePathElapsedTime = now - startTime;
+
+ numWaypoints = startTime = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1);
+ this->timePathWaypointTime = this->timePathTotalTime / numWaypoints;
+
+ this->timePathIsSetup = false;
this->timePathWaypoint = (this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1);
- this->unk_43C = 0;
+ this->timePathHasReachedEnd = false;
+
return true;
}
-s32 func_80BA9110(EnBaba* this, PlayState* play, ScheduleResult* arg2) {
- s32 ret;
+s32 EnBaba_ProcessScheduleOutput(EnBaba* this, PlayState* play, ScheduleOutput* scheduleOutput) {
+ s32 success;
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
default:
- ret = false;
+ success = false;
break;
- case 2:
- ret = func_80BA8F88(this, play, arg2);
+ case BOMB_SHOP_LADY_SCH_FOLLOW_TIME_PATH:
+ success = EnBaba_InitTimePath(this, play, scheduleOutput);
break;
- case 1:
- ret = true;
+ case BOMB_SHOP_LADY_SCH_KNOCKED_OVER:
+ success = true;
break;
}
- return ret;
+ return success;
}
-s32 func_80BA9160(EnBaba* this, PlayState* play) {
- f32 knots[265];
- Vec3f sp70;
- Vec3f sp64;
- Vec3f timePathTargetPos;
- s32 sp54 = 0;
- s32 sp50 = 0;
+s32 EnBaba_FollowTimePath(EnBaba* this, PlayState* play) {
+ f32 weightArray[265];
+ Vec3f worldPos;
+ Vec3f timePathPointNew; // used to compute yaw after update
+ Vec3f timePathPoint; // used in setup and to store a backup before update
+ s32 prevTimePathElapsedTime = 0;
+ s32 prevTimePathWaypoint = 0;
s32 pad;
- SubS_TimePathing_FillKnots(knots, SUBS_TIME_PATHING_ORDER, this->timePath->count + SUBS_TIME_PATHING_ORDER);
+ SubS_TimePathing_FillKnots(weightArray, SUBS_TIME_PATHING_ORDER, this->timePath->count + SUBS_TIME_PATHING_ORDER);
- if (this->unk_438 == 0) {
- timePathTargetPos = gZeroVec3f;
+ if (!this->timePathIsSetup) {
+ timePathPoint = gZeroVec3f;
SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime,
- this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint, knots,
- &timePathTargetPos, this->timePathTimeSpeed);
- SubS_TimePathing_ComputeInitialY(play, this->timePath, this->timePathWaypoint, &timePathTargetPos);
- this->actor.world.pos.y = timePathTargetPos.y;
- this->unk_438 = 1;
+ this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint,
+ weightArray, &timePathPoint, this->timePathTimeSpeed);
+ SubS_TimePathing_ComputeInitialY(play, this->timePath, this->timePathWaypoint, &timePathPoint);
+ this->actor.world.pos.y = timePathPoint.y;
+ this->timePathIsSetup = true;
} else {
- timePathTargetPos = this->timePathTargetPos;
+ timePathPoint = this->timePathPoint;
}
- this->actor.world.pos.x = timePathTargetPos.x;
- this->actor.world.pos.z = timePathTargetPos.z;
+ this->actor.world.pos.x = timePathPoint.x;
+ this->actor.world.pos.z = timePathPoint.z;
if (SubS_InCsMode(play)) {
- sp54 = this->timePathElapsedTime;
- sp50 = this->timePathWaypoint;
- timePathTargetPos = this->actor.world.pos;
+ prevTimePathElapsedTime = this->timePathElapsedTime;
+ prevTimePathWaypoint = this->timePathWaypoint;
+ timePathPoint = this->actor.world.pos;
}
- this->timePathTargetPos = gZeroVec3f;
+ this->timePathPoint = gZeroVec3f;
if (SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime,
- this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint, knots,
- &this->timePathTargetPos, this->timePathTimeSpeed)) {
- this->unk_43C = 1;
+ this->timePathWaypointTime, this->timePathTotalTime, &this->timePathWaypoint,
+ weightArray, &this->timePathPoint, this->timePathTimeSpeed)) {
+ this->timePathHasReachedEnd = true;
} else {
- sp70 = this->actor.world.pos;
- sp64 = this->timePathTargetPos;
- this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64);
+ worldPos = this->actor.world.pos;
+ timePathPointNew = this->timePathPoint;
+ this->actor.world.rot.y = Math_Vec3f_Yaw(&worldPos, &timePathPointNew);
}
if (SubS_InCsMode(play)) {
- this->timePathElapsedTime = sp54;
- this->timePathWaypoint = sp50;
- this->timePathTargetPos = timePathTargetPos;
+ this->timePathElapsedTime = prevTimePathElapsedTime;
+ this->timePathWaypoint = prevTimePathWaypoint;
+ this->timePathPoint = timePathPoint;
}
return false;
}
-void func_80BA93AC(EnBaba* this, PlayState* play) {
- if (this->unk_434 != 1) {
- if (this->unk_434 == 2) {
+void EnBaba_HandleSchedule(EnBaba* this, PlayState* play) {
+ switch (this->scheduleResult) {
+ case BOMB_SHOP_LADY_SCH_FOLLOW_TIME_PATH:
gSaveContext.save.weekEventReg[58] |= 0x40;
- this->unk_40A |= 2;
- func_80BA9160(this, play);
- }
- } else {
- this->unk_40C = 3;
- this->unk_1E0 = 10800;
- this->actor.speedXZ = 0.0f;
- Enemy_StartFinishingBlow(play, &this->actor);
- this->unk_40A |= 4;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_40C);
- this->actionFunc = func_80BA9CD4;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE;
+ EnBaba_FollowTimePath(this, play);
+ break;
+
+ case BOMB_SHOP_LADY_SCH_KNOCKED_OVER:
+ this->animIndex = BOMB_SHOP_LADY_ANIM_KNOCKED_OVER;
+ // Ouch
+ this->textId = 0x2A30;
+ this->actor.speedXZ = 0.0f;
+ Enemy_StartFinishingBlow(play, &this->actor);
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_KNOCKED_OVER;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex);
+ this->actionFunc = EnBaba_KnockedOver;
+ break;
}
Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 4, 0x1554);
}
-void func_80BA9480(EnBaba* this, PlayState* play) {
+void EnBaba_FinishInit(EnBaba* this, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gBbaSkel, &gBbaWalkingHoldingBagAnim, this->jointTable,
- this->morphTable, 0x12);
+ this->morphTable, BBA_LIMB_MAX);
this->actor.draw = EnBaba_Draw;
- this->unk_40A |= 0x80;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_DRAW_SHADOW;
this->actor.flags |= ACTOR_FLAG_1;
if (play->sceneNum == SCENE_BOMYA) {
- this->unk_40A |= 2;
- this->unk_40C = 1;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1);
- this->actionFunc = func_80BA9758;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE;
+ this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex);
+ this->actionFunc = EnBaba_Idle;
} else if (play->sceneNum == SCENE_BACKTOWN) {
- if ((ENBABA_GET_C000(&this->actor) == ENBABA_C000_0) && (gSaveContext.save.entranceIndex != 0xD670) &&
- ((ENBABA_GET_3F00(&this->actor)) != ENBABA_3F00_3F)) {
+ if ((BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_FOLLOW_SCHEDULE) &&
+ (gSaveContext.save.entranceIndex != 0xD670) && (BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor) != 0x3F)) {
if ((gSaveContext.save.weekEventReg[58] & 0x40) ||
- (!(gSaveContext.save.time < CLOCK_TIME(0, 20)) && (gSaveContext.save.time < CLOCK_TIME(6, 0)))) {
+ (gSaveContext.save.time >= CLOCK_TIME(0, 20) && (gSaveContext.save.time < CLOCK_TIME(6, 0)))) {
Actor_MarkForDeath(&this->actor);
return;
}
- this->unk_404 = 50;
- this->unk_40C = 2;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2);
- this->actionFunc = func_80BA9B80;
- } else if ((ENBABA_GET_C000(&this->actor) == ENBABA_C000_1) && (gSaveContext.save.entranceIndex == 0xD670)) {
+ this->sakonDeadTimer = 50;
+ this->animIndex = BOMB_SHOP_LADY_ANIM_WALKING_HOLDING_BAG;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex);
+ this->actionFunc = EnBaba_FollowSchedule;
+ } else if ((BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_IDLE) &&
+ (gSaveContext.save.entranceIndex == 0xD670)) {
if (gSaveContext.save.weekEventReg[81] & 2) {
Actor_MarkForDeath(&this->actor);
return;
}
- this->unk_40A |= 2;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE;
if (gSaveContext.save.weekEventReg[33] & 8) {
- this->unk_40C = 0;
+ this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE_HOLDING_BAG;
} else {
- this->unk_40C = 1;
+ this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE;
}
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->unk_40C);
- this->unk_40A |= 8;
- this->actionFunc = func_80BA9758;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex);
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_AUTOTALK;
+ this->actionFunc = EnBaba_Idle;
} else {
Actor_MarkForDeath(&this->actor);
return;
}
} else {
- this->unk_40A |= 2;
- if (ENBABA_GET_C000(&this->actor) == ENBABA_C000_2) {
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE;
+ if (BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_SWAY) {
this->actor.flags &= ~ACTOR_FLAG_1;
- this->unk_40C = 5;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5);
- this->actionFunc = func_80BA9E00;
- } else if ((ENBABA_GET_3F00(&this->actor)) != ENBABA_3F00_3F) {
- this->unk_40C = 2;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2);
- this->actionFunc = func_80BA9E10;
+ this->animIndex = BOMB_SHOP_LADY_ANIM_SWAY;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex);
+ this->actionFunc = EnBaba_DoNothing;
+ } else if (BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor) != 0x3F) {
+ this->animIndex = BOMB_SHOP_LADY_ANIM_WALKING_HOLDING_BAG;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex);
+ this->actionFunc = EnBaba_Walk;
} else {
- this->unk_40C = 0;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0);
- this->actionFunc = func_80BA9E48;
+ this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE_HOLDING_BAG;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex);
+ this->actionFunc = EnBaba_FaceForward;
}
}
}
-void func_80BA9758(EnBaba* this, PlayState* play) {
- if ((this->unk_40A & 8) || (this->unk_144 != NULL) || func_80BA8820(this, play)) {
+void EnBaba_Idle(EnBaba* this, PlayState* play) {
+ if ((this->stateFlags & BOMB_SHOP_LADY_STATE_AUTOTALK) || (this->bombShopkeeper != NULL) ||
+ EnBaba_FindBombShopkeeper(this, play)) {
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
- func_80BA886C(this, play);
- if (this->unk_40A & 8) {
+ EnBaba_HandleConversation(this, play);
+ if (this->stateFlags & BOMB_SHOP_LADY_STATE_AUTOTALK) {
this->actor.flags &= ~ACTOR_FLAG_10000;
}
- this->actionFunc = func_80BA98EC;
+ this->actionFunc = EnBaba_Talk;
} else if (this->actor.xzDistToPlayer < 100.0f) {
- if (this->unk_40A & 8) {
+ if (this->stateFlags & BOMB_SHOP_LADY_STATE_AUTOTALK) {
this->actor.flags |= ACTOR_FLAG_10000;
}
func_800B8614(&this->actor, play, 100.0f);
@@ -526,99 +579,100 @@ void func_80BA9758(EnBaba* this, PlayState* play) {
}
}
-void func_80BA9848(EnBaba* this, PlayState* play) {
- u8 temp_v0 = Message_GetState(&play->msgCtx);
+void EnBaba_FollowSchedule_Talk(EnBaba* this, PlayState* play) {
+ u8 talkState = Message_GetState(&play->msgCtx);
- if (((temp_v0 == 5) || (temp_v0 == 6)) && Message_ShouldAdvance(play)) {
+ if (((talkState == 5) || (talkState == 6)) && Message_ShouldAdvance(play)) {
play->msgCtx.msgMode = 0x43;
play->msgCtx.unk12023 = 4;
- this->actionFunc = func_80BA9B80;
+ this->actionFunc = EnBaba_FollowSchedule;
}
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100);
}
-void func_80BA98EC(EnBaba* this, PlayState* play) {
- u8 temp_v0 = Message_GetState(&play->msgCtx);
+void EnBaba_Talk(EnBaba* this, PlayState* play) {
+ u8 talkState = Message_GetState(&play->msgCtx);
- if (temp_v0 == 5) {
+ if (talkState == 5) {
if (Message_ShouldAdvance(play)) {
- if (this->unk_40A & 1) {
- this->unk_40A &= ~1;
+ if (this->stateFlags & BOMB_SHOP_LADY_STATE_END_CONVERSATION) {
+ this->stateFlags &= ~BOMB_SHOP_LADY_STATE_END_CONVERSATION;
play->msgCtx.msgMode = 0x43;
play->msgCtx.unk12023 = 4;
- if (this->unk_40A & 8) {
+ if (this->stateFlags & BOMB_SHOP_LADY_STATE_AUTOTALK) {
if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) {
if (play->msgCtx.unk120B1 == 0) {
gSaveContext.save.weekEventReg[81] |= 2;
- func_80BA8C4C(play, 0xD670);
+ EnBaba_TriggerTransition(play, 0xD670);
return;
}
} else {
gSaveContext.save.weekEventReg[81] |= 2;
- func_80BA8C4C(play, 0xD670);
+ EnBaba_TriggerTransition(play, 0xD670);
}
} else {
- this->unk_1E0 = 0;
- this->actionFunc = func_80BA9758;
+ this->textId = 0;
+ this->actionFunc = EnBaba_Idle;
}
- } else if (this->unk_40A & 0x20) {
- this->unk_40A &= ~0x20;
+ } else if (this->stateFlags & BOMB_SHOP_LADY_STATE_GIVE_BLAST_MASK) {
+ this->stateFlags &= ~BOMB_SHOP_LADY_STATE_GIVE_BLAST_MASK;
play->msgCtx.msgMode = 0x43;
play->msgCtx.unk12023 = 4;
- this->actionFunc = func_80BA9AB8;
+ this->actionFunc = EnBaba_GiveBlastMask;
} else {
- func_80BA886C(this, play);
+ EnBaba_HandleConversation(this, play);
}
}
- } else if (temp_v0 == 6) {
+ } else if (talkState == 6) {
if (Message_ShouldAdvance(play) && (play->msgCtx.unk120B1 == 0)) {
gSaveContext.save.weekEventReg[81] |= 2;
- func_80BA8C4C(play, 0xD670);
+ EnBaba_TriggerTransition(play, 0xD670);
}
}
}
-void func_80BA9AB8(EnBaba* this, PlayState* play) {
+void EnBaba_GiveBlastMask(EnBaba* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
- this->unk_40A |= 0x40;
- this->actionFunc = func_80BA9B24;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_GAVE_BLAST_MASK;
+ this->actionFunc = EnBaba_GaveBlastMask;
} else {
Actor_PickUp(&this->actor, play, GI_MASK_BLAST, 300.0f, 300.0f);
}
}
-void func_80BA9B24(EnBaba* this, PlayState* play) {
+void EnBaba_GaveBlastMask(EnBaba* this, PlayState* play) {
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
- func_80BA886C(this, play);
- this->actionFunc = func_80BA98EC;
+ EnBaba_HandleConversation(this, play);
+ this->actionFunc = EnBaba_Talk;
} else {
- func_800B85E0(&this->actor, play, 400.0f, -1);
+ func_800B85E0(&this->actor, play, 400.0f, EXCH_ITEM_MINUS1);
}
}
-void func_80BA9B80(EnBaba* this, PlayState* play) {
- ScheduleResult sp20;
+void EnBaba_FollowSchedule(EnBaba* this, PlayState* play) {
+ ScheduleOutput scheduleOutput;
this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed);
- if (!Schedule_RunScript(play, D_80BAA488, &sp20) ||
- ((this->unk_434 != sp20.result) && !func_80BA9110(this, play, &sp20))) {
- this->unk_40A &= ~0x80;
+ if (!Schedule_RunScript(play, sSchedule, &scheduleOutput) ||
+ ((this->scheduleResult != scheduleOutput.result) &&
+ !EnBaba_ProcessScheduleOutput(this, play, &scheduleOutput))) {
+ this->stateFlags &= ~BOMB_SHOP_LADY_STATE_DRAW_SHADOW;
this->actor.flags &= ~ACTOR_FLAG_1;
- sp20.result = false;
+ scheduleOutput.result = BOMB_SHOP_LADY_SCH_NONE;
} else {
- this->unk_40A |= 0x80;
+ this->stateFlags |= BOMB_SHOP_LADY_STATE_DRAW_SHADOW;
this->actor.flags |= ACTOR_FLAG_1;
}
- this->unk_434 = sp20.result;
+ this->scheduleResult = scheduleOutput.result;
- func_80BA93AC(this, play);
+ EnBaba_HandleSchedule(this, play);
- if (this->unk_40A & 2) {
+ if (this->stateFlags & BOMB_SHOP_LADY_STATE_VISIBLE) {
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
Message_StartTextbox(play, 0x2A39, &this->actor); // "I'm sorry"
- this->actionFunc = func_80BA9848;
+ this->actionFunc = EnBaba_FollowSchedule_Talk;
} else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) {
func_800B863C(&this->actor, play);
}
@@ -626,42 +680,42 @@ void func_80BA9B80(EnBaba* this, PlayState* play) {
Actor_MoveWithGravity(&this->actor);
}
-void func_80BA9CD4(EnBaba* this, PlayState* play) {
- s16 sp2E = this->skelAnime.curFrame;
- s16 sp2C = Animation_GetLastFrame(sAnimations[this->unk_40C].animation);
+void EnBaba_KnockedOver(EnBaba* this, PlayState* play) {
+ s16 curFrame = this->skelAnime.curFrame;
+ s16 endFrame = Animation_GetLastFrame(sAnimations[this->animIndex].animation);
this->collider.dim.height = 37;
this->collider.dim.radius = 23;
- if (this->unk_40C == 3) {
+ if (this->animIndex == BOMB_SHOP_LADY_ANIM_KNOCKED_OVER) {
if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_BBVO00);
}
- if (sp2E == sp2C) {
- this->unk_40C = 4;
- Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 4);
+ if (curFrame == endFrame) {
+ this->animIndex = BOMB_SHOP_LADY_ANIM_LYING_DOWN;
+ Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animIndex);
}
} else {
- if ((gSaveContext.save.weekEventReg[79] & 0x40) && (DECR(this->unk_404) == 0)) {
+ if ((gSaveContext.save.weekEventReg[79] & 0x40) && (DECR(this->sakonDeadTimer) == 0)) {
Audio_QueueSeqCmd(0x101400FF);
- func_80BA8C4C(play, 0xD670);
+ EnBaba_TriggerTransition(play, 0xD670);
} else {
Actor_MoveWithGravity(&this->actor);
}
}
}
-void func_80BA9E00(EnBaba* this, PlayState* play) {
+void EnBaba_DoNothing(EnBaba* this, PlayState* play) {
}
-void func_80BA9E10(EnBaba* this, PlayState* play) {
- if (func_80BA8D2C(this, 1.0f)) {
- this->unk_1E8 = 0;
+void EnBaba_Walk(EnBaba* this, PlayState* play) {
+ if (EnBaba_MoveForward(this, 1.0f)) {
+ this->waypoint = 0;
}
}
-void func_80BA9E48(EnBaba* this, PlayState* play) {
+void EnBaba_FaceForward(EnBaba* this, PlayState* play) {
this->actor.shape.rot = this->actor.world.rot;
}
@@ -673,13 +727,13 @@ void EnBaba_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
- this->path = SubS_GetPathByIndex(play, ENBABA_GET_3F00(&this->actor), ENBABA_3F00_3F);
+ this->path = SubS_GetPathByIndex(play, BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor), 0x3F);
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = 0;
this->actor.gravity = -4.0f;
- this->actionFunc = func_80BA9480;
+ this->actionFunc = EnBaba_FinishInit;
}
void EnBaba_Destroy(Actor* thisx, PlayState* play) {
@@ -694,46 +748,48 @@ void EnBaba_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4);
- func_80BA8DF4(this, play);
+ EnBaba_UpdateModel(this, play);
}
s32 EnBaba_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnBaba* this = THIS;
- if (limbIndex == 6) {
+ if (limbIndex == BBA_LIMB_NECK) {
Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateXS(this->headRot.y, MTXMODE_APPLY);
Matrix_RotateZS(-this->headRot.x, MTXMODE_APPLY);
Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
- if (limbIndex == 5) {
+ if (limbIndex == BBA_LIMB_UPPER_ROOT) {
Matrix_RotateXS(-this->torsoRot.y, MTXMODE_APPLY);
Matrix_RotateZS(-this->torsoRot.x, MTXMODE_APPLY);
}
- if ((limbIndex == 6) && (this->unk_1E2 != 0) && ((play->state.frames % 2) == 0)) {
+ if ((limbIndex == BBA_LIMB_NECK) && (this->inMsgState3 != 0) && ((play->state.frames % 2) == 0)) {
Matrix_Translate(40.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
- if ((limbIndex == 5) || (limbIndex == 10) || (limbIndex == 14)) {
- rot->y += (s16)(Math_SinS(this->unk_302[limbIndex]) * 200.0f);
- rot->z += (s16)(Math_CosS(this->unk_326[limbIndex]) * 200.0f);
+ if ((limbIndex == BBA_LIMB_UPPER_ROOT) || (limbIndex == BBA_LIMB_LEFT_UPPER_ARM) ||
+ (limbIndex == BBA_LIMB_RIGHT_UPPER_ARM)) {
+ rot->y += (s16)(Math_SinS(this->limbRotTableY[limbIndex]) * 200.0f);
+ rot->z += (s16)(Math_CosS(this->limbRotTableZ[limbIndex]) * 200.0f);
}
- if (((this->unk_40C == 1) || (this->unk_40C == 3) || (this->unk_40C == 4) ||
- (ENBABA_GET_C000(&this->actor) == ENBABA_C000_2)) &&
- (limbIndex == 8)) {
+ if (((this->animIndex == BOMB_SHOP_LADY_ANIM_IDLE) || (this->animIndex == BOMB_SHOP_LADY_ANIM_KNOCKED_OVER) ||
+ (this->animIndex == BOMB_SHOP_LADY_ANIM_LYING_DOWN) ||
+ (BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_SWAY)) &&
+ (limbIndex == BBA_LIMB_BAG)) {
*dList = NULL;
}
- return 0;
+ return false;
}
void EnBaba_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
EnBaba* this = THIS;
Vec3f sp18 = { 0.0f, 0.0f, 0.0f };
- if (limbIndex == 7) {
+ if (limbIndex == BBA_LIMB_HEAD) {
this->actor.focus.pos.x = this->actor.world.pos.x;
this->actor.focus.pos.y = this->actor.world.pos.y;
this->actor.focus.pos.z = this->actor.world.pos.z;
@@ -747,10 +803,10 @@ void EnBaba_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
void EnBaba_Draw(Actor* thisx, PlayState* play) {
s32 pad;
EnBaba* this = THIS;
- Vec3f sp4C;
- Vec3f sp40;
+ Vec3f pos;
+ Vec3f scale;
- if (this->unk_40A & 2) {
+ if (this->stateFlags & BOMB_SHOP_LADY_STATE_VISIBLE) {
OPEN_DISPS(play->state.gfxCtx);
func_8012C5B0(play->state.gfxCtx);
@@ -761,18 +817,19 @@ void EnBaba_Draw(Actor* thisx, PlayState* play) {
this->skelAnime.dListCount, EnBaba_OverrideLimbDraw, EnBaba_PostLimbDraw,
EnBaba_TransformLimbDraw, &this->actor);
- if (this->unk_40A & 0x80) {
- if ((this->unk_40C == 3) || (this->unk_40C == 4)) {
+ if (this->stateFlags & BOMB_SHOP_LADY_STATE_DRAW_SHADOW) {
+ if ((this->animIndex == BOMB_SHOP_LADY_ANIM_KNOCKED_OVER) ||
+ (this->animIndex == BOMB_SHOP_LADY_ANIM_LYING_DOWN)) {
func_8012C2DC(play->state.gfxCtx);
- sp4C.x = this->actor.world.pos.x + 20.0f;
- sp4C.y = this->actor.world.pos.y;
- sp4C.z = this->actor.world.pos.z + 20.0f;
+ pos.x = this->actor.world.pos.x + 20.0f;
+ pos.y = this->actor.world.pos.y;
+ pos.z = this->actor.world.pos.z + 20.0f;
} else {
- sp4C = this->actor.world.pos;
+ pos = this->actor.world.pos;
}
- sp40.x = sp40.y = sp40.z = 0.3f;
- func_800BC620(&sp4C, &sp40, 255, play);
+ scale.x = scale.y = scale.z = 0.3f;
+ func_800BC620(&pos, &scale, 255, play);
}
CLOSE_DISPS(play->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.h b/src/overlays/actors/ovl_En_Baba/z_en_baba.h
index 0b39fc50b3..2335dcb70f 100644
--- a/src/overlays/actors/ovl_En_Baba/z_en_baba.h
+++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.h
@@ -2,58 +2,60 @@
#define Z_EN_BABA_H
#include "global.h"
+#include "overlays/actors/ovl_En_Sob1/z_en_sob1.h"
+#include "objects/object_bba/object_bba.h"
struct EnBaba;
typedef void (*EnBabaActionFunc)(struct EnBaba*, PlayState*);
-#define ENBABA_GET_3F00(thisx) (((thisx)->params & 0x3F00) >> 8)
-#define ENBABA_GET_C000(thisx) (((thisx)->params & 0xC000) >> 0xE)
+#define BOMB_SHOP_LADY_GET_PATH_INDEX(thisx) (((thisx)->params & 0x3F00) >> 8)
+#define BOMB_SHOP_LADY_GET_TYPE(thisx) (((thisx)->params & 0xC000) >> 0xE)
-#define ENBABA_3F00_3F 0x3F
-
-enum {
- /* 0 */ ENBABA_C000_0,
- /* 1 */ ENBABA_C000_1,
- /* 2 */ ENBABA_C000_2,
-};
+// Types BOMB_SHOP_LADY_TYPE_FOLLOW_SCHEDULE and BOMB_SHOP_LADY_TYPE_IDLE can only be used in SCENE_BACKTOWN
+// Type BOMB_SHOP_LADY_TYPE_SWAY can be used anywhere except SCENE_BACKTOWN and SCENE_BOMYA
+typedef enum {
+ /* 0 */ BOMB_SHOP_LADY_TYPE_FOLLOW_SCHEDULE,
+ /* 1 */ BOMB_SHOP_LADY_TYPE_IDLE,
+ /* 2 */ BOMB_SHOP_LADY_TYPE_SWAY
+} BombShopLadyType;
typedef struct EnBaba {
/* 0x000 */ Actor actor;
- /* 0x144 */ struct EnOssan* unk_144;
+ /* 0x144 */ EnSob1* bombShopkeeper;
/* 0x148 */ EnBabaActionFunc actionFunc;
/* 0x14C */ UNK_TYPE1 unk14C[4];
/* 0x150 */ SkelAnime skelAnime;
/* 0x194 */ ColliderCylinder collider;
- /* 0x1E0 */ u16 unk_1E0;
- /* 0x1E2 */ u8 unk_1E2;
+ /* 0x1E0 */ u16 textId;
+ /* 0x1E2 */ u8 inMsgState3;
/* 0x1E4 */ Path* path;
- /* 0x1E8 */ s16 unk_1E8;
+ /* 0x1E8 */ s16 waypoint;
/* 0x1EA */ UNK_TYPE1 unk1EA[0x1C];
- /* 0x206 */ Vec3s jointTable[18];
- /* 0x272 */ Vec3s morphTable[18];
+ /* 0x206 */ Vec3s jointTable[BBA_LIMB_MAX];
+ /* 0x272 */ Vec3s morphTable[BBA_LIMB_MAX];
/* 0x2DE */ Vec3s trackTarget;
/* 0x2E4 */ Vec3s headRot;
/* 0x2EA */ Vec3s torsoRot;
/* 0x2F0 */ UNK_TYPE1 unk2F0[0x12];
- /* 0x302 */ s16 unk_302[18];
- /* 0x326 */ s16 unk_326[18];
+ /* 0x302 */ s16 limbRotTableY[18];
+ /* 0x326 */ s16 limbRotTableZ[18];
/* 0x34A */ UNK_TYPE1 unk34A[0xBA];
- /* 0x404 */ s16 unk_404;
+ /* 0x404 */ s16 sakonDeadTimer;
/* 0x406 */ UNK_TYPE1 unk406[4];
- /* 0x40A */ u16 unk_40A;
- /* 0x40C */ s32 unk_40C;
+ /* 0x40A */ u16 stateFlags;
+ /* 0x40C */ s32 animIndex;
/* 0x410 */ Path* timePath;
- /* 0x414 */ Vec3f timePathTargetPos;
+ /* 0x414 */ Vec3f timePathPoint;
/* 0x420 */ f32 timePathProgress;
/* 0x424 */ s32 timePathTotalTime;
/* 0x428 */ s32 timePathWaypointTime;
/* 0x42C */ s32 timePathWaypoint;
/* 0x430 */ s32 timePathElapsedTime;
- /* 0x434 */ u8 unk_434;
+ /* 0x434 */ u8 scheduleResult;
/* 0x436 */ s16 timePathTimeSpeed;
- /* 0x438 */ s32 unk_438;
- /* 0x43C */ s32 unk_43C;
+ /* 0x438 */ s32 timePathIsSetup;
+ /* 0x43C */ s32 timePathHasReachedEnd;
} EnBaba; // size = 0x440
extern const ActorInit En_Baba_InitVars;
diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c
index 071e879aa8..4bf72dafe3 100644
--- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c
+++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c
@@ -162,7 +162,7 @@ void EnBba01_FinishInit(EnHy* this, PlayState* play) {
this->actor.flags |= ACTOR_FLAG_1;
this->actor.draw = EnBba01_Draw;
this->waitingOnInit = false;
- if (ENBBA01_GET_PATH(&this->actor) == ENBBA01_NO_PATH) {
+ if (ENBBA01_GET_PATH(&this->actor) == 0x3F) {
this->actionFunc = EnBba01_FaceFoward;
} else {
this->actionFunc = EnBba01_Walk;
@@ -225,7 +225,7 @@ void EnBba01_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->enHy.collider, &this->enHy.actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->enHy.actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
this->enHy.actor.flags &= ~ACTOR_FLAG_1;
- this->enHy.path = SubS_GetPathByIndex(play, ENBBA01_GET_PATH(&this->enHy.actor), ENBBA01_NO_PATH);
+ this->enHy.path = SubS_GetPathByIndex(play, ENBBA01_GET_PATH(&this->enHy.actor), 0x3F);
this->enHy.waitingOnInit = true;
Actor_SetScale(&this->enHy.actor, 0.01f);
this->enHy.actionFunc = EnBba01_FinishInit;
diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h
index 04bab2ff12..c9030f1125 100644
--- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h
+++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h
@@ -8,7 +8,6 @@ struct EnBba01;
typedef void (*EnBba01ActionFunc)(struct EnBba01*, PlayState*);
#define ENBBA01_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9)
-#define ENBBA01_NO_PATH 0x3F
typedef struct EnBba01 {
/* 0x000 */ EnHy enHy;
diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c
index a0f597229c..d4b3670cee 100644
--- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c
+++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c
@@ -152,7 +152,7 @@ void EnCne01_FinishInit(EnHy* this, PlayState* play) {
this->actor.flags |= ACTOR_FLAG_1;
this->actor.draw = EnCne01_Draw;
this->waitingOnInit = false;
- if (ENCNE01_GET_PATH(&this->actor) == ENCNE01_NO_PATH) {
+ if (ENCNE01_GET_PATH(&this->actor) == 0x3F) {
this->actionFunc = EnCne01_FaceForward;
} else {
this->actionFunc = EnCne01_Walk;
@@ -215,7 +215,7 @@ void EnCne01_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->enHy.collider, &this->enHy.actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->enHy.actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
this->enHy.actor.flags &= ~ACTOR_FLAG_1;
- this->enHy.path = SubS_GetPathByIndex(play, ENCNE01_GET_PATH(&this->enHy.actor), ENCNE01_NO_PATH);
+ this->enHy.path = SubS_GetPathByIndex(play, ENCNE01_GET_PATH(&this->enHy.actor), 0x3F);
this->enHy.waitingOnInit = true;
Actor_SetScale(&this->enHy.actor, 0.01f);
this->enHy.actionFunc = EnCne01_FinishInit;
diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h
index c2ce1c8612..0b9e1e08b8 100644
--- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h
+++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h
@@ -8,7 +8,6 @@ struct EnCne01;
typedef void (*EnCne01ActionFunc)(struct EnCne01*, PlayState*);
#define ENCNE01_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9)
-#define ENCNE01_NO_PATH 0x3F
typedef struct EnCne01 {
/* 0x000 */ EnHy enHy;
diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c
index 8a2fff41a9..d9bc5cee1c 100644
--- a/src/overlays/actors/ovl_En_Door/z_en_door.c
+++ b/src/overlays/actors/ovl_En_Door/z_en_door.c
@@ -532,7 +532,7 @@ void func_80866B20(EnDoor* this, PlayState* play) {
this->dyna.actor.textId = baseTextId + textIdOffset;
}
} else if ((this->unk_1A4 == 5) && (playerPosRelToDoor.z > 0.0f)) {
- ScheduleResult sp30;
+ ScheduleOutput sp30;
if (Schedule_RunScript(play, D_8086778C[this->switchFlag], &sp30) != 0) {
this->dyna.actor.textId = sp30.result + 0x1800;
diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
index 4f3076bb69..6517f4fe1d 100644
--- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
+++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c
@@ -53,20 +53,20 @@ typedef enum {
} EnFsnCutsceneState;
typedef enum {
- /* 00 */ FSN_ANIMATION_IDLE,
- /* 01 */ FSN_ANIMATION_SCRATCH_BACK,
- /* 02 */ FSN_ANIMATION_TURN_AROUND_FORWARD,
- /* 03 */ FSN_ANIMATION_TURN_AROUND_REVERSE,
- /* 04 */ FSN_ANIMATION_HANDS_ON_COUNTER_START,
- /* 05 */ FSN_ANIMATION_HANDS_ON_COUNTER_LOOP,
- /* 06 */ FSN_ANIMATION_HAND_ON_FACE_START,
- /* 07 */ FSN_ANIMATION_HAND_ON_FACE_LOOP,
- /* 08 */ FSN_ANIMATION_LEAN_FORWARD_START,
- /* 09 */ FSN_ANIMATION_LEAN_FORWARD_LOOP,
- /* 10 */ FSN_ANIMATION_SLAM_COUNTER_START,
- /* 11 */ FSN_ANIMATION_SLAM_COUNTER_LOOP,
- /* 12 */ FSN_ANIMATION_MAKE_OFFER,
- /* 13 */ FSN_ANIMATION_MAX
+ /* 0 */ FSN_ANIM_IDLE,
+ /* 1 */ FSN_ANIM_SCRATCH_BACK,
+ /* 2 */ FSN_ANIM_TURN_AROUND_FORWARD,
+ /* 3 */ FSN_ANIM_TURN_AROUND_REVERSE,
+ /* 4 */ FSN_ANIM_HANDS_ON_COUNTER_START,
+ /* 5 */ FSN_ANIM_HANDS_ON_COUNTER_LOOP,
+ /* 6 */ FSN_ANIM_HAND_ON_FACE_START,
+ /* 7 */ FSN_ANIM_HAND_ON_FACE_LOOP,
+ /* 8 */ FSN_ANIM_LEAN_FORWARD_START,
+ /* 9 */ FSN_ANIM_LEAN_FORWARD_LOOP,
+ /* 10 */ FSN_ANIM_SLAM_COUNTER_START,
+ /* 11 */ FSN_ANIM_SLAM_COUNTER_LOOP,
+ /* 12 */ FSN_ANIM_MAKE_OFFER,
+ /* 13 */ FSN_ANIM_MAX
} FsnAnimation;
const ActorInit En_Fsn_InitVars = {
@@ -711,7 +711,7 @@ void EnFsn_InitShop(EnFsn* this, PlayState* play) {
this->stickAnimTween = this->arrowAnimTween = 0.0f;
}
this->blinkTimer = 20;
- this->animationIndex = FSN_ANIMATION_HANDS_ON_COUNTER_START;
+ this->animationIndex = FSN_ANIM_HANDS_ON_COUNTER_START;
this->eyeTextureIdx = 0;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex);
this->actionFunc = EnFsn_Idle;
@@ -720,11 +720,11 @@ void EnFsn_InitShop(EnFsn* this, PlayState* play) {
void EnFsn_Idle(EnFsn* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- if (this->animationIndex == FSN_ANIMATION_HANDS_ON_COUNTER_START) {
+ if (this->animationIndex == FSN_ANIM_HANDS_ON_COUNTER_START) {
s16 curFrame = this->skelAnime.curFrame;
s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation);
if (curFrame == frameCount) {
- this->animationIndex = FSN_ANIMATION_HANDS_ON_COUNTER_LOOP;
+ this->animationIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex);
}
return;
@@ -762,24 +762,24 @@ void EnFsn_Haggle(EnFsn* this, PlayState* play) {
if (this->flags & ENFSN_ANGRY) {
this->flags &= ~ENFSN_ANGRY;
- this->animationIndex = FSN_ANIMATION_SLAM_COUNTER_LOOP;
+ this->animationIndex = FSN_ANIM_SLAM_COUNTER_LOOP;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex);
} else {
- if (this->animationIndex == FSN_ANIMATION_SLAM_COUNTER_LOOP && Animation_OnFrame(&this->skelAnime, 18.0f)) {
+ if (this->animationIndex == FSN_ANIM_SLAM_COUNTER_LOOP && Animation_OnFrame(&this->skelAnime, 18.0f)) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO);
}
if (this->flags & ENFSN_CALM_DOWN) {
this->flags &= ~ENFSN_CALM_DOWN;
- this->animationIndex = FSN_ANIMATION_HANDS_ON_COUNTER_LOOP;
+ this->animationIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex);
} else if (this->flags & ENFSN_OFFER_FINAL_PRICE) {
this->flags &= ~ENFSN_OFFER_FINAL_PRICE;
- this->animationIndex = FSN_ANIMATION_MAKE_OFFER;
+ this->animationIndex = FSN_ANIM_MAKE_OFFER;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex);
} else {
- if (this->animationIndex == FSN_ANIMATION_MAKE_OFFER) {
+ if (this->animationIndex == FSN_ANIM_MAKE_OFFER) {
if (curFrame == frameCount) {
- this->animationIndex = FSN_ANIMATION_HANDS_ON_COUNTER_LOOP;
+ this->animationIndex = FSN_ANIM_HANDS_ON_COUNTER_LOOP;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex);
} else {
if (Animation_OnFrame(&this->skelAnime, 28.0f)) {
@@ -1430,7 +1430,7 @@ void EnFsn_Init(Actor* thisx, PlayState* play) {
this->eyeTextureIdx = 0;
this->actor.flags |= ACTOR_FLAG_1;
this->actor.targetMode = 0;
- this->animationIndex = FSN_ANIMATION_IDLE;
+ this->animationIndex = FSN_ANIM_IDLE;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, this->animationIndex);
this->actionFunc = EnFsn_IdleBackroom;
}
diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c
index fbd3a06efd..a1172fb127 100644
--- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c
+++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c
@@ -1027,7 +1027,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) {
Actor_MarkForDeath(&this->actor);
} else {
this->unk_318 = this->actor.cutscene;
- this->path = SubS_GetPathByIndex(play, ENGK_GET_F0(&this->actor), 15);
+ this->path = SubS_GetPathByIndex(play, ENGK_GET_F0(&this->actor), 0xF);
this->actionFunc = func_80B51760;
}
} else if (play->sceneNum == SCENE_GORONRACE) {
diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c
index a23e5f7846..664bbbf10e 100644
--- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c
+++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c
@@ -969,7 +969,7 @@ s32 func_8094F53C(EnGm* this, PlayState* play) {
return false;
}
-s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleResult* arg2, u8 arg3, s16 arg4) {
+s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput, u8 arg3, s16 arg4) {
u8 sp4F = ENGM_GET_FF(&this->actor);
Vec3s* sp48;
Vec3f sp3C;
@@ -981,8 +981,8 @@ s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleResult* arg2, u8 arg3, s1
this->timePath = NULL;
actor = func_8094DEE0(this, play, arg3, arg4);
- if (D_80951A0C[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80951A0C[arg2->result]);
+ if (D_80951A0C[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80951A0C[scheduleOutput->result]);
}
if ((actor != NULL) && (actor->update != NULL)) {
@@ -999,7 +999,7 @@ s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleResult* arg2, u8 arg3, s1
return ret;
}
-s32 func_8094F904(EnGm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_8094F904(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
u16 sp56 = SCHEDULE_TIME_NOW;
u8 sp55 = ENGM_GET_FF(&this->actor);
EnDoor* door;
@@ -1010,10 +1010,10 @@ s32 func_8094F904(EnGm* this, PlayState* play, ScheduleResult* arg2) {
s32 ret = false;
this->timePath = NULL;
- door = func_8094DF90(play, arg2->result);
+ door = func_8094DF90(play, scheduleOutput->result);
- if (D_80951A0C[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp55, D_80951A0C[arg2->result]);
+ if (D_80951A0C[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp55, D_80951A0C[scheduleOutput->result]);
}
if ((door != NULL) && (door->dyna.actor.update != NULL)) {
@@ -1032,8 +1032,8 @@ s32 func_8094F904(EnGm* this, PlayState* play, ScheduleResult* arg2) {
this->unk_261 = 75;
}
- this->unk_3B8 = arg2->time1 - arg2->time0;
- this->unk_3BA = sp56 - arg2->time0;
+ this->unk_3B8 = scheduleOutput->time1 - scheduleOutput->time0;
+ this->unk_3BA = sp56 - scheduleOutput->time0;
this->actor.flags &= ~ACTOR_FLAG_1;
this->unk_3A4 |= 0x100;
this->unk_3A4 |= 0x200;
@@ -1045,16 +1045,17 @@ s32 func_8094F904(EnGm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
u16 sp2E = SCHEDULE_TIME_NOW;
u16 phi_v1;
u8 sp2B = ENGM_GET_FF(&this->actor);
- s32 pad;
+ u16 tmp;
+ s16 pad;
s32 ret = false;
this->timePath = NULL;
- if (D_80951A0C[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80951A0C[arg2->result]);
+ if (D_80951A0C[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80951A0C[scheduleOutput->result]);
}
if ((this->timePath != NULL) && (this->timePath->count < 3)) {
@@ -1065,18 +1066,18 @@ s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleResult* arg2) {
if ((this->unk_258 < 9) && (this->unk_258 != 0) && (this->timePathTimeSpeed >= 0)) {
phi_v1 = sp2E;
} else {
- phi_v1 = arg2->time0;
+ phi_v1 = scheduleOutput->time0;
}
- if (arg2->time1 < phi_v1) {
- this->timePathTotalTime = (phi_v1 - arg2->time1) + 0xFFFF;
+ if (scheduleOutput->time1 < phi_v1) {
+ this->timePathTotalTime = (phi_v1 - scheduleOutput->time1) + 0xFFFF;
} else {
- this->timePathTotalTime = arg2->time1 - phi_v1;
+ this->timePathTotalTime = scheduleOutput->time1 - phi_v1;
}
this->timePathElapsedTime = sp2E - phi_v1;
- phi_v1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1);
- this->timePathWaypointTime = this->timePathTotalTime / phi_v1;
+ tmp = phi_v1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1);
+ this->timePathWaypointTime = this->timePathTotalTime / tmp;
this->timePathWaypoint =
(this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1);
this->unk_3A4 &= ~0x8;
@@ -1091,11 +1092,11 @@ s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_8094FCC4(EnGm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_8094FCC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
static Vec3f D_80951D90 = { 64.0f, 0.0f, -122.0f };
s32 ret = false;
- if (func_8094F7D0(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_TAB)) {
+ if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TAB)) {
if (this->unk_258 == 0) {
Math_Vec3f_Copy(&this->actor.world.pos, &D_80951D90);
SubS_UpdateFlags(&this->unk_3A4, 3, 7);
@@ -1111,10 +1112,10 @@ s32 func_8094FCC4(EnGm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_8094FD88(EnGm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_8094FD88(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
- if (func_8094F7D0(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL)) {
+ if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL)) {
func_8094E054(this, play, 11);
SubS_UpdateFlags(&this->unk_3A4, 3, 7);
this->unk_3A4 |= 0x100;
@@ -1124,12 +1125,13 @@ s32 func_8094FD88(EnGm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
Actor* al;
al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL);
- if (func_8094F7D0(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_TOTO) && (al != NULL) && (al->update != NULL)) {
+ if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TOTO) && (al != NULL) &&
+ (al->update != NULL)) {
func_8094E054(this, play, 11);
SubS_UpdateFlags(&this->unk_3A4, 3, 7);
this->unk_268 = al;
@@ -1145,7 +1147,7 @@ s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
static Vec3f D_80951D9C = { 64.0f, 0.0f, -122.0f };
u8 sp4F = ENGM_GET_FF(&this->actor);
Vec3s* sp48;
@@ -1156,8 +1158,8 @@ s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleResult* arg2) {
this->timePath = NULL;
- if (D_80951A0C[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80951A0C[arg2->result]);
+ if (D_80951A0C[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80951A0C[scheduleOutput->result]);
}
if (this->timePath != NULL) {
@@ -1187,7 +1189,7 @@ s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80950088(EnGm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80950088(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
static Vec3f D_80951DA8 = { 278.0f, 0.0f, 223.0f };
static Vec3s D_80951DB4 = { 0x0000, 0xC000, 0x0000 };
s32 pad;
@@ -1202,7 +1204,7 @@ s32 func_80950088(EnGm* this, PlayState* play, ScheduleResult* arg2) {
return true;
}
-s32 func_80950120(EnGm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80950120(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
static Vec3f D_80951DBC = { -525.0f, 214.0f, 515.0f };
static Vec3s D_80951DC8 = { 0x0000, 0x38E0, 0x0000 };
s32 pad;
@@ -1217,7 +1219,7 @@ s32 func_80950120(EnGm* this, PlayState* play, ScheduleResult* arg2) {
return true;
}
-s32 func_809501B8(EnGm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_809501B8(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
static Vec3f D_80951DD0 = { -334.0f, 225.0f, 903.0f };
static Vec3s D_80951DDC = { 0x0000, 0x7FFF, 0x0000 };
s32 pad;
@@ -1238,7 +1240,7 @@ s32 func_809501B8(EnGm* this, PlayState* play, ScheduleResult* arg2) {
return true;
}
-s32 func_80950280(EnGm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80950280(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 phi_v1;
this->actor.flags |= ACTOR_FLAG_1;
@@ -1249,33 +1251,33 @@ s32 func_80950280(EnGm* this, PlayState* play, ScheduleResult* arg2) {
this->unk_3CC = 8;
this->unk_3B4 = 40.0f;
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
case 1:
- phi_v1 = func_8094FD88(this, play, arg2);
+ phi_v1 = func_8094FD88(this, play, scheduleOutput);
break;
case 2:
- phi_v1 = func_8094FE10(this, play, arg2);
+ phi_v1 = func_8094FE10(this, play, scheduleOutput);
break;
case 3:
- phi_v1 = func_8094FCC4(this, play, arg2);
+ phi_v1 = func_8094FCC4(this, play, scheduleOutput);
break;
case 5:
- phi_v1 = func_8094FF04(this, play, arg2);
+ phi_v1 = func_8094FF04(this, play, scheduleOutput);
break;
case 6:
- phi_v1 = func_80950088(this, play, arg2);
+ phi_v1 = func_80950088(this, play, scheduleOutput);
break;
case 7:
- phi_v1 = func_809501B8(this, play, arg2);
+ phi_v1 = func_809501B8(this, play, scheduleOutput);
break;
case 8:
- phi_v1 = func_80950120(this, play, arg2);
+ phi_v1 = func_80950120(this, play, scheduleOutput);
break;
case 9:
@@ -1290,7 +1292,7 @@ s32 func_80950280(EnGm* this, PlayState* play, ScheduleResult* arg2) {
case 18:
case 19:
case 20:
- phi_v1 = func_8094F904(this, play, arg2);
+ phi_v1 = func_8094F904(this, play, scheduleOutput);
break;
case 21:
@@ -1303,7 +1305,7 @@ s32 func_80950280(EnGm* this, PlayState* play, ScheduleResult* arg2) {
case 28:
case 29:
case 30:
- phi_v1 = func_8094FAC4(this, play, arg2);
+ phi_v1 = func_8094FAC4(this, play, scheduleOutput);
break;
default:
@@ -1576,7 +1578,7 @@ void func_80950C24(EnGm* this, PlayState* play) {
}
void func_80950CDC(EnGm* this, PlayState* play) {
- ScheduleResult sp20;
+ ScheduleOutput sp20;
this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed);
diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c
index 072ec01d40..60b4ab44be 100644
--- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c
+++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c
@@ -496,7 +496,7 @@ s32 func_80BF1B40(EnIg* this, PlayState* play) {
return false;
}
-s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleResult* arg2, s32 arg3, s32 arg4) {
+s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput, s32 arg3, s32 arg4) {
u8 sp4F = ENIG_GET_FF(&this->actor);
Vec3s* sp48;
Vec3f sp3C;
@@ -508,8 +508,8 @@ s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleResult* arg2, s32 arg3, s
sp2C = func_80BF1150(this, play, arg3, arg4);
this->timePath = NULL;
- if (D_80BF3318[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80BF3318[arg2->result]);
+ if (D_80BF3318[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80BF3318[scheduleOutput->result]);
}
if ((sp2C != NULL) && (sp2C->update != NULL)) {
@@ -526,10 +526,10 @@ s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleResult* arg2, s32 arg3, s
return sp24;
}
-s32 func_80BF1D78(EnIg* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BF1D78(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 sp2C = 0;
- if (func_80BF1C44(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_AN)) {
+ if (func_80BF1C44(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_AN)) {
func_80BF1284(this, 0);
SubS_UpdateFlags(&this->unk_3D0, 3, 7);
this->unk_3D0 |= 0x20;
@@ -539,7 +539,7 @@ s32 func_80BF1D78(EnIg* this, PlayState* play, ScheduleResult* arg2) {
return sp2C;
}
-s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
u16 sp56 = SCHEDULE_TIME_NOW;
u8 sp55 = ENIG_GET_FF(&this->actor);
EnDoor* door;
@@ -550,10 +550,10 @@ s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleResult* arg2) {
s32 ret = false;
this->timePath = NULL;
- door = func_80BF1200(play, arg2->result);
+ door = func_80BF1200(play, scheduleOutput->result);
- if (D_80BF3318[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp55, D_80BF3318[arg2->result]);
+ if (D_80BF3318[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp55, D_80BF3318[scheduleOutput->result]);
}
if ((door != NULL) && (door->dyna.actor.update != NULL)) {
@@ -572,8 +572,8 @@ s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleResult* arg2) {
this->unk_2A4 = 75;
}
- this->unk_3E0 = arg2->time1 - arg2->time0;
- this->unk_3E2 = sp56 - arg2->time0;
+ this->unk_3E0 = scheduleOutput->time1 - scheduleOutput->time0;
+ this->unk_3E2 = sp56 - scheduleOutput->time0;
this->actor.flags &= ~ACTOR_FLAG_1;
this->unk_3D0 |= 0x100;
func_80BF1284(this, 3);
@@ -584,17 +584,18 @@ s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
u16 sp2E = SCHEDULE_TIME_NOW;
u16 phi_v1;
u8 sp2B = ENIG_GET_FF(&this->actor);
- s32 pad;
+ u16 tmp;
+ s16 pad;
s32 ret = false;
this->timePath = NULL;
- if (D_80BF3318[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80BF3318[arg2->result]);
+ if (D_80BF3318[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80BF3318[scheduleOutput->result]);
}
if ((this->timePath != NULL) && (this->timePath->count < 3)) {
@@ -605,20 +606,20 @@ s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleResult* arg2) {
if ((this->scheduleResult < 10) && (this->scheduleResult != 0) && (this->timePathTimeSpeed >= 0)) {
phi_v1 = sp2E;
} else {
- phi_v1 = arg2->time0;
+ phi_v1 = scheduleOutput->time0;
}
- if (arg2->time1 < phi_v1) {
- this->timePathTotalTime = (phi_v1 - arg2->time1) + 0xFFFF;
+ if (scheduleOutput->time1 < phi_v1) {
+ this->timePathTotalTime = (phi_v1 - scheduleOutput->time1) + 0xFFFF;
} else {
- this->timePathTotalTime = arg2->time1 - phi_v1;
+ this->timePathTotalTime = scheduleOutput->time1 - phi_v1;
}
this->timePathElapsedTime = sp2E - phi_v1;
- phi_v1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1);
+ tmp = phi_v1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1);
- this->timePathWaypointTime = this->timePathTotalTime / phi_v1;
+ this->timePathWaypointTime = this->timePathTotalTime / tmp;
this->timePathWaypoint =
(this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1);
@@ -633,7 +634,7 @@ s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
u8 sp4F = ENIG_GET_FF(&this->actor);
Vec3f sp40;
Vec3f sp34;
@@ -643,8 +644,8 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleResult* arg2) {
this->timePath = NULL;
- if (D_80BF3318[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80BF3318[arg2->result]);
+ if (D_80BF3318[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80BF3318[scheduleOutput->result]);
}
if ((this->timePath != 0) && (this->timePath->count >= 2)) {
@@ -656,7 +657,7 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleResult* arg2) {
Math_Vec3f_Copy(&this->actor.world.pos, &sp40);
Math_Vec3f_Copy(&this->actor.prevPos, &sp40);
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
case 2:
this->actor.home.rot.y = this->actor.world.rot.y;
this->actor.home.rot.y += 0x8000;
@@ -678,20 +679,20 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80BF2368(EnIg* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BF2368(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
this->actor.targetMode = 0;
this->unk_3D0 = 0;
this->actor.flags |= ACTOR_FLAG_1;
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
case 5:
case 6:
case 7:
case 8:
case 9:
- ret = func_80BF1DF4(this, play, arg2);
+ ret = func_80BF1DF4(this, play, scheduleOutput);
break;
case 10:
@@ -699,16 +700,16 @@ s32 func_80BF2368(EnIg* this, PlayState* play, ScheduleResult* arg2) {
case 12:
case 13:
case 14:
- ret = func_80BF1FA8(this, play, arg2);
+ ret = func_80BF1FA8(this, play, scheduleOutput);
break;
case 2:
case 4:
- ret = func_80BF219C(this, play, arg2);
+ ret = func_80BF219C(this, play, scheduleOutput);
break;
case 3:
- ret = func_80BF1D78(this, play, arg2);
+ ret = func_80BF1D78(this, play, scheduleOutput);
break;
}
return ret;
@@ -873,7 +874,7 @@ void func_80BF2A50(EnIg* this, PlayState* play) {
}
void func_80BF2AF8(EnIg* this, PlayState* play) {
- ScheduleResult sp20;
+ ScheduleOutput sp20;
this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed);
diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.c b/src/overlays/actors/ovl_En_Ja/z_en_ja.c
index 153edf8539..883cbe2516 100644
--- a/src/overlays/actors/ovl_En_Ja/z_en_ja.c
+++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.c
@@ -239,7 +239,7 @@ void func_80BC1E40(EnJa* this, PlayState* play) {
this->unk_374 = sp20;
}
-s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
if (func_80BC1AE0(this, play)) {
@@ -252,7 +252,7 @@ s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80BC203C(EnJa* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BC203C(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
if (func_80BC1AE0(this, play)) {
@@ -269,19 +269,19 @@ s32 func_80BC203C(EnJa* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80BC20D0(EnJa* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BC20D0(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
this->unk_340 = 0;
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
case 1:
- ret = func_80BC1FC8(this, play, arg2);
- if (ret == 1) {}
+ ret = func_80BC1FC8(this, play, scheduleOutput);
+ if (ret == true) {}
break;
case 2:
- ret = func_80BC203C(this, play, arg2);
+ ret = func_80BC203C(this, play, scheduleOutput);
break;
}
return ret;
@@ -299,7 +299,7 @@ void func_80BC2150(EnJa* this, PlayState* play) {
}
void func_80BC21A8(EnJa* this, PlayState* play) {
- ScheduleResult sp18;
+ ScheduleOutput sp18;
this->unk_35C = REG(15) + ((void)0, gSaveContext.save.daySpeed);
if (!Schedule_RunScript(play, D_80BC35F0, &sp18) ||
diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c
index b5e4f95a61..6c50f7ed67 100644
--- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c
+++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c
@@ -1196,7 +1196,7 @@ s32 func_80AF8DD4(EnPm* this, PlayState* play) {
return 0;
}
-s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleResult* arg2, u8 actorCat, s16 actorId) {
+s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput, u8 actorCat, s16 actorId) {
u8 sp4F = this->actor.params & 0xFF;
Vec3s* sp48;
Vec3f sp3C;
@@ -1207,8 +1207,8 @@ s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleResult* arg2, u8 actorCat
this->timePath = NULL;
sp2C = func_80AF7CB0(this, play, actorCat, actorId);
- if (D_80AFB430[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80AFB430[arg2->result]);
+ if (D_80AFB430[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80AFB430[scheduleOutput->result]);
}
if ((sp2C != NULL) && (sp2C->update != NULL)) {
@@ -1226,7 +1226,7 @@ s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleResult* arg2, u8 actorCat
return ret;
}
-s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
u16 sp56 = SCHEDULE_TIME_NOW;
u8 sp55 = this->actor.params & 0xFF;
EnDoor* door;
@@ -1237,9 +1237,9 @@ s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleResult* arg2) {
s32 ret = false;
this->timePath = NULL;
- door = func_80AF7D60(play, arg2->result);
- if (D_80AFB430[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp55, D_80AFB430[arg2->result]);
+ door = func_80AF7D60(play, scheduleOutput->result);
+ if (D_80AFB430[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp55, D_80AFB430[scheduleOutput->result]);
}
if ((door != NULL) && (door->dyna.actor.update != NULL)) {
@@ -1258,8 +1258,8 @@ s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleResult* arg2) {
this->unk_260 = 0x4B;
}
- this->unk_36C = arg2->time1 - arg2->time0;
- this->unk_36E = sp56 - arg2->time0;
+ this->unk_36C = scheduleOutput->time1 - scheduleOutput->time0;
+ this->unk_36E = sp56 - scheduleOutput->time0;
this->actor.flags &= ~ACTOR_FLAG_1;
if (gSaveContext.save.weekEventReg[90] & 8) {
this->unk_356 |= 0x800;
@@ -1274,17 +1274,18 @@ s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
u16 sp2E = SCHEDULE_TIME_NOW;
u16 phi_v1;
u8 sp2B = this->actor.params & 0xFF;
- s32 pad;
+ u16 tmp;
+ s16 pad;
s32 ret = false;
this->timePath = NULL;
- if (D_80AFB430[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80AFB430[arg2->result]);
+ if (D_80AFB430[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80AFB430[scheduleOutput->result]);
}
if ((this->timePath != NULL) && (this->timePath->count < 3)) {
@@ -1295,18 +1296,18 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
if ((this->unk_258 < 38) && (this->unk_258 != 0) && (this->timePathTimeSpeed >= 0)) {
phi_v1 = sp2E;
} else {
- phi_v1 = arg2->time0;
+ phi_v1 = scheduleOutput->time0;
}
- if (arg2->time1 < phi_v1) {
- this->timePathTotalTime = (phi_v1 - arg2->time1) + 0xFFFF;
+ if (scheduleOutput->time1 < phi_v1) {
+ this->timePathTotalTime = (phi_v1 - scheduleOutput->time1) + 0xFFFF;
} else {
- this->timePathTotalTime = arg2->time1 - phi_v1;
+ this->timePathTotalTime = scheduleOutput->time1 - phi_v1;
}
this->timePathElapsedTime = sp2E - phi_v1;
- phi_v1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1);
- this->timePathWaypointTime = this->timePathTotalTime / phi_v1;
+ tmp = phi_v1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1);
+ this->timePathWaypointTime = this->timePathTotalTime / tmp;
this->timePathWaypoint =
(this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1);
this->unk_356 &= ~8;
@@ -1316,7 +1317,7 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
Flags_UnsetSwitch(play, 0);
}
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
case 83:
case 84:
case 85:
@@ -1355,7 +1356,7 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
u8 sp4F = this->actor.params & 0xFF;
Vec3f sp40;
Vec3f sp34;
@@ -1364,8 +1365,8 @@ s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleResult* arg2) {
s32 ret = false;
this->timePath = NULL;
- if (D_80AFB430[arg2->result] >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80AFB430[arg2->result]);
+ if (D_80AFB430[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80AFB430[scheduleOutput->result]);
}
if ((this->timePath != 0) && (this->timePath->count >= 2)) {
@@ -1376,7 +1377,7 @@ s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleResult* arg2) {
Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot);
Math_Vec3f_Copy(&this->actor.world.pos, &sp40);
Math_Vec3f_Copy(&this->actor.prevPos, &sp40);
- if (arg2->result == 24) {
+ if (scheduleOutput->result == 24) {
Flags_UnsetSwitch(play, 0);
Flags_UnsetSwitch(play, 1);
this->unk_394 = EXCH_ITEM_NONE;
@@ -1388,7 +1389,7 @@ s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
u8 sp4F = this->actor.params & 0xFF;
Vec3f sp40;
Vec3f sp34;
@@ -1397,13 +1398,13 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
s32 ret = false;
s32 phi_a3 = -1;
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
case 3:
case 4:
case 5:
case 6:
case 7:
- phi_a3 = arg2->result - 3;
+ phi_a3 = scheduleOutput->result - 3;
break;
case 19:
@@ -1416,7 +1417,7 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
}
this->timePath = NULL;
- phi_a3 = D_80AFB430[arg2->result];
+ phi_a3 = D_80AFB430[scheduleOutput->result];
if (phi_a3 >= 0) {
this->timePath = SubS_GetAdditionalPath(play, sp4F, phi_a3);
}
@@ -1430,7 +1431,7 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
Math_Vec3f_Copy(&this->actor.world.pos, &sp40);
Math_Vec3f_Copy(&this->actor.prevPos, &sp40);
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
case 27:
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROOM_CARTAIN);
Flags_SetSwitch(play, 0);
@@ -1462,7 +1463,7 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
gSaveContext.save.weekEventReg[60] |= 4;
default:
- if (arg2->result == 0x1D) {
+ if (scheduleOutput->result == 29) {
this->actor.world.rot.y = BINANG_ROT180(this->actor.world.rot.y);
}
SubS_UpdateFlags(&this->unk_356, 3, 7);
@@ -1475,7 +1476,7 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80AF98A0(EnPm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80AF98A0(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_MM3, 116.0f, 26.0f, -219.0f, 0, -0x3F46, 0,
@@ -1486,7 +1487,7 @@ s32 func_80AF98A0(EnPm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80AF992C(EnPm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80AF992C(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
static Vec3f D_80AFB8EC = { 116.0f, 26.0f, -219.0f };
static Vec3s D_80AFB8F8 = { 0x0000, 0xC0BA, 0x0000 };
s32 pad;
@@ -1498,7 +1499,7 @@ s32 func_80AF992C(EnPm* this, PlayState* play, ScheduleResult* arg2) {
this->actor.targetMode = 6;
this->actor.gravity = -1.0f;
this->unk_368 = 80.0f;
- if (arg2->result == 14) {
+ if (scheduleOutput->result == 14) {
this->unk_356 &= ~0x200;
func_80AF7E98(this, 13);
} else {
@@ -1508,10 +1509,10 @@ s32 func_80AF992C(EnPm* this, PlayState* play, ScheduleResult* arg2) {
return true;
}
-s32 func_80AF9A0C(EnPm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80AF9A0C(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
- if (func_80AF8ED4(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_AN)) {
+ if (func_80AF8ED4(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_AN)) {
SubS_UpdateFlags(&this->unk_356, 3, 7);
this->unk_356 |= 0x20;
this->unk_356 |= 0x9000;
@@ -1526,10 +1527,10 @@ s32 func_80AF9A0C(EnPm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80AF9AB0(EnPm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80AF9AB0(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
- if (func_80AF8ED4(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_TEST3)) {
+ if (func_80AF8ED4(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TEST3)) {
SubS_UpdateFlags(&this->unk_356, 3, 7);
this->unk_356 |= 0x20;
this->unk_356 |= 0x9000;
@@ -1544,10 +1545,10 @@ s32 func_80AF9AB0(EnPm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80AF9B54(EnPm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80AF9B54(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
- if (func_80AF8ED4(this, play, arg2, ACTORCAT_NPC, ACTOR_EN_AL)) {
+ if (func_80AF8ED4(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_AL)) {
SubS_UpdateFlags(&this->unk_356, 3, 7);
this->unk_356 |= 0x9000;
this->unk_356 |= 0x20;
@@ -1562,7 +1563,7 @@ s32 func_80AF9B54(EnPm* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret;
this->actor.flags |= ACTOR_FLAG_1;
@@ -1571,25 +1572,25 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
this->unk_356 = 0;
this->unk_368 = 40.0f;
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
case 16:
- ret = func_80AF9A0C(this, play, arg2);
+ ret = func_80AF9A0C(this, play, scheduleOutput);
break;
case 17:
- ret = func_80AF9AB0(this, play, arg2);
+ ret = func_80AF9AB0(this, play, scheduleOutput);
break;
case 28:
- ret = func_80AF9B54(this, play, arg2);
+ ret = func_80AF9B54(this, play, scheduleOutput);
break;
case 24:
- ret = func_80AF94AC(this, play, arg2);
+ ret = func_80AF94AC(this, play, scheduleOutput);
break;
case 29:
- ret = func_80AF95E8(this, play, arg2);
+ ret = func_80AF95E8(this, play, scheduleOutput);
break;
case 1:
@@ -1604,7 +1605,7 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
case 35:
case 36:
case 37:
- ret = func_80AF9008(this, play, arg2);
+ ret = func_80AF9008(this, play, scheduleOutput);
break;
case 3:
@@ -1617,11 +1618,11 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
case 23:
case 25:
case 27:
- ret = func_80AF95E8(this, play, arg2);
+ ret = func_80AF95E8(this, play, scheduleOutput);
break;
case 8:
- ret = func_80AF98A0(this, play, arg2);
+ ret = func_80AF98A0(this, play, scheduleOutput);
break;
case 9:
@@ -1629,7 +1630,7 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
case 20:
case 21:
case 22:
- ret = func_80AF992C(this, play, arg2);
+ ret = func_80AF992C(this, play, scheduleOutput);
break;
case 38:
@@ -1686,7 +1687,7 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleResult* arg2) {
case 89:
case 90:
case 91:
- ret = func_80AF91E8(this, play, arg2);
+ ret = func_80AF91E8(this, play, scheduleOutput);
break;
default:
@@ -1988,7 +1989,7 @@ void func_80AFA4D0(EnPm* this, PlayState* play) {
};
u16 time = gSaveContext.save.time;
u16 sp3C = 0;
- ScheduleResult sp2C;
+ ScheduleOutput sp2C;
this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed);
if (this->unk_38C != 0) {
diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c
index 3786f78302..5bcc3cd169 100644
--- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c
+++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c
@@ -673,16 +673,14 @@ void func_80BABB90(EnSuttari* this, s32 arg1) {
}
}
-s32 func_80BABC48(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResult) {
+s32 func_80BABC48(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutput) {
u16 sp26 = SCHEDULE_TIME_NOW;
- u16 pad1;
- u8 sp23 = ENSUTTARI_GET_PATH(&this->actor);
- u16 pad2;
- s32 sp1C = D_80BAE8F8[scheduleResult->result];
u16 phi_a0;
+ u8 sp23 = ENSUTTARI_GET_PATH(&this->actor);
+ u16 tmp;
- if (sp1C >= 0) {
- this->timePath = SubS_GetAdditionalPath(play, sp23, sp1C);
+ if (D_80BAE8F8[scheduleOutput->result] >= 0) {
+ this->timePath = SubS_GetAdditionalPath(play, sp23, D_80BAE8F8[scheduleOutput->result]);
}
if (this->timePath == NULL) {
return 0;
@@ -690,23 +688,23 @@ s32 func_80BABC48(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResu
if ((this->unk428 != 0 && this->unk428 < 0xC) && (this->timePathTimeSpeed >= 0)) {
phi_a0 = sp26;
} else {
- phi_a0 = scheduleResult->time0;
+ phi_a0 = scheduleOutput->time0;
}
- if (scheduleResult->time1 < phi_a0) {
- this->timePathTotalTime = (phi_a0 - scheduleResult->time1) + 0xFFFF;
+ if (scheduleOutput->time1 < phi_a0) {
+ this->timePathTotalTime = (phi_a0 - scheduleOutput->time1) + 0xFFFF;
} else {
- this->timePathTotalTime = scheduleResult->time1 - phi_a0;
+ this->timePathTotalTime = scheduleOutput->time1 - phi_a0;
}
this->timePathElapsedTime = sp26 - phi_a0;
- phi_a0 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1);
+ tmp = phi_a0 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1);
this->unk42C = 0;
- this->timePathWaypointTime = this->timePathTotalTime / phi_a0;
+ this->timePathWaypointTime = this->timePathTotalTime / tmp;
this->timePathWaypoint = (this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1);
this->unk430 = 0;
return 1;
}
-s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResult) {
+s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 pad;
EnDoor* sp48;
u8 sp47 = ENSUTTARI_GET_PATH(&this->actor);
@@ -720,7 +718,7 @@ s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResu
return 0;
}
sp48 = (EnDoor*)SubS_FindNearestActor(&this->actor, play, ACTORCAT_DOOR, ACTOR_EN_DOOR);
- sp24 = D_80BAE8F8[scheduleResult->result];
+ sp24 = D_80BAE8F8[scheduleOutput->result];
if ((sp48 != NULL) && (sp24 >= 0)) {
this->timePath = SubS_GetAdditionalPath(play, sp47, sp24);
}
@@ -730,9 +728,9 @@ s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResu
sp28 = Lib_SegmentedToVirtual(this->timePath->points);
Math_Vec3s_ToVec3f(&sp38, &sp28[0]);
Math_Vec3s_ToVec3f(&sp2C, &sp28[1]);
- this->unk434 = sp44 - scheduleResult->time0;
- this->unk436 = scheduleResult->time1 - scheduleResult->time0;
- if (scheduleResult->result != 10 && scheduleResult->result != 11) {
+ this->unk434 = sp44 - scheduleOutput->time0;
+ this->unk436 = scheduleOutput->time1 - scheduleOutput->time0;
+ if (scheduleOutput->result != 10 && scheduleOutput->result != 11) {
sp48->unk_1A7 = 0x4B;
}
Math_Vec3f_Copy(&this->unk438, &sp38);
@@ -742,15 +740,15 @@ s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResu
return 1;
}
-s32 func_80BABF64(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResult) {
+s32 func_80BABF64(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret;
- switch (scheduleResult->result) {
+ switch (scheduleOutput->result) {
case 15:
case 14:
case 13:
case 12:
- ret = func_80BABC48(this, play, scheduleResult);
+ ret = func_80BABC48(this, play, scheduleOutput);
break;
case 11:
case 10:
@@ -758,7 +756,7 @@ s32 func_80BABF64(EnSuttari* this, PlayState* play, ScheduleResult* scheduleResu
case 8:
case 7:
case 6:
- ret = func_80BABDD8(this, play, scheduleResult);
+ ret = func_80BABDD8(this, play, scheduleOutput);
break;
case 5:
case 4:
@@ -1100,17 +1098,17 @@ void func_80BACE4C(EnSuttari* this, PlayState* play) {
}
void func_80BACEE0(EnSuttari* this, PlayState* play) {
- ScheduleResult scheduleResult;
+ ScheduleOutput scheduleOutput;
this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed);
- if (!Schedule_RunScript(play, D_80BAE820, &scheduleResult) ||
- ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, play, &scheduleResult))) {
+ if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) ||
+ ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) {
this->actor.flags &= ~ACTOR_FLAG_1;
- scheduleResult.result = 0;
+ scheduleOutput.result = 0;
} else {
this->actor.flags |= ACTOR_FLAG_1;
}
- this->unk428 = scheduleResult.result;
+ this->unk428 = scheduleOutput.result;
func_80BAC2FC(this, play);
func_80BAB434(this);
if (this->unk428 == 5) {
@@ -1124,17 +1122,17 @@ void func_80BACEE0(EnSuttari* this, PlayState* play) {
}
void func_80BAD004(EnSuttari* this, PlayState* play) {
- ScheduleResult scheduleResult;
+ ScheduleOutput scheduleOutput;
this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed);
- if (!Schedule_RunScript(play, D_80BAE820, &scheduleResult) ||
- ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, play, &scheduleResult))) {
+ if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) ||
+ ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) {
this->actor.flags &= ~ACTOR_FLAG_1;
- scheduleResult.result = 0;
+ scheduleOutput.result = 0;
} else {
this->actor.flags |= ACTOR_FLAG_1;
}
- this->unk428 = scheduleResult.result;
+ this->unk428 = scheduleOutput.result;
func_80BAC2FC(this, play);
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
Message_StartTextbox(play, 0x2A3A, &this->actor);
@@ -1245,7 +1243,7 @@ void func_80BAD380(EnSuttari* this, PlayState* play) {
}
void func_80BAD5F8(EnSuttari* this, PlayState* play) {
- ScheduleResult scheduleResult;
+ ScheduleOutput scheduleOutput;
s16 curFrame = this->skelAnime.curFrame;
s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation);
@@ -1254,21 +1252,21 @@ void func_80BAD5F8(EnSuttari* this, PlayState* play) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex);
}
this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed);
- if (!Schedule_RunScript(play, D_80BAE820, &scheduleResult) ||
- ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, play, &scheduleResult))) {
+ if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) ||
+ ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) {
this->actor.flags &= ~ACTOR_FLAG_1;
- scheduleResult.result = 0;
+ scheduleOutput.result = 0;
} else {
this->actor.flags |= ACTOR_FLAG_1;
}
- this->unk428 = scheduleResult.result;
+ this->unk428 = scheduleOutput.result;
func_80BAC2FC(this, play);
if ((this->unk430 == 1) && (this->timePath->unk1 == 0xFF)) {
Actor_MarkForDeath(&this->actor);
return;
}
func_80BAB434(this);
- if ((this->flags1 & 0x20) && (this->unk430 == 0) && (scheduleResult.result != 7)) {
+ if ((this->flags1 & 0x20) && (this->unk430 == 0) && (scheduleOutput.result != 7)) {
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
Message_StartTextbox(play, 0x2A02, &this->actor);
this->actionFunc = func_80BAD130;
@@ -1280,7 +1278,7 @@ void func_80BAD5F8(EnSuttari* this, PlayState* play) {
}
void func_80BAD7F8(EnSuttari* this, PlayState* play) {
- ScheduleResult scheduleResult;
+ ScheduleOutput scheduleOutput;
s16 curFrame = this->skelAnime.curFrame;
s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation);
@@ -1292,20 +1290,20 @@ void func_80BAD7F8(EnSuttari* this, PlayState* play) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, this->animationIndex);
}
this->timePathTimeSpeed = REG(15) + ((void)0, gSaveContext.save.daySpeed);
- if (!Schedule_RunScript(play, D_80BAE820, &scheduleResult) ||
- ((this->unk428 != scheduleResult.result) && !func_80BABF64(this, play, &scheduleResult))) {
+ if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) ||
+ ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) {
this->actor.flags &= ~ACTOR_FLAG_1;
- scheduleResult.result = 0;
+ scheduleOutput.result = 0;
} else {
this->actor.flags |= ACTOR_FLAG_1;
}
- this->unk428 = scheduleResult.result;
+ this->unk428 = scheduleOutput.result;
func_80BAC2FC(this, play);
if ((this->unk430 == 1) && (this->timePath->unk1 == 0xFF)) {
Actor_MarkForDeath(&this->actor);
return;
}
- if ((this->flags1 & 0x20) && (scheduleResult.result != 9)) {
+ if ((this->flags1 & 0x20) && (scheduleOutput.result != 9)) {
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
Message_StartTextbox(play, 0x2A02, &this->actor);
this->actionFunc = func_80BAD130;
diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c
index 60f5d472b4..ebabed9ebf 100644
--- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c
+++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c
@@ -366,7 +366,7 @@ s32* func_80BE0E04(EnTab* this, PlayState* play) {
return NULL;
}
-s32 func_80BE0F04(EnTab* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BE0F04(EnTab* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
EnGm* sp28 = func_80BE04E0(this, play, ACTORCAT_NPC, ACTOR_EN_GM);
@@ -385,7 +385,7 @@ s32 func_80BE0F04(EnTab* this, PlayState* play, ScheduleResult* arg2) {
return ret;
}
-s32 func_80BE0FC4(EnTab* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BE0FC4(EnTab* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 pad;
Math_Vec3f_Copy(&this->actor.world.pos, &D_80BE1B04);
@@ -399,18 +399,18 @@ s32 func_80BE0FC4(EnTab* this, PlayState* play, ScheduleResult* arg2) {
return true;
}
-s32 func_80BE1060(EnTab* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80BE1060(EnTab* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret;
this->unk_2FC = 0;
- switch (arg2->result) {
+ switch (scheduleOutput->result) {
case 1:
- ret = func_80BE0F04(this, play, arg2);
+ ret = func_80BE0F04(this, play, scheduleOutput);
break;
case 2:
- ret = func_80BE0FC4(this, play, arg2);
+ ret = func_80BE0FC4(this, play, scheduleOutput);
break;
default:
@@ -472,7 +472,7 @@ void func_80BE1224(EnTab* this, PlayState* play) {
}
void func_80BE127C(EnTab* this, PlayState* play) {
- ScheduleResult sp18;
+ ScheduleOutput sp18;
this->unk_31A = REG(15) + ((void)0, gSaveContext.save.daySpeed);
diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c
index 253720d1fb..4a412deadf 100644
--- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c
+++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c
@@ -24,8 +24,8 @@ void func_80AECB0C(EnTk* this, PlayState* play);
void func_80AECB6C(EnTk* this, PlayState* play);
void func_80AECE0C(EnTk* this, PlayState* play);
s32 func_80AECE60(EnTk* this, PlayState* play);
-s32 func_80AED354(EnTk* this, PlayState* play, ScheduleResult* arg2);
-s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleResult* arg2);
+s32 func_80AED354(EnTk* this, PlayState* play, ScheduleOutput* scheduleOutput);
+s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleOutput* scheduleOutput);
void func_80AED4F8(EnTk* this, PlayState* play);
void func_80AED610(EnTk* this, PlayState* play);
void func_80AED898(EnTk* this, PlayState* play);
@@ -312,7 +312,7 @@ void func_80AECB6C(EnTk* this, PlayState* play) {
s32 temp3;
f32 sp48;
f32 sp44;
- ScheduleResult sp34;
+ ScheduleOutput sp34;
u8 temp4;
this->actor.textId = 0;
@@ -492,22 +492,23 @@ s32 func_80AECE60(EnTk* this, PlayState* play) {
return false;
}
-s32 func_80AED354(EnTk* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80AED354(EnTk* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 phi_v1 = false;
- if (arg2->result != 0) {
- phi_v1 = func_80AED38C(this, play, arg2);
+ if (scheduleOutput->result != 0) {
+ phi_v1 = func_80AED38C(this, play, scheduleOutput);
}
return phi_v1;
}
-s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleResult* arg2) {
+s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleOutput* scheduleOutput) {
u16 sp1E = SCHEDULE_TIME_NOW;
u8 params = ENTK_GET_F800(&this->actor);
u16 phi_a1;
- s32 idx = arg2->result - 1;
+ s32 index = scheduleOutput->result - 1;
+ u16 tmp;
- this->timePath = SubS_GetAdditionalPath(play, params, D_80AEF8E8[idx + 1]);
+ this->timePath = SubS_GetAdditionalPath(play, params, D_80AEF8E8[index + 1]);
if (this->timePath == NULL) {
return false;
}
@@ -515,13 +516,13 @@ s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleResult* arg2) {
if ((this->unk_3CC <= 0) && (this->unk_3CC != 0) && (this->timePathTimeSpeed >= 0)) {
phi_a1 = sp1E;
} else {
- phi_a1 = arg2->time0;
+ phi_a1 = scheduleOutput->time0;
}
- this->timePathTotalTime = arg2->time1 - phi_a1;
+ this->timePathTotalTime = scheduleOutput->time1 - phi_a1;
this->timePathElapsedTime = sp1E - phi_a1;
- phi_a1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1);
- this->timePathWaypointTime = this->timePathTotalTime / phi_a1;
+ tmp = phi_a1 = this->timePath->count - (SUBS_TIME_PATHING_ORDER - 1);
+ this->timePathWaypointTime = this->timePathTotalTime / tmp;
this->timePathWaypoint = (this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1);
this->unk_3CE &= ~4;
this->unk_3CE &= ~8;
diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c
index 72b55a0361..68051705ef 100644
--- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c
+++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c
@@ -205,11 +205,11 @@ void EnZo_LookAtPlayer(EnZo* this, PlayState* play) {
}
void EnZo_Walk(EnZo* this, PlayState* play) {
- if (ENZO_GET_PATH(&this->actor) != ENZO_NO_PATH) {
+ if (ENZO_GET_PATH(&this->actor) != 0x3F) {
EnZo_SetAnimation(&this->skelAnime, 6);
}
- if (ENZO_GET_PATH(&this->actor) != ENZO_NO_PATH) {
+ if (ENZO_GET_PATH(&this->actor) != 0x3F) {
this->actionFunc = EnZo_FollowPath;
} else {
this->actionFunc = EnZo_DoNothing;
@@ -263,7 +263,7 @@ void EnZo_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
- this->path = SubS_GetPathByIndex(play, ENZO_GET_PATH(&this->actor), ENZO_NO_PATH);
+ this->path = SubS_GetPathByIndex(play, ENZO_GET_PATH(&this->actor), 0x3F);
Actor_SetScale(&this->actor, 0.01f);
this->actionFunc = EnZo_Walk;
diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.h b/src/overlays/actors/ovl_En_Zo/z_en_zo.h
index b53ee19f84..bfd0c79dd8 100644
--- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h
+++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h
@@ -9,7 +9,6 @@ struct EnZo;
typedef void (*EnZoActionFunc)(struct EnZo*, PlayState*);
#define ENZO_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9)
-#define ENZO_NO_PATH 0x3F
typedef struct EnZo {
/* 0x000 */ Actor actor;
diff --git a/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.c b/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.c
index 2a75d5af11..5246b20d4a 100644
--- a/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.c
+++ b/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.c
@@ -43,11 +43,11 @@ static u8 sScheduleScript[] = {
void ObjShutter_Update(Actor* thisx, PlayState* play2) {
ObjShutter* this = THIS;
PlayState* play = play2;
- ScheduleResult schedule;
+ ScheduleOutput scheduleOutput;
- Schedule_RunScript(play, sScheduleScript, &schedule);
- if (schedule.result == 1) {
- if (this->scheduleResult != schedule.result) {
+ Schedule_RunScript(play, sScheduleScript, &scheduleOutput);
+ if (scheduleOutput.result == 1) {
+ if (this->scheduleResult != scheduleOutput.result) {
this->actor.velocity.y = 0.0f;
}
if ((this->verticalOffset >= 80.0f) || (this->scheduleResult == 0)) {
@@ -57,7 +57,7 @@ void ObjShutter_Update(Actor* thisx, PlayState* play2) {
this->verticalOffset += 10.0f;
}
} else {
- if (this->scheduleResult != schedule.result) {
+ if (this->scheduleResult != scheduleOutput.result) {
this->actor.velocity.y = 0.0f;
}
if (this->verticalOffset != 0.0f) {
@@ -72,7 +72,7 @@ void ObjShutter_Update(Actor* thisx, PlayState* play2) {
}
}
}
- this->scheduleResult = schedule.result;
+ this->scheduleResult = scheduleOutput.result;
}
void ObjShutter_Draw(Actor* thisx, PlayState* play) {
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index 88f50c50a3..96b94580a6 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -15168,27 +15168,27 @@
0x80BA7D30:("EnRailgibud_SinkIntoGround",),
0x80BA7DC8:("EnRailgibud_PerformCutsceneActions",),
0x80BA8050:("EnRailgibud_Cutscene_Update",),
- 0x80BA8820:("func_80BA8820",),
- 0x80BA886C:("func_80BA886C",),
- 0x80BA8C4C:("func_80BA8C4C",),
- 0x80BA8C90:("func_80BA8C90",),
- 0x80BA8D2C:("func_80BA8D2C",),
- 0x80BA8DF4:("func_80BA8DF4",),
- 0x80BA8F88:("func_80BA8F88",),
- 0x80BA9110:("func_80BA9110",),
- 0x80BA9160:("func_80BA9160",),
- 0x80BA93AC:("func_80BA93AC",),
- 0x80BA9480:("func_80BA9480",),
- 0x80BA9758:("func_80BA9758",),
- 0x80BA9848:("func_80BA9848",),
- 0x80BA98EC:("func_80BA98EC",),
- 0x80BA9AB8:("func_80BA9AB8",),
- 0x80BA9B24:("func_80BA9B24",),
- 0x80BA9B80:("func_80BA9B80",),
- 0x80BA9CD4:("func_80BA9CD4",),
- 0x80BA9E00:("func_80BA9E00",),
- 0x80BA9E10:("func_80BA9E10",),
- 0x80BA9E48:("func_80BA9E48",),
+ 0x80BA8820:("EnBaba_FindBombShopkeeper",),
+ 0x80BA886C:("EnBaba_HandleConversation",),
+ 0x80BA8C4C:("EnBaba_TriggerTransition",),
+ 0x80BA8C90:("EnBaba_UpdateCollider",),
+ 0x80BA8D2C:("EnBaba_MoveForward",),
+ 0x80BA8DF4:("EnBaba_UpdateModel",),
+ 0x80BA8F88:("EnBaba_InitTimePath",),
+ 0x80BA9110:("EnBaba_ProcessScheduleOutput",),
+ 0x80BA9160:("EnBaba_FollowTimePath",),
+ 0x80BA93AC:("EnBaba_HandleSchedule",),
+ 0x80BA9480:("EnBaba_FinishInit",),
+ 0x80BA9758:("EnBaba_Idle",),
+ 0x80BA9848:("EnBaba_FollowSchedule_Talk",),
+ 0x80BA98EC:("EnBaba_Talk",),
+ 0x80BA9AB8:("EnBaba_GiveBlastMask",),
+ 0x80BA9B24:("EnBaba_GaveBlastMask",),
+ 0x80BA9B80:("EnBaba_FollowSchedule",),
+ 0x80BA9CD4:("EnBaba_KnockedOver",),
+ 0x80BA9E00:("EnBaba_DoNothing",),
+ 0x80BA9E10:("EnBaba_Walk",),
+ 0x80BA9E48:("EnBaba_FaceForward",),
0x80BA9E6C:("EnBaba_Init",),
0x80BA9F24:("EnBaba_Destroy",),
0x80BA9F50:("EnBaba_Update",),
diff --git a/tools/namefixer.py b/tools/namefixer.py
index bc2f9e7d48..bd0cc43b42 100755
--- a/tools/namefixer.py
+++ b/tools/namefixer.py
@@ -597,6 +597,7 @@ wordReplace = {
"GlobalContext": "PlayState",
"globalCtx": "play",
"globalCtx2": "play2",
+ "ScheduleResult": "ScheduleOutput",
# Struct members
"skelAnime.unk03": "skelAnime.taper",