mirror of
https://github.com/zeldaret/mm.git
synced 2026-08-17 21:03:30 -04:00
SubS ActorPathing (#689)
* Bring code over * Clean up * Renames * Cleanup * Split SubS stuff from z64 into z64subs * newline * Bss * Name callbacks * bss * bss
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
|
||||
#define ANIM_INTERP 1
|
||||
|
||||
+125
-6
@@ -307,17 +307,136 @@ s32 SubS_FillLimbRotTables(GlobalContext* globalCtx, s16* limbRotTableY, s16* li
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013DCCC.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013DCE0.s")
|
||||
void SubS_ActorPathing_Init(GlobalContext* globalCtx, Vec3f* worldPos, Actor* actor, ActorPathing* actorPath,
|
||||
Path* paths, s32 pathIndex, s32 begPointIndex, s32 endPointIndex, s32 curPointIndex,
|
||||
u8 flags) {
|
||||
Path* path;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013DE04.s")
|
||||
actorPath->setupPathList = globalCtx->setupPathList;
|
||||
actorPath->pathIndex = pathIndex;
|
||||
path = &paths[pathIndex];
|
||||
actorPath->points = Lib_SegmentedToVirtual(path->points);
|
||||
actorPath->count = path->count;
|
||||
actorPath->begPointIndex = begPointIndex;
|
||||
if (endPointIndex == 0) {
|
||||
actorPath->endPointIndex = actorPath->count - 1;
|
||||
} else if (endPointIndex > 0) {
|
||||
actorPath->endPointIndex = endPointIndex;
|
||||
} else {
|
||||
//! @bug: endPointIndex is negative, subtraction causes result to be past the end
|
||||
actorPath->endPointIndex = (actorPath->count - endPointIndex) - 1;
|
||||
}
|
||||
actorPath->curPointIndex = curPointIndex;
|
||||
actorPath->curPoint.x = actorPath->points[0].x;
|
||||
actorPath->curPoint.y = actorPath->points[0].y;
|
||||
actorPath->curPoint.z = actorPath->points[0].z;
|
||||
Math_Vec3f_Copy(&actorPath->prevPoint, &actorPath->curPoint);
|
||||
actorPath->worldPos = worldPos;
|
||||
actorPath->actor = actor;
|
||||
actorPath->flags = flags;
|
||||
actorPath->prevFlags = flags;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013DF3C.s")
|
||||
s32 SubS_ActorPathing_Update(GlobalContext* globalCtx, ActorPathing* actorPath,
|
||||
ActorPathingComputeFunc computePointInfoFunc, ActorPathingUpdateFunc updateActorInfoFunc,
|
||||
ActorPathingUpdateFunc moveFunc, ActorPathingUpdateFunc setNextPointFunc) {
|
||||
s32 shouldSetNextPoint;
|
||||
s32 reupdate;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E054.s")
|
||||
actorPath->computePointInfoFunc = computePointInfoFunc;
|
||||
actorPath->updateActorInfoFunc = updateActorInfoFunc;
|
||||
actorPath->moveFunc = moveFunc;
|
||||
actorPath->setNextPointFunc = setNextPointFunc;
|
||||
actorPath->flags &= ~ACTOR_PATHING_REACHED_TEMPORARY;
|
||||
reupdate = false;
|
||||
if (actorPath->flags & ACTOR_PATHING_MOVE_BACKWARDS) {
|
||||
if (!(actorPath->prevFlags & ACTOR_PATHING_MOVE_BACKWARDS)) {
|
||||
actorPath->curPointIndex--;
|
||||
}
|
||||
} else if (actorPath->prevFlags & ACTOR_PATHING_MOVE_BACKWARDS) {
|
||||
actorPath->curPointIndex++;
|
||||
}
|
||||
do {
|
||||
shouldSetNextPoint = false;
|
||||
if (actorPath->computePointInfoFunc != NULL) {
|
||||
actorPath->computePointInfoFunc(globalCtx, actorPath);
|
||||
}
|
||||
if (actorPath->updateActorInfoFunc != NULL) {
|
||||
shouldSetNextPoint = actorPath->updateActorInfoFunc(globalCtx, actorPath);
|
||||
}
|
||||
if (shouldSetNextPoint) {
|
||||
if (actorPath->setNextPointFunc != NULL) {
|
||||
reupdate = actorPath->setNextPointFunc(globalCtx, actorPath);
|
||||
}
|
||||
} else if (actorPath->moveFunc != NULL) {
|
||||
reupdate = actorPath->moveFunc(globalCtx, actorPath);
|
||||
}
|
||||
} while (reupdate);
|
||||
actorPath->prevFlags = actorPath->flags;
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E07C.s")
|
||||
void SubS_ActorPathing_ComputePointInfo(GlobalContext* globalCtx, ActorPathing* actorPath) {
|
||||
Vec3f diff;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E0A4.s")
|
||||
actorPath->curPoint.x = actorPath->points[actorPath->curPointIndex].x + actorPath->pointOffset.x;
|
||||
actorPath->curPoint.y = actorPath->points[actorPath->curPointIndex].y + actorPath->pointOffset.y;
|
||||
actorPath->curPoint.z = actorPath->points[actorPath->curPointIndex].z + actorPath->pointOffset.z;
|
||||
diff.x = actorPath->curPoint.x - actorPath->worldPos->x;
|
||||
diff.y = actorPath->curPoint.y - actorPath->worldPos->y;
|
||||
diff.z = actorPath->curPoint.z - actorPath->worldPos->z;
|
||||
actorPath->distSqToCurPointXZ = Math3D_XZLengthSquared(diff.x, diff.z);
|
||||
actorPath->distSqToCurPoint = Math3D_LengthSquared(&diff);
|
||||
actorPath->rotToCurPoint.y = Math_FAtan2F(diff.z, diff.x);
|
||||
actorPath->rotToCurPoint.x = Math_FAtan2F(sqrtf(actorPath->distSqToCurPointXZ), -diff.y);
|
||||
actorPath->rotToCurPoint.z = 0;
|
||||
}
|
||||
|
||||
s32 SubS_ActorPathing_MoveWithGravity(GlobalContext* globalCtx, ActorPathing* actorPath) {
|
||||
Actor_MoveWithGravity(actorPath->actor);
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 SubS_ActorPathing_MoveWithoutGravityReverse(GlobalContext* globalCtx, ActorPathing* actorPath) {
|
||||
Actor_MoveWithoutGravityReverse(actorPath->actor);
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 SubS_ActorPathing_SetNextPoint(GlobalContext* globalCtx, ActorPathing* actorPath) {
|
||||
s32 reupdate = true;
|
||||
|
||||
Math_Vec3f_Copy(&actorPath->prevPoint, &actorPath->curPoint);
|
||||
if (!(actorPath->flags & ACTOR_PATHING_MOVE_BACKWARDS)) {
|
||||
if (actorPath->curPointIndex >= actorPath->endPointIndex) {
|
||||
if (actorPath->flags & ACTOR_PATHING_RETURN_TO_START) {
|
||||
actorPath->curPointIndex = actorPath->begPointIndex;
|
||||
} else if (actorPath->flags & ACTOR_PATHING_SWITCH_DIRECTION) {
|
||||
actorPath->flags |= ACTOR_PATHING_MOVE_BACKWARDS;
|
||||
} else {
|
||||
reupdate = false;
|
||||
}
|
||||
actorPath->flags |= ACTOR_PATHING_REACHED_END;
|
||||
} else {
|
||||
actorPath->curPointIndex++;
|
||||
}
|
||||
actorPath->flags |= ACTOR_PATHING_REACHED_POINT;
|
||||
} else {
|
||||
if (actorPath->begPointIndex >= actorPath->curPointIndex) {
|
||||
if (actorPath->flags & ACTOR_PATHING_RETURN_TO_START) {
|
||||
actorPath->curPointIndex = actorPath->endPointIndex;
|
||||
} else if (actorPath->flags & ACTOR_PATHING_SWITCH_DIRECTION) {
|
||||
actorPath->flags &= ~ACTOR_PATHING_MOVE_BACKWARDS;
|
||||
} else {
|
||||
reupdate = false;
|
||||
}
|
||||
actorPath->flags |= ACTOR_PATHING_REACHED_END;
|
||||
} else {
|
||||
actorPath->curPointIndex--;
|
||||
}
|
||||
}
|
||||
actorPath->flags |= ACTOR_PATHING_REACHED_POINT;
|
||||
return reupdate;
|
||||
}
|
||||
|
||||
void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* animations, s32 nextIndex,
|
||||
s32* curIndex) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Description: Snowhead Temple Central Pillar
|
||||
*/
|
||||
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "z_bg_hakugin_post.h"
|
||||
#include "objects/object_hakugin_obj/object_hakugin_obj.h"
|
||||
|
||||
|
||||
@@ -687,12 +687,12 @@ void func_80A72C04(EnDno* this, GlobalContext* globalCtx) {
|
||||
this->actor.flags |= ACTOR_FLAG_8000000;
|
||||
this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8);
|
||||
Math_Vec3f_Copy(&this->unk_334, &this->actor.world.pos);
|
||||
func_8013DCE0(globalCtx, &this->unk_334, &this->actor, &this->unk_340, globalCtx->setupPathList,
|
||||
ENDNO_GET_7F(&this->actor), 1, 0, 1, 0);
|
||||
func_8013DF3C(globalCtx, &this->unk_340);
|
||||
SubS_ActorPathing_Init(globalCtx, &this->unk_334, &this->actor, &this->actorPath, globalCtx->setupPathList,
|
||||
ENDNO_GET_7F(&this->actor), 1, 0, 1, 0);
|
||||
SubS_ActorPathing_ComputePointInfo(globalCtx, &this->actorPath);
|
||||
|
||||
this->actor.world.rot.y = this->unk_340.unk_54.y;
|
||||
this->actor.world.rot.x = this->unk_340.unk_54.x;
|
||||
this->actor.world.rot.y = this->actorPath.rotToCurPoint.y;
|
||||
this->actor.world.rot.x = this->actorPath.rotToCurPoint.x;
|
||||
|
||||
Flags_SetSwitch(globalCtx, ENDNO_GET_3F80(&this->actor));
|
||||
this->actionFunc = func_80A730A0;
|
||||
@@ -704,8 +704,8 @@ void func_80A72CF8(EnDno* this, GlobalContext* globalCtx) {
|
||||
this->actor.floorHeight, this->actor.world.pos.z, 0, 0, 0, 0x201);
|
||||
}
|
||||
|
||||
s32 func_80A72D8C(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1) {
|
||||
Actor* actor = arg1->actor;
|
||||
s32 EnDno_ActorPathing_UpdateActorInfo(GlobalContext* globalCtx, ActorPathing* actorPath) {
|
||||
Actor* thisx = actorPath->actor;
|
||||
s32 pad;
|
||||
s32 ret = false;
|
||||
f32 sp38;
|
||||
@@ -713,52 +713,52 @@ s32 func_80A72D8C(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1) {
|
||||
s32 temp_v0_2;
|
||||
s32 sp2C;
|
||||
|
||||
actor->gravity = 0.0f;
|
||||
temp_v0 = actor->yawTowardsPlayer - actor->world.rot.y;
|
||||
thisx->gravity = 0.0f;
|
||||
temp_v0 = thisx->yawTowardsPlayer - thisx->world.rot.y;
|
||||
if ((temp_v0 <= 0x4000) && (temp_v0 >= -0x4000)) {
|
||||
Math_SmoothStepToF(&actor->speedXZ, 15.0f, 0.8f, 1.0f, 0.01f);
|
||||
Math_SmoothStepToF(&thisx->speedXZ, 15.0f, 0.8f, 1.0f, 0.01f);
|
||||
} else {
|
||||
if (actor->xzDistToPlayer <= 80.0f) {
|
||||
Math_SmoothStepToF(&actor->speedXZ, 8.0f, 0.5f, 0.5f, 0.01f);
|
||||
} else if (actor->xzDistToPlayer <= 360.0f) {
|
||||
Math_SmoothStepToF(&actor->speedXZ, 7.0f, 0.5f, 0.5f, 0.01f);
|
||||
if (thisx->xzDistToPlayer <= 80.0f) {
|
||||
Math_SmoothStepToF(&thisx->speedXZ, 8.0f, 0.5f, 0.5f, 0.01f);
|
||||
} else if (thisx->xzDistToPlayer <= 360.0f) {
|
||||
Math_SmoothStepToF(&thisx->speedXZ, 7.0f, 0.5f, 0.5f, 0.01f);
|
||||
} else {
|
||||
Math_SmoothStepToF(&actor->speedXZ, 3.5f, 0.5f, 0.5f, 0.01f);
|
||||
Math_SmoothStepToF(&thisx->speedXZ, 3.5f, 0.5f, 0.5f, 0.01f);
|
||||
}
|
||||
}
|
||||
|
||||
if (arg1->unk_50 < SQ(actor->speedXZ)) {
|
||||
if (actorPath->distSqToCurPoint < SQ(thisx->speedXZ)) {
|
||||
ret = true;
|
||||
} else {
|
||||
sp38 = actor->speedXZ / sqrtf(arg1->unk_4C);
|
||||
sp2C = ABS(arg1->unk_54.x - actor->world.rot.x);
|
||||
sp38 = thisx->speedXZ / sqrtf(actorPath->distSqToCurPointXZ);
|
||||
sp2C = ABS(actorPath->rotToCurPoint.x - thisx->world.rot.x);
|
||||
temp_v0_2 = sp2C;
|
||||
temp_v0_2 *= sp38;
|
||||
temp_v0_2 += 0x71C;
|
||||
sp2C = ABS(arg1->unk_54.y - actor->world.rot.y);
|
||||
sp2C = ABS(actorPath->rotToCurPoint.y - thisx->world.rot.y);
|
||||
|
||||
Math_ScaledStepToS(&actor->world.rot.x, arg1->unk_54.x, temp_v0_2);
|
||||
Math_ScaledStepToS(&actor->world.rot.y, arg1->unk_54.y, (s32)(sp2C * sp38) + 0x71C);
|
||||
Math_ScaledStepToS(&thisx->world.rot.x, actorPath->rotToCurPoint.x, temp_v0_2);
|
||||
Math_ScaledStepToS(&thisx->world.rot.y, actorPath->rotToCurPoint.y, (s32)(sp2C * sp38) + 0x71C);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 func_80A72FAC(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1) {
|
||||
Actor* actor = arg1->actor;
|
||||
EnDno* dno = (EnDno*)actor;
|
||||
f32 sp24 = Math_CosS(-actor->world.rot.x) * actor->speedXZ;
|
||||
s32 EnDno_ActorPathing_Move(GlobalContext* globalCtx, ActorPathing* actorPath) {
|
||||
Actor* thisx = actorPath->actor;
|
||||
EnDno* this = (EnDno*)thisx;
|
||||
f32 sp24 = Math_CosS(-thisx->world.rot.x) * thisx->speedXZ;
|
||||
f32 sp20 = gFramerateDivisorHalf;
|
||||
|
||||
actor->velocity.x = Math_SinS(actor->world.rot.y) * sp24;
|
||||
actor->velocity.y = Math_SinS(-actor->world.rot.x) * actor->speedXZ;
|
||||
actor->velocity.z = Math_CosS(actor->world.rot.y) * sp24;
|
||||
thisx->velocity.x = Math_SinS(thisx->world.rot.y) * sp24;
|
||||
thisx->velocity.y = Math_SinS(-thisx->world.rot.x) * thisx->speedXZ;
|
||||
thisx->velocity.z = Math_CosS(thisx->world.rot.y) * sp24;
|
||||
|
||||
dno->unk_334.x += (dno->actor.velocity.x * sp20) + dno->actor.colChkInfo.displacement.x;
|
||||
dno->unk_334.y += (dno->actor.velocity.y * sp20) + dno->actor.colChkInfo.displacement.y;
|
||||
dno->unk_334.z += (dno->actor.velocity.z * sp20) + dno->actor.colChkInfo.displacement.z;
|
||||
this->unk_334.x += (this->actor.velocity.x * sp20) + this->actor.colChkInfo.displacement.x;
|
||||
this->unk_334.y += (this->actor.velocity.y * sp20) + this->actor.colChkInfo.displacement.y;
|
||||
this->unk_334.z += (this->actor.velocity.z * sp20) + this->actor.colChkInfo.displacement.z;
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
void func_80A730A0(EnDno* this, GlobalContext* globalCtx) {
|
||||
@@ -786,11 +786,13 @@ void func_80A730A0(EnDno* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
func_8013DE04(globalCtx, &this->unk_340, func_8013DF3C, func_80A72D8C, func_80A72FAC, func_8013E0A4);
|
||||
SubS_ActorPathing_Update(globalCtx, &this->actorPath, SubS_ActorPathing_ComputePointInfo,
|
||||
EnDno_ActorPathing_UpdateActorInfo, EnDno_ActorPathing_Move,
|
||||
SubS_ActorPathing_SetNextPoint);
|
||||
this->unk_45C += 6553;
|
||||
this->unk_340.unk_2C.x = 0.0f;
|
||||
this->unk_340.unk_2C.y = 0.0f;
|
||||
this->unk_340.unk_2C.z = 0.0f;
|
||||
this->actorPath.pointOffset.x = 0.0f;
|
||||
this->actorPath.pointOffset.y = 0.0f;
|
||||
this->actorPath.pointOffset.z = 0.0f;
|
||||
Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_334);
|
||||
temp_f10 = (4.0f + Math_SinS(this->unk_3AE)) * Math_SinS(this->unk_3AC);
|
||||
this->actor.world.pos.y += temp_f10;
|
||||
@@ -799,8 +801,8 @@ void func_80A730A0(EnDno* this, GlobalContext* globalCtx) {
|
||||
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
|
||||
func_80A715DC(this, globalCtx);
|
||||
func_800B9010(&this->actor, NA_SE_EV_BUTLER_FRY - SFX_FLAG);
|
||||
if (this->unk_340.unk_1C & 0x20) {
|
||||
Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_340.unk_20);
|
||||
if (this->actorPath.flags & ACTOR_PATHING_REACHED_END_PERMANENT) {
|
||||
Math_Vec3f_Copy(&this->actor.world.pos, &this->actorPath.curPoint);
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->actor.velocity.x = 0.0f;
|
||||
this->actor.velocity.y = 0.0f;
|
||||
|
||||
@@ -34,7 +34,7 @@ typedef struct EnDno {
|
||||
/* 0x32C */ s32 unk_32C;
|
||||
/* 0x330 */ UNK_TYPE1 unk_330[0x4];
|
||||
/* 0x334 */ Vec3f unk_334;
|
||||
/* 0x340 */ struct_8013DF3C_arg1 unk_340;
|
||||
/* 0x340 */ ActorPathing actorPath;
|
||||
/* 0x3AC */ s16 unk_3AC;
|
||||
/* 0x3AE */ s16 unk_3AE;
|
||||
/* 0x3B0 */ u16 unk_3B0;
|
||||
|
||||
@@ -817,31 +817,27 @@ void func_80B5D160(EnOt* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_80B5D37C(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1) {
|
||||
s32 pad;
|
||||
EnOt* temp_s0 = (EnOt*)arg1->actor;
|
||||
f32 sp24;
|
||||
f32 sp20;
|
||||
s32 EnOt_ActorPathing_Move(GlobalContext* globalCtx, ActorPathing* actorPath) {
|
||||
Actor* thisx = actorPath->actor;
|
||||
EnOt* this = (EnOt*)thisx;
|
||||
f32 sp24 = Math_CosS(-thisx->world.rot.x) * thisx->speedXZ;
|
||||
f32 sp20 = gFramerateDivisorHalf;
|
||||
|
||||
sp24 = Math_CosS(temp_s0->actor.world.rot.x * -1) * temp_s0->actor.speedXZ;
|
||||
sp20 = gFramerateDivisorHalf;
|
||||
thisx->velocity.x = Math_SinS(thisx->world.rot.y) * sp24;
|
||||
thisx->velocity.y = Math_SinS(-thisx->world.rot.x) * thisx->speedXZ;
|
||||
thisx->velocity.z = Math_CosS(thisx->world.rot.y) * sp24;
|
||||
|
||||
temp_s0->actor.velocity.x = Math_SinS(temp_s0->actor.world.rot.y) * sp24;
|
||||
temp_s0->actor.velocity.y = Math_SinS(temp_s0->actor.world.rot.x * -1) * temp_s0->actor.speedXZ;
|
||||
do {
|
||||
temp_s0->actor.velocity.z = Math_CosS(temp_s0->actor.world.rot.y) * sp24;
|
||||
temp_s0->unk_330.x += (temp_s0->actor.velocity.x * sp20) + temp_s0->actor.colChkInfo.displacement.x;
|
||||
temp_s0->unk_330.y += (temp_s0->actor.velocity.y * sp20) + temp_s0->actor.colChkInfo.displacement.y;
|
||||
} while (0);
|
||||
temp_s0->unk_330.z += (temp_s0->actor.velocity.z * sp20) + temp_s0->actor.colChkInfo.displacement.z;
|
||||
this->unk_330.x += (thisx->velocity.x * sp20) + thisx->colChkInfo.displacement.x;
|
||||
this->unk_330.y += (thisx->velocity.y * sp20) + thisx->colChkInfo.displacement.y;
|
||||
this->unk_330.z += (thisx->velocity.z * sp20) + thisx->colChkInfo.displacement.z;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 func_80B5D470(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1) {
|
||||
s32 EnOt_ActorPathing_UpdateActorInfo(GlobalContext* globalCtx, ActorPathing* actorPath) {
|
||||
Actor* thisx = actorPath->actor;
|
||||
s32 ret = false;
|
||||
s32 pad;
|
||||
s32 ret;
|
||||
Actor* temp_s1 = arg1->actor;
|
||||
Vec3f sp50;
|
||||
Vec3f sp44;
|
||||
f32 temp;
|
||||
@@ -849,32 +845,31 @@ s32 func_80B5D470(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1) {
|
||||
s32 sp30;
|
||||
s32 sp34;
|
||||
|
||||
ret = false;
|
||||
temp_s1->gravity = 0.0f;
|
||||
Math_SmoothStepToF(&temp_s1->speedXZ, 10.0f, 0.8f, 2.0f, 0.0f);
|
||||
thisx->gravity = 0.0f;
|
||||
Math_SmoothStepToF(&thisx->speedXZ, 10.0f, 0.8f, 2.0f, 0.0f);
|
||||
|
||||
sp50.x = arg1->unk_20.x - temp_s1->world.pos.x;
|
||||
sp50.y = arg1->unk_20.y - temp_s1->world.pos.y;
|
||||
sp50.z = arg1->unk_20.z - temp_s1->world.pos.z;
|
||||
sp50.x = actorPath->curPoint.x - thisx->world.pos.x;
|
||||
sp50.y = actorPath->curPoint.y - thisx->world.pos.y;
|
||||
sp50.z = actorPath->curPoint.z - thisx->world.pos.z;
|
||||
|
||||
sp44.x = arg1->unk_20.x - arg1->unk_38.x;
|
||||
sp44.y = arg1->unk_20.y - arg1->unk_38.y;
|
||||
sp44.z = arg1->unk_20.z - arg1->unk_38.z;
|
||||
sp44.x = actorPath->curPoint.x - actorPath->prevPoint.x;
|
||||
sp44.y = actorPath->curPoint.y - actorPath->prevPoint.y;
|
||||
sp44.z = actorPath->curPoint.z - actorPath->prevPoint.z;
|
||||
|
||||
temp = Math3D_Parallel(&sp50, &sp44);
|
||||
if ((arg1->unk_4C < SQ(temp_s1->speedXZ)) || (temp <= 0.0f)) {
|
||||
if ((actorPath->distSqToCurPointXZ < SQ(thisx->speedXZ)) || (temp <= 0.0f)) {
|
||||
ret = true;
|
||||
} else {
|
||||
temp = SQ(temp_s1->speedXZ) / arg1->unk_50;
|
||||
sp34 = ABS(arg1->unk_54.x - temp_s1->world.rot.x);
|
||||
temp = SQ(thisx->speedXZ) / actorPath->distSqToCurPoint;
|
||||
sp34 = ABS(actorPath->rotToCurPoint.x - thisx->world.rot.x);
|
||||
sp2C = (s32)(sp34 * temp) + 0xAAA;
|
||||
|
||||
sp34 = ABS(arg1->unk_54.y - temp_s1->world.rot.y);
|
||||
sp34 = ABS(actorPath->rotToCurPoint.y - thisx->world.rot.y);
|
||||
|
||||
Math_SmoothStepToS(&temp_s1->world.rot.x, arg1->unk_54.x, 1, sp2C, 0);
|
||||
Math_SmoothStepToS(&thisx->world.rot.x, actorPath->rotToCurPoint.x, 1, sp2C, 0);
|
||||
sp2C = (s32)(sp34 * temp) + 0xAAA;
|
||||
Math_SmoothStepToS(&temp_s1->world.rot.y, arg1->unk_54.y, 1, sp2C, 0);
|
||||
Math_SmoothStepToS(&temp_s1->shape.rot.y, temp_s1->world.rot.y, 2, sp2C, 0);
|
||||
Math_SmoothStepToS(&thisx->world.rot.y, actorPath->rotToCurPoint.y, 1, sp2C, 0);
|
||||
Math_SmoothStepToS(&thisx->shape.rot.y, thisx->world.rot.y, 2, sp2C, 0);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -883,12 +878,12 @@ s32 func_80B5D470(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1) {
|
||||
void func_80B5D648(EnOt* this, GlobalContext* globalCtx) {
|
||||
func_80B5B2E0(globalCtx, &this->actor.world.pos, this->unk_346, &this->unk_348, &this->unk_340);
|
||||
Math_Vec3f_Copy(&this->unk_330, &this->actor.world.pos);
|
||||
func_8013DCE0(globalCtx, &this->unk_330, &this->actor, &this->unk_2C0, globalCtx->setupPathList, this->unk_346, 0,
|
||||
0, this->unk_340, 0);
|
||||
SubS_ActorPathing_Init(globalCtx, &this->unk_330, &this->actor, &this->actorPath, globalCtx->setupPathList,
|
||||
this->unk_346, 0, 0, this->unk_340, 0);
|
||||
this->unk_32C = 0;
|
||||
this->unk_2C0.unk_2C.x = 0.0f;
|
||||
this->unk_2C0.unk_2C.y = 0.0f;
|
||||
this->unk_2C0.unk_2C.z = 0.0f;
|
||||
this->actorPath.pointOffset.x = 0.0f;
|
||||
this->actorPath.pointOffset.y = 0.0f;
|
||||
this->actorPath.pointOffset.z = 0.0f;
|
||||
this->actor.gravity = 0.0f;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIdx);
|
||||
@@ -900,16 +895,18 @@ void func_80B5D648(EnOt* this, GlobalContext* globalCtx) {
|
||||
|
||||
void func_80B5D750(EnOt* this, GlobalContext* globalCtx) {
|
||||
if (!(this->unk_32C & 1) && !(this->unk_32C & 2)) {
|
||||
func_8013DE04(globalCtx, &this->unk_2C0, func_8013DF3C, func_80B5D470, func_80B5D37C, func_8013E0A4);
|
||||
SubS_ActorPathing_Update(globalCtx, &this->actorPath, SubS_ActorPathing_ComputePointInfo,
|
||||
EnOt_ActorPathing_UpdateActorInfo, EnOt_ActorPathing_Move,
|
||||
SubS_ActorPathing_SetNextPoint);
|
||||
}
|
||||
|
||||
Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_330);
|
||||
|
||||
if (this->unk_2C0.unk_1C & 0x40) {
|
||||
if (this->actorPath.flags & ACTOR_PATHING_REACHED_POINT_TEMPORARY) {
|
||||
this->unk_32C |= 2;
|
||||
}
|
||||
|
||||
if (this->unk_2C0.unk_1C & 0x80) {
|
||||
if (this->actorPath.flags & ACTOR_PATHING_REACHED_END_TEMPORARY) {
|
||||
this->unk_32C |= 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ typedef struct EnOt {
|
||||
/* 0x01D8 */ Vec3s jointTable[19];
|
||||
/* 0x024A */ Vec3s morphTable[19];
|
||||
/* 0x02BC */ s32 animIdx;
|
||||
/* 0x02C0 */ struct_8013DF3C_arg1 unk_2C0;
|
||||
/* 0x02C0 */ ActorPathing actorPath;
|
||||
/* 0x032C */ u16 unk_32C;
|
||||
/* 0x0330 */ Vec3f unk_330;
|
||||
/* 0x033C */ s32 unk_33C;
|
||||
|
||||
Reference in New Issue
Block a user