SubS General Pathing Helpers (#760)

* Brought code over and cleanup

* cleanup functions.h and format

* add comment

* Whitespace

* Format

* Update src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c

Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>

* Format

Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
This commit is contained in:
Derek Hensley
2022-03-29 21:37:58 +01:00
committed by GitHub
co-authored by Anghelo Carvajal
parent cabb14e4b7
commit 486e7cbe83
43 changed files with 360 additions and 172 deletions
+6
View File
@@ -0,0 +1,6 @@
<Root>
<File Name="code" OutName="sub_s" BaseAddress="0x800A5AC0" RangeStart="0x120260" RangeEnd="0x1202F0" >
<DList Name="D_801C5D60" Offset="0x1202A0"/>
<DList Name="D_801C5D80" Offset="0x1202C0"/>
</File>
</Root>
+14 -13
View File
@@ -2439,8 +2439,8 @@ void func_8013A46C(s32 flag);
u32 func_8013A4C4(s32 flag);
s16 func_8013A504(s16 val);
s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, Vec3s* rot, f32 distanceMin, f32 distanceMax, s16 angleError);
struct EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 unk_1A5);
Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 idx, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, TransformLimbDraw transformLimbDraw, Actor* actor, Mtx** mtx, Gfx* gfx);
struct EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 switchFlag);
Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, TransformLimbDraw transformLimbDraw, Actor* actor, Mtx** mtx, Gfx* gfx);
Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, TransformLimbDraw transformLimbDraw, Actor* actor, Gfx* gfx);
s32 func_8013AD6C(GlobalContext* globalCtx);
s32 func_8013AD9C(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 arg5);
@@ -2451,14 +2451,14 @@ void func_8013B0C8(s32 arg0, f32 arg1, s32 arg2, f32* arg3, f32* arg4);
void func_8013B350(Vec3f* arg0, f32* arg1, f32 arg2, s32 arg3, s32 arg4, Vec3s* arg5, f32* arg6);
s32 func_8013B6B0(Path* path, f32* arg1, s32* arg2, s32 arg3, s32 arg4, s32* arg5, f32* arg6, Vec3f* arg7, s32 arg8);
void func_8013B878(GlobalContext* globalCtx, Path* path, s32 arg2, Vec3f* arg3);
Path* func_8013BB34(GlobalContext* globalCtx, u8 arg1, s32 arg2);
Path* SubS_GetAdditionalPath(GlobalContext* globalCtx, u8 pathIndex, s32 max);
Actor* SubS_FindNearestActor(Actor* actor, GlobalContext* globalCtx, u8 actorCategory, s16 actorId);
s32 SubS_ChangeAnimationByInfoS(SkelAnime* skelAnime, AnimationInfoS* animations, s32 index);
s32 func_8013BD40(Actor* actor, Path* path, s32 arg2);
Path* func_8013BEDC(GlobalContext* globalCtx, u8 arg1, u8 arg2, s32* arg3);
s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex);
Path* SubS_GetDayDependentPath(GlobalContext* globalCtx, u8 pathIndex, u8 max, s32* startPointIndex);
s32 func_8013C068(Path* path, s32 arg1, Vec3f* arg2, f32 arg3, s32 arg4);
s32 func_8013C624(Actor* actor, Path* path, s32* arg2, f32* arg3, s32 arg4, s32 arg5);
s32 func_8013C8B8(Path* path, s32 arg1, Vec3f* arg2);
s32 SubS_CopyPointFromPathCheckBounds(Path* path, s32 pointIndex, Vec3f* dst);
s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, s32 arg4, s32 arg5);
void func_8013CC2C(s32 arg0, s32 arg1, u8* arg2, s32 arg3);
void func_8013CD64(Vec3f* arg0, Vec3f* arg1, u8* arg2, f32 arg3, u8 arg4, u8* arg5, s8* arg6);
@@ -2466,17 +2466,18 @@ void func_8013CF04(Actor* actor, GraphicsContext** gfxCtxPtr, u8* arg2);
s16 func_8013D0E0(s16* arg0, s16 arg1, s16 arg2, f32 arg3, f32 arg4, f32 arg5);
s32 func_8013D2E0(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, Vec3s* arg3, Vec3s* arg4, Vec3s* arg5, u16* arg6);
s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB);
Path* func_8013D648(GlobalContext* globalCtx, s16 arg1, s16 arg2);
s32 func_8013D68C(Path* path, s32 arg1, Vec3f* arg2);
s16 func_8013D720(Vec3f* arg0, Vec3f* arg1, f32* arg2);
s32 func_8013D768(Actor* actor, Vec3f* arg1, s16 arg2);
s16 func_8013D83C(Path* path, s32 pointIdx, Vec3f* pos, f32* distSq);
Path* SubS_GetPathByIndex(GlobalContext* globalCtx, s16 pathIndex, s16 max);
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);
s16 SubS_GetDistSqAndOrientPath(Path* path, s32 pointIdx, Vec3f* pos, f32* distSq);
s8 SubS_IsObjectLoaded(s8 index, GlobalContext* globalCtx);
s8 SubS_GetObjectIndex(s16 id, GlobalContext* globalCtx);
Actor* SubS_FindActor(GlobalContext* globalCtx, Actor* actorListStart, u8 actorCategory, s16 actorId);
s32 SubS_FillLimbRotTables(GlobalContext* globalCtx, s16* limbRotTableY, s16* limbRotTableZ, s32 numLimbs);
s32 func_8013DB90(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2);
s32 func_8013DC40(Path* arg0, s32 arg1, s32 arg2, Vec3f* arg3);
s32 SubS_IsFloorAbove(GlobalContext* globalCtx, Vec3f* pos, f32 distAbove);
s32 SubS_CopyPointFromPathList(Path* paths, s32 pathIndex, s32 pointIndex, Vec3f* dst);
u8 SubS_GetPathCount(Path* paths, s32 index);
void SubS_ActorPathing_Init(GlobalContext* globalCtx, Vec3f* worldPos, Actor* actor, ActorPathing* actorPath, Path* paths, s32 pathIndex, s32 begPointIndex, s32 endPointIndex, s32 curPointIndex, u8 flags);
s32 SubS_ActorPathing_Update(GlobalContext* globalCtx, ActorPathing* actorPath, ActorPathingComputeFunc computePointInfoFunc, ActorPathingUpdateFunc updateActorInfoFunc, ActorPathingUpdateFunc moveFunc, ActorPathingUpdateFunc setNextPointFunc);
void SubS_ActorPathing_ComputePointInfo(GlobalContext* globalCtx, ActorPathing* actorPath);
+1 -1
View File
@@ -10,7 +10,7 @@ typedef enum {
/* 2 */ SUBS_CUTSCENE_SET_FLAG
} SubSCutsceneType;
typedef s32 (*func_8013E748_arg6)(struct GlobalContext*, Actor*, Vec3s*);
typedef s32 (*func_8013E748_arg6)(struct GlobalContext*, Actor*, void*);
typedef s32 (*VerifyActor)(struct GlobalContext*, Actor*, Actor*, void*);
-1
View File
@@ -530,7 +530,6 @@ beginseg
include "build/src/code/z_skin_matrix.o"
include "build/src/code/z_snap.o"
include "build/src/code/z_sub_s.o"
include "build/data/code/z_sub_s.data.o"
include "build/data/code/code_801DE890.rodata.o"
include "build/src/code/code_8013EC10.o"
include "build/data/code/code_8013EC10.bss.o"
+8 -6
View File
@@ -152,7 +152,7 @@ s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3
EnDoor* door;
s32 pad;
if (func_8013D68C(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) {
if (SubS_CopyPointFromPath(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) {
door = EnHy_FindNearestDoor(&enHy->actor, globalCtx);
if (door != NULL) {
ret = true;
@@ -174,7 +174,7 @@ s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3) {
EnDoor* door;
enHy->curPoint = 0;
if (func_8013D68C(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) {
if (SubS_CopyPointFromPath(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) {
door = EnHy_FindNearestDoor(&enHy->actor, globalCtx);
if (door != NULL) {
ret = true;
@@ -209,7 +209,8 @@ s32 EnHy_MoveForwards(EnHy* enHy, f32 speedTarget) {
Math_SmoothStepToF(&enHy->actor.speedXZ, speedTarget, 0.4f, 1000.0f, 0.0f);
rotStep = enHy->actor.speedXZ * 400.0f;
if (func_8013D68C(enHy->path, enHy->curPoint, &curPointPos) && func_8013D768(&enHy->actor, &curPointPos, rotStep)) {
if (SubS_CopyPointFromPath(enHy->path, enHy->curPoint, &curPointPos) &&
SubS_MoveActorToPoint(&enHy->actor, &curPointPos, rotStep)) {
enHy->curPoint++;
if (enHy->curPoint >= enHy->path->count) {
reachedEnd = true;
@@ -226,7 +227,8 @@ s32 EnHy_MoveBackwards(EnHy* enHy, f32 speedTarget) {
Math_SmoothStepToF(&enHy->actor.speedXZ, speedTarget, 0.4f, 1000.0f, 0.0f);
rotStep = enHy->actor.speedXZ * 400.0f;
if (func_8013D68C(enHy->path, enHy->curPoint, &curPointPos) && func_8013D768(&enHy->actor, &curPointPos, rotStep)) {
if (SubS_CopyPointFromPath(enHy->path, enHy->curPoint, &curPointPos) &&
SubS_MoveActorToPoint(&enHy->actor, &curPointPos, rotStep)) {
enHy->curPoint--;
if (enHy->curPoint < 0) {
reachedEnd = true;
@@ -263,12 +265,12 @@ s32 EnHy_PlayWalkingSound(EnHy* enHy, GlobalContext* globalCtx, f32 distAboveThr
sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, enHy->actor.floorPoly, enHy->actor.floorBgId) + SFX_FLAG;
}
enHy->isLeftFootOnGround = isFootOnGround = func_8013DB90(globalCtx, &enHy->leftFootPos, distAboveThreshold);
enHy->isLeftFootOnGround = isFootOnGround = SubS_IsFloorAbove(globalCtx, &enHy->leftFootPos, distAboveThreshold);
if (enHy->isLeftFootOnGround && !wasLeftFootOnGround && isFootOnGround) {
Actor_PlaySfxAtPos(&enHy->actor, sfxId);
}
enHy->isRightFootOnGround = isFootOnGround = func_8013DB90(globalCtx, &enHy->rightFootPos, distAboveThreshold);
enHy->isRightFootOnGround = isFootOnGround = SubS_IsFloorAbove(globalCtx, &enHy->rightFootPos, distAboveThreshold);
if (enHy->isRightFootOnGround && !wasRightFootOnGround && isFootOnGround) {
Actor_PlaySfxAtPos(&enHy->actor, sfxId);
}
+187 -15
View File
@@ -6,10 +6,18 @@
#include "global.h"
#include "overlays/actors/ovl_En_Door/z_en_door.h"
s16 sPathDayFlags[] = { 0x40, 0x20, 0x10, 8, 4, 2, 1, 0 };
#include "code/sub_s/sub_s.c"
Vec3f D_801C5DB0 = { 1.0f, 1.0f, 1.0f };
s32 D_801C5DBC[] = { 0, 1 }; // Unused
/**
* Finds the first EnDoor instance with unk_1A4 == 5 and the specified unk_1A5.
* Finds the first EnDoor instance with unk_1A4 == 5 and the specified switchFlag.
*/
EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 unk_1A5) {
EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 switchFlag) {
Actor* actor = NULL;
EnDoor* door;
@@ -21,7 +29,7 @@ EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 unk_1A5) {
break;
}
if ((door->unk_1A4 == 5) && (door->switchFlag == (u8)unk_1A5)) {
if ((door->unk_1A4 == 5) && (door->switchFlag == (u8)switchFlag)) {
break;
}
@@ -170,7 +178,21 @@ void SubS_UpdateFlags(u16* flags, u16 setBits, u16 unsetBits) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013B878.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013BB34.s")
Path* SubS_GetAdditionalPath(GlobalContext* globalCtx, u8 pathIndex, s32 max) {
Path* path;
s32 i = 0;
do {
path = &globalCtx->setupPathList[pathIndex];
if (i >= max) {
break;
}
pathIndex = path->unk1;
i++;
} while (pathIndex != 0xFF);
return path;
}
/**
* Finds the nearest actor instance of a specified Id and category to an actor.
@@ -228,15 +250,88 @@ s32 SubS_ChangeAnimationByInfoS(SkelAnime* skelAnime, AnimationInfoS* animations
return true;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013BD40.s")
s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) {
Vec3s* points = Lib_SegmentedToVirtual(path->points);
s32 count = path->count;
s32 index = pointIndex;
s32 reached = false;
f32 diffX;
f32 diffZ;
f32 px;
f32 pz;
f32 d;
Vec3f point;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013BEDC.s")
Math_Vec3s_ToVec3f(&point, &points[index]);
if (index == 0) {
diffX = points[1].x - points[0].x;
diffZ = points[1].z - points[0].z;
} else if (index == count - 1) {
diffX = points[count - 1].x - points[count - 2].x;
diffZ = points[count - 1].z - points[count - 2].z;
} else {
diffX = points[index + 1].x - points[index - 1].x;
diffZ = points[index + 1].z - points[index - 1].z;
}
func_8017B7F8(&point, RADF_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d);
if (((px * actor->world.pos.x) + (pz * actor->world.pos.z) + d) > 0.0f) {
reached = true;
}
return reached;
}
Path* SubS_GetDayDependentPath(GlobalContext* globalCtx, u8 pathIndex, u8 max, s32* startPointIndex) {
Path* path = NULL;
s32 found = false;
s32 time = (((s16)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60) +
((s16)TIME_TO_MINUTES_F(gSaveContext.save.time) / 60) * 60) /
30;
s32 day = CURRENT_DAY;
if (pathIndex == max) {
return NULL;
}
while (pathIndex != 0xFF) {
path = &globalCtx->setupPathList[pathIndex];
if (sPathDayFlags[day] & path->unk2) {
found = true;
break;
}
pathIndex = path->unk1;
}
if (found == true) {
*startPointIndex = time;
*startPointIndex = CLAMP(*startPointIndex, 0, path->count - 1);
} else {
*startPointIndex = 0;
}
return path;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013C068.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013C624.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013C8B8.s")
s32 SubS_CopyPointFromPathCheckBounds(Path* path, s32 pointIndex, Vec3f* dst) {
Vec3s* point;
if ((path == NULL) || (pointIndex >= path->count) || (pointIndex < 0)) {
return false;
}
point = Lib_SegmentedToVirtual(path->points);
point = &point[pointIndex];
dst->x = point->x;
dst->y = point->y;
dst->z = point->z;
return true;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013C964.s")
@@ -254,15 +349,68 @@ s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB) {
return (ABS_ALT(BINANG_SUB(angleB, angleA)) <= threshold) ? true : false;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D648.s")
Path* SubS_GetPathByIndex(GlobalContext* globalCtx, s16 pathIndex, s16 max) {
return (pathIndex != max) ? &globalCtx->setupPathList[pathIndex] : NULL;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D68C.s")
s32 SubS_CopyPointFromPath(Path* path, s32 pointIndex, Vec3f* dst) {
Vec3s* point;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D720.s")
if (path == NULL) {
return false;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D768.s")
point = Lib_SegmentedToVirtual(path->points);
point = &point[pointIndex];
dst->x = point->x;
dst->y = point->y;
dst->z = point->z;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D83C.s")
return true;
}
s16 SubS_GetDistSqAndOrientPoints(Vec3f* vecA, Vec3f* vecB, f32* distSq) {
f32 diffX = vecA->x - vecB->x;
f32 diffZ = vecA->z - vecB->z;
*distSq = SQ(diffX) + SQ(diffZ);
return Math_Atan2S(diffX, diffZ);
}
/**
* Returns true when the actor has reached the inputed point
*/
s32 SubS_MoveActorToPoint(Actor* actor, Vec3f* point, s16 rotStep) {
Vec3f offsetBefore;
Vec3f offsetAfter;
f32 distSqBefore;
f32 distSqAfter;
Actor_OffsetOfPointInActorCoords(actor, &offsetBefore, point);
Math_SmoothStepToS(&actor->world.rot.y, SubS_GetDistSqAndOrientPoints(point, &actor->world.pos, &distSqBefore), 4,
rotStep, 1);
actor->shape.rot.y = actor->world.rot.y;
Actor_MoveWithGravity(actor);
Actor_OffsetOfPointInActorCoords(actor, &offsetAfter, point);
SubS_GetDistSqAndOrientPoints(point, &actor->world.pos, &distSqAfter);
return ((offsetBefore.z > 0.0f) && (offsetAfter.z <= 0.0f)) ? true : false;
}
s16 SubS_GetDistSqAndOrientPath(Path* path, s32 pointIndex, Vec3f* pos, f32* distSq) {
Vec3s* point;
f32 diffX = 0.0f;
f32 diffZ = 0.0f;
if (path != NULL) {
point = Lib_SegmentedToVirtual(path->points);
point = &point[pointIndex];
diffX = point->x - pos->x;
diffZ = point->z - pos->z;
}
*distSq = SQ(diffX) + SQ(diffZ);
return Math_Atan2S(diffX, diffZ);
}
s8 SubS_IsObjectLoaded(s8 index, GlobalContext* globalCtx) {
return !Object_IsLoaded(&globalCtx->objectCtx, index) ? false : true;
@@ -301,11 +449,35 @@ s32 SubS_FillLimbRotTables(GlobalContext* globalCtx, s16* limbRotTableY, s16* li
return true;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013DB90.s")
s32 SubS_IsFloorAbove(GlobalContext* globalCtx, Vec3f* pos, f32 distAbove) {
CollisionPoly* outPoly;
Vec3f posA;
Vec3f posB;
Vec3f posResult;
s32 bgId;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013DC40.s")
posA = posB = *pos;
posB.y += distAbove;
return BgCheck_EntityLineTest1(&globalCtx->colCtx, &posA, &posB, &posResult, &outPoly, false, true, false, true,
&bgId);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013DCCC.s")
s32 SubS_CopyPointFromPathList(Path* paths, s32 pathIndex, s32 pointIndex, Vec3f* dst) {
Path* path = &paths[pathIndex];
Vec3s* point = &((Vec3s*)Lib_SegmentedToVirtual(path->points))[pointIndex];
dst->x = point->x;
dst->y = point->y;
dst->z = point->z;
return false;
}
u8 SubS_GetPathCount(Path* paths, s32 index) {
Path* path = &paths[index];
return path->count;
}
void SubS_ActorPathing_Init(GlobalContext* globalCtx, Vec3f* worldPos, Actor* actor, ActorPathing* actorPath,
Path* paths, s32 pathIndex, s32 begPointIndex, s32 endPointIndex, s32 curPointIndex,
@@ -328,7 +328,7 @@ void BgIngate_Init(Actor* thisx, GlobalContext* globalCtx2) {
this->unk160 |= 0x8;
this->unk160 |= 0x10;
Actor_SetScale(&this->dyna.actor, 1.0f);
this->unk164 = func_8013BB34(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), 0);
this->unk164 = SubS_GetAdditionalPath(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), 0);
this->dyna.actor.room = -1;
if (gSaveContext.save.weekEventReg[20] & 2) {
gSaveContext.save.weekEventReg[90] &= (u8)~0x40;
@@ -350,7 +350,7 @@ void BgIngate_Init(Actor* thisx, GlobalContext* globalCtx2) {
this->actionFunc = func_80953F8C;
}
}
this->unk164 = func_8013BB34(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), phi_a2);
this->unk164 = SubS_GetAdditionalPath(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), phi_a2);
if (this->unk164 != 0) {
sp38 = Lib_SegmentedToVirtual(this->unk164->points);
Math_Vec3s_ToVec3f(&sp2C, &sp38[0]);
@@ -361,7 +361,7 @@ void BgIngate_Init(Actor* thisx, GlobalContext* globalCtx2) {
this->dyna.actor.world.pos.y = -15.0f;
this->dyna.actor.world.pos.z = sp2C.z;
}
this->unk164 = func_8013BB34(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), 0);
this->unk164 = SubS_GetAdditionalPath(globalCtx, BGINGATE_GET_FF(&this->dyna.actor), 0);
} else {
Actor_MarkForDeath(&this->dyna.actor);
}
@@ -1606,7 +1606,7 @@ void EnAkindonuts_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.gravity = -1.0f;
if (!ENAKINDONUTS_GET_4(&this->actor)) {
this->path = func_8013D648(globalCtx, ENAKINDONUTS_GET_FC00(&this->actor), 0x3F);
this->path = SubS_GetPathByIndex(globalCtx, ENAKINDONUTS_GET_FC00(&this->actor), 0x3F);
if (this->path == NULL) {
Actor_MarkForDeath(&this->actor);
return;
@@ -113,7 +113,7 @@ void func_809C1158(EnAob01* this, GlobalContext* globalCtx) {
if (temp_s0 != 0x3F) {
do {
this->unk_1D8[i] = func_8013D648(globalCtx, temp_s0, 0x3F);
this->unk_1D8[i] = SubS_GetPathByIndex(globalCtx, temp_s0, 0x3F);
temp_s0 = this->unk_1D8[i]->unk1;
i++;
} while (temp_s0 != 0xFF);
+3 -3
View File
@@ -266,7 +266,7 @@ s32 func_80BA8D2C(EnBaba* this, f32 arg1) {
Math_SmoothStepToF(&this->actor.speedXZ, arg1, 0.4f, 1000.0f, 0.0f);
sp3E = this->actor.speedXZ * 400.0f;
if (func_8013D68C(this->path, this->unk_1E8, &sp2C) && func_8013D768(&this->actor, &sp2C, sp3E)) {
if (SubS_CopyPointFromPath(this->path, this->unk_1E8, &sp2C) && SubS_MoveActorToPoint(&this->actor, &sp2C, sp3E)) {
this->unk_1E8++;
if (this->unk_1E8 >= this->path->count) {
ret = true;
@@ -311,7 +311,7 @@ s32 func_80BA8F88(EnBaba* this, GlobalContext* globalCtx, struct_80133038_arg2*
u8 sp23 = ENBABA_GET_3F00(&this->actor);
if (D_80BAA4A8[arg2->unk0] >= 0) {
this->unk_410 = func_8013BB34(globalCtx, sp23, D_80BAA4A8[arg2->unk0]);
this->unk_410 = SubS_GetAdditionalPath(globalCtx, sp23, D_80BAA4A8[arg2->unk0]);
}
if (this->unk_410 == NULL) {
@@ -659,7 +659,7 @@ void EnBaba_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
this->path = func_8013D648(globalCtx, ENBABA_GET_3F00(&this->actor), ENBABA_3F00_3F);
this->path = SubS_GetPathByIndex(globalCtx, ENBABA_GET_3F00(&this->actor), ENBABA_3F00_3F);
Actor_SetScale(&this->actor, 0.01f);
@@ -220,7 +220,7 @@ void EnBba01_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_SetCylinder(globalCtx, &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 = func_8013D648(globalCtx, ENBBA01_GET_PATH(&this->enHy.actor), ENBBA01_NO_PATH);
this->enHy.path = SubS_GetPathByIndex(globalCtx, ENBBA01_GET_PATH(&this->enHy.actor), ENBBA01_NO_PATH);
this->enHy.waitingOnInit = true;
Actor_SetScale(&this->enHy.actor, 0.01f);
this->enHy.actionFunc = EnBba01_FinishInit;
@@ -94,7 +94,7 @@ void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx) {
}
this->unk_29A = ENBOMBOWLMAN_GET_FF00(&this->actor);
this->path = func_8013D648(globalCtx, this->unk_29A, 0x3F);
this->path = SubS_GetPathByIndex(globalCtx, this->unk_29A, 0x3F);
this->unk_2C8 = 80.0f;
if ((gSaveContext.save.entranceIndex == 0xD220) && (gSaveContext.save.weekEventReg[73] & 0x80) &&
@@ -157,7 +157,7 @@ void func_809C4B50(EnBomBowlMan* this) {
void func_809C4B6C(EnBomBowlMan* this) {
if ((this->unk_29A != ENBOMBOWLMAN_FF00_MINUS1) && (this->path != NULL)) {
if (!func_8013D68C(this->path, this->unk_298, &this->unk_2A0)) {
if (!SubS_CopyPointFromPath(this->path, this->unk_298, &this->unk_2A0)) {
Actor_MarkForDeath(&this->actor);
}
}
@@ -210,7 +210,7 @@ void EnCne01_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_SetCylinder(globalCtx, &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 = func_8013D648(globalCtx, ENCNE01_GET_PATH(&this->enHy.actor), ENCNE01_NO_PATH);
this->enHy.path = SubS_GetPathByIndex(globalCtx, ENCNE01_GET_PATH(&this->enHy.actor), ENCNE01_NO_PATH);
this->enHy.waitingOnInit = true;
Actor_SetScale(&this->enHy.actor, 0.01f);
this->enHy.actionFunc = EnCne01_FinishInit;
@@ -67,7 +67,7 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) {
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 = func_8013D648(globalCtx, this->unk_288, 0x3F);
this->unk_258 = SubS_GetPathByIndex(globalCtx, this->unk_288, 0x3F);
} else if (this->unk_278 == ENDAIKU_PARAMS_FF_2) {
this->unk_264 = -2000;
}
@@ -134,7 +134,7 @@ void func_8094373C(EnDaiku* this, s32 arg1) {
void func_809437C8(EnDaiku* this) {
if ((this->unk_288 != -1) && (this->unk_258 != 0)) {
if (!func_8013D68C(this->unk_258, this->unk_25C, &this->unk_26C)) {
if (!SubS_CopyPointFromPath(this->unk_258, this->unk_25C, &this->unk_26C)) {
Actor_MarkForDeath(&this->actor);
}
}
@@ -70,7 +70,7 @@ static ColliderCylinderInit sCylinderInit = {
void func_80BE61D0(EnDaiku2* this) {
if ((this->unk_27A != -1) && (this->unk_258 != 0)) {
if (func_8013D68C(this->unk_258, this->unk_25C, &this->unk_268) == 0) {
if (!SubS_CopyPointFromPath(this->unk_258, this->unk_25C, &this->unk_268)) {
Actor_MarkForDeath(&this->actor);
}
}
@@ -88,7 +88,7 @@ void EnDaiku2_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
this->unk_278 = ENDAIKU2_GET_7F(&this->actor);
this->unk_27A = ENDAIKU2_GET_1F80(&this->actor);
this->unk_258 = func_8013D648(globalCtx, this->unk_27A, 0x3F);
this->unk_258 = SubS_GetPathByIndex(globalCtx, this->unk_27A, 0x3F);
this->unk_280 = ENDAIKU2_GET_8000(&this->actor);
Actor_SetScale(&this->actor, 0.01f);
if (!this->unk_280) {
+3 -3
View File
@@ -212,7 +212,7 @@ s32 func_80989418(EnDg* this, Path* arg1, s32 arg2) {
if (idx == 0) {
phi_f12 = sp5C[1].x - sp5C[0].x;
phi_f14 = sp5C[1].z - sp5C[0].z;
} else if ((idx + 1) == ((void)0, count)) {
} else if (idx == count - 1) {
phi_f12 = sp5C[count - 1].x - sp5C[count - 2].x;
phi_f14 = sp5C[count - 1].z - sp5C[count - 2].z;
} else {
@@ -220,7 +220,7 @@ s32 func_80989418(EnDg* this, Path* arg1, s32 arg2) {
phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z;
}
func_8017B7F8(&sp30, func_80086B30(phi_f12, phi_f14) * 10430.378f, &sp44, &sp40, &sp3C);
func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(phi_f12, phi_f14)), &sp44, &sp40, &sp3C);
if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) {
sp50 = true;
}
@@ -1114,7 +1114,7 @@ void EnDg_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
Actor_ProcessInitChain(&this->actor, sInitChain);
this->unk_1DC = func_8013D648(globalCtx, ENDG_GET_FC00(&this->actor), 0x3F);
this->unk_1DC = SubS_GetPathByIndex(globalCtx, ENDG_GET_FC00(&this->actor), 0x3F);
Actor_SetScale(&this->actor, 0.0075f);
this->actor.targetMode = 1;
this->actor.gravity = -3.0f;
+1 -1
View File
@@ -369,7 +369,7 @@ void EnGg2_Init(Actor* thisx, GlobalContext* globalCtx2) {
this->actor.bgCheckFlags |= 0x400;
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable,
this->morphTable, 20);
this->unk_1D8 = func_8013D648(globalCtx, ENGG2_GET_FC00(&this->actor), 0x3F);
this->unk_1D8 = SubS_GetPathByIndex(globalCtx, ENGG2_GET_FC00(&this->actor), 0x3F);
this->actor.flags &= ~ACTOR_FLAG_80;
this->unk_2F0 = 0;
this->unk_2F1 = 0;
+1 -1
View File
@@ -1028,7 +1028,7 @@ void EnGk_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_MarkForDeath(&this->actor);
} else {
this->unk_318 = this->actor.cutscene;
this->path = func_8013D648(globalCtx, ENGK_GET_F0(&this->actor), 15);
this->path = SubS_GetPathByIndex(globalCtx, ENGK_GET_F0(&this->actor), 15);
this->actionFunc = func_80B51760;
}
} else if (globalCtx->sceneNum == SCENE_GORONRACE) {
+4 -4
View File
@@ -902,7 +902,7 @@ s32 func_8094F7D0(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
actor = func_8094DEE0(this, globalCtx, arg3, arg4);
if (D_80951A0C[arg2->unk0] >= 0) {
this->unk_234 = func_8013BB34(globalCtx, sp4F, D_80951A0C[arg2->unk0]);
this->unk_234 = SubS_GetAdditionalPath(globalCtx, sp4F, D_80951A0C[arg2->unk0]);
}
if ((actor != NULL) && (actor->update != NULL)) {
@@ -933,7 +933,7 @@ s32 func_8094F904(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
door = func_8094DF90(globalCtx, arg2->unk0);
if (D_80951A0C[arg2->unk0] >= 0) {
this->unk_234 = func_8013BB34(globalCtx, sp55, D_80951A0C[arg2->unk0]);
this->unk_234 = SubS_GetAdditionalPath(globalCtx, sp55, D_80951A0C[arg2->unk0]);
}
if ((door != NULL) && (door->dyna.actor.update != NULL)) {
@@ -974,7 +974,7 @@ s32 func_8094FAC4(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
this->unk_234 = NULL;
if (D_80951A0C[arg2->unk0] >= 0) {
this->unk_234 = func_8013BB34(globalCtx, sp2B, D_80951A0C[arg2->unk0]);
this->unk_234 = SubS_GetAdditionalPath(globalCtx, sp2B, D_80951A0C[arg2->unk0]);
}
if ((this->unk_234 != NULL) && (this->unk_234->count < 3)) {
@@ -1076,7 +1076,7 @@ s32 func_8094FF04(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
this->unk_234 = NULL;
if (D_80951A0C[arg2->unk0] >= 0) {
this->unk_234 = func_8013BB34(globalCtx, sp4F, D_80951A0C[arg2->unk0]);
this->unk_234 = SubS_GetAdditionalPath(globalCtx, sp4F, D_80951A0C[arg2->unk0]);
}
if (this->unk_234 != NULL) {
+3 -3
View File
@@ -1332,7 +1332,7 @@ void func_80A1428C(EnGo* this, GlobalContext* globalCtx) {
Math_Vec3f_Copy(&sp30, &this->actor.world.pos);
if (this->unk_284 != NULL) {
this->actor.flags &= ~ACTOR_FLAG_2000000;
func_8013C8B8(this->unk_284, 0, &sp24);
SubS_CopyPointFromPathCheckBounds(this->unk_284, 0, &sp24);
temp = Math_Vec3f_Yaw(&sp30, &sp24);
this->actor.shape.rot.y = temp;
this->actor.world.rot.y = temp;
@@ -1393,7 +1393,7 @@ void func_80A1449C(EnGo* this, GlobalContext* globalCtx) {
void func_80A144F4(EnGo* this, GlobalContext* globalCtx) {
if (gSaveContext.save.day >= 2) {
this->unk_284 = func_8013BEDC(globalCtx, ENGO_GET_7F80(&this->actor), 0xFF, &this->unk_3E4);
this->unk_284 = SubS_GetDayDependentPath(globalCtx, ENGO_GET_7F80(&this->actor), 0xFF, &this->unk_3E4);
if (this->unk_284 != NULL) {
this->unk_3E4 = 1;
}
@@ -1785,7 +1785,7 @@ void func_80A153FC(EnGo* this, GlobalContext* globalCtx) {
}
sp5C = Lib_SegmentedToVirtual(this->unk_284->points);
if (func_8013BD40(&this->actor, this->unk_284, this->unk_3E4)) {
if (SubS_HasReachedPoint(&this->actor, this->unk_284, this->unk_3E4)) {
if (this->unk_3E4 >= (this->unk_284->count - 1)) {
this->unk_3E4 = 0;
} else {

Some files were not shown because too many files have changed in this diff Show More