diff --git a/include/functions.h b/include/functions.h index 5774ca3c6e..ccf1877e01 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1503,7 +1503,7 @@ void Interface_Update(PlayState* play); void Interface_Destroy(PlayState* play); void Interface_Init(PlayState* play); -Path* Path_GetByIndex(PlayState* play, s16 index, s16 max); +Path* Path_GetByIndex(PlayState* play, s16 index, s16 indexNone); f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw); void Path_CopyLastPoint(Path* path, Vec3f* dest); diff --git a/include/z64scene.h b/include/z64scene.h index 387d584f55..7f48d87402 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -469,10 +469,13 @@ typedef struct { /* 0x00C */ ObjectStatus status[OBJECT_EXCHANGE_BANK_MAX]; } ObjectContext; // size = 0x958 +#define PATH_INDEX_NONE -1 +#define ADDITIONAL_PATH_INDEX_NONE (u8)-1 + typedef struct { - /* 0x0 */ u8 count; // number of points in the path - /* 0x1 */ u8 unk1; - /* 0x2 */ s16 unk2; + /* 0x0 */ u8 count; // Number of points in the path + /* 0x1 */ u8 additionalPathIndex; + /* 0x2 */ s16 customValue; // Path specific to help distinguish different paths /* 0x4 */ Vec3s* points; // Segment Address to the array of points } Path; // size = 0x8 diff --git a/include/z64subs.h b/include/z64subs.h index ad2b7044f7..768f810791 100644 --- a/include/z64subs.h +++ b/include/z64subs.h @@ -108,7 +108,7 @@ s32 SubS_ChangeAnimationByInfoS(SkelAnime* skelAnime, AnimationInfoS* animationI s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex); -Path* SubS_GetDayDependentPath(struct PlayState* play, u8 pathIndex, u8 max, s32* startPointIndex); +Path* SubS_GetDayDependentPath(struct PlayState* play, u8 pathIndex, u8 pathIndexNone, s32* startPointIndex); s32 SubS_WeightPathing_ComputePoint(Path* path, s32 waypoint, Vec3f* point, f32 progress, s32 direction); s32 SubS_WeightPathing_Move(Actor* actor, Path* path, s32* waypoint, f32* progress, s32 direction, s32 returnStart); @@ -126,7 +126,7 @@ s32 SubS_TrackPoint(Vec3f* target, Vec3f* focusPos, Vec3s* shapeRot, Vec3s* trac s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB); -Path* SubS_GetPathByIndex(struct PlayState* play, s16 pathIndex, s16 max); +Path* SubS_GetPathByIndex(struct PlayState* play, s16 pathIndex, s16 pathIndexNone); s32 SubS_CopyPointFromPath(Path* path, s32 pointIndex, Vec3f* dst); s16 SubS_GetDistSqAndOrientPoints(Vec3f* vecA, Vec3f* vecB, f32* distSq); s32 SubS_MoveActorToPoint(Actor* actor, Vec3f* point, s16 rotStep); diff --git a/src/code/z_path.c b/src/code/z_path.c index 3c446d49aa..76d7ce1446 100644 --- a/src/code/z_path.c +++ b/src/code/z_path.c @@ -1,9 +1,9 @@ #include "global.h" -Path* Path_GetByIndex(PlayState* play, s16 index, s16 max) { +Path* Path_GetByIndex(PlayState* play, s16 index, s16 indexNone) { Path* path; - if (index != max) { + if (index != indexNone) { path = &play->setupPathList[index]; } else { path = NULL; diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index 05a3c331ea..35886da186 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -489,9 +489,9 @@ Path* SubS_GetAdditionalPath(PlayState* play, u8 pathIndex, s32 limit) { if (i >= limit) { break; } - pathIndex = path->unk1; + pathIndex = path->additionalPathIndex; i++; - } while (pathIndex != 0xFF); + } while (pathIndex != ADDITIONAL_PATH_INDEX_NONE); return path; } @@ -585,7 +585,7 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) { return reached; } -Path* SubS_GetDayDependentPath(PlayState* play, u8 pathIndex, u8 max, s32* startPointIndex) { +Path* SubS_GetDayDependentPath(PlayState* play, u8 pathIndex, u8 pathIndexNone, s32* startPointIndex) { Path* path = NULL; s32 found = false; s32 time = (((s16)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60) + @@ -593,17 +593,17 @@ Path* SubS_GetDayDependentPath(PlayState* play, u8 pathIndex, u8 max, s32* start 30; s32 day = CURRENT_DAY; - if (pathIndex == max) { + if (pathIndex == pathIndexNone) { return NULL; } - while (pathIndex != 0xFF) { + while (pathIndex != ADDITIONAL_PATH_INDEX_NONE) { path = &play->setupPathList[pathIndex]; - if (sPathDayFlags[day] & path->unk2) { + if (path->customValue & sPathDayFlags[day]) { found = true; break; } - pathIndex = path->unk1; + pathIndex = path->additionalPathIndex; } if (found == true) { @@ -1098,8 +1098,8 @@ s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB) { return (ABS_ALT(BINANG_SUB(angleB, angleA)) <= threshold) ? true : false; } -Path* SubS_GetPathByIndex(PlayState* play, s16 pathIndex, s16 max) { - return (pathIndex != max) ? &play->setupPathList[pathIndex] : NULL; +Path* SubS_GetPathByIndex(PlayState* play, s16 pathIndex, s16 pathIndexNone) { + return (pathIndex != pathIndexNone) ? &play->setupPathList[pathIndex] : NULL; } s32 SubS_CopyPointFromPath(Path* path, s32 pointIndex, Vec3f* dst) { diff --git a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c index 134e7227ac..97ccc907a5 100644 --- a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c +++ b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c @@ -56,8 +56,8 @@ s32 func_80BC3980(BgF40Block* this, PlayState* play) { this->unk_160 = 0; this->unk_164 = 0; - if (BGF40BLOCK_GET_PATH(&this->dyna.actor) != 0x3F) { - this->path = &play->setupPathList[BGF40BLOCK_GET_PATH(&this->dyna.actor)]; + if (BGF40BLOCK_GET_PATH_INDEX(&this->dyna.actor) != BGF40BLOCK_PATH_INDEX_NONE) { + this->path = &play->setupPathList[BGF40BLOCK_GET_PATH_INDEX(&this->dyna.actor)]; if (this->path != NULL) { points = Lib_SegmentedToVirtual(this->path->points); @@ -78,8 +78,8 @@ s32 func_80BC3A2C(BgF40Block* this, PlayState* play) { this->unk_160 = this->path->count - 1; this->unk_164 = this->path->count - 1; - if (BGF40BLOCK_GET_PATH(&this->dyna.actor) != 0x3F) { - this->path = &play->setupPathList[BGF40BLOCK_GET_PATH(&this->dyna.actor)]; + if (BGF40BLOCK_GET_PATH_INDEX(&this->dyna.actor) != BGF40BLOCK_PATH_INDEX_NONE) { + this->path = &play->setupPathList[BGF40BLOCK_GET_PATH_INDEX(&this->dyna.actor)]; if (this->path != NULL) { points = Lib_SegmentedToVirtual(this->path->points); points += this->unk_164; @@ -231,8 +231,8 @@ void BgF40Block_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); DynaPolyActor_LoadMesh(play, &this->dyna, &gStoneTowerBlockCol); - if (BGF40BLOCK_GET_PATH(&this->dyna.actor) != 0x3F) { - this->path = &play->setupPathList[BGF40BLOCK_GET_PATH(&this->dyna.actor)]; + if (BGF40BLOCK_GET_PATH_INDEX(&this->dyna.actor) != BGF40BLOCK_PATH_INDEX_NONE) { + this->path = &play->setupPathList[BGF40BLOCK_GET_PATH_INDEX(&this->dyna.actor)]; } else { this->path = NULL; } diff --git a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.h b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.h index 37a5c360e1..228fb6bfd3 100644 --- a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.h +++ b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.h @@ -7,9 +7,11 @@ struct BgF40Block; typedef void (*BgF40BlockActionFunc)(struct BgF40Block*, PlayState*); -#define BGF40BLOCK_GET_PATH(thisx) (((thisx)->params & 0x1FC) >> 2) +#define BGF40BLOCK_GET_PATH_INDEX(thisx) (((thisx)->params & 0x1FC) >> 2) #define BGF40BLOCK_GET_SWITCHFLAG(thisx) (((thisx)->params & 0xFE00) >> 9) +#define BGF40BLOCK_PATH_INDEX_NONE 0x3F + typedef struct BgF40Block { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ Path* path; diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 8f86f7c127..2796aed7e8 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -190,7 +190,7 @@ void func_80953F9C(BgIngate* this, PlayState* play) { if (this->unk160 & 2) { - if (this->timePath->unk1 != 0xFF) { + if (this->timePath->additionalPathIndex != ADDITIONAL_PATH_INDEX_NONE) { func_80953E38(play); func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_WAIT); this->dyna.actor.textId = 0x9E4; @@ -262,7 +262,7 @@ void func_80954340(BgIngate* this, PlayState* play) { if (DECR(this->unk16A) == 0) { if (this->timePath != NULL) { func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); - this->timePath = &play->setupPathList[this->timePath->unk1]; + this->timePath = &play->setupPathList[this->timePath->additionalPathIndex]; func_80953F14(this, play); Environment_StopTime(); } @@ -287,7 +287,7 @@ void func_809543D4(BgIngate* this, PlayState* play) { func_8019F208(); } else { if (this->timePath != NULL) { - this->timePath = &play->setupPathList[this->timePath->unk1]; + this->timePath = &play->setupPathList[this->timePath->additionalPathIndex]; } func_80953F14(this, play); CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); @@ -328,7 +328,7 @@ void BgIngate_Init(Actor* thisx, PlayState* play2) { this->unk160 |= 0x8; this->unk160 |= 0x10; Actor_SetScale(&this->dyna.actor, 1.0f); - this->timePath = SubS_GetAdditionalPath(play, BGINGATE_GET_FF(&this->dyna.actor), 0); + this->timePath = SubS_GetAdditionalPath(play, BGINGATE_GET_PATH_INDEX(&this->dyna.actor), 0); this->dyna.actor.room = -1; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_WOODFALL_TEMPLE)) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40); @@ -350,7 +350,7 @@ void BgIngate_Init(Actor* thisx, PlayState* play2) { this->actionFunc = func_80953F8C; } } - this->timePath = SubS_GetAdditionalPath(play, BGINGATE_GET_FF(&this->dyna.actor), phi_a2); + this->timePath = SubS_GetAdditionalPath(play, BGINGATE_GET_PATH_INDEX(&this->dyna.actor), phi_a2); if (this->timePath != NULL) { sp38 = Lib_SegmentedToVirtual(this->timePath->points); Math_Vec3s_ToVec3f(&sp2C, &sp38[0]); @@ -361,7 +361,7 @@ void BgIngate_Init(Actor* thisx, PlayState* play2) { this->dyna.actor.world.pos.y = -15.0f; this->dyna.actor.world.pos.z = sp2C.z; } - this->timePath = SubS_GetAdditionalPath(play, BGINGATE_GET_FF(&this->dyna.actor), 0); + this->timePath = SubS_GetAdditionalPath(play, BGINGATE_GET_PATH_INDEX(&this->dyna.actor), 0); } else { Actor_Kill(&this->dyna.actor); } diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h index 6046fc31e4..bf272f3421 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h @@ -7,7 +7,7 @@ struct BgIngate; typedef void (*BgIngateActionFunc)(struct BgIngate*, PlayState*); -#define BGINGATE_GET_FF(thisx) ((thisx)->params & 0xFF) +#define BGINGATE_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF) typedef struct BgIngate { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c index 0f53193d13..587ca059dd 100644 --- a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c +++ b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c @@ -129,7 +129,7 @@ void func_80AB2268(DmChar09* this, PlayState* play) { s32 i; s32 cueChannel; s32 max = 0; - s32 pathnum; + s32 pathIndex; u8 temp = false; if (!DMCHAR09_GET_F(&this->actor)) { @@ -160,12 +160,12 @@ void func_80AB2268(DmChar09* this, PlayState* play) { } if (play->csCtx.actorCues[cueChannel]->id >= 2) { - pathnum = DMCHAR09_GET_PATH(&this->actor); - path = &play->setupPathList[pathnum]; + pathIndex = DMCHAR09_GET_PATH_INDEX(&this->actor); + path = &play->setupPathList[pathIndex]; for (i = 0; i < max; i++) { - pathnum = path->unk1; - path = &play->setupPathList[pathnum]; + pathIndex = path->additionalPathIndex; + path = &play->setupPathList[pathIndex]; } this->unk_224 = Lib_SegmentedToVirtual(path->points); @@ -175,7 +175,7 @@ void func_80AB2268(DmChar09* this, PlayState* play) { this->unk_220 = 1; this->unk_22E = true; - this->speed = (u16)play->csCtx.actorCues[cueChannel]->rot.z * 0.00390625f; + this->speed = (u16)play->csCtx.actorCues[cueChannel]->rot.z * (1.0f / 256.0f); this->actionFunc = func_80AB1FDC; } else { this->unk_22E = false; diff --git a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h index cfb3523e64..cca08d0795 100644 --- a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h +++ b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h @@ -4,7 +4,7 @@ #include "global.h" #include "objects/object_bee/object_bee.h" -#define DMCHAR09_GET_PATH(thisx) (((thisx)->params >> 4) & 0xF) +#define DMCHAR09_GET_PATH_INDEX(thisx) (((thisx)->params >> 4) & 0xF) #define DMCHAR09_GET_100(thisx) ((thisx)->params & 0x100) #define DMCHAR09_GET_F(thisx) ((thisx)->params & 0xF) diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index 015e570084..5fcf75fdf9 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -1610,7 +1610,7 @@ void EnAkindonuts_Init(Actor* thisx, PlayState* play) { this->actor.gravity = -1.0f; if (!ENAKINDONUTS_GET_4(&this->actor)) { - this->path = SubS_GetPathByIndex(play, ENAKINDONUTS_GET_FC00(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENAKINDONUTS_GET_PATH_INDEX(&this->actor), ENAKINDONUTS_PATH_INDEX_NONE); if (this->path == NULL) { Actor_Kill(&this->actor); return; diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.h b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.h index 180d73ed46..4c8a4eb775 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.h +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.h @@ -10,7 +10,9 @@ typedef void (*EnAkindonutsUnkFunc)(struct EnAkindonuts*, PlayState*); #define ENAKINDONUTS_GET_3(thisx) ((thisx)->params & 3) #define ENAKINDONUTS_GET_4(thisx) (((thisx)->params & 4) >> 2) -#define ENAKINDONUTS_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) +#define ENAKINDONUTS_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 0xA) + +#define ENAKINDONUTS_PATH_INDEX_NONE 0x3F enum { /* 1 */ ENAKINDONUTS_3_1 = 1, diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 64adaa49b6..8d3c6b23bf 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -134,12 +134,12 @@ void EnAob01_InitializeDogPaths(EnAob01* this, PlayState* play) { s32 pathIndex = ENAOB01_GET_STARTING_DOG_PATH_INDEX(&this->actor); s16 i = 0; - if (pathIndex != 0x3F) { + if (pathIndex != ENAOB01_PATH_INDEX_NONE) { do { - this->dogPaths[i] = SubS_GetPathByIndex(play, pathIndex, 0x3F); - pathIndex = this->dogPaths[i]->unk1; + this->dogPaths[i] = SubS_GetPathByIndex(play, pathIndex, ENAOB01_PATH_INDEX_NONE); + pathIndex = this->dogPaths[i]->additionalPathIndex; i++; - } while (pathIndex != 0xFF); + } while (pathIndex != ADDITIONAL_PATH_INDEX_NONE); } } @@ -153,7 +153,7 @@ void EnAob01_SpawnDogs(EnAob01* this, PlayState* play) { EnAob01_InitializeDogPaths(this, play); for (i = 0; i < RACEDOG_COUNT; i++) { - enDgParams = ENDG_PARAMS(this->dogPaths[sDogInfo[i].pathIndex]->unk1, i); + enDgParams = ENDG_PARAMS(this->dogPaths[sDogInfo[i].pathIndex]->additionalPathIndex, i); this->dogs[i] = Actor_SpawnAsChildAndCutscene( &play->actorCtx, play, ACTOR_EN_DG, sDogInfo[i].pos.x, sDogInfo[i].pos.y, sDogInfo[i].pos.z, 0, diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h index a550fd0d35..5f77753685 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.h @@ -29,6 +29,8 @@ typedef void (*EnAob01ActionFunc)(struct EnAob01*, PlayState*); #define ENAOB01_FLAG_SURPRISE (1 << 7) #define ENAOB01_FLAG_PLAYER_CAN_TALK (1 << 8) +#define ENAOB01_PATH_INDEX_NONE 0x3F + typedef struct EnAob01 { /* 0x000 */ Actor actor; /* 0x144 */ EnAob01ActionFunc actionFunc; 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 e303fe1c5b..f41dcbd312 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -511,7 +511,7 @@ void EnBaba_FinishInit(EnBaba* this, PlayState* play) { } else if (play->sceneId == SCENE_BACKTOWN) { if ((BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_FOLLOW_SCHEDULE) && (gSaveContext.save.entrance != ENTRANCE(NORTH_CLOCK_TOWN, 7)) && - (BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor) != 0x3F)) { + (BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor) != BOMB_SHOP_LADY_PATH_INDEX_NONE)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_58_40) || (gSaveContext.save.time >= CLOCK_TIME(0, 20) && (gSaveContext.save.time < CLOCK_TIME(6, 0)))) { Actor_Kill(&this->actor); @@ -550,7 +550,7 @@ void EnBaba_FinishInit(EnBaba* this, PlayState* play) { this->animIndex = BOMB_SHOP_LADY_ANIM_SWAY; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnBaba_DoNothing; - } else if (BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor) != 0x3F) { + } else if (BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor) != BOMB_SHOP_LADY_PATH_INDEX_NONE) { this->animIndex = BOMB_SHOP_LADY_ANIM_WALKING_HOLDING_BAG; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnBaba_Walk; @@ -728,7 +728,7 @@ 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, BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor), BOMB_SHOP_LADY_PATH_INDEX_NONE); Actor_SetScale(&this->actor, 0.01f); 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 7da0ed054f..9618dd3a27 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.h +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.h @@ -12,6 +12,8 @@ typedef void (*EnBabaActionFunc)(struct EnBaba*, PlayState*); #define BOMB_SHOP_LADY_GET_PATH_INDEX(thisx) (((thisx)->params & 0x3F00) >> 8) #define BOMB_SHOP_LADY_GET_TYPE(thisx) (((thisx)->params & 0xC000) >> 0xE) +#define BOMB_SHOP_LADY_PATH_INDEX_NONE 0x3F + // 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 { 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 223bb1b249..d124f0b77c 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) == 0x3F) { + if (ENBBA01_GET_PATH_INDEX(&this->actor) == ENBBA01_PATH_INDEX_NONE) { this->actionFunc = EnBba01_FaceFoward; } else { this->actionFunc = EnBba01_Walk; @@ -227,7 +227,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), 0x3F); + this->enHy.path = SubS_GetPathByIndex(play, ENBBA01_GET_PATH_INDEX(&this->enHy.actor), ENBBA01_PATH_INDEX_NONE); 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 7160594d89..0cc158f2a2 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 @@ -7,7 +7,9 @@ struct EnBba01; typedef void (*EnBba01ActionFunc)(struct EnBba01*, PlayState*); -#define ENBBA01_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) +#define ENBBA01_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) + +#define ENBBA01_PATH_INDEX_NONE 0x3F typedef struct EnBba01 { /* 0x000 */ EnHy enHy; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 8d104842a7..834d5f7f79 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -93,8 +93,8 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play) { return; } - this->unk_29A = ENBOMBOWLMAN_GET_FF00(&this->actor); - this->path = SubS_GetPathByIndex(play, this->unk_29A, 0x3F); + this->pathIndex = ENBOMBOWLMAN_GET_PATH_INDEX(&this->actor); + this->path = SubS_GetPathByIndex(play, this->pathIndex, ENBOMBOWLMAN_PATH_INDEX_NONE); this->unk_2C8 = 80.0f; if ((gSaveContext.save.entrance == ENTRANCE(EAST_CLOCK_TOWN, 2)) && CHECK_WEEKEVENTREG(WEEKEVENTREG_73_80) && @@ -156,7 +156,7 @@ void func_809C4B50(EnBomBowlMan* this) { } void func_809C4B6C(EnBomBowlMan* this) { - if ((this->unk_29A != ENBOMBOWLMAN_FF00_MINUS1) && (this->path != NULL)) { + if ((this->pathIndex != PATH_INDEX_NONE) && (this->path != NULL)) { if (!SubS_CopyPointFromPath(this->path, this->unk_298, &this->unk_2A0)) { Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h index e958b84a12..df515ef4fe 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h @@ -9,13 +9,13 @@ typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, PlayState*); #define ENBOMBOWLMAN_GET_F(thisx) ((thisx)->params & 0xF) #define ENBOMBOWLMAN_GET_F0(thisx) (((thisx)->params >> 4) & 0xF) -#define ENBOMBOWLMAN_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) +#define ENBOMBOWLMAN_GET_PATH_INDEX(thisx) (((thisx)->params >> 8) & 0xFF) + +#define ENBOMBOWLMAN_PATH_INDEX_NONE 0x3F #define ENBOMBOWLMAN_F0_0 0 #define ENBOMBOWLMAN_F0_2 2 -#define ENBOMBOWLMAN_FF00_MINUS1 -1 - typedef struct EnBomBowlMan { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -30,7 +30,7 @@ typedef struct EnBomBowlMan { /* 0x292 */ UNK_TYPE1 unk292[2]; /* 0x294 */ Path* path; /* 0x298 */ s16 unk_298; - /* 0x29A */ s16 unk_29A; + /* 0x29A */ s16 pathIndex; /* 0x29C */ s16 unk_29C; /* 0x29E */ s16 unk_29E; /* 0x2A0 */ Vec3f unk_2A0; 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 1cda18c275..8eb9eb8398 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) == 0x3F) { + if (ENCNE01_GET_PATH_INDEX(&this->actor) == ENCNE01_PATH_INDEX_NONE) { this->actionFunc = EnCne01_FaceForward; } else { this->actionFunc = EnCne01_Walk; @@ -217,7 +217,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), 0x3F); + this->enHy.path = SubS_GetPathByIndex(play, ENCNE01_GET_PATH_INDEX(&this->enHy.actor), ENCNE01_PATH_INDEX_NONE); 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 2530257607..feee462a99 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 @@ -7,7 +7,9 @@ struct EnCne01; typedef void (*EnCne01ActionFunc)(struct EnCne01*, PlayState*); -#define ENCNE01_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) +#define ENCNE01_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) + +#define ENCNE01_PATH_INDEX_NONE 0x3F typedef struct EnCne01 { /* 0x000 */ EnHy enHy; diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 8a87703710..2900f4d345 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -77,8 +77,8 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_278 = ENDAIKU_GET_FF(&this->actor); if (this->unk_278 == ENDAIKU_PARAMS_FF_3) { - this->unk_288 = ENDAIKU_GET_FF00(&this->actor); - this->unk_258 = SubS_GetPathByIndex(play, this->unk_288, 0x3F); + this->pathIndex = ENDAIKU_GET_PATH_INDEX(&this->actor); + this->path = SubS_GetPathByIndex(play, this->pathIndex, ENDAIKU_PATH_INDEX_NONE); } else if (this->unk_278 == ENDAIKU_PARAMS_FF_2) { this->unk_264 = -2000; } @@ -134,8 +134,8 @@ void func_8094373C(EnDaiku* this, s32 arg1) { } void func_809437C8(EnDaiku* this) { - if ((this->unk_288 != -1) && (this->unk_258 != 0)) { - if (!SubS_CopyPointFromPath(this->unk_258, this->unk_25C, &this->unk_26C)) { + if ((this->pathIndex != PATH_INDEX_NONE) && (this->path != NULL)) { + if (!SubS_CopyPointFromPath(this->path, this->unk_25C, &this->unk_26C)) { Actor_Kill(&this->actor); } } @@ -208,9 +208,9 @@ void func_809438F8(EnDaiku* this, PlayState* play) { xzDist = sqrtf(SQ(this->actor.world.pos.x - this->unk_26C.x) + SQ(this->actor.world.pos.z - this->unk_26C.z)); yawDiff = fabsf(this->actor.world.rot.y - this->unk_282); - if ((xzDist < 4.0f) && (this->unk_258 != NULL) && (yawDiff < 10.0f)) { + if ((xzDist < 4.0f) && (this->path != NULL) && (yawDiff < 10.0f)) { this->unk_25C++; - if (this->unk_25C >= this->unk_258->count) { + if (this->unk_25C >= this->path->count) { this->unk_25C = 0; } @@ -221,6 +221,7 @@ void func_809438F8(EnDaiku* this, PlayState* play) { if (this->unk_278 != ENDAIKU_PARAMS_FF_0) { s16 angle = ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.world.rot.y)); + this->unk_280 = this->actor.yawTowardsPlayer; if ((this->unk_278 == ENDAIKU_PARAMS_FF_1) || (this->unk_278 == ENDAIKU_PARAMS_FF_2) || (angle <= 0x2890)) { func_800B8614(&this->actor, play, 100.0f); diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h index 4a3c9b4444..c75afec6e8 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h @@ -8,7 +8,9 @@ struct EnDaiku; typedef void (*EnDaikuActionFunc)(struct EnDaiku*, PlayState*); #define ENDAIKU_GET_FF(thisx) ((thisx)->params & 0xFF) -#define ENDAIKU_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) +#define ENDAIKU_GET_PATH_INDEX(thisx) (((thisx)->params >> 8) & 0xFF) + +#define ENDAIKU_PATH_INDEX_NONE 0x3F enum { /* 0x0 */ ENDAIKU_PARAMS_FF_0, @@ -23,7 +25,7 @@ typedef struct EnDaiku { /* 0x188 */ Vec3s jointTable[17]; /* 0x1EE */ Vec3s morphTable[17]; /* 0x254 */ EnDaikuActionFunc actionFunc; - /* 0x258 */ Path* unk_258; + /* 0x258 */ Path* path; /* 0x25C */ s16 unk_25C; /* 0x25E */ s16 unk_25E; /* 0x260 */ s16 unk_260; @@ -38,7 +40,7 @@ typedef struct EnDaiku { /* 0x280 */ s16 unk_280; /* 0x282 */ s16 unk_282; /* 0x284 */ f32 unk_284; - /* 0x288 */ s16 unk_288; + /* 0x288 */ s16 pathIndex; /* 0x28A */ s16 unk_28A; /* 0x28C */ s16 unk_28C; /* 0x28E */ UNK_TYPE1 unk_28E[0xE]; diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c index be45cfac6b..eaf1839c67 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c @@ -69,8 +69,8 @@ static ColliderCylinderInit sCylinderInit = { }; void func_80BE61D0(EnDaiku2* this) { - if ((this->unk_27A != -1) && (this->unk_258 != 0)) { - if (!SubS_CopyPointFromPath(this->unk_258, this->unk_25C, &this->unk_268)) { + if ((this->pathIndex != PATH_INDEX_NONE) && (this->path != NULL)) { + if (!SubS_CopyPointFromPath(this->path, this->unk_25C, &this->unk_268)) { Actor_Kill(&this->actor); } } @@ -87,8 +87,8 @@ void EnDaiku2_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 0; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->unk_278 = ENDAIKU2_GET_7F(&this->actor); - this->unk_27A = ENDAIKU2_GET_1F80(&this->actor); - this->unk_258 = SubS_GetPathByIndex(play, this->unk_27A, 0x3F); + this->pathIndex = ENDAIKU2_GET_PATH_INDEX(&this->actor); + this->path = SubS_GetPathByIndex(play, this->pathIndex, ENDAIKU2_PATH_INDEX_NONE); this->unk_280 = ENDAIKU2_GET_8000(&this->actor); Actor_SetScale(&this->actor, 0.01f); if (!this->unk_280) { @@ -100,7 +100,7 @@ void EnDaiku2_Init(Actor* thisx, PlayState* play) { if (this->unk_278 == ENDAIKU2_GET_7F_127) { this->unk_278 = ENDAIKU2_GET_7F_MINUS1; } else if (Flags_GetSwitch(play, this->unk_278)) { - this->unk_25C = this->unk_258->count - 1; + this->unk_25C = this->path->count - 1; func_80BE61D0(this); Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_268); } @@ -342,9 +342,9 @@ void func_80BE6D40(EnDaiku2* this, PlayState* play) { Math_ApproachF(&this->actor.world.pos.z, this->unk_268.z, 0.5f, fabsf(Math_CosS(this->actor.world.rot.y) * 6.0f)); if ((sqrtf(SQ(this->actor.world.pos.x - this->unk_268.x) + SQ(this->actor.world.pos.z - this->unk_268.z)) < 4.0f) && - (this->unk_258 != 0)) { + (this->path != NULL)) { this->unk_25C++; - if (this->unk_25C >= this->unk_258->count) { + if (this->unk_25C >= this->path->count) { func_80BE6EB0(this); return; } @@ -385,7 +385,7 @@ void func_80BE6EF0(EnDaiku2* this, PlayState* play) { fabsf(Math_CosS(this->actor.world.rot.y) * 4.0f)); if ((sqrtf(SQ(this->actor.world.pos.x - this->unk_268.x) + SQ(this->actor.world.pos.z - this->unk_268.z)) < 4.0f) && - (this->unk_258 != 0)) { + (this->path != NULL)) { if (!func_80BE64C0(this, play)) { if (this->unk_276 != 3) { func_80BE6408(this, 3); @@ -412,7 +412,7 @@ void func_80BE6EF0(EnDaiku2* this, PlayState* play) { Math_Vec3f_Copy(&sp40, &this->unk_268); var = this->unk_25C; this->unk_25C++; - if (this->unk_25C < this->unk_258->count) { + if (this->unk_25C < this->path->count) { func_80BE61D0(this); func_80BE6CFC(this); return; diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h index 130a06a235..775b2453f7 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h @@ -8,9 +8,11 @@ struct EnDaiku2; typedef void (*EnDaiku2ActionFunc)(struct EnDaiku2*, PlayState*); #define ENDAIKU2_GET_7F(thisx) ((thisx)->params & 0x7F) -#define ENDAIKU2_GET_1F80(thisx) (((thisx)->params >> 7) & 0x3F) +#define ENDAIKU2_GET_PATH_INDEX(thisx) (((thisx)->params >> 7) & 0x3F) #define ENDAIKU2_GET_8000(thisx) (((thisx)->params >> 15) & 0x1) +#define ENDAIKU2_PATH_INDEX_NONE 0x3F + enum { /* -1 */ ENDAIKU2_GET_7F_MINUS1 = -1, /* 0 */ ENDAIKU2_GET_7F_0, @@ -35,7 +37,7 @@ typedef struct EnDaiku2 { /* 0x188 */ Vec3s jointTable[17]; /* 0x1EE */ Vec3s morphTable[17]; /* 0x254 */ EnDaiku2ActionFunc actionFunc; - /* 0x258 */ Path* unk_258; + /* 0x258 */ Path* path; /* 0x25C */ s16 unk_25C; /* 0x260 */ f32 unk_260; /* 0x264 */ f32 unk_264; @@ -43,7 +45,7 @@ typedef struct EnDaiku2 { /* 0x274 */ s16 unk_274; /* 0x276 */ s16 unk_276; /* 0x278 */ s16 unk_278; - /* 0x27A */ s16 unk_27A; + /* 0x27A */ s16 pathIndex; /* 0x27C */ UNK_TYPE1 unk_27C[0x4]; /* 0x280 */ s32 unk_280; /* 0x284 */ f32 unk_284; diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index 0c84f91bc6..849ae33786 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -1302,7 +1302,7 @@ void EnDg_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Actor_ProcessInitChain(&this->actor, sInitChain); - this->path = SubS_GetPathByIndex(play, ENDG_GET_PATH(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENDG_GET_PATH_INDEX(&this->actor), ENDG_PATH_INDEX_NONE); Actor_SetScale(&this->actor, 0.0075f); this->actor.targetMode = 1; this->actor.gravity = -3.0f; diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.h b/src/overlays/actors/ovl_En_Dg/z_en_dg.h index 62c01a011b..9f82039877 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.h +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.h @@ -19,9 +19,11 @@ struct EnDg; typedef void (*EnDgActionFunc)(struct EnDg*, PlayState*); #define ENDG_GET_INDEX(thisx) (((thisx)->params & 0x3E0) >> 5) -#define ENDG_GET_PATH(thisx) (((thisx)->params & 0xFC00) >> 10) +#define ENDG_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 10) #define ENDG_PARAMS(path, index) ((path << 10) | (index << 5)) +#define ENDG_PATH_INDEX_NONE 0x3F + typedef enum { /* 0 */ ENDG_INDEX_RACETRACK_0, /* 1 */ ENDG_INDEX_RACETRACK_1, diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c index 2d03fccf23..bcb7c6fa2d 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c @@ -394,7 +394,7 @@ void EnEgol_DestroyBlocks(EnEgol* this, PlayState* play, Vec3f pos1, Vec3f pos2) } void EnEgol_GetWaypoint(EnEgol* this) { - if ((this->pathIndex != -1) && (this->path != NULL) && + if ((this->pathIndex != PATH_INDEX_NONE) && (this->path != NULL) && !SubS_CopyPointFromPath(this->path, this->waypoint, &this->waypointPos)) { Actor_Kill(&this->actor); } @@ -426,9 +426,9 @@ void EnEgol_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetJntSph(play, &this->eyeCollider, &this->actor, &sEyeJntSphInit, this->eyeElements); Collider_InitAndSetQuad(play, &this->laserCollider, &this->actor, &sLaserQuadInit); - this->pathIndex = EYEGORE_GET_PATH(&this->actor); - if (this->pathIndex == 0x3F) { - this->pathIndex = -1; + this->pathIndex = EYEGORE_GET_PATH_INDEX(&this->actor); + if (this->pathIndex == EYEGORE_PATH_INDEX_NONE) { + this->pathIndex = PATH_INDEX_NONE; Actor_Kill(&this->actor); return; } @@ -445,7 +445,7 @@ void EnEgol_Init(Actor* thisx, PlayState* play) { this->minLaserRange = 200.0f; } - this->path = SubS_GetPathByIndex(play, this->pathIndex, 0x3F); + this->path = SubS_GetPathByIndex(play, this->pathIndex, EYEGORE_PATH_INDEX_NONE); EYEGORE_SET_SPH_DIM(this->eyeCollider.elements[0], 500, 0, 0, 26, 1.0f); diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.h b/src/overlays/actors/ovl_En_Egol/z_en_egol.h index cec69e5a14..e85e4b98a8 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.h +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.h @@ -8,10 +8,12 @@ struct EnEgol; typedef void (*EnEgolActionFunc)(struct EnEgol*, PlayState*); -#define EYEGORE_GET_PATH(thisx) ((thisx)->params & 0x3F) +#define EYEGORE_GET_PATH_INDEX(thisx) ((thisx)->params & 0x3F) #define EYEGORE_GET_SWITCH(thisx) (((thisx)->params >> 6) & 0x7F) -#define EYEGORE_PARAMS(switch, path) ((((switch) & 0x7F) << 6) | ((path) & 0x3F)) +#define EYEGORE_PATH_INDEX_NONE 0x3F + +#define EYEGORE_PARAMS(switch, pathIndex) ((((switch) & 0x7F) << 6) | ((pathIndex) & 0x3F)) #define EYEGORE_EFFECT_COUNT 100 diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.c b/src/overlays/actors/ovl_En_Famos/z_en_famos.c index 645a757a01..97d1ec357d 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.c +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.c @@ -166,13 +166,13 @@ void EnFamos_Init(Actor* thisx, PlayState* play) { s32 i; Actor_ProcessInitChain(&this->actor, sInitChain); - if (FAMOS_GET_PATH(thisx) != 0xFF) { - path = &play->setupPathList[this->actor.params]; + if (FAMOS_GET_PATH_INDEX(&this->actor) != FAMOS_PATH_INDEX_NONE) { + path = &play->setupPathList[FAMOS_GET_PATH_INDEX(&this->actor)]; this->pathPoints = Lib_SegmentedToVirtual(path->points); - this->pathNodeCount = path->count; - if (this->pathNodeCount == 1) { + this->pathCount = path->count; + if (this->pathCount == 1) { this->pathPoints = NULL; - this->pathNodeCount = 0; + this->pathCount = 0; } } @@ -365,15 +365,15 @@ void EnFamos_StillIdle(EnFamos* this, PlayState* play) { */ void EnFamos_SetupPathingIdle(EnFamos* this) { if (this->isCalm) { - this->currentPathNode++; - if (this->currentPathNode == this->pathNodeCount) { - this->currentPathNode = 0; + this->waypointIndex++; + if (this->waypointIndex == this->pathCount) { + this->waypointIndex = 0; } } else { this->isCalm = true; } - Math_Vec3s_ToVec3f(&this->targetDest, &this->pathPoints[this->currentPathNode]); + Math_Vec3s_ToVec3f(&this->targetDest, &this->pathPoints[this->waypointIndex]); this->targetYaw = Actor_WorldYawTowardPoint(&this->actor, &this->targetDest); this->actionFunc = EnFamos_PathingIdle; this->actor.speed = 0.0f; diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.h b/src/overlays/actors/ovl_En_Famos/z_en_famos.h index 874da90346..468356376e 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.h +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.h @@ -15,9 +15,11 @@ typedef struct EnFamosRock { /* 0x20 */ f32 scale; } EnFamosRock; // size = 0x24 -#define FAMOS_GET_PATH(thisx) ((thisx)->params) +#define FAMOS_GET_PATH_INDEX(thisx) ((thisx)->params) #define FAMOS_GET_AGGRO_DISTANCE(thisx) ((thisx)->shape.rot.x) +#define FAMOS_PATH_INDEX_NONE 0xFF + // stateTimer gets reused: // after spotting player, counts frames until first attack (8) // after lost aggro, measures frames looking around before returning to home (60) @@ -33,8 +35,8 @@ typedef struct EnFamos { /* 0x1D0 */ EnFamosActionFunc actionFunc; /* 0x1D4 */ u8 animatedMaterialIndex; /* 0x1D5 */ u8 hasFinishedRotating; // stable up or down - /* 0x1D6 */ u8 pathNodeCount; - /* 0x1D7 */ u8 currentPathNode; + /* 0x1D6 */ u8 pathCount; + /* 0x1D7 */ u8 waypointIndex; /* 0x1D8 */ u8 isCalm; // is NOT aware of player /* 0x1DA */ s16 hoverTimer; // start 30, decr to 0, repeat: for trig height adjustment when hovering /* 0x1DC */ s16 stateTimer; // reused for different actionFunc diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 6fe9bf2911..bfc157fcb3 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -171,7 +171,7 @@ void func_809619D0(EnFu* this, PlayState* play) { } for (i = 0; i < this->unk_542; i++) { - path = &play->setupPathList[path->unk1]; + path = &play->setupPathList[path->additionalPathIndex]; } this->unk_520 = path->count; diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 6de6c7e750..0a8aea2fd9 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -191,8 +191,8 @@ void EnGe1_SetupPath(EnGe1* this, PlayState* play) { this->curPointIndex = 0; - if (GERUDO_WHITE_GET_PATH(&this->picto.actor) != 0x3F) { - this->path = &play->setupPathList[GERUDO_WHITE_GET_PATH(&this->picto.actor)]; + if (GERUDO_WHITE_GET_PATH_INDEX(&this->picto.actor) != GERUDO_WHITE_PATH_INDEX_NONE) { + this->path = &play->setupPathList[GERUDO_WHITE_GET_PATH_INDEX(&this->picto.actor)]; if (this->path != NULL) { point = Lib_SegmentedToVirtual(this->path->points); Math_Vec3s_ToVec3f(&this->picto.actor.world.pos, point); diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h index 63a2a3c7fc..f1684315b1 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -6,7 +6,9 @@ #include "objects/object_ge1/object_ge1.h" #define GERUDO_WHITE_GET_TYPE(thisx) (((thisx)->params) & 0xF) -#define GERUDO_WHITE_GET_PATH(thisx) ((((thisx)->params) & 0xFC00) >> 10) +#define GERUDO_WHITE_GET_PATH_INDEX(thisx) ((((thisx)->params) & 0xFC00) >> 10) + +#define GERUDO_WHITE_PATH_INDEX_NONE 0x3F //! Only the first type is used typedef enum { diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 15c1517895..facc4def29 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -200,8 +200,8 @@ s32 EnGe2_LookForPlayer(PlayState* play, Actor* actor, Vec3f* pos, s16 yaw, s16 * @return true if path is set up in reverse */ s32 EnGe2_SetupPath(EnGe2* this, PlayState* play) { - if (GERUDO_PURPLE_GET_PATH(&this->picto.actor) != GERUDO_PURPLE_PATH_NONE) { - this->path = &play->setupPathList[GERUDO_PURPLE_GET_PATH(&this->picto.actor)]; + if (GERUDO_PURPLE_GET_PATH_INDEX(&this->picto.actor) != GERUDO_PRUPLE_PATH_INDEX_NONE) { + this->path = &play->setupPathList[GERUDO_PURPLE_GET_PATH_INDEX(&this->picto.actor)]; if (this->path != NULL) { Path* path = this->path; Vec3s* points = Lib_SegmentedToVirtual(path->points); @@ -228,14 +228,14 @@ void EnGe2_GetNextPath(EnGe2* this, PlayState* play) { Path* curPath; Path* nextPath; Vec3s* points; - u8 unk1; + u8 nextPathIndex; this->curPointIndex = 0; - if (GERUDO_PURPLE_GET_PATH(&this->picto.actor) != GERUDO_PURPLE_PATH_NONE) { - curPath = &play->setupPathList[GERUDO_PURPLE_GET_PATH(&this->picto.actor)]; - unk1 = curPath->unk1; - nextPath = &play->setupPathList[unk1]; + if (GERUDO_PURPLE_GET_PATH_INDEX(&this->picto.actor) != GERUDO_PRUPLE_PATH_INDEX_NONE) { + curPath = &play->setupPathList[GERUDO_PURPLE_GET_PATH_INDEX(&this->picto.actor)]; + nextPathIndex = curPath->additionalPathIndex; + nextPath = &play->setupPathList[nextPathIndex]; this->path = nextPath; points = Lib_SegmentedToVirtual(nextPath->points); this->picto.actor.world.pos.x = points[0].x; @@ -252,8 +252,8 @@ void EnGe2_SetupBlownAwayPath(EnGe2* this, PlayState* play) { this->curPointIndex = 0; - if (GERUDO_PURPLE_GET_PATH(&this->picto.actor) != GERUDO_PURPLE_PATH_NONE) { - this->path = &play->setupPathList[GERUDO_PURPLE_GET_PATH(&this->picto.actor)]; + if (GERUDO_PURPLE_GET_PATH_INDEX(&this->picto.actor) != GERUDO_PRUPLE_PATH_INDEX_NONE) { + this->path = &play->setupPathList[GERUDO_PURPLE_GET_PATH_INDEX(&this->picto.actor)]; if (this->path != NULL) { points = Lib_SegmentedToVirtual(this->path->points); Math_Vec3s_ToVec3f(&this->picto.actor.world.pos, points); diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h index 0a85e3bfe4..ee0d99d00e 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -11,12 +11,12 @@ typedef void (*EnGe2ActionFunc)(struct EnGe2*, PlayState*); #define GERUDO_PURPLE_GET_EXIT(thisx) (((thisx)->params) & 0x1F) //!< Exit to send Player to when caught #define GERUDO_PURPLE_GET_TYPE(thisx) (((thisx)->params & 0xE0) >> 5) -#define GERUDO_PURPLE_GET_PATH(thisx) ((((thisx)->params) & 0xFC00) >> 10) +#define GERUDO_PURPLE_GET_PATH_INDEX(thisx) ((((thisx)->params) & 0xFC00) >> 10) -#define GERUDO_PURPLE_PARAMS(path, type, exit) (((path) & 0x1F) | (((type) & 7) << 5) | (((exit) & 0x3F) << 10)) +#define GERUDO_PURPLE_PARAMS(exit, type, pathIndex) (((exit) & 0x1F) | (((type) & 7) << 5) | (((pathIndex) & 0x3F) << 10)) #define GERUDO_PURPLE_EXIT_NONE 0x1F -#define GERUDO_PURPLE_PATH_NONE 0x3F +#define GERUDO_PRUPLE_PATH_INDEX_NONE 0x3F typedef enum { /* 0 */ GERUDO_PURPLE_TYPE_CUTSCENE, diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index 76e3d69dac..e059456805 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -183,14 +183,14 @@ void func_80B3B0A0(EnGg2* this, PlayState* play) { void func_80B3B120(EnGg2* this, PlayState* play) { Vec3s sp30; - if (this->unk_1D8 != NULL) { - func_80B3B7E4(this->unk_1D8, this->unk_1DC, &this->actor.world.pos, &sp30); + if (this->path != NULL) { + func_80B3B7E4(this->path, this->unk_1DC, &this->actor.world.pos, &sp30); Math_SmoothStepToS(&this->actor.world.rot.y, sp30.y, 4, 0x3E8, 1); this->actor.shape.rot.y = this->actor.world.rot.y; Math_SmoothStepToS(&this->actor.shape.rot.x, sp30.x, 4, 0x3E8, 1); this->actor.world.rot.x = -this->actor.shape.rot.x; - if (func_80B3B648(this, this->unk_1D8, this->unk_1DC) != 0) { - if (this->unk_1DC >= (this->unk_1D8->count - 2)) { + if (func_80B3B648(this, this->path, this->unk_1DC) != 0) { + if (this->unk_1DC >= (this->path->count - 2)) { this->actionFunc = func_80B3AE60; this->actor.speed = 0.0f; } else { @@ -227,15 +227,15 @@ void func_80B3B294(EnGg2* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_20_10); } - if (this->unk_1D8 != NULL) { - func_80B3B7E4(this->unk_1D8, this->unk_1DC, &this->actor.world.pos, &sp30); + if (this->path != NULL) { + func_80B3B7E4(this->path, this->unk_1DC, &this->actor.world.pos, &sp30); Math_SmoothStepToS(&this->actor.world.rot.y, sp30.y, 4, 0x3E8, 1); this->actor.shape.rot.y = this->actor.world.rot.y; Math_SmoothStepToS(&this->actor.shape.rot.x, sp30.x, 4, 0x3E8, 1); this->actor.world.rot.x = -this->actor.shape.rot.x; - if (func_80B3B648(this, this->unk_1D8, this->unk_1DC)) { - if (this->unk_1DC < (this->unk_1D8->count - 1)) { + if (func_80B3B648(this, this->path, this->unk_1DC)) { + if (this->unk_1DC < (this->path->count - 1)) { this->unk_1DC++; } else { this->unk_2F1 = 1; @@ -369,7 +369,7 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400; SkelAnime_InitFlex(play, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable, this->morphTable, 20); - this->unk_1D8 = SubS_GetPathByIndex(play, ENGG2_GET_FC00(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENGG2_GET_PATH_INDEX(&this->actor), ENGG2_PATH_INDEX_NONE); this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; this->unk_2F0 = 0; this->unk_2F1 = 0; diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h index ff7aec4a6d..83b4bad42b 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.h @@ -7,14 +7,16 @@ struct EnGg2; typedef void (*EnGg2ActionFunc)(struct EnGg2*, PlayState*); -#define ENGG2_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) +#define ENGG2_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 0xA) + +#define ENGG2_PATH_INDEX_NONE 0x3F typedef struct EnGg2 { /* 0x000 */ Actor actor; /* 0x144 */ UNK_TYPE1 unk144[0x4C]; /* 0x190 */ SkelAnime skelAnime; /* 0x1D4 */ EnGg2ActionFunc actionFunc; - /* 0x1D8 */ Path* unk_1D8; + /* 0x1D8 */ Path* path; /* 0x1DC */ s32 unk_1DC; /* 0x1E0 */ Vec3s unk_1E0; /* 0x1E6 */ Vec3s unk_1E6; 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 edb079373a..8692f937cf 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -1025,7 +1025,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); } else { this->csId = this->actor.csId; - this->path = SubS_GetPathByIndex(play, ENGK_GET_F0(&this->actor), 0xF); + this->path = SubS_GetPathByIndex(play, ENGK_GET_PATH_INDEX(&this->actor), ENGK_PATH_INDEX_NONE); this->actionFunc = func_80B51760; } } else if (play->sceneId == SCENE_GORONRACE) { diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.h b/src/overlays/actors/ovl_En_Gk/z_en_gk.h index 0f74c1d658..fd724cc7c6 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.h +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.h @@ -8,9 +8,11 @@ struct EnGk; typedef void (*EnGkActionFunc)(struct EnGk*, PlayState*); #define ENGK_GET_F(thisx) ((thisx)->params & 0xF) -#define ENGK_GET_F0(thisx) (((thisx)->params & 0xF0) >> 4) +#define ENGK_GET_PATH_INDEX(thisx) (((thisx)->params & 0xF0) >> 4) #define ENGK_GET_3F00(thisx) (((thisx)->params & 0x3F00) >> 8) +#define ENGK_PATH_INDEX_NONE 0xF + enum { /* 0 */ ENGK_F_0, /* 1 */ ENGK_F_1, 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 4c4aa474be..bcdb204311 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -973,7 +973,7 @@ s32 func_8094F53C(EnGm* this, PlayState* play) { } s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput, u8 arg3, s16 arg4) { - u8 sp4F = ENGM_GET_FF(&this->actor); + u8 pathIndex = ENGM_GET_PATH_INDEX(&this->actor); Vec3s* sp48; Vec3f sp3C; Vec3f sp30; @@ -985,7 +985,7 @@ s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput, u actor = func_8094DEE0(this, play, arg3, arg4); if (D_80951A0C[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80951A0C[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80951A0C[scheduleOutput->result]); } if ((actor != NULL) && (actor->update != NULL)) { @@ -1004,7 +1004,7 @@ s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput, u s32 func_8094F904(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp56 = SCHEDULE_TIME_NOW; - u8 sp55 = ENGM_GET_FF(&this->actor); + u8 pathIndex = ENGM_GET_PATH_INDEX(&this->actor); EnDoor* door; Vec3s* sp4C; Vec3f sp40; @@ -1016,7 +1016,7 @@ s32 func_8094F904(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { door = func_8094DF90(play, scheduleOutput->result); if (D_80951A0C[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp55, D_80951A0C[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80951A0C[scheduleOutput->result]); } if ((door != NULL) && (door->knobDoor.dyna.actor.update != NULL)) { @@ -1051,14 +1051,14 @@ s32 func_8094F904(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp2E = SCHEDULE_TIME_NOW; u16 phi_v1; - u8 sp2B = ENGM_GET_FF(&this->actor); + u8 pathIndex = ENGM_GET_PATH_INDEX(&this->actor); u16 tmp; s16 pad; s32 ret = false; this->timePath = NULL; if (D_80951A0C[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80951A0C[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80951A0C[scheduleOutput->result]); } if ((this->timePath != NULL) && (this->timePath->count < 3)) { @@ -1152,7 +1152,7 @@ s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { 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); + u8 pathIndex = ENGM_GET_PATH_INDEX(&this->actor); Vec3s* sp48; Vec3f sp3C; Vec3f sp30; @@ -1162,7 +1162,7 @@ s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->timePath = NULL; if (D_80951A0C[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80951A0C[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80951A0C[scheduleOutput->result]); } if (this->timePath != NULL) { diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.h b/src/overlays/actors/ovl_En_Gm/z_en_gm.h index 6eede07441..760c9d91ce 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.h +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.h @@ -9,7 +9,7 @@ typedef void (*EnGmActionFunc)(struct EnGm*, PlayState*); typedef s32 (*EnGmUnkFunc)(struct EnGm*, PlayState*); typedef void (*EnGmUnkFunc2)(struct EnGm*, PlayState*); -#define ENGM_GET_FF(thisx) ((thisx)->params & 0xFF) +#define ENGM_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF) typedef struct EnGm { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index f706289304..216d5c301d 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1883,7 +1883,8 @@ void EnGo_SetupSpectator(EnGo* this, PlayState* play) { */ void EnGo_SetupGatekeeper(EnGo* this, PlayState* play) { if (gSaveContext.save.day >= 2) { - this->gatekeeperPath = SubS_GetDayDependentPath(play, ENGO_GET_PATH(&this->actor), 0xFF, &this->indexPathPoint); + this->gatekeeperPath = SubS_GetDayDependentPath(play, ENGO_GET_PATH_INDEX(&this->actor), ENGO_PATH_INDEX_NONE, + &this->indexPathPoint); if (this->gatekeeperPath != NULL) { this->indexPathPoint = 1; } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index a1c96214b5..23c02a9c4c 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -11,8 +11,9 @@ typedef s32 (*MsgEventFunc)(Actor*, PlayState*); #define ENGO_GET_TYPE(thisx) (((thisx)->params & 0xF) & 0xFF) #define ENGO_GET_SUBTYPE(thisx) ((((thisx)->params & 0x70) >> 4) & 0xFF) +#define ENGO_GET_PATH_INDEX(thisx) ((((thisx)->params & 0x7F80) >> 7) & 0xFF) -#define ENGO_GET_PATH(thisx) ((((thisx)->params & 0x7F80) >> 7) & 0xFF) +#define ENGO_PATH_INDEX_NONE 0xFF #define ENGO_SNOW_EFFECT_COUNT 16 #define ENGO_OTHER_EFFECT_COUNT 16 diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c index 43a5895d55..e0f9301cea 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c @@ -87,7 +87,7 @@ void EnHiddenNuts_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->unk_21E = ENHIDDENNUTS_GET_F80(&this->actor); + this->pathIndex = ENHIDDENNUTS_GET_PATH_INDEX(&this->actor); this->switchFlag = ENHIDDENNUTS_GET_SWITCHFLAG(&this->actor); if (this->switchFlag == 0x7F) { @@ -99,12 +99,12 @@ void EnHiddenNuts_Init(Actor* thisx, PlayState* play) { return; } - if (this->unk_21E == 0x1F) { + if (this->pathIndex == ENHIDDENNUTS_PATH_INDEX_NONE) { Actor_Kill(&this->actor); return; } - this->path = SubS_GetPathByIndex(play, this->unk_21E, 0x3F); + this->path = SubS_GetPathByIndex(play, this->pathIndex, ENHIDDENNUTS_PATH_INDEX_NONE_ALT); this->csId = this->actor.csId; func_801A5080(2); func_80BDB268(this); diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h index 435e4662cd..03a0a52b78 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.h @@ -8,7 +8,10 @@ struct EnHiddenNuts; typedef void (*EnHiddenNutsActionFunc)(struct EnHiddenNuts*, PlayState*); #define ENHIDDENNUTS_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F) -#define ENHIDDENNUTS_GET_F80(thisx) (((thisx)->params >> 7) & 0x1F) +#define ENHIDDENNUTS_GET_PATH_INDEX(thisx) (((thisx)->params >> 7) & 0x1F) + +#define ENHIDDENNUTS_PATH_INDEX_NONE 0x1F +#define ENHIDDENNUTS_PATH_INDEX_NONE_ALT 0x3F typedef struct EnHiddenNuts { /* 0x000 */ Actor actor; @@ -23,7 +26,7 @@ typedef struct EnHiddenNuts { /* 0x218 */ s16 unk_218; /* 0x21A */ s16 unk_21A; /* 0x21C */ s16 switchFlag; - /* 0x21E */ s16 unk_21E; + /* 0x21E */ s16 pathIndex; /* 0x220 */ s32 unk_220; /* 0x224 */ s16 unk_224; /* 0x226 */ s16 csId; 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 86d6309b67..d4ccc8fd6e 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -497,7 +497,7 @@ s32 func_80BF1B40(EnIg* this, PlayState* play) { } s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput, s32 arg3, s32 arg4) { - u8 sp4F = ENIG_GET_FF(&this->actor); + u8 pathIndex = ENIG_GET_PATH_INDEX(&this->actor); Vec3s* sp48; Vec3f sp3C; Vec3f sp30; @@ -509,7 +509,7 @@ s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput, s this->timePath = NULL; if (D_80BF3318[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80BF3318[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80BF3318[scheduleOutput->result]); } if ((sp2C != NULL) && (sp2C->update != NULL)) { @@ -541,7 +541,7 @@ s32 func_80BF1D78(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp56 = SCHEDULE_TIME_NOW; - u8 sp55 = ENIG_GET_FF(&this->actor); + u8 pathIndex = ENIG_GET_PATH_INDEX(&this->actor); EnDoor* door; Vec3s* sp4C; Vec3f sp40; @@ -553,7 +553,7 @@ s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { door = func_80BF1200(play, scheduleOutput->result); if (D_80BF3318[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp55, D_80BF3318[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80BF3318[scheduleOutput->result]); } if ((door != NULL) && (door->knobDoor.dyna.actor.update != NULL)) { @@ -587,7 +587,7 @@ s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp2E = SCHEDULE_TIME_NOW; u16 phi_v1; - u8 sp2B = ENIG_GET_FF(&this->actor); + u8 pathIndex = ENIG_GET_PATH_INDEX(&this->actor); u16 tmp; s16 pad; s32 ret = false; @@ -595,7 +595,7 @@ s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->timePath = NULL; if (D_80BF3318[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80BF3318[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80BF3318[scheduleOutput->result]); } if ((this->timePath != NULL) && (this->timePath->count < 3)) { @@ -635,7 +635,7 @@ s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { } s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { - u8 sp4F = ENIG_GET_FF(&this->actor); + u8 pathIndex = ENIG_GET_PATH_INDEX(&this->actor); Vec3f sp40; Vec3f sp34; Vec3s* sp30; @@ -645,7 +645,7 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->timePath = NULL; if (D_80BF3318[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80BF3318[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80BF3318[scheduleOutput->result]); } if ((this->timePath != 0) && (this->timePath->count >= 2)) { diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.h b/src/overlays/actors/ovl_En_Ig/z_en_ig.h index c3fd0c3fb9..274338a113 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.h +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.h @@ -9,7 +9,7 @@ typedef void (*EnIgActionFunc)(struct EnIg*, PlayState*); typedef s32 (*EnIgUnkFunc)(struct EnIg*, PlayState*); typedef void (*EnIgUnkFunc2)(struct EnIg*, PlayState*); -#define ENIG_GET_FF(thisx) ((thisx)->params & 0xFF) +#define ENIG_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF) typedef struct EnIg { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 5031d7e872..514074a8f8 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -274,10 +274,10 @@ void EnIn_DoNothing(EnIn* this, PlayState* play) { } void func_808F3618(EnIn* this, PlayState* play) { - if (ENIN_GET_PATH(&this->actor) != 0x3F) { + if (ENIN_GET_PATH_INDEX(&this->actor) != ENIN_PATH_INDEX_NONE) { EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_9); } - if (ENIN_GET_PATH(&this->actor) != 0x3F) { + if (ENIN_GET_PATH_INDEX(&this->actor) != ENIN_PATH_INDEX_NONE) { this->actionFunc = func_808F3690; } else { this->actionFunc = EnIn_DoNothing; @@ -1517,7 +1517,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) { Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, &this->colliderJntSphElement); Actor_SetScale(&this->actor, 0.01f); this->actor.gravity = -4.0f; - this->path = SubS_GetPathByIndex(play, ENIN_GET_PATH(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENIN_GET_PATH_INDEX(&this->actor), ENIN_PATH_INDEX_NONE); this->unk23D = 0; if ((type == ENIN_YELLOW_SHIRT) || (type == ENIN_BLUE_SHIRT)) { if ((GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_2) || diff --git a/src/overlays/actors/ovl_En_In/z_en_in.h b/src/overlays/actors/ovl_En_In/z_en_in.h index dd32ac9c66..c5d7500b68 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.h +++ b/src/overlays/actors/ovl_En_In/z_en_in.h @@ -37,7 +37,9 @@ typedef enum { } EnInAnimation; #define ENIN_GET_TYPE(thisx) ((thisx)->params & 0x1FF) -#define ENIN_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) // Only used with ENIN_UNK_TYPE +#define ENIN_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) // Only used with ENIN_UNK_TYPE + +#define ENIN_PATH_INDEX_NONE 0x3F typedef struct EnIn { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index 451b9e553e..7479a6208a 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -957,7 +957,7 @@ void EnJg_Init(Actor* thisx, PlayState* play) { this->actionFunc = EnJg_LullabyIntroCutsceneAction; } else { // This is the elder that appears in Mountain Village or the Path to Goron Village in winter. - this->path = SubS_GetPathByIndex(play, EN_JG_GET_PATH(thisx), 0x3F); + this->path = SubS_GetPathByIndex(play, EN_JG_GET_PATH_INDEX(thisx), EN_JG_PATH_INDEX_NONE); this->animIndex = EN_JG_ANIM_SURPRISE_START; this->action = EN_JG_ACTION_SPAWNING; this->freezeTimer = 1000; diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.h b/src/overlays/actors/ovl_En_Jg/z_en_jg.h index ad8eee0a89..b63f34dce5 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.h +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.h @@ -5,7 +5,9 @@ #include "objects/object_jg/object_jg.h" #define EN_JG_IS_IN_GORON_SHRINE(thisx) ((thisx)->params & 0x1) -#define EN_JG_GET_PATH(thisx) (((thisx)->params & 0xFC00) >> 10) +#define EN_JG_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 10) + +#define EN_JG_PATH_INDEX_NONE 0x3F struct EnJg; diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 25fe130641..b023bf688d 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -119,7 +119,7 @@ void func_80C13A2C(EnJgameTsn* this, PlayState* play) { this->unk_1D8[i].points = Lib_SegmentedToVirtual(path->points); this->unk_1D8[i].count = path->count; - path = &play->setupPathList[path->unk1]; + path = &play->setupPathList[path->additionalPathIndex]; if (path == NULL) { Actor_Kill(&this->actor); } @@ -128,7 +128,7 @@ void func_80C13A2C(EnJgameTsn* this, PlayState* play) { this->unk_1F8.points = Lib_SegmentedToVirtual(path->points); this->unk_1F8.count = path->count; - path = &play->setupPathList[path->unk1]; + path = &play->setupPathList[path->additionalPathIndex]; if (path == NULL) { Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index abf5e9eb44..350f4ae822 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -194,7 +194,7 @@ s32 func_80968B8C(EnJs* this, PlayState* play) { f32 sp18 = 0.0f; Vec3s* points; - if (pathIndex != 0x3F) { + if (pathIndex != ENJS_PATH_INDEX_NONE) { this->path = &play->setupPathList[pathIndex]; if (this->path != NULL) { path = this->path; diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.h b/src/overlays/actors/ovl_En_Js/z_en_js.h index c4dd3e3a2c..f673a97d63 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.h +++ b/src/overlays/actors/ovl_En_Js/z_en_js.h @@ -8,6 +8,8 @@ #define ENJS_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 10) #define ENJS_GET_EXIT_INDEX(thisx) (((thisx)->params & 0x3F0) >> 4) +#define ENJS_PATH_INDEX_NONE 0x3F + struct EnJs; typedef void (*EnJsActionFunc)(struct EnJs*, PlayState*); diff --git a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c index cc333b2ae5..908bbf3744 100644 --- a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c +++ b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.c @@ -112,7 +112,7 @@ void EnLookNuts_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 1; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; - this->pathLocation = LOOKNUTS_GET_PATROL_LOCATION(&this->actor); + this->pathIndex = LOOKNUTS_GET_PATH_INDEX(&this->actor); this->switchFlag = LOOKNUTS_GET_SCENE_FLAG(&this->actor); this->spawnIndex = LOOKNUTS_GET_SPAWN_INDEX(&this->actor); @@ -123,7 +123,7 @@ void EnLookNuts_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); return; } - if (this->pathLocation == 0x1F) { + if (this->pathIndex == LOOKNUTS_PATH_INDEX_NONE) { Actor_Kill(&this->actor); return; } @@ -165,17 +165,17 @@ void EnLookNuts_Patrol(EnLookNuts* this, PlayState* play) { return; } - this->path = SubS_GetPathByIndex(play, this->pathLocation, 0x1F); + this->path = SubS_GetPathByIndex(play, this->pathIndex, LOOKNUTS_PATH_INDEX_NONE); if (this->path != NULL) { - sp34 = SubS_GetDistSqAndOrientPath(this->path, this->currentPathIndex, &this->actor.world.pos, &sp30); + sp34 = SubS_GetDistSqAndOrientPath(this->path, this->waypointIndex, &this->actor.world.pos, &sp30); } //! @bug sp30 is uninitialised if path == NULL. Fix by enclosing everything in the path NULL check. if (sp30 < 10.0f) { if (this->path != NULL) { - this->currentPathIndex++; - if (this->currentPathIndex >= this->path->count) { - this->currentPathIndex = 0; + this->waypointIndex++; + if (this->waypointIndex >= this->path->count) { + this->waypointIndex = 0; } if (Rand_ZeroOne() < 0.6f) { EnLookNuts_SetupStandAndWait(this); diff --git a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.h b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.h index b72215ce69..92c24cfbde 100644 --- a/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.h +++ b/src/overlays/actors/ovl_En_Look_Nuts/z_en_look_nuts.h @@ -10,7 +10,9 @@ typedef void (*EnLookNutsActionFunc)(struct EnLookNuts*, PlayState*); #define LOOKNUTS_GET_SPAWN_INDEX(thisx) (((thisx)->params >> 0xC) & 0xF) #define LOOKNUTS_GET_SCENE_FLAG(thisx) ((thisx)->params & 0x7F) -#define LOOKNUTS_GET_PATROL_LOCATION(thisx) (((thisx)->params >> 0x7) & 0x1F) +#define LOOKNUTS_GET_PATH_INDEX(thisx) (((thisx)->params >> 0x7) & 0x1F) + +#define LOOKNUTS_PATH_INDEX_NONE 0x1F typedef struct EnLookNuts { /* 0x000 */ Actor actor; @@ -19,13 +21,13 @@ typedef struct EnLookNuts { /* 0x1CA */ Vec3s morphTable[DEKU_PALACE_GUARD_LIMB_MAX]; /* 0x20C */ EnLookNutsActionFunc actionFunc; /* 0x210 */ Path *path; - /* 0x214 */ s16 currentPathIndex; // Index for the point where the deku guard is in its path + /* 0x214 */ s16 waypointIndex; // Index for the point where the deku guard is in its path /* 0x216 */ s16 eyeState; /* 0x218 */ s16 blinkTimer; /* 0x21A */ s16 eventTimer; // Timer to trigger when another event within the actor will happen /* 0x21C */ s16 state; /* 0x21E */ s16 switchFlag; - /* 0x220 */ s16 pathLocation; // Determines path that a guard will patrol + /* 0x220 */ s16 pathIndex; // Determines path that a guard will patrol /* 0x222 */ s16 isPlayerDetected; /* 0x224 */ s16 waitTimer; // Timer for how long the deku guard will take a break for /* 0x226 */ s16 spawnIndex; diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 44bb67443b..d295b1c7f6 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -163,9 +163,9 @@ void EnMa4_InitPath(EnMa4* this, PlayState* play) { Path* path; Vec3f nextPoint; - path = &play->setupPathList[(this->actor.params & 0xFF00) >> 8]; + path = &play->setupPathList[ENMA_GET_PATH_INDEX(&this->actor)]; this->pathPoints = Lib_SegmentedToVirtual(path->points); - this->pathIndex = 0; + this->waypointIndex = 0; this->pathPointsCount = path->count; this->actor.home.pos.x = this->pathPoints[0].x; @@ -272,9 +272,9 @@ void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_ROMANI_BOW_FLICK); } - sp34.x = this->pathPoints[this->pathIndex].x; - sp34.y = this->pathPoints[this->pathIndex].y; - sp34.z = this->pathPoints[this->pathIndex].z; + sp34.x = this->pathPoints[this->waypointIndex].x; + sp34.y = this->pathPoints[this->waypointIndex].y; + sp34.z = this->pathPoints[this->waypointIndex].z; sp2E = Math_Vec3f_Yaw(&this->actor.world.pos, &sp34); if (Math_Vec3f_DistXZ(&this->actor.world.pos, &sp34) > 50.0f) { Math_SmoothStepToS(&this->actor.world.rot.y, sp2E, 10, 0x3000, 0x100); @@ -291,10 +291,10 @@ void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { } } - if (this->pathIndex < (this->pathPointsCount - 1)) { - this->pathIndex++; + if (this->waypointIndex < (this->pathPointsCount - 1)) { + this->waypointIndex++; } else { - this->pathIndex = 0; + this->waypointIndex = 0; } } diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h index 91876c9386..dfedd3330e 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.h @@ -8,6 +8,8 @@ struct EnMa4; typedef void (*EnMa4ActionFunc)(struct EnMa4*, PlayState*); +#define ENMA_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) + typedef struct EnMa4 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; @@ -19,7 +21,7 @@ typedef struct EnMa4 { /* 0x28E */ UNK_TYPE1 unk28E[0x6]; /* 0x294 */ Vec3s morphTable[ROMANI_LIMB_MAX]; /* 0x31E */ UNK_TYPE1 unk31E[0x6]; - /* 0x324 */ s16 pathIndex; + /* 0x324 */ s16 waypointIndex; /* 0x326 */ s16 pathPointsCount; /* 0x328 */ UNK_TYPE1 unk_328[0x2]; /* 0x32A */ s16 blinkTimer; diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index e64e09cbca..e47515c5d9 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -167,9 +167,9 @@ void EnPamera_Init(Actor* thisx, PlayState* play) { } func_80BD8700(this); } else { - this->pathIndex = this->pathPointsCount - 1; - Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[this->pathIndex]); - Math_Vec3s_ToVec3f(&sp44, &this->pathPoints[this->pathIndex - 1]); + this->waypointIndex = this->pathCount - 1; + Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[this->waypointIndex]); + Math_Vec3s_ToVec3f(&sp44, &this->pathPoints[this->waypointIndex - 1]); this->actor.world.rot.y = this->actor.shape.rot.y = Math_Vec3f_Yaw(&sp44, &this->actor.world.pos); func_80BD8CCC(this); } @@ -195,19 +195,19 @@ s32 func_80BD84F0(EnPamera* this, PlayState* play) { } void func_80BD8588(EnPamera* this, PlayState* play) { - Path* path = &play->setupPathList[((this->actor.params & 0xFF0) >> 4)]; + Path* path = &play->setupPathList[ENPAMERA_GET_PATH_INDEX(&this->actor)]; Vec3f sp28; if (path == NULL) { Actor_Kill(&this->actor); } if (CHECK_WEEKEVENTREG(WEEKEVENTREG_61_04)) { - path = &play->setupPathList[path->unk1]; + path = &play->setupPathList[path->additionalPathIndex]; } this->pathPoints = Lib_SegmentedToVirtual(path->points); - this->pathIndex = 0; - this->pathPointsCount = path->count; - this->pathId = path->unk1; + this->waypointIndex = 0; + this->pathCount = path->count; + this->additionalPathIndex = path->additionalPathIndex; Math_Vec3s_ToVec3f(&sp28, this->pathPoints); this->actor.world.rot.y = this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &sp28); } @@ -323,15 +323,15 @@ void func_80BD8B70(EnPamera* this, PlayState* play) { Vec3f vec; s16 sp32; - vec.x = this->pathPoints[this->pathIndex].x; - vec.y = this->pathPoints[this->pathIndex].y; - vec.z = this->pathPoints[this->pathIndex].z; + vec.x = this->pathPoints[this->waypointIndex].x; + vec.y = this->pathPoints[this->waypointIndex].y; + vec.z = this->pathPoints[this->waypointIndex].z; sp32 = Math_Vec3f_Yaw(&this->actor.world.pos, &vec); if (Math_Vec3f_StepToXZ(&this->actor.world.pos, &vec, this->actor.speed) > 10.0f) { Math_SmoothStepToS(&this->actor.shape.rot.y, sp32, 0xA, 0x3000, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - } else if (this->pathIndex < (this->pathPointsCount - 1)) { - this->pathIndex++; + } else if (this->waypointIndex < (this->pathCount - 1)) { + this->waypointIndex++; } else { func_80BD8CCC(this); } @@ -356,8 +356,8 @@ void func_80BD8D1C(EnPamera* this, PlayState* play) { } void func_80BD8D80(EnPamera* this) { - if (this->pathIndex > 0) { - this->pathIndex--; + if (this->waypointIndex > 0) { + this->waypointIndex--; } this->actor.gravity = -2.0f; this->actionFunc = func_80BD8DB0; @@ -367,15 +367,15 @@ void func_80BD8DB0(EnPamera* this, PlayState* play) { Vec3f vec; s16 sp32; - vec.x = this->pathPoints[this->pathIndex].x; - vec.y = this->pathPoints[this->pathIndex].y; - vec.z = this->pathPoints[this->pathIndex].z; + vec.x = this->pathPoints[this->waypointIndex].x; + vec.y = this->pathPoints[this->waypointIndex].y; + vec.z = this->pathPoints[this->waypointIndex].z; sp32 = Math_Vec3f_Yaw(&this->actor.world.pos, &vec); if (Math_Vec3f_StepToXZ(&this->actor.world.pos, &vec, this->actor.speed) > 10.0f) { Math_SmoothStepToS(&this->actor.shape.rot.y, sp32, 0xA, 0x3000, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - } else if (this->pathIndex > 0) { - this->pathIndex--; + } else if (this->waypointIndex > 0) { + this->waypointIndex--; } else { func_80BD9338(this, play); func_80BD8A38(this); @@ -404,9 +404,9 @@ void func_80BD8FF0(EnPamera* this) { Vec3f pameraPos; s16 pameraYaw; - this->pathIndex = this->pathPointsCount - 1; - Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[this->pathPointsCount - 1]); - Math_Vec3s_ToVec3f(&pameraPos, &this->pathPoints[this->pathPointsCount - 2]); + this->waypointIndex = this->pathCount - 1; + Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[this->pathCount - 1]); + Math_Vec3s_ToVec3f(&pameraPos, &this->pathPoints[this->pathCount - 2]); pameraYaw = Math_Vec3f_Yaw(&pameraPos, &this->actor.world.pos); this->actor.shape.rot.y = pameraYaw; this->actor.world.rot.y = pameraYaw; @@ -422,7 +422,7 @@ void func_80BD90AC(EnPamera* this, PlayState* play) { if (Player_GetMask(play) != PLAYER_MASK_STONE && (this->actionFunc != func_80BD8758) && (this->actionFunc != func_80BD8964) && (this->actionFunc != func_80BD8A7C) && - (this->actionFunc != func_80BD8F60) && ((this->actionFunc != func_80BD8B70) || (this->pathIndex != 0)) && + (this->actionFunc != func_80BD8F60) && ((this->actionFunc != func_80BD8B70) || (this->waypointIndex != 0)) && ((this->actionFunc != func_80BD8DB0) || (this->actor.speed != 3.0f)) && ((this->actor.xzDistToPlayer < 150.0f) || ((this->actionFunc == func_80BD909C) && @@ -456,14 +456,14 @@ s32 func_80BD9234(EnPamera* this, PlayState* play) { void func_80BD92D0(EnPamera* this, PlayState* play) { Path* path; - s32 pathId = this->pathId; + s32 pathIndex = this->additionalPathIndex; - path = &play->setupPathList[pathId]; - if (pathId >= 0) { + path = &play->setupPathList[pathIndex]; + if (pathIndex >= 0) { this->pathPoints = Lib_SegmentedToVirtual(path->points); - this->pathIndex = 0; - this->pathPointsCount = path->count; - this->pathId = path->unk1; + this->waypointIndex = 0; + this->pathCount = path->count; + this->additionalPathIndex = path->additionalPathIndex; } } diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h index 59bf40e09e..4fa3e4f5f9 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h @@ -9,6 +9,8 @@ struct EnPamera; typedef void (*EnPameraActionFunc)(struct EnPamera*, PlayState*); typedef void (*EnPameraSetupFunc)(struct EnPamera*, PlayState*); +#define ENPAMERA_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF0) >> 4) + typedef struct EnPamera { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; @@ -16,9 +18,9 @@ typedef struct EnPamera { /* 0x1D4 */ EnPameraActionFunc actionFunc; /* 0x1D8 */ EnPameraSetupFunc setupFunc; /* 0x1DC */ Vec3s* pathPoints; - /* 0x1E0 */ s32 pathIndex; - /* 0x1E4 */ s32 pathPointsCount; - /* 0x1E8 */ s32 pathId; + /* 0x1E0 */ s32 waypointIndex; + /* 0x1E4 */ s32 pathCount; + /* 0x1E8 */ s32 additionalPathIndex; /* 0x1EC */ s32 unk_1EC; /* 0x1F0 */ Vec3s jointTable[PAMELA_LIMB_MAX]; /* 0x27A */ Vec3s morphTable[PAMELA_LIMB_MAX]; 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 99e301250d..0627ddbf82 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -1197,7 +1197,7 @@ s32 func_80AF8DD4(EnPm* this, PlayState* play) { } s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput, u8 actorCat, s16 actorId) { - u8 sp4F = this->actor.params & 0xFF; + u8 pathIndex = ENPM_GET_PATH_INDEX(&this->actor); Vec3s* sp48; Vec3f sp3C; Vec3f sp30; @@ -1208,7 +1208,7 @@ s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput, u this->timePath = NULL; sp2C = func_80AF7CB0(this, play, actorCat, actorId); if (D_80AFB430[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80AFB430[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80AFB430[scheduleOutput->result]); } if ((sp2C != NULL) && (sp2C->update != NULL)) { @@ -1228,7 +1228,7 @@ s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput, u s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp56 = SCHEDULE_TIME_NOW; - u8 sp55 = this->actor.params & 0xFF; + u8 pathIndex = ENPM_GET_PATH_INDEX(&this->actor); EnDoor* door; Vec3s* sp4C; Vec3f sp40; @@ -1239,7 +1239,7 @@ s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->timePath = NULL; door = func_80AF7D60(play, scheduleOutput->result); if (D_80AFB430[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp55, D_80AFB430[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80AFB430[scheduleOutput->result]); } if ((door != NULL) && (door->knobDoor.dyna.actor.update != NULL)) { @@ -1277,7 +1277,7 @@ s32 func_80AF9008(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp2E = SCHEDULE_TIME_NOW; u16 phi_v1; - u8 sp2B = this->actor.params & 0xFF; + u8 pathIndex = ENPM_GET_PATH_INDEX(&this->actor); u16 tmp; s16 pad; s32 ret = false; @@ -1285,7 +1285,7 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->timePath = NULL; if (D_80AFB430[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp2B, D_80AFB430[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80AFB430[scheduleOutput->result]); } if ((this->timePath != NULL) && (this->timePath->count < 3)) { @@ -1357,7 +1357,7 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { } s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { - u8 sp4F = this->actor.params & 0xFF; + u8 pathIndex = ENPM_GET_PATH_INDEX(&this->actor); Vec3f sp40; Vec3f sp34; Vec3s* sp30; @@ -1366,7 +1366,7 @@ s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->timePath = NULL; if (D_80AFB430[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, D_80AFB430[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80AFB430[scheduleOutput->result]); } if ((this->timePath != 0) && (this->timePath->count >= 2)) { @@ -1390,7 +1390,7 @@ s32 func_80AF94AC(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { } s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { - u8 sp4F = this->actor.params & 0xFF; + u8 pathIndex = ENPM_GET_PATH_INDEX(&this->actor); Vec3f sp40; Vec3f sp34; Vec3s* sp30; @@ -1419,7 +1419,7 @@ s32 func_80AF95E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { this->timePath = NULL; phi_a3 = D_80AFB430[scheduleOutput->result]; if (phi_a3 >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp4F, phi_a3); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, phi_a3); } if ((this->timePath != 0) && (this->timePath->count >= 2)) { diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.h b/src/overlays/actors/ovl_En_Pm/z_en_pm.h index c7bf76e378..bf7bbe8597 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.h +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.h @@ -9,6 +9,8 @@ typedef void (*EnPmActionFunc)(struct EnPm*, PlayState*); typedef s32 (*EnPmFunc)(struct EnPm*, PlayState*); typedef s32 (*EnPmFunc2)(struct EnPm*, PlayState*); +#define ENPM_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF) + typedef struct EnPm { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c index 7fe6e3d26c..f4747b4c67 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c @@ -151,8 +151,8 @@ void EnPr2_Init(Actor* thisx, PlayState* play) { Actor* parent = this->actor.parent; if (parent->update != NULL) { - this->unk_1C8 = ((EnEncount1*)parent)->pathIndex; - this->path = SubS_GetPathByIndex(play, this->unk_1C8, 0x3F); + this->pathIndex = ((EnEncount1*)parent)->pathIndex; + this->path = SubS_GetPathByIndex(play, this->pathIndex, ENPR2_PATH_INDEX_NONE); this->unk_208 = parent->world.rot.z * 20.0f; if (this->unk_208 < 20.0f) { this->unk_208 = 20.0f; @@ -272,7 +272,7 @@ void func_80A745FC(EnPr2* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_PIRANHA_EXIST - SFX_FLAG); Math_ApproachF(&this->unk_204, 0.02f, 0.1f, 0.005f); - if (this->path->unk2 < this->unk_1D0) { + if (this->path->customValue < this->unk_1D0) { Math_ApproachF(&this->actor.speed, 5.0f, 0.3f, 1.0f); } else { Math_ApproachF(&this->actor.speed, 10.0f, 0.3f, 1.0f); diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h index bbcd28afd8..94fb7e033d 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h @@ -10,6 +10,7 @@ typedef void (*EnPr2ActionFunc)(struct EnPr2*, PlayState*); #define ENPR2_GET_F(thisx) ((thisx)->params & 0xF) #define ENPR2_GET_FF0(thisx) (((thisx)->params >> 4) & 0xFF) +#define ENPR2_PATH_INDEX_NONE 0x3F #define ENPR2_PARAMS(paramF, paramFF0) (((paramF) & 0xF) | (((paramFF0) << 4) & 0xFF0)) typedef struct EnPr2 { @@ -18,7 +19,7 @@ typedef struct EnPr2 { /* 0x188 */ Vec3s jointTable[5]; /* 0x1A6 */ Vec3s morphtable[5]; /* 0x1C4 */ EnPr2ActionFunc actionFunc; - /* 0x1C8 */ s16 unk_1C8; + /* 0x1C8 */ s16 pathIndex; /* 0x1CC */ Path* path; /* 0x1D0 */ s32 unk_1D0; /* 0x1D4 */ s16 unk_1D4; diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index 80986adf48..d08110e433 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -313,7 +313,7 @@ void EnRacedog_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Actor_ProcessInitChain(&this->actor, sInitChain); - this->path = SubS_GetPathByIndex(play, ENRACEDOG_GET_PATH(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENRACEDOG_GET_PATH_INDEX(&this->actor), ENRACEDOG_PATH_INDEX_NONE); Actor_SetScale(&this->actor, 0.0075f); this->actor.gravity = -3.0f; if (ENRACEDOG_GET_INDEX(&this->actor) < RACEDOG_COUNT) { diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h index a8cf2a9f9a..a3d9afee51 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.h @@ -5,7 +5,10 @@ #include "objects/object_dog/object_dog.h" #define ENRACEDOG_GET_INDEX(thisx) (((thisx)->params & 0x3E0) >> 5) -#define ENRACEDOG_GET_PATH(thisx) (((thisx)->params & 0xFC00) >> 10) +#define ENRACEDOG_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 10) + +#define ENRACEDOG_PATH_INDEX_NONE 0x3F + #define ENRACEDOG_PARAMS(index, path) ((index << 5) | (path)) /** diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index 893062fbd2..9766fe6949 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -196,7 +196,7 @@ void EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation(EnRailgibud* this, Pl static s32 currentGibdoIndex = 0; s32 nextPoint; Vec3f targetPos; - Path* path = &play->setupPathList[ENRAILGIBUD_GET_PATH(&this->actor)]; + Path* path = &play->setupPathList[ENRAILGIBUD_GET_PATH_INDEX(&this->actor)]; this->points = Lib_SegmentedToVirtual(path->points); this->currentPoint = currentGibdoIndex; diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h index 95a2bbd7b4..f9d3922c85 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h @@ -10,7 +10,7 @@ typedef void (*EnRailgibudActionFunc)(struct EnRailgibud*, PlayState*); #define ENRAILGIBUD_GET_CUTSCENE_TYPE(thisx) ((thisx)->params & 0x7F) #define ENRAILGIBUD_IS_CUTSCENE_TYPE(thisx) ((thisx)->params & 0x80) -#define ENRAILGIBUD_GET_PATH(thisx) (((thisx)->params & 0xFF00) >> 8) +#define ENRAILGIBUD_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) typedef struct EnRailgibud { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.c b/src/overlays/actors/ovl_En_Rg/z_en_rg.c index a3a026f2bb..b6407d24bc 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c @@ -373,11 +373,11 @@ s32 func_80BF43FC(EnRg* this) { f32 sp88; f32 sp84; f32 phi_f20 = 0.0f; - s32 temp_s7 = ENRG_GET_7F80(&this->actor); + s32 pathIndex = ENRG_GET_PATH_INDEX(&this->actor); s32 phi_s4 = -1; s32 temp_s5 = this->unk_344; s16 phi_s6 = 0; - s32 phi_s0 = D_80BF57E4[this->unk_344][temp_s7]; + s32 phi_s0 = D_80BF57E4[this->unk_344][pathIndex]; do { SubS_CopyPointFromPathCheckBounds(this->path, phi_s0 - 1, &sp9C); @@ -390,7 +390,7 @@ s32 func_80BF43FC(EnRg* this) { phi_s4 = phi_s0; } phi_s0++; - } while ((temp_s5 != 18) && (phi_s0 < D_80BF57E4[temp_s5 + 1][temp_s7])); + } while ((temp_s5 != 18) && (phi_s0 < D_80BF57E4[temp_s5 + 1][pathIndex])); return phi_s4; } @@ -741,7 +741,8 @@ void EnRg_Init(Actor* thisx, PlayState* play) { Effect_Add(play, &this->unk_340, EFFECT_TIRE_MARK, 0, 0, &D_80BF59F0); - this->path = SubS_GetDayDependentPath(play, ENRG_GET_7F80(&this->actor), 255, &this->unk_33C); + this->path = + SubS_GetDayDependentPath(play, ENRG_GET_PATH_INDEX(&this->actor), ENRG_PATH_INDEX_NONE, &this->unk_33C); if (this->path != NULL) { this->unk_33C = 1; } diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.h b/src/overlays/actors/ovl_En_Rg/z_en_rg.h index 4db0b58e09..14f8e38820 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.h +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.h @@ -7,7 +7,9 @@ struct EnRg; typedef void (*EnRgActionFunc)(struct EnRg*, PlayState*); -#define ENRG_GET_7F80(thisx) ((((thisx)->params & 0x7F80) >> 7) & 0xFF) +#define ENRG_GET_PATH_INDEX(thisx) ((((thisx)->params & 0x7F80) >> 7) & 0xFF) + +#define ENRG_PATH_INDEX_NONE 0xFF typedef struct { /* 0x00 */ u8 unk_00; diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index ae7da7d1ba..6ea51586a9 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -35,7 +35,7 @@ void EnRiverSound_Init(Actor* thisx, PlayState* play) { this->playSound = false; pathIndex = RS_GET_PATH_INDEX(&this->actor); this->actor.params = RS_GET_TYPE(&this->actor); - if (pathIndex == 0xFF) { + if (pathIndex == RS_PATH_INDEX_NONE) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h index eff4fbb472..ceef56fbe1 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h @@ -8,6 +8,8 @@ struct EnRiverSound; #define RS_GET_TYPE(thisx) ((thisx)->params & 0xFF); #define RS_GET_PATH_INDEX(thisx) (((thisx)->params >> 8) & 0xFF); +#define RS_PATH_INDEX_NONE 0xFF + // Any param not as one of these values will result in UB typedef enum { /* 0x00 */ RS_RIVER_STREAM, diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.c b/src/overlays/actors/ovl_En_Ru/z_en_ru.c index b67ca2141c..3a4d305160 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.c +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.c @@ -235,7 +235,7 @@ void EnRu_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, RU_GET_PATH(thisx), 0x3F); + this->path = SubS_GetPathByIndex(play, RU_GET_PATH_INDEX(thisx), RU_PATH_INDEX_NONE); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = EnRu_DoNothing; this->actor.gravity = -4.0f; diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.h b/src/overlays/actors/ovl_En_Ru/z_en_ru.h index 081f3bbd8a..7aeaea0447 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.h +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.h @@ -4,7 +4,9 @@ #include "global.h" #include "objects/object_ru2/object_ru2.h" -#define RU_GET_PATH(thisx) ((thisx->params & 0x7E00) >> 9) +#define RU_GET_PATH_INDEX(thisx) ((thisx->params & 0x7E00) >> 9) + +#define RU_PATH_INDEX_NONE 0x3F struct EnRu; diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index fcc01b1ec5..69ad52a2d1 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -652,7 +652,7 @@ void EnRuppecrow_Init(Actor* thisx, PlayState* play2) { Actor_SetScale(&this->actor, 0.01f); this->actor.flags |= ACTOR_FLAG_2000000; - this->path = SubS_GetPathByIndex(play, ENRUPPECROW_GET_PATH(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENRUPPECROW_GET_PATH_INDEX(&this->actor), ENRUPPECROW_PATH_INDEX_NONE); if (this->path != NULL) { this->actionFunc = EnRuppecrow_HandleSong; } else { diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h index 887cd8c6bb..5d591258b1 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.h @@ -4,7 +4,9 @@ #include "global.h" #include "objects/object_crow/object_crow.h" -#define ENRUPPECROW_GET_PATH(thisx) (((thisx)->params & 0xFC00) >> 0xA) +#define ENRUPPECROW_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 0xA) + +#define ENRUPPECROW_PATH_INDEX_NONE 0x3F #define ENRUPPECROW_RUPEE_COUNT 20 #define ENRUPPECROW_LIMB_POS_COUNT 4 diff --git a/src/overlays/actors/ovl_En_Rz/z_en_rz.c b/src/overlays/actors/ovl_En_Rz/z_en_rz.c index e7eaaed998..1a43768fcc 100644 --- a/src/overlays/actors/ovl_En_Rz/z_en_rz.c +++ b/src/overlays/actors/ovl_En_Rz/z_en_rz.c @@ -247,8 +247,8 @@ void func_80BFBA1C(PlayState* play, EnRz* this, s16 animIndex) { } s32 EnRz_SetupPath(EnRz* this, PlayState* play) { - if (EN_RZ_GET_PATH(&this->actor) != 0x3F) { - this->path = &play->setupPathList[EN_RZ_GET_PATH(&this->actor)]; + if (EN_RZ_GET_PATH_INDEX(&this->actor) != EN_RZ_PATH_INDEX_NONE) { + this->path = &play->setupPathList[EN_RZ_GET_PATH_INDEX(&this->actor)]; if (this->path != NULL) { Path* path = this->path; Vec3s* points = (Vec3s*)Lib_SegmentedToVirtual(path->points); diff --git a/src/overlays/actors/ovl_En_Rz/z_en_rz.h b/src/overlays/actors/ovl_En_Rz/z_en_rz.h index c6d8fe3c86..a29f6d5c25 100644 --- a/src/overlays/actors/ovl_En_Rz/z_en_rz.h +++ b/src/overlays/actors/ovl_En_Rz/z_en_rz.h @@ -6,7 +6,9 @@ #define EN_RZ_GET_SISTER(thisx) ((thisx)->params & 0x8000) #define EN_RZ_GET_TYPE(thisx) ((thisx)->params & 0xF) -#define EN_RZ_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) +#define EN_RZ_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) + +#define EN_RZ_PATH_INDEX_NONE 0x3F typedef enum { /* 0 */ EN_RZ_JUDO, // in red diff --git a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c index 525696ead2..9779de80ca 100644 --- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c +++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c @@ -276,7 +276,7 @@ void EnScopecrow_Init(Actor* thisx, PlayState* play) { } if (func_80BCD09C(this->unk_260)) { - this->path = SubS_GetPathByIndex(play, ENSCOPECROW_GET_PATH(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENSCOPECROW_GET_PATH_INDEX(&this->actor), ENSCOPECROW_PATH_INDEX_NONE); this->unk_262 = ENSCOPECROW_GET_3E0(&this->actor); if (this->path != NULL) { @@ -316,7 +316,7 @@ void EnScopecrow_Init(Actor* thisx, PlayState* play) { this->collider.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; Actor_SetScale(&this->actor, 0.03f); - this->path = SubS_GetPathByIndex(play, ENSCOPECROW_GET_PATH(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENSCOPECROW_GET_PATH_INDEX(&this->actor), ENSCOPECROW_PATH_INDEX_NONE); this->unk_262 = ENSCOPECROW_GET_3E0(&this->actor); if (this->path != NULL) { diff --git a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.h b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.h index 30f002fb59..523d28804d 100644 --- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.h +++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.h @@ -10,7 +10,9 @@ typedef void (*EnScopecrowActionFunc)(struct EnScopecrow*, PlayState*); #define ENSCOPECROW_GET_1F(thisx) ((thisx)->params & 0x1F) #define ENSCOPECROW_GET_3E0(thisx) (((thisx)->params & 0x3E0) >> 5) -#define ENSCOPECROW_GET_PATH(thisx) (((thisx)->params & 0xFC00) >> 0xA) +#define ENSCOPECROW_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 0xA) + +#define ENSCOPECROW_PATH_INDEX_NONE 0x3F typedef struct EnScopecrow { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index 46add654ac..08b4b2817b 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -708,7 +708,8 @@ void EnScopenuts_Init(Actor* thisx, PlayState* play) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_40)) { Actor_Kill(&this->actor); } else if (play->actorCtx.flags & ACTORCTX_FLAG_1) { - this->path = SubS_GetPathByIndex(play, ENSCOPENUTS_GET_FC00(&this->actor), 0x3F); + this->path = + SubS_GetPathByIndex(play, ENSCOPENUTS_GET_PATH_INDEX(&this->actor), ENSCOPENUTS_PATH_INDEX_NONE); this->actor.draw = NULL; this->actionFunc = func_80BCAFA8; this->actor.gravity = 0.0f; @@ -717,7 +718,8 @@ void EnScopenuts_Init(Actor* thisx, PlayState* play) { } } else if (ENSCOPENUTS_GET_3E0(&this->actor) == ENSCOPENUTS_3E0_1) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_40)) { - this->path = SubS_GetPathByIndex(play, ENSCOPENUTS_GET_FC00(&this->actor), 0x3F); + this->path = + SubS_GetPathByIndex(play, ENSCOPENUTS_GET_PATH_INDEX(&this->actor), ENSCOPENUTS_PATH_INDEX_NONE); if (this->path == NULL) { Actor_Kill(&this->actor); } else { diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.h b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.h index ef2ea74d83..3f1b8b84e1 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.h +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.h @@ -8,7 +8,9 @@ struct EnScopenuts; typedef void (*EnScopenutsActionFunc)(struct EnScopenuts*, PlayState*); #define ENSCOPENUTS_GET_3E0(thisx) (((thisx)->params & 0x3E0) >> 5) -#define ENSCOPENUTS_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) +#define ENSCOPENUTS_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 0xA) + +#define ENSCOPENUTS_PATH_INDEX_NONE 0x3F #define ENSCOPENUTS_3E0_0 0 #define ENSCOPENUTS_3E0_1 1 diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index 5dcdeaa8e0..e22791c82a 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -958,7 +958,7 @@ void EnSellnuts_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); - this->path = SubS_GetPathByIndex(play, ENSELLNUTS_GET_FC00(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENSELLNUTS_GET_PATH_INDEX(&this->actor), ENSELLNUTS_PATH_INDEX_NONE); this->csId = this->actor.csId; Actor_SetScale(&this->actor, 0.01f); this->actor.colChkInfo.cylRadius = 0; diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.h b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.h index 3acf7a3e0c..d56c04f9e8 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.h +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.h @@ -8,7 +8,9 @@ struct EnSellnuts; typedef void (*EnSellnutsActionFunc)(struct EnSellnuts*, PlayState*); #define ENSELLNUTS_GET_1(thisx) ((thisx)->params & 1) -#define ENSELLNUTS_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) +#define ENSELLNUTS_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 0xA) + +#define ENSELLNUTS_PATH_INDEX_NONE 0x3F typedef struct EnSellnuts { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index bde4559868..3cd33653b4 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -1416,7 +1416,7 @@ void EnSob1_InitShop(EnSob1* this, PlayState* play) { this->waypoint = 0; if (this->shopType == BOMB_SHOP) { - this->path = SubS_GetPathByIndex(play, ENSOB1_GET_PATH(&this->actor), 0x1F); + this->path = SubS_GetPathByIndex(play, ENSOB1_GET_PATH_INDEX(&this->actor), ENSOB1_PATH_INDEX_NONE); } if (this->shopType == BOMB_SHOP) { EnSob1_SetupAction(this, EnSob1_SetupWalk); diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h index 1509868ee1..12c14301bb 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.h @@ -15,7 +15,9 @@ typedef void (*EnSob1ActionFunc)(struct EnSob1*, PlayState*); typedef void (*EnSob1BlinkFunc)(struct EnSob1*); #define ENSOB1_GET_SHOPTYPE(thisx) ((thisx)->params & 0x1F) -#define ENSOB1_GET_PATH(thisx) (((thisx)->params & 0x3E0) >> 5) +#define ENSOB1_GET_PATH_INDEX(thisx) (((thisx)->params & 0x3E0) >> 5) + +#define ENSOB1_PATH_INDEX_NONE 0x1F typedef struct EnSob1XZRange { /* 0x0 */ f32 xMin; 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 74258058f7..e86d1e1bd5 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -549,8 +549,9 @@ void func_80BAB434(EnSuttari* this) { } void EnSuttari_GetPaths(EnSuttari* this, PlayState* play) { - this->paths[0] = SubS_GetPathByIndex(play, ENSUTTARI_GET_PATH(&this->actor), 0x3F); - this->paths[1] = SubS_GetPathByIndex(play, this->paths[0]->unk1, 0x3F); + this->paths[0] = SubS_GetPathByIndex(play, ENSUTTARI_GET_PATH_INDEX(&this->actor), ENSUTTARI_PATH_INDEX_NONE); + //! @bug: the additional path shouldn't use `ENSUTTARI_PATH_INDEX_NONE`, but `ADDITIONAL_PATH_INDEX_NONE` + this->paths[1] = SubS_GetPathByIndex(play, this->paths[0]->additionalPathIndex, ENSUTTARI_PATH_INDEX_NONE); } void func_80BAB4F0(EnSuttari* this, PlayState* play) { @@ -712,11 +713,11 @@ void func_80BABB90(EnSuttari* this, s32 arg1) { s32 func_80BABC48(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp26 = SCHEDULE_TIME_NOW; u16 phi_a0; - u8 sp23 = ENSUTTARI_GET_PATH(&this->actor); + u8 pathIndex = ENSUTTARI_GET_PATH_INDEX(&this->actor); u16 tmp; if (D_80BAE8F8[scheduleOutput->result] >= 0) { - this->timePath = SubS_GetAdditionalPath(play, sp23, D_80BAE8F8[scheduleOutput->result]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80BAE8F8[scheduleOutput->result]); } if (this->timePath == NULL) { return 0; @@ -743,7 +744,7 @@ s32 func_80BABC48(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutp s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 pad; EnDoor* sp48; - u8 sp47 = ENSUTTARI_GET_PATH(&this->actor); + u8 pathIndex = ENSUTTARI_GET_PATH_INDEX(&this->actor); u16 sp44 = SCHEDULE_TIME_NOW; Vec3f sp38; Vec3f sp2C; @@ -756,7 +757,7 @@ s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutp sp48 = (EnDoor*)SubS_FindNearestActor(&this->actor, play, ACTORCAT_DOOR, ACTOR_EN_DOOR); sp24 = D_80BAE8F8[scheduleOutput->result]; if ((sp48 != NULL) && (sp24 >= 0)) { - this->timePath = SubS_GetAdditionalPath(play, sp47, sp24); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, sp24); } if ((sp48 == NULL) || (this->timePath == NULL)) { return false; @@ -1313,7 +1314,7 @@ void func_80BAD5F8(EnSuttari* this, PlayState* play) { } this->unk428 = scheduleOutput.result; func_80BAC2FC(this, play); - if ((this->unk430 == 1) && (this->timePath->unk1 == 0xFF)) { + if ((this->unk430 == 1) && (this->timePath->additionalPathIndex == ADDITIONAL_PATH_INDEX_NONE)) { Actor_Kill(&this->actor); return; } @@ -1351,7 +1352,7 @@ void func_80BAD7F8(EnSuttari* this, PlayState* play) { } this->unk428 = scheduleOutput.result; func_80BAC2FC(this, play); - if ((this->unk430 == 1) && (this->timePath->unk1 == 0xFF)) { + if ((this->unk430 == 1) && (this->timePath->additionalPathIndex == ADDITIONAL_PATH_INDEX_NONE)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h index 0710007637..8da01b67e5 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h @@ -8,7 +8,9 @@ struct EnSuttari; typedef void (*EnSuttariActionFunc)(struct EnSuttari*, PlayState*); -#define ENSUTTARI_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) +#define ENSUTTARI_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) + +#define ENSUTTARI_PATH_INDEX_NONE 0x3F typedef struct EnSuttari { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 3f32564bbf..a705a85467 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -901,13 +901,13 @@ void func_808DA89C(EnSw* this, PlayState* play) { } void func_808DAA60(EnSw* this, PlayState* play) { - Vec3s* sp44; + Vec3s* points; s16 temp_v0; s16 sp40; Vec3f sp34; f32 temp_f16; - sp44 = Lib_SegmentedToVirtual(this->unk_1E4->points); + points = Lib_SegmentedToVirtual(this->path->points); sp40 = 0; if (DECR(this->unk_454) == 0) { @@ -915,13 +915,13 @@ void func_808DAA60(EnSw* this, PlayState* play) { temp_f16 = this->skelAnime.endFrame - this->skelAnime.curFrame; sp40 = 80.0f * temp_f16; if (this->unk_45E == 0) { - Math_Vec3s_ToVec3f(&sp34, &sp44[this->unk_4A0]); + Math_Vec3s_ToVec3f(&sp34, &points[this->unk_4A0]); func_808D9894(this, &sp34); temp_v0 = Math_Atan2S_XY(sp34.z, sp34.x); if (ABS_ALT(temp_v0) < sp40) { this->skelAnime.curFrame = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_STALWALL_DASH); - Math_Vec3s_ToVec3f(&this->unk_374, &sp44[this->unk_4A0]); + Math_Vec3s_ToVec3f(&this->unk_374, &points[this->unk_4A0]); this->actionFunc = func_808DACF4; this->unk_414 = 0.0f; sp40 = ABS_ALT(temp_v0); @@ -981,7 +981,7 @@ void func_808DACF4(EnSw* this, PlayState* play) { if (((s32)this->unk_414 != 0) && ((s32)this->unk_414 < (s32)sp4C)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_374); this->unk_4A0 += this->unk_49C; - if ((this->unk_4A0 >= this->unk_1E4->count) || (this->unk_4A0 < 0)) { + if ((this->unk_4A0 >= this->path->count) || (this->unk_4A0 < 0)) { this->unk_49C = -this->unk_49C; this->unk_4A0 += this->unk_49C * 2; } @@ -1154,8 +1154,9 @@ void EnSw_Init(Actor* thisx, PlayState* play) { this->collider.info.toucher.damage = 16; } - this->unk_1E4 = SubS_GetDayDependentPath(play, ENSW_GET_FF00(&this->actor), 255, &this->unk_4A0); - if (this->unk_1E4 != NULL) { + this->path = + SubS_GetDayDependentPath(play, ENSW_GET_PATH_INDEX(&this->actor), ENSW_PATH_INDEX_NONE, &this->unk_4A0); + if (this->path != NULL) { this->unk_4A0 = 1; } @@ -1201,7 +1202,7 @@ void EnSw_Init(Actor* thisx, PlayState* play) { } func_808D9F78(this, play, 1); - if (this->unk_1E4 != NULL) { + if (this->path != NULL) { this->unk_49C = 1; func_808D9F08(this); this->actionFunc = func_808DAA60; diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.h b/src/overlays/actors/ovl_En_Sw/z_en_sw.h index 4544346a00..f77d122672 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.h +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.h @@ -11,14 +11,16 @@ typedef void (*EnSwActionFunc)(struct EnSw*, PlayState*); #define ENSW_GET_3(thisx) (ENSW_GETS_3((thisx)->params)) #define ENSW_GETS_3FC(params) (((params & 0x3FC) >> 2) & 0xFF) #define ENSW_GET_3FC(thisx) (ENSW_GETS_3FC((thisx)->params)) -#define ENSW_GET_FF00(thisx) ((((thisx)->params & 0xFF00) >> 8) & 0xFF) +#define ENSW_GET_PATH_INDEX(thisx) ((((thisx)->params & 0xFF00) >> 8) & 0xFF) + +#define ENSW_PATH_INDEX_NONE 0xFF typedef struct EnSw { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnSwActionFunc actionFunc; /* 0x18C */ ColliderSphere collider; - /* 0x1E4 */ Path* unk_1E4; + /* 0x1E4 */ Path* path; /* 0x1E8 */ Vec3s jointTable[30]; /* 0x29C */ Vec3s morphTable[30]; /* 0x350 */ Vec3f unk_350; diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c index ae47161725..5f5194523e 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c @@ -79,12 +79,12 @@ void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2) { s32 i; path = syatekiMan->path; - while (path->unk2 != 0) { - path = &play->setupPathList[path->unk1]; + while (path->customValue != SG_PATH_TYPE_CROW) { + path = &play->setupPathList[path->additionalPathIndex]; } for (i = 0; i < EN_SYATEKI_CROW_GET_INDEX(&this->actor); i++) { - path = &play->setupPathList[path->unk1]; + path = &play->setupPathList[path->additionalPathIndex]; } Actor_ProcessInitChain(&this->actor, sInitChain); diff --git a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c index 6fefd906a0..b8c5eda14c 100644 --- a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c +++ b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c @@ -103,7 +103,7 @@ void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play2) { static s32 sDrawFlowers = true; // This makes it so only one EnSyatekiDekunuts draws all the flowers. EnSyatekiDekunuts* this = THIS; PlayState* play = play2; - s32 unkPathComparison; + s32 pathType; Path* path; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; s32 i; @@ -115,18 +115,18 @@ void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play2) { if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) == EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { Actor_SetScale(&this->actor, 0.01f); this->collider.dim = sBonusDekuScrubColliderDimensions[0]; - unkPathComparison = 3; + pathType = SG_PATH_TYPE_SCRUB_BONUS; } else { Actor_SetScale(&this->actor, 0.02f); - unkPathComparison = 1; + pathType = SG_PATH_TYPE_SCRUB_NORMAL; } - while (path->unk2 != unkPathComparison) { - path = &play->setupPathList[path->unk1]; + while (path->customValue != pathType) { + path = &play->setupPathList[path->additionalPathIndex]; } for (i = 0; i < EN_SYATEKI_DEKUNUTS_GET_PARAM_FF00(&this->actor); i++) { - path = &play->setupPathList[path->unk1]; + path = &play->setupPathList[path->additionalPathIndex]; } if (sDrawFlowers == true) { diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 2a1ea53573..a584257375 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -183,7 +183,7 @@ void EnSyatekiMan_Swamp_SpawnTargetActors(EnSyatekiMan* this, PlayState* play2, void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { EnSyatekiMan* this = THIS; s32 pad; - Path* path = &play->setupPathList[EN_SYATEKI_MAN_GET_PATH(&this->actor)]; + Path* path = &play->setupPathList[EN_SYATEKI_MAN_GET_PATH_INDEX(&this->actor)]; s32 actorListLength = sSwampTargetActorListLengths[this->swampTargetActorListIndex]; this->actor.targetMode = 1; diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h index 0b637fecfe..468cb981c6 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h @@ -8,7 +8,7 @@ struct EnSyatekiMan; typedef void (*EnSyatekiManActionFunc)(struct EnSyatekiMan*, PlayState*); -#define EN_SYATEKI_MAN_GET_PATH(thisx) (((thisx)->params & 0xFF00) >> 8) +#define EN_SYATEKI_MAN_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) typedef enum { /* 0 */ SG_GAME_STATE_NONE, // None of the states below apply. @@ -18,22 +18,29 @@ typedef enum { /* 4 */ SG_GAME_STATE_ONE_MORE_GAME, // The player failed to get a new high score (Town) and/or perfect score (Swamp and Town). /* 5 */ SG_GAME_STATE_GIVING_BONUS, // The player gets bonus points at the end of the Swamp game if they get a perfect score. /* 6 */ SG_GAME_STATE_ENDED, // The player got a new high score and/or perfect score (Town), or the game is over (Swamp). - /* 7 */ SG_GAME_STATE_MOVING_PLAYER, // The player is automatically moving towards the spot to play the game. + /* 7 */ SG_GAME_STATE_MOVING_PLAYER // The player is automatically moving towards the spot to play the game. } ShootingGalleryGameState; typedef enum { /* 0 */ SG_OCTO_STATE_SPAWNING, /* 1 */ SG_OCTO_STATE_SPAWNED, /* 70 */ SG_OCTO_STATE_INITIAL = 70, - /* 80 */ SG_OCTO_STATE_HIDING = 80, + /* 80 */ SG_OCTO_STATE_HIDING = 80 } ShootingGalleryOctorokState; typedef enum { /* 0 */ SG_OCTO_HIT_TYPE_NONE, /* 1 */ SG_OCTO_HIT_TYPE_RED, - /* 2 */ SG_OCTO_HIT_TYPE_BLUE, + /* 2 */ SG_OCTO_HIT_TYPE_BLUE } ShootingGalleryoctorokHitType; +typedef enum { + /* 0 */ SG_PATH_TYPE_CROW, + /* 1 */ SG_PATH_TYPE_SCRUB_NORMAL, + /* 2 */ SG_PATH_TYPE_WOLFOS, + /* 3 */ SG_PATH_TYPE_SCRUB_BONUS +} ShootingGalleryPathType; + typedef struct EnSyatekiMan { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c index f582063b72..7b885c5e89 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c @@ -146,12 +146,12 @@ void EnSyatekiWf_Init(Actor* thisx, PlayState* play) { s32 i; path = syatekiMan->path; - while (path->unk2 != 2) { - path = &play->setupPathList[path->unk1]; + while (path->customValue != SG_PATH_TYPE_WOLFOS) { + path = &play->setupPathList[path->additionalPathIndex]; } for (i = 0; i < EN_SYATEKI_WF_GET_INDEX(&this->actor); i++) { - path = &play->setupPathList[path->unk1]; + path = &play->setupPathList[path->additionalPathIndex]; } if (path == NULL) { diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index 3987f9d12e..6711fcde6c 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -533,17 +533,17 @@ void func_80A3F114(EnTest3* this, PlayState* play) { } s32 func_80A3F15C(EnTest3* this, PlayState* play, struct_80A41828* arg2) { - s32 pathIndex; + s32 limit; Path* path; Vec3s* curPathPoint; Vec3s* nextPathPoint; Vec3f curPathPos; Vec3f nextPathPos; - pathIndex = ABS_ALT(arg2->unk_1_0) - 1; + limit = ABS_ALT(arg2->unk_1_0) - 1; - if (pathIndex >= 0) { - path = SubS_GetAdditionalPath(play, KAFEI_GET_PARAM_1F(&this->player.actor), pathIndex); + if (limit >= 0) { + path = SubS_GetAdditionalPath(play, KAFEI_GET_PATH_INDEX(&this->player.actor), limit); curPathPoint = Lib_SegmentedToVirtual(path->points); if (arg2->unk_1_0 > 0) { @@ -868,7 +868,7 @@ s32 func_80A40098(EnTest3* this, PlayState* play, struct_80A41828* arg2, Schedul u16 numWaypoints; func_80A3F15C(this, play, arg2); - this->unk_D7C = SubS_GetAdditionalPath(play, KAFEI_GET_PARAM_1F(&this->player.actor), ABS_ALT(arg2->unk_1_0) - 1); + this->unk_D7C = SubS_GetAdditionalPath(play, KAFEI_GET_PATH_INDEX(&this->player.actor), ABS_ALT(arg2->unk_1_0) - 1); if ((this->unk_D88 < 7) && (this->unk_D88 != 0) && (this->unk_D80 >= 0)) { startTime = now; } else { diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.h b/src/overlays/actors/ovl_En_Test3/z_en_test3.h index 36cd15c27f..17c7041293 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.h +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.h @@ -7,7 +7,7 @@ struct EnTest3; typedef void (*EnTest3ActionFunc)(struct EnTest3*, PlayState*); -#define KAFEI_GET_PARAM_1F(thisx) ((thisx)->params & 0x1F) +#define KAFEI_GET_PATH_INDEX(thisx) ((thisx)->params & 0x1F) #define KAFEI_GET_PARAM_1E0(thisx) (((thisx)->params >> 5) & 0xF) typedef struct { 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 01ec414e5b..341f0a89d9 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -503,12 +503,12 @@ s32 func_80AED354(EnTk* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleOutput* scheduleOutput) { u16 sp1E = SCHEDULE_TIME_NOW; - u8 params = ENTK_GET_F800(&this->actor); + u8 pathIndex = ENTK_GET_PATH_INDEX(&this->actor); u16 phi_a1; s32 index = scheduleOutput->result - 1; u16 tmp; - this->timePath = SubS_GetAdditionalPath(play, params, D_80AEF8E8[index + 1]); + this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80AEF8E8[index + 1]); if (this->timePath == NULL) { return false; } diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.h b/src/overlays/actors/ovl_En_Tk/z_en_tk.h index 9604133e7f..aa15c6fc62 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.h +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.h @@ -10,7 +10,7 @@ typedef void (*EnTkUnkFunc)(struct EnTk*, PlayState*); #define ENTK_GET_F(thisx) ((thisx)->params & 0xF) #define ENTK_GET_7F0(thisx) (((thisx)->params >> 4) & 0x7F) -#define ENTK_GET_F800(thisx) ((((thisx)->params >> 0xB) & 0x1F) & 0xFF) +#define ENTK_GET_PATH_INDEX(thisx) (((thisx)->params >> 0xB) & 0x1F) typedef struct EnTk { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index 9517246680..bf0f9cc31d 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -216,7 +216,7 @@ void func_80AD36EC(EnTrt2* this, PlayState* play) { this->unk_1E4 = 0; this->unk_3D9 = 1; this->actor.velocity.y = 0.0f; - this->path = SubS_GetPathByIndex(play, this->path->unk1, -1); + this->path = SubS_GetPathByIndex(play, this->path->additionalPathIndex, PATH_INDEX_NONE); CutsceneManager_Stop(this->csId); this->csId = CutsceneManager_GetAdditionalCsId(this->csId); CutsceneManager_Queue(this->csId); @@ -450,7 +450,7 @@ void func_80AD417C(EnTrt2* this, PlayState* play) { play->msgCtx.stateTimer = 4; if (this->unk_3A8 == 0x84C) { EnTrt2_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT2_ANIM_HOVER); - this->path = SubS_GetPathByIndex(play, ENTRT2_GET_FC00(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENTRT2_GET_PATH_INDEX(&this->actor), ENTRT2_PATH_INDEX_NONE); this->unk_3B2 = 18; } else if (this->unk_3A8 == 0x88F) { this->unk_3A8 = 0x88E; @@ -722,7 +722,7 @@ void func_80AD4DB4(EnTrt2* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10; Actor_SetObjectDependency(play, &this->actor); Actor_SetScale(&this->actor, 0.008f); - this->path = SubS_GetPathByIndex(play, ENTRT2_GET_FC00(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENTRT2_GET_PATH_INDEX(&this->actor), ENTRT2_PATH_INDEX_NONE); this->unk_3AE = Rand_S16Offset(100, 50); this->unk_3B0 = 10; this->unk_3A8 = 0; diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h index f30f41d800..f9e2b4fc87 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.h @@ -9,7 +9,9 @@ typedef void (*EnTrt2ActionFunc)(struct EnTrt2*, PlayState*); typedef void (*EnTrt2UnkFunc)(struct EnTrt2*); typedef void (*EnTrt2UnkFunc2)(struct EnTrt2*, PlayState*); -#define ENTRT2_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) +#define ENTRT2_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 0xA) + +#define ENTRT2_PATH_INDEX_NONE 0x3F typedef struct EnTrt2 { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index a3c2678466..a11d00cdbc 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -1138,7 +1138,8 @@ void EnTru_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); this->animIndex = -1; EnTru_ChangeAnim(this, KOUME_ANIM_INJURED_LYING_DOWN); - this->path = SubS_GetDayDependentPath(play, ENTRU_GET_PATH(&this->actor), 255, &this->unk_384); + this->path = + SubS_GetDayDependentPath(play, ENTRU_GET_PATH_INDEX(&this->actor), ENTRU_PATH_INDEX_NONE, &this->unk_384); if (this->path != NULL) { this->unk_384 = 1; } diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.h b/src/overlays/actors/ovl_En_Tru/z_en_tru.h index c6d2af00c9..e7c06e1278 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.h +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.h @@ -9,7 +9,9 @@ struct EnTru; typedef void (*EnTruActionFunc)(struct EnTru*, PlayState*); typedef s32 (*EnTruUnkFunc)(Actor*, PlayState*); -#define ENTRU_GET_PATH(thisx) ((thisx)->params & 0xFF) +#define ENTRU_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF) + +#define ENTRU_PATH_INDEX_NONE 0xFF typedef struct { /* 0x00 */ u8 unk_00; diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index 2c8e4ed8a4..6cd2641a18 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -431,7 +431,7 @@ void EnTruMt_Init(Actor* thisx, PlayState* play) { this->collider.dim.worldSphere.radius = 22; this->actor.colChkInfo.damageTable = &sDamageTable; - this->path = SubS_GetPathByIndex(play, ENTRUMT_GET_FF(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENTRUMT_GET_FF(&this->actor), ENTRUMT_PATH_INDEX_NONE); this->actor.targetMode = 0; Actor_SetScale(&this->actor, 0.008f); @@ -439,7 +439,7 @@ void EnTruMt_Init(Actor* thisx, PlayState* play) { this->unk_328 = 0; this->actor.room = -1; - this->path = SubS_GetPathByIndex(play, ENTRUMT_GET_FC00(&this->actor), 0x3F); + this->path = SubS_GetPathByIndex(play, ENTRUMT_GET_FC00(&this->actor), ENTRUMT_PATH_INDEX_NONE); EnTruMt_ChangeAnim(&this->skelAnime, KOUME_MT_ANIM_FLY); this->actionFunc = func_80B76A64; } diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.h b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.h index b114804d70..d25d54a241 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.h +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.h @@ -11,6 +11,8 @@ typedef void (*EnTruMtActionFunc)(struct EnTruMt*, PlayState*); #define ENTRUMT_GET_FF(thisx) ((thisx)->params & 0xFF) #define ENTRUMT_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) +#define ENTRUMT_PATH_INDEX_NONE 0x3F + typedef struct EnTruMt { /* 0x000 */ Actor actor; /* 0x144 */ EnTruMtActionFunc actionFunc; 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 a732f01242..ba71bbd7fb 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -206,11 +206,11 @@ void EnZo_LookAtPlayer(EnZo* this, PlayState* play) { } void EnZo_Walk(EnZo* this, PlayState* play) { - if (ENZO_GET_PATH(&this->actor) != 0x3F) { + if (ENZO_GET_PATH_INDEX(&this->actor) != ENZO_PATH_INDEX_NONE) { EnZo_ChangeAnim(&this->skelAnime, 6); } - if (ENZO_GET_PATH(&this->actor) != 0x3F) { + if (ENZO_GET_PATH_INDEX(&this->actor) != ENZO_PATH_INDEX_NONE) { this->actionFunc = EnZo_FollowPath; } else { this->actionFunc = EnZo_DoNothing; @@ -264,7 +264,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), 0x3F); + this->path = SubS_GetPathByIndex(play, ENZO_GET_PATH_INDEX(&this->actor), ENZO_PATH_INDEX_NONE); 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 bfd0c79dd8..9d32f63e5b 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h @@ -8,7 +8,9 @@ struct EnZo; typedef void (*EnZoActionFunc)(struct EnZo*, PlayState*); -#define ENZO_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) +#define ENZO_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) + +#define ENZO_PATH_INDEX_NONE 0x3F typedef struct EnZo { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index ab97962de1..1493759a5d 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -111,8 +111,8 @@ void EnZot_Init(Actor* thisx, PlayState* play2) { for (i = 0; i < ARRAY_COUNT(this->unk_2D8); i++) { this->unk_2D8[i] = NULL; } - if (ENZOT_GET_FC00(&this->actor) != 0x3F) { - this->path = &play->setupPathList[ENZOT_GET_FC00(&this->actor)]; + if (ENZOT_GET_PATH_INDEX(&this->actor) != ENZOT_PATH_INDEX_NONE) { + this->path = &play->setupPathList[ENZOT_GET_PATH_INDEX(&this->actor)]; this->unk_2D4 = 0; func_80B965D0(this, play); } else { @@ -124,8 +124,8 @@ void EnZot_Init(Actor* thisx, PlayState* play2) { case 3: case 4: this->actionFunc = func_80B97B5C; - if (ENZOT_GET_FC00(&this->actor) != 0x3F) { - this->path = &play->setupPathList[ENZOT_GET_FC00(&this->actor)]; + if (ENZOT_GET_PATH_INDEX(&this->actor) != ENZOT_PATH_INDEX_NONE) { + this->path = &play->setupPathList[ENZOT_GET_PATH_INDEX(&this->actor)]; } else { this->path = NULL; } @@ -134,8 +134,8 @@ void EnZot_Init(Actor* thisx, PlayState* play2) { case 5: this->unk_2F2 |= 4; this->actionFunc = func_80B97FD0; - if (ENZOT_GET_FC00(&this->actor) != 0x3F) { - this->path = &play->setupPathList[ENZOT_GET_FC00(&this->actor)]; + if (ENZOT_GET_PATH_INDEX(&this->actor) != ENZOT_PATH_INDEX_NONE) { + this->path = &play->setupPathList[ENZOT_GET_PATH_INDEX(&this->actor)]; } else { this->path = NULL; } @@ -167,8 +167,8 @@ void EnZot_Init(Actor* thisx, PlayState* play2) { case 10: this->actionFunc = func_80B992C0; func_80B96BEC(this, 1, ANIMMODE_LOOP); - if (ENZOT_GET_FC00(&this->actor) != 0x3F) { - this->path = &play->setupPathList[ENZOT_GET_FC00(&this->actor)]; + if (ENZOT_GET_PATH_INDEX(&this->actor) != ENZOT_PATH_INDEX_NONE) { + this->path = &play->setupPathList[ENZOT_GET_PATH_INDEX(&this->actor)]; } else { this->path = NULL; } @@ -211,8 +211,8 @@ void EnZot_Init(Actor* thisx, PlayState* play2) { case 22: this->actionFunc = func_80B980FC; - if (ENZOT_GET_FC00(&this->actor) != 0x3F) { - this->path = &play->setupPathList[ENZOT_GET_FC00(&this->actor)]; + if (ENZOT_GET_PATH_INDEX(&this->actor) != ENZOT_PATH_INDEX_NONE) { + this->path = &play->setupPathList[ENZOT_GET_PATH_INDEX(&this->actor)]; } else { this->path = NULL; } diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.h b/src/overlays/actors/ovl_En_Zot/z_en_zot.h index 1bab43ae32..e2c43baa32 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.h +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.h @@ -8,7 +8,9 @@ struct EnZot; typedef void (*EnZotActionFunc)(struct EnZot*, PlayState*); #define ENZOT_GET_1F(thisx) ((thisx)->params & 0x1F) -#define ENZOT_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) +#define ENZOT_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 0xA) + +#define ENZOT_PATH_INDEX_NONE 0x3F typedef struct EnZot { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c index 43f137326d..6c81e8de66 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c @@ -66,7 +66,7 @@ void ObjBoat_Init(Actor* thisx, PlayState* play) { if (thisx->params < 0) { this->dyna.actor.update = ObjBoat_UpdateCutscene; } else { - path = &play->setupPathList[OBJBOAT_GET_PATH(thisx)]; + path = &play->setupPathList[OBJBOAT_GET_PATH_INDEX(thisx)]; this->maxPointIndex = path->count - 1; this->points = Lib_SegmentedToVirtual(path->points); this->direction = 1; @@ -157,10 +157,10 @@ void ObjBoat_UpdateCutscene(Actor* thisx, PlayState* play2) { if (this->cueId != cue->id) { this->dyna.actor.shape.rot.x = cue->rot.x; if (cue->id != 1) { - Path* path = &play->setupPathList[OBJBOAT_GET_PATH(&this->dyna.actor)]; + Path* path = &play->setupPathList[OBJBOAT_GET_PATH_INDEX(&this->dyna.actor)]; if (cue->id == 3) { - path = &play->setupPathList[path->unk1]; + path = &play->setupPathList[path->additionalPathIndex]; } this->maxPointIndex = path->count; diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h index bfc7c7c2b3..00cb936d71 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h @@ -3,7 +3,7 @@ #include "global.h" -#define OBJBOAT_GET_PATH(thisx) (((thisx)->params >> 7) & 0x1F) +#define OBJBOAT_GET_PATH_INDEX(thisx) (((thisx)->params >> 7) & 0x1F) #define OBJBOAT_GET_4000(thisx) ((thisx)->params & 0x4000) struct ObjBoat; diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c index a33bf2a430..9d468d8347 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c @@ -68,7 +68,7 @@ void ObjDanpeilift_Init(Actor* thisx, PlayState* play) { if (this->speed < 0.01f) { this->actionFunc = ObjDanpeilift_DoNothing; } else { - path = &play->setupPathList[OBJDANPEILIFT_GET_PATH(thisx)]; + path = &play->setupPathList[OBJDANPEILIFT_GET_PATH_INDEX(thisx)]; this->curPoint = OBJDANPEILIFT_GET_STARTING_POINT(thisx); this->endPoint = path->count - 1; this->direction = 1; diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h index 9c0d023c70..8ad582dd48 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h @@ -10,7 +10,7 @@ typedef void (*ObjDanpeiliftActionFunc)(struct ObjDanpeilift*, PlayState*); #define OBJDANPEILIFT_GET_TYPE(thisx) (((thisx)->params >> 0xF) & 1) #define OBJDANPEILIFT_GET_STARTING_POINT(thisx) (((thisx)->params >> 7) & 0x1F) -#define OBJDANPEILIFT_GET_PATH(thisx) ((thisx)->params & 0x7F) +#define OBJDANPEILIFT_GET_PATH_INDEX(thisx) ((thisx)->params & 0x7F) #define OBJDANPEILIFT_SHOULD_TELEPORT(thisx) (((thisx)->params >> 0xC) & 1) #define OBJDANPEILIFT_GET_SPEED(thisx) ((thisx)->home.rot.z * 0.1f) #define OBJDANPEILIFT_REACT_TO_PLAYER_ON_TOP(thisx) (((thisx)->params >> 0xE) & 1) diff --git a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c index cb957b8398..7cace26214 100644 --- a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c +++ b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c @@ -65,7 +65,7 @@ void ObjLupygamelift_Init(Actor* thisx, PlayState* play) { this->dyna.actor.home.rot.y = 0; this->dyna.actor.home.rot.z = 0; - path = &play->setupPathList[OBJLUPYGAMELIFT_GET_PATH(thisx)]; + path = &play->setupPathList[OBJLUPYGAMELIFT_GET_PATH_INDEX(thisx)]; this->pointIndex = OBJLUPYGAMELIFT_GET_7(thisx); this->count = path->count; if (this->pointIndex >= this->count) { diff --git a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.h b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.h index e25f9cd6d1..a1928c473d 100644 --- a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.h +++ b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.h @@ -3,7 +3,7 @@ #include "global.h" -#define OBJLUPYGAMELIFT_GET_PATH(thisx) ((thisx)->params & 0x7F) +#define OBJLUPYGAMELIFT_GET_PATH_INDEX(thisx) ((thisx)->params & 0x7F) #define OBJLUPYGAMELIFT_GET_7(thisx) (((thisx)->params >> 7) & 0x1F) #define OBJLUPYGAMELIFT_GET_C(thisx) (((thisx)->params >> 0xC) & 1) diff --git a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c index bb7d30f694..bcef92843d 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c @@ -61,7 +61,7 @@ void ObjMakeoshihiki_Init(Actor* thisx, PlayState* play) { Path* path; s32 childPointIndex; - path = &play->setupPathList[OBJMAKEOSHIHIKI_GET_PATHLISTINDEX(&this->actor)]; + path = &play->setupPathList[OBJMAKEOSHIHIKI_GET_PATH_INDEX(&this->actor)]; this->pathPoints = Lib_SegmentedToVirtual(path->points); this->pathCount = path->count; childPointIndex = ObjMakeoshihiki_GetChildSpawnPointIndex(this, play); diff --git a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h index 47fbe831be..fbe8c1283d 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h @@ -5,7 +5,7 @@ struct ObjMakeoshihiki; -#define OBJMAKEOSHIHIKI_GET_PATHLISTINDEX(thisx) (((thisx)->params >> 7) & 0x7F) +#define OBJMAKEOSHIHIKI_GET_PATH_INDEX(thisx) (((thisx)->params >> 7) & 0x7F) #define OBJMAKEOSHIHIKI_GET_SWITCHFLAG_1(thisx) ((thisx)->home.rot.z & 0x7F) #define OBJMAKEOSHIHIKI_GET_SWITCHFLAG_2(thisx) ((thisx)->params & 0x7F) diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c index d224125dd9..1a63e89cb0 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c @@ -86,7 +86,7 @@ void ObjRaillift_Init(Actor* thisx, PlayState* play) { if (this->speed < 0.01f) { this->actionFunc = ObjRaillift_DoNothing; } else { - path = &play->setupPathList[OBJRAILLIFT_GET_PATH(thisx)]; + path = &play->setupPathList[OBJRAILLIFT_GET_PATH_INDEX(thisx)]; this->curPoint = OBJRAILLIFT_GET_STARTING_POINT(thisx); this->endPoint = path->count - 1; this->direction = 1; diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h index b921b0e5aa..dc197432fc 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h @@ -10,7 +10,7 @@ typedef void (*ObjRailliftActionFunc)(struct ObjRaillift*, PlayState*); #define OBJRAILLIFT_GET_TYPE(thisx) (((thisx)->params >> 0xF) & 1) #define OBJRAILLIFT_HAS_FLAG(thisx) (((thisx)->params >> 0xD) & 1) #define OBJRAILLIFT_GET_FLAG(thisx) ((thisx)->home.rot.x & 0x7F) -#define OBJRAILLIFT_GET_PATH(thisx) ((thisx)->params & 0x7F) +#define OBJRAILLIFT_GET_PATH_INDEX(thisx) ((thisx)->params & 0x7F) #define OBJRAILLIFT_GET_STARTING_POINT(thisx) (((thisx)->params >> 7) & 0x1F) #define OBJRAILLIFT_GET_SPEED(thisx) ((thisx)->home.rot.z * 0.1f) #define OBJRAILLIFT_SHOULD_TELEPORT(thisx) (((thisx)->params >> 0xC) & 1) diff --git a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c index c6ed2cc2cb..cecb80832f 100644 --- a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c +++ b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c @@ -131,12 +131,12 @@ void ObjToge_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); - if (OBJTOGE_GET_PATH(thisx) == 0xFF) { + if (OBJTOGE_GET_PATH_INDEX(thisx) == OBJTOGE_PATH_INDEX_NONE) { Actor_Kill(thisx); return; } - path = &play->setupPathList[OBJTOGE_GET_PATH(thisx)]; + path = &play->setupPathList[OBJTOGE_GET_PATH_INDEX(thisx)]; if (path->count != 2) { Actor_Kill(thisx); return; diff --git a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.h b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.h index 8259e62c88..54cf02bf47 100644 --- a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.h +++ b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.h @@ -7,11 +7,13 @@ struct ObjToge; typedef void (*ObjTogeActionFunc)(struct ObjToge*, PlayState*); -#define OBJTOGE_GET_PATH(thisx) ((thisx)->params & 0xFF) +#define OBJTOGE_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF) #define OBJTOGE_GET_700(thisx) (((thisx)->params >> 8) & 7) #define OBJTOGE_GET_3800(thisx) (((thisx)->params >> 0xB) & 7) #define OBJTOGE_GET_4000(thisx) (((thisx)->params >> 0xE) & 1) +#define OBJTOGE_PATH_INDEX_NONE 0xFF + typedef struct ObjToge { /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collider; diff --git a/tools/namefixer.py b/tools/namefixer.py index 901d6dbf61..286653e13e 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -1037,6 +1037,9 @@ wordReplace = { "play->nextEntranceIndex": "play->nextEntrance", "play->sceneNum": "play->sceneId", "play->pauseCtx.unk_1F0": "play->pauseCtx.bombersNotebookOpen", + "play->sceneLoadFlag": "play->transitionTrigger", + "play->unk_18B4A": "play->transitionMode", + "play->unk_1887F": "play->transitionType", "play->playerActorCsIds": "play->playerCsIds", "play->envFlags": "play->cutsceneFlags", "play->roomCtx.curRoom.unk3": "play->roomCtx.curRoom.behaviorType1", @@ -1061,16 +1064,14 @@ wordReplace = { "gSaveContext.unk_3E50": "gSaveContext.timerStartOsTimes", "gSaveContext.unk_3E88": "gSaveContext.timerStopTimes", "gSaveContext.unk_3EC0": "gSaveContext.timerPausedOsTimes", - - "play->sceneLoadFlag": "play->transitionTrigger", - "play->unk_18B4A": "play->transitionMode", - "play->unk_1887F": "play->transitionType", - "play->roomCtx.currRoom": "play->roomCtx.curRoom", "gSaveContext.nextTransition": "gSaveContext.nextTransitionType", "gSaveContext.unk_3F48": "gSaveContext.cutsceneTransitionControl", "gSaveContext.fadeDuration": "gSaveContext.transFadeDuration", "gSaveContext.fadeSpeed": "gSaveContext.transWipeSpeed", + "path->unk1": "path->additionalPathIndex", + "path->unk2": "path->customValue", + "D_801D15B0": "gZeroVec3f", "D_801D15BC": "gZeroVec3s", "D_801D1DE0": "gIdentityMtx",