SubS models (#807)

* Bring model code over

* SubS_UpdateLimb

* SubS_TurnToPoint

* SubS_TurnToPointMultiTarget

* Adjust comment

* Another comment

* Review

* options as structs

* bss

* adj -> step, SubS_TurnToPointMultiTarget -> SubS_TurnToPointStep, various comment cleanups

* Fix SubS_TurnToPointStep header comment
This commit is contained in:
Derek Hensley 2022-05-25 18:44:09 -07:00 committed by GitHub
parent af1a4b01ef
commit a6e90d144c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 535 additions and 316 deletions

View File

@ -2424,7 +2424,7 @@ 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 SubS_InCsMode(GlobalContext* globalCtx);
s32 func_8013AD9C(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 arg5);
s32 SubS_UpdateLimb(s16 newRotZ, s16 newRotY, Vec3f* pos, Vec3s* rot, s32 stepRot, s32 overrideRot);
void SubS_UpdateFlags(u16* flags, u16 setBits, u16 unsetBits);
void func_8013AF00(f32* arg0, s32 arg1, s32 arg2);
s32 func_8013B010(f32* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, f32* arg6);
@ -2444,8 +2444,8 @@ s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRang
void SubS_FillShadowTex(s32 startCol, s32 startRow, u8* tex, s32 size);
void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween, u8 bodyPartsNum, u8 sizes[], s8 parentBodyParts[]);
void SubS_DrawShadowTex(Actor* actor, GameState* gameState, u8* tex);
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);
s16 SubS_ComputeTurnToPointRot(s16* rot, s16 rotMax, s16 target, f32 slowness, f32 stepMin, f32 stepMax);
s32 SubS_TurnToPoint(Vec3f* point, Vec3f* focusPos, Vec3s* shapeRot, Vec3s* turnTarget, Vec3s* headRot, Vec3s* torsoRot, TurnOptionsSet* options);
s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB);
Path* SubS_GetPathByIndex(GlobalContext* globalCtx, s16 pathIndex, s16 max);
s32 SubS_CopyPointFromPath(Path* path, s32 pointIndex, Vec3f* dst);
@ -2474,7 +2474,7 @@ Actor* SubS_FindActorCustom(GlobalContext* globalCtx, Actor* actor, Actor* actor
s32 func_8013E748(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exchangeItemId, void* data, func_8013E748_VerifyFunc verifyFunc);
s32 SubS_ActorAndPlayerFaceEachOther(GlobalContext* globalCtx, Actor* actor, void* data);
s32 func_8013E8F8(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exhangeItemId, s16 playerYawTol, s16 actorYawTol);
s32 func_8013E950(Vec3f* arg0, Vec3f* arg1, s16 arg2, Vec3f* arg3, Vec3f* arg4, s16* arg5, s16* arg6, s16* arg7, s16* arg8, u16 arg9, u16 arg10, u16 arg11, u16 arg12);
s32 SubS_TurnToPointStep(Vec3f* worldPos, Vec3f* focusPos, s16 shapeYRot, Vec3f* yawTarget, Vec3f* pitchTarget, s16* headZRotStep, s16* headXRotStep, s16* torsoZRotStep, s16* torsoXRotStep, u16 headZRotStepMax, u16 headXRotStepMax, u16 torsoZRotStepMax, u16 torsoXRotStepMax);
// void func_8013EC10(void);
void func_8013EC44(f32 a, u8 b, u8 c, u8 d);
void func_8013ECE0(f32 xyzDistToPlayerSq, u8 arg1, u8 arg2, u8 arg3);

View File

@ -38,6 +38,20 @@ typedef s32 (*VerifyActor)(struct GlobalContext*, Actor*, Actor*, void*);
#define ACTOR_PATHING_REACHED_END \
(ACTOR_PATHING_REACHED_END_PERMANENT | ACTOR_PATHING_REACHED_END_TEMPORARY)
typedef struct TurnOptions {
/* 0x0 */ u16 rotMax; // binary angles
/* 0x2 */ u16 slowness; // larger for slower rotation, cannot be 0
/* 0x4 */ u16 rotStepMin; // degrees
/* 0x6 */ u16 rotStepMax; // degrees
} TurnOptions; // size = 0x8
typedef struct TurnOptionsSet {
/* 0x00 */ TurnOptions headRotX;
/* 0x08 */ TurnOptions headRotY;
/* 0x10 */ TurnOptions torsoRotX;
/* 0x18 */ TurnOptions torsoRotY;
} TurnOptionsSet; // size = 0x20
struct ActorPathing;
typedef void (*ActorPathingComputeFunc)(struct GlobalContext*, struct ActorPathing*);
typedef s32 (*ActorPathingUpdateFunc)(struct GlobalContext*, struct ActorPathing*);

View File

@ -57,10 +57,10 @@ typedef struct EnHy {
/* 0x205 */ u8 isRightFootOnGround;
/* 0x206 */ Vec3s jointTable[ENHY_LIMB_MAX];
/* 0x266 */ Vec3s morphTable[ENHY_LIMB_MAX];
/* 0x2C6 */ Vec3s focusTarget;
/* 0x2C6 */ Vec3s turnTarget;
/* 0x2CC */ Vec3s headRot;
/* 0x2D2 */ Vec3s torsoRot;
/* 0x2D8 */ Vec3s tmpFocusTarget;
/* 0x2D8 */ Vec3s tmpTurnTarget;
/* 0x2DE */ Vec3s tmpHeadRot;
/* 0x2E4 */ Vec3s tmpTorsoRot;
/* 0x2EA */ s16 limbRotTableY[16];

View File

@ -1,4 +1,3 @@
#include "prevent_bss_reordering.h"
#include "global.h"
u32 sDmaMgrDmaBuffSize = 0x2000;

View File

@ -168,7 +168,47 @@ s32 SubS_InCsMode(GlobalContext* globalCtx) {
return inCsMode;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013AD9C.s")
/**
* Computes a limb's position and rotation for use in TransformLimbDraws
*
* @param[in] newRotZ value to override newRot's Z value if override is true
* @param[in] newRotY value to override newRot's Y value if override is true
* @param[out] pos limb's computed position
* @param[out] rot limb's computed rotation
* @param[in] stepRot boolean, step towards newRot instead of setting directly
* @param[in] overrideRot boolean, override newRot with the specified input.
*
* Note:
* If overrideRot is true, the rotation will automatically step instead of setting directly
*/
s32 SubS_UpdateLimb(s16 newRotZ, s16 newRotY, Vec3f* pos, Vec3s* rot, s32 stepRot, s32 overrideRot) {
Vec3f newPos;
Vec3f zeroVec = gZeroVec3f;
Vec3s newRot;
MtxF curState;
Matrix_MultiplyVector3fByState(&zeroVec, &newPos);
Matrix_CopyCurrentState(&curState);
func_8018219C(&curState, &newRot, MTXMODE_NEW);
*pos = newPos;
if (!stepRot && !overrideRot) {
rot->x = newRot.x;
rot->y = newRot.y;
rot->z = newRot.z;
return true;
}
if (overrideRot) {
newRot.z = newRotZ;
newRot.y = newRotY;
}
Math_SmoothStepToS(&rot->x, newRot.x, 3, 0x2AA8, 0xB6);
Math_SmoothStepToS(&rot->y, newRot.y, 3, 0x2AA8, 0xB6);
Math_SmoothStepToS(&rot->z, newRot.z, 3, 0x2AA8, 0xB6);
return true;
}
void SubS_UpdateFlags(u16* flags, u16 setBits, u16 unsetBits) {
*flags = (*flags & ~unsetBits) | setBits;
@ -525,9 +565,93 @@ void SubS_DrawShadowTex(Actor* actor, GameState* gameState, u8* tex) {
CLOSE_DISPS(gfxCtx);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D0E0.s")
/**
* Computes the rotation based on the options and target rotation value
*
* @param[in,out] rot the computed rotation
* @param[in] rotMax the max rotation in binary angles
* @param[in] target the target rotation value
* @param[in] slowness how slow to rotate, the larger the number the slower the rotation, cannot be 0
* @param[in] stepMin the minimun step in degrees
* @param[in] stepMax the maximum step in degrees
*/
s16 SubS_ComputeTurnToPointRot(s16* rot, s16 rotMax, s16 target, f32 slowness, f32 stepMin, f32 stepMax) {
s16 prevRot = *rot;
f32 step;
f32 prevRotStep;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D2E0.s")
step = (f32)(target - *rot) * (360.0f / (f32)0x10000);
step *= gFramerateDivisorHalf;
prevRotStep = step;
if (step >= 0.0f) {
step /= slowness;
step = CLAMP(step, stepMin, stepMax);
*rot += (s16)((step * (f32)0x10000) / 360.0f);
if (prevRotStep < stepMin) {
*rot = target;
}
if (rotMax != 0) {
*rot = CLAMP(*rot, -rotMax, rotMax);
}
} else {
step = (step / slowness) * -1.0f;
step = CLAMP(step, stepMin, stepMax);
*rot -= (s16)((step * (f32)0x10000) / 360.0f);
if (-stepMin < prevRotStep) {
*rot = target;
}
if (rotMax != 0) {
*rot = CLAMP(*rot, -rotMax, rotMax);
}
}
return prevRot - *rot;
}
/**
* Computes the necessary HeadRot and TorsoRot to smoothly turn an actors's head and torso to a point
*
* @param[in] point the point to turn to
* @param[in] focusPos the actor's focus postion
* @param[in] shapeRot the actor's shape rotation
* @param[in,out] turnTarget the intermediate target step that headRot and torsoRot step towards
* @param[in,out] headRot the computed head rotation
* @param[in,out] torsoRot the computed torso rotation
* @param[in] options various options to adjust how the actor turns, see `SubS_ComputeTurnToPointRot and
* TurnOptions/TurnOptionsSet`
*
*/
s32 SubS_TurnToPoint(Vec3f* point, Vec3f* focusPos, Vec3s* shapeRot, Vec3s* turnTarget, Vec3s* headRot, Vec3s* torsoRot,
TurnOptionsSet* options) {
s16 pitch;
s16 yaw;
s16 pad;
s16 targetY;
f32 diffX = point->x - focusPos->x;
s16 targetX;
f32 diffZ = point->z - focusPos->z;
yaw = Math_FAtan2F(diffZ, diffX);
pitch = Math_FAtan2F(sqrtf(SQ(diffX) + SQ(diffZ)), point->y - focusPos->y);
Math_SmoothStepToS(&turnTarget->x, pitch, 4, 0x2710, 0);
Math_SmoothStepToS(&turnTarget->y, yaw, 4, 0x2710, 0);
targetX =
SubS_ComputeTurnToPointRot(&headRot->x, options->headRotX.rotMax, turnTarget->x, options->headRotX.slowness,
options->headRotX.rotStepMin, options->headRotX.rotStepMax);
//! @bug: torsoRotX uses headRotX slowness
SubS_ComputeTurnToPointRot(&torsoRot->x, options->torsoRotX.rotMax, targetX, options->headRotX.slowness,
options->torsoRotX.rotStepMin, options->torsoRotX.rotStepMax);
targetY = turnTarget->y - shapeRot->y;
SubS_ComputeTurnToPointRot(&headRot->y, options->headRotY.rotMax, targetY - torsoRot->y, options->headRotY.slowness,
options->headRotY.rotStepMin, options->headRotY.rotStepMax);
SubS_ComputeTurnToPointRot(&torsoRot->y, options->torsoRotY.rotMax, targetY - headRot->y,
options->torsoRotY.slowness, options->torsoRotY.rotStepMin,
options->torsoRotY.rotStepMax);
return true;
}
s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB) {
return (ABS_ALT(BINANG_SUB(angleB, angleA)) <= threshold) ? true : false;
@ -987,4 +1111,51 @@ s32 func_8013E8F8(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRang
return func_8013E748(actor, globalCtx, xzRange, yRange, exhangeItemId, &yawTols, SubS_ActorAndPlayerFaceEachOther);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E950.s")
/**
* Computes the necessary HeadRot and TorsoRot steps to be added to the normal rotation to smoothly turn an actors's
* head and torso to a point
*
* @param[in] worldPos the actor's world position
* @param[in] focusPos the actor's focus position
* @param[in] shapeYRot the actor's shape's Y rotation
* @param[in] yawTarget the target point to determine desired yaw
* @param[in] pitchTarget the target point to determine desired pitch
* @param[in,out] headZRotStep the computed actors' head's Z rotation step
* @param[in,out] headXRotStep the computed actors' head's X rotation step
* @param[in,out] torsoZRotStep the computed actors' torso's Z rotation step
* @param[in,out] torsoXRotStep the computed actors' torso's X rotation step
* @param[in] headZRotStepMax the max head's Z rotation step
* @param[in] headXRotStepMax the max head's X rotation step
* @param[in] torsoZRotStepMax the max torso's Z rotation step
* @param[in] torsoXRotStepMax the max torso's X rotation step
*/
s32 SubS_TurnToPointStep(Vec3f* worldPos, Vec3f* focusPos, s16 shapeYRot, Vec3f* yawTarget, Vec3f* pitchTarget,
s16* headZRotStep, s16* headXRotStep, s16* torsoZRotStep, s16* torsoXRotStep,
u16 headZRotStepMax, u16 headXRotStepMax, u16 torsoZRotStepMax, u16 torsoXRotStepMax) {
s16 yaw = Math_Vec3f_Yaw(worldPos, yawTarget) - shapeYRot;
s16 pad;
s16 pad2;
s16 pitch = Math_Vec3f_Pitch(focusPos, pitchTarget);
if (BINANG_ADD(headXRotStepMax, torsoXRotStepMax) >= (s16)ABS(yaw)) {
Math_ApproachS(headXRotStep, yaw - *torsoXRotStep, 4, 0x2AA8);
*headXRotStep = CLAMP(*headXRotStep, -headXRotStepMax, headXRotStepMax);
Math_ApproachS(torsoXRotStep, yaw - *headXRotStep, 4, 0x2AA8);
*torsoXRotStep = CLAMP(*torsoXRotStep, -torsoXRotStepMax, torsoXRotStepMax);
} else {
Math_ApproachS(headXRotStep, 0, 4, 0x2AA8);
Math_ApproachS(torsoXRotStep, 0, 4, 0x2AA8);
}
if (BINANG_ADD(headZRotStepMax, torsoZRotStepMax) >= (s16)ABS(pitch)) {
Math_ApproachS(headZRotStep, pitch - *torsoZRotStep, 4, 0x2AA8);
*headZRotStep = CLAMP(*headZRotStep, -headZRotStepMax, headZRotStepMax);
Math_ApproachS(torsoZRotStep, pitch - *headZRotStep, 4, 0x2AA8);
*torsoZRotStep = CLAMP(*torsoZRotStep, -torsoZRotStepMax, torsoZRotStepMax);
} else {
Math_ApproachS(headZRotStep, 0, 4, 0x2AA8);
Math_ApproachS(torsoZRotStep, 0, 4, 0x2AA8);
}
return true;
}

View File

@ -301,25 +301,25 @@ void func_80C1CD80(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
void func_80C1CEFC(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
DmAn* this = THIS;
s16 phi_v1;
s16 phi_v0;
s16 stepRot;
s16 overrideRot;
if (!(this->unk_2AE & 1)) {
if (this->unk_2AE & 2) {
phi_v0 = 1;
overrideRot = true;
} else {
phi_v0 = 0;
overrideRot = false;
}
phi_v1 = 1;
stepRot = true;
} else {
phi_v1 = 0;
phi_v0 = 0;
stepRot = false;
overrideRot = false;
}
if (limbIndex == OBJECT_AN1_LIMB_09) {
func_8013AD9C(this->unk_2BE + this->unk_2C2 + 0x4000,
this->unk_2C0 + this->unk_2C4 + this->actor.shape.rot.y + 0x4000, &this->unk_18C, &this->unk_1A4,
phi_v1, phi_v0);
SubS_UpdateLimb(this->unk_2BE + this->unk_2C2 + 0x4000,
this->unk_2C0 + this->unk_2C4 + this->actor.shape.rot.y + 0x4000, &this->unk_18C,
&this->unk_1A4, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_18C.x, this->unk_18C.y, this->unk_18C.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
@ -328,8 +328,8 @@ void func_80C1CEFC(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
Matrix_InsertZRotation_s(this->unk_1A4.z, MTXMODE_APPLY);
Matrix_StatePush();
} else if (limbIndex == OBJECT_AN1_LIMB_02) {
func_8013AD9C(this->unk_2C2 + 0x4000, this->unk_2C4 + this->actor.shape.rot.y + 0x4000, &this->unk_194,
&this->unk_1AA, phi_v1, phi_v0);
SubS_UpdateLimb(this->unk_2C2 + 0x4000, this->unk_2C4 + this->actor.shape.rot.y + 0x4000, &this->unk_194,
&this->unk_1AA, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_194.x, this->unk_194.y, this->unk_194.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
@ -342,13 +342,13 @@ void func_80C1CEFC(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
TexturePtr D_80C1D2E8[] = {
object_an1_Tex_00E6E0,
&object_an1_Tex_00F7A0,
&object_an1_Tex_0101A0,
object_an1_Tex_00F7A0,
object_an1_Tex_0101A0,
};
TexturePtr D_80C1D2F4[] = {
&object_an1_Tex_00E1E0, &object_an1_Tex_00EFA0, &object_an1_Tex_00F3A0, &object_an1_Tex_00EFA0,
&object_an1_Tex_00FDA0, &object_an1_Tex_00F9A0, &object_an1_Tex_0103A0,
object_an1_Tex_00E1E0, object_an1_Tex_00EFA0, object_an1_Tex_00F3A0, object_an1_Tex_00EFA0,
object_an1_Tex_00FDA0, object_an1_Tex_00F9A0, object_an1_Tex_0103A0,
};
void func_80C1D0B0(Actor* thisx, GlobalContext* globalCtx) {

View File

@ -301,25 +301,25 @@ void DmGm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
void DmGm_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
DmGm* this = THIS;
s16 phi_v1;
s16 phi_v0;
s16 stepRot;
s16 overrideRot;
if (!(this->unk_2AE & 1)) {
if (this->unk_2AE & 2) {
phi_v0 = 1;
overrideRot = true;
} else {
phi_v0 = 0;
overrideRot = false;
}
phi_v1 = 1;
stepRot = true;
} else {
phi_v1 = 0;
phi_v0 = 0;
stepRot = false;
overrideRot = false;
}
if (limbIndex == OBJECT_AN1_LIMB_09) {
func_8013AD9C(this->unk_2BE + this->unk_2C2 + 0x4000,
this->unk_2C0 + this->unk_2C4 + this->actor.shape.rot.y + 0x4000, &this->unk_18C, &this->unk_1A4,
phi_v1, phi_v0);
SubS_UpdateLimb(this->unk_2BE + this->unk_2C2 + 0x4000,
this->unk_2C0 + this->unk_2C4 + this->actor.shape.rot.y + 0x4000, &this->unk_18C,
&this->unk_1A4, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_18C.x, this->unk_18C.y, this->unk_18C.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
@ -328,8 +328,8 @@ void DmGm_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* this
Matrix_InsertZRotation_s(this->unk_1A4.z, MTXMODE_APPLY);
Matrix_StatePush();
} else if (limbIndex == OBJECT_AN1_LIMB_02) {
func_8013AD9C(this->unk_2C2 + 0x4000, this->unk_2C4 + this->actor.shape.rot.y + 0x4000, &this->unk_194,
&this->unk_1AA, phi_v1, phi_v0);
SubS_UpdateLimb(this->unk_2C2 + 0x4000, this->unk_2C4 + this->actor.shape.rot.y + 0x4000, &this->unk_194,
&this->unk_1AA, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_194.x, this->unk_194.y, this->unk_194.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);

View File

@ -564,7 +564,7 @@ void EnAh_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
void func_80BD3AA8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
void EnAh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
EnAh* this = THIS;
if (limbIndex == 7) {
@ -573,27 +573,27 @@ void func_80BD3AA8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
}
}
void func_80BD3AF8(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
void EnAh_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
EnAh* this = THIS;
s32 phi_v1;
s32 phi_v0;
s32 stepRot;
s32 overrideRot;
if (!(this->unk_2D8 & 0x80)) {
if (this->unk_2D8 & 0x20) {
phi_v0 = 1;
overrideRot = true;
} else {
phi_v0 = 0;
overrideRot = false;
}
phi_v1 = 1;
stepRot = true;
} else {
phi_v1 = 0;
phi_v0 = 0;
stepRot = false;
overrideRot = false;
}
if (limbIndex == 7) {
func_8013AD9C(BINANG_ADD(this->unk_2EC + this->unk_2F0, 0x4000),
BINANG_ADD(this->unk_2EE + this->unk_2F2 + this->actor.shape.rot.y, 0x4000), this->unk_1E8,
this->unk_200, phi_v1, phi_v0);
SubS_UpdateLimb(BINANG_ADD(this->unk_2EC + this->unk_2F0, 0x4000),
BINANG_ADD(this->unk_2EE + this->unk_2F2 + this->actor.shape.rot.y, 0x4000), this->unk_1E8,
this->unk_200, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_1E8[0].x, this->unk_1E8[0].y, this->unk_1E8[0].z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
@ -602,8 +602,8 @@ void func_80BD3AF8(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
Matrix_InsertZRotation_s(this->unk_200[0].z, MTXMODE_APPLY);
Matrix_StatePush();
} else if (limbIndex == 2) {
func_8013AD9C(BINANG_ADD(this->unk_2F0, 0x4000), BINANG_ADD(this->unk_2F2 + this->actor.shape.rot.y, 0x4000),
&this->unk_1E8[1], &this->unk_200[1], phi_v1, phi_v0);
SubS_UpdateLimb(BINANG_ADD(this->unk_2F0, 0x4000), BINANG_ADD(this->unk_2F2 + this->actor.shape.rot.y, 0x4000),
&this->unk_1E8[1], &this->unk_200[1], stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_1E8[1].x, this->unk_1E8[1].y, this->unk_1E8[1].z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
@ -626,7 +626,8 @@ void EnAh_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80BD3F0C[this->unk_2FC]));
SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
this->skelAnime.dListCount, NULL, func_80BD3AA8, func_80BD3AF8, &this->actor);
this->skelAnime.dListCount, NULL, EnAh_PostLimbDraw, EnAh_TransformLimbDraw,
&this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -871,24 +871,24 @@ void EnAl_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
void EnAl_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
EnAl* this = THIS;
s32 phi_v0;
s32 phi_v1;
s32 stepRot;
s32 overrideRot;
if (!(this->unk_4C2 & 0x200)) {
if (this->unk_4C2 & 0x80) {
phi_v1 = 1;
overrideRot = true;
} else {
phi_v1 = 0;
overrideRot = false;
}
phi_v0 = 1;
stepRot = true;
} else {
phi_v1 = 0;
phi_v0 = 0;
overrideRot = false;
stepRot = false;
}
if (limbIndex == 16) {
func_8013AD9C(this->unk_4DC + 0x4000, this->unk_4DE + this->actor.shape.rot.y + 0x4000, &this->unk_36C,
&this->unk_378, phi_v0, phi_v1);
SubS_UpdateLimb(this->unk_4DC + 0x4000, this->unk_4DE + this->actor.shape.rot.y + 0x4000, &this->unk_36C,
&this->unk_378, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_36C.x, this->unk_36C.y, this->unk_36C.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);

View File

@ -462,24 +462,29 @@ void func_809C1D64(EnAob01* this, GlobalContext* globalCtx) {
}
void func_809C1EC8(EnAob01* this, GlobalContext* globalCtx) {
static u16 D_809C392C[] = { 4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6 };
static TurnOptionsSet sTurnOptions = {
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
};
Player* player = GET_PLAYER(globalCtx);
Vec3f sp30;
Vec3f point;
SkelAnime_Update(&this->skelAnime);
if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer)) {
sp30.x = player->actor.world.pos.x;
sp30.y = player->bodyPartsPos[7].y + 3.0f;
sp30.z = player->actor.world.pos.z;
func_8013D2E0(&sp30, &this->actor.focus.pos, &this->actor.shape.rot, &this->unk_2D4, &this->unk_2DA,
&this->unk_2E0, D_809C392C);
point.x = player->actor.world.pos.x;
point.y = player->bodyPartsPos[7].y + 3.0f;
point.z = player->actor.world.pos.z;
SubS_TurnToPoint(&point, &this->actor.focus.pos, &this->actor.shape.rot, &this->turnTarget, &this->headRot,
&this->torsoRot, &sTurnOptions);
} else {
Math_SmoothStepToS(&this->unk_2D4.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk_2D4.y, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk_2DA.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk_2DA.y, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk_2E0.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk_2E0.y, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->turnTarget.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->turnTarget.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->headRot.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->headRot.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->torsoRot.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1);
}
func_809C10B0(this, 3);
SubS_FillLimbRotTables(globalCtx, this->unk_2F8, this->unk_318, ARRAY_COUNT(this->unk_2F8));
@ -500,9 +505,9 @@ void func_809C2060(EnAob01* this, GlobalContext* globalCtx) {
}
} else if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) && (this->unk_2D2 & 0x100)) {
this->unk_2D2 &= ~0x100;
this->unk_2E6 = this->unk_2D4;
this->unk_2EC = this->unk_2DA;
this->unk_2F2 = this->unk_2E0;
this->unk_2E6 = this->turnTarget;
this->unk_2EC = this->headRot;
this->unk_2F2 = this->torsoRot;
func_809C16DC(this, globalCtx);
this->actionFunc = func_809C21E0;
} else {
@ -751,9 +756,9 @@ void func_809C2A64(EnAob01* this, GlobalContext* globalCtx) {
}
if (Actor_HasParent(&this->actor, globalCtx)) {
this->unk_2D4 = this->unk_2E6;
this->unk_2DA = this->unk_2EC;
this->unk_2E0 = this->unk_2F2;
this->turnTarget = this->unk_2E6;
this->headRot = this->unk_2EC;
this->torsoRot = this->unk_2F2;
this->actor.parent = NULL;
this->actor.shape.rot.y = this->actor.world.rot.y;
if (gSaveContext.save.weekEventReg[8] & 0x20) {
@ -822,9 +827,9 @@ void func_809C2D0C(EnAob01* this, GlobalContext* globalCtx) {
Message_StartTextbox(globalCtx, this->unk_210, &this->actor);
this->actionFunc = func_809C2A64;
} else {
this->unk_2D4 = this->unk_2E6;
this->unk_2DA = this->unk_2EC;
this->unk_2E0 = this->unk_2F2;
this->turnTarget = this->unk_2E6;
this->headRot = this->unk_2EC;
this->torsoRot = this->unk_2F2;
this->unk_434 = 0;
this->actor.shape.rot.y = this->actor.world.rot.y;
@ -995,14 +1000,14 @@ s32 EnAob01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis
if (limbIndex == MAMAMU_YAN_LIMB_HEAD) {
Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_InsertXRotation_s(this->unk_2DA.y, MTXMODE_APPLY);
Matrix_InsertZRotation_s(this->unk_2DA.x * -1, MTXMODE_APPLY);
Matrix_InsertXRotation_s(this->headRot.y, MTXMODE_APPLY);
Matrix_InsertZRotation_s(this->headRot.x * -1, MTXMODE_APPLY);
Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == MAMAMU_YAN_LIMB_TORSO) {
Matrix_InsertXRotation_s(this->unk_2E0.y * -1, MTXMODE_APPLY);
Matrix_InsertZRotation_s(this->unk_2E0.x * -1, MTXMODE_APPLY);
Matrix_InsertXRotation_s(this->torsoRot.y * -1, MTXMODE_APPLY);
Matrix_InsertZRotation_s(this->torsoRot.x * -1, MTXMODE_APPLY);
}
if ((limbIndex == MAMAMU_YAN_LIMB_TORSO) || (limbIndex == MAMAMU_YAN_LIMB_LEFT_UPPER_ARM) ||

View File

@ -21,9 +21,9 @@ typedef struct EnAob01 {
/* 0x212 */ Vec3s jointTable[MAMAMU_YAN_LIMB_MAX];
/* 0x272 */ Vec3s morphTable[MAMAMU_YAN_LIMB_MAX];
/* 0x2D2 */ u16 unk_2D2;
/* 0x2D4 */ Vec3s unk_2D4;
/* 0x2DA */ Vec3s unk_2DA;
/* 0x2E0 */ Vec3s unk_2E0;
/* 0x2D4 */ Vec3s turnTarget;
/* 0x2DA */ Vec3s headRot;
/* 0x2E0 */ Vec3s torsoRot;
/* 0x2E6 */ Vec3s unk_2E6;
/* 0x2EC */ Vec3s unk_2EC;
/* 0x2F2 */ Vec3s unk_2F2;

View File

@ -121,7 +121,12 @@ static u8 D_80BAA488[] = {
s32 D_80BAA4A8[] = { -1, -1, 0 };
u16 D_80BAA4B4[] = { 4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6 };
static TurnOptionsSet sTurnOptions = {
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
};
s32 func_80BA8820(EnBaba* this, GlobalContext* globalCtx) {
this->unk_144 = (EnOssan*)SubS_FindActor(globalCtx, &this->unk_144->actor, ACTORCAT_NPC, ACTOR_EN_OSSAN);
@ -285,25 +290,25 @@ s32 func_80BA8D2C(EnBaba* this, f32 arg1) {
void func_80BA8DF4(EnBaba* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
Vec3f sp30;
Vec3f point;
SkelAnime_Update(&this->skelAnime);
if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer) &&
!(this->unk_40A & 4)) {
sp30.x = player->actor.world.pos.x;
sp30.y = player->bodyPartsPos[7].y + 3.0f;
sp30.z = player->actor.world.pos.z;
point.x = player->actor.world.pos.x;
point.y = player->bodyPartsPos[7].y + 3.0f;
point.z = player->actor.world.pos.z;
func_8013D2E0(&sp30, &this->actor.focus.pos, &this->actor.shape.rot, &this->unk_2DE, &this->unk_2E4,
&this->unk_2EA, D_80BAA4B4);
SubS_TurnToPoint(&point, &this->actor.focus.pos, &this->actor.shape.rot, &this->turnTarget, &this->headRot,
&this->torsoRot, &sTurnOptions);
} else {
Math_SmoothStepToS(&this->unk_2DE.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk_2DE.y, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk_2E4.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk_2E4.y, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk_2EA.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk_2EA.y, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->turnTarget.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->turnTarget.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->headRot.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->headRot.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->torsoRot.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1);
}
SubS_FillLimbRotTables(globalCtx, this->unk_302, this->unk_326, ARRAY_COUNT(this->unk_302));
@ -696,14 +701,14 @@ s32 EnBaba_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList
if (limbIndex == 6) {
Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_InsertXRotation_s(this->unk_2E4.y, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->unk_2E4.x, MTXMODE_APPLY);
Matrix_InsertXRotation_s(this->headRot.y, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->headRot.x, MTXMODE_APPLY);
Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == 5) {
Matrix_InsertXRotation_s(-this->unk_2EA.y, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->unk_2EA.x, MTXMODE_APPLY);
Matrix_InsertXRotation_s(-this->torsoRot.y, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->torsoRot.x, MTXMODE_APPLY);
}
if ((limbIndex == 6) && (this->unk_1E2 != 0) && ((globalCtx->state.frames % 2) == 0)) {

View File

@ -32,9 +32,9 @@ typedef struct EnBaba {
/* 0x01EA */ UNK_TYPE1 unk1EA[0x1C];
/* 0x0206 */ Vec3s jointTable[18];
/* 0x0272 */ Vec3s morphTable[18];
/* 0x02DE */ Vec3s unk_2DE;
/* 0x02E4 */ Vec3s unk_2E4;
/* 0x02EA */ Vec3s unk_2EA;
/* 0x02DE */ Vec3s turnTarget;
/* 0x02E4 */ Vec3s headRot;
/* 0x02EA */ Vec3s torsoRot;
/* 0x02F0 */ UNK_TYPE1 unk2F0[0x12];
/* 0x0302 */ s16 unk_302[18];
/* 0x0326 */ s16 unk_326[18];

View File

@ -97,22 +97,27 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(0, 0),
};
u16 D_809CCCD8[] = { 4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6 };
static TurnOptionsSet sTurnOptions = {
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
};
void EnBba01_UpdateModel(EnBba01* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
Vec3f focus;
Vec3f point;
EnHy_UpdateSkelAnime(&this->enHy, globalCtx);
if (SubS_AngleDiffLessEqual(this->enHy.actor.shape.rot.y, 0x36B0, this->enHy.actor.yawTowardsPlayer)) {
focus.x = player->actor.world.pos.x;
focus.y = player->bodyPartsPos[7].y + 3.0f;
focus.z = player->actor.world.pos.z;
func_8013D2E0(&focus, &this->enHy.actor.focus.pos, &this->enHy.actor.shape.rot, &this->enHy.focusTarget,
&this->enHy.headRot, &this->enHy.torsoRot, D_809CCCD8);
point.x = player->actor.world.pos.x;
point.y = player->bodyPartsPos[7].y + 3.0f;
point.z = player->actor.world.pos.z;
SubS_TurnToPoint(&point, &this->enHy.actor.focus.pos, &this->enHy.actor.shape.rot, &this->enHy.turnTarget,
&this->enHy.headRot, &this->enHy.torsoRot, &sTurnOptions);
} else {
Math_SmoothStepToS(&this->enHy.focusTarget.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.focusTarget.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.turnTarget.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.turnTarget.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.headRot.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.headRot.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.torsoRot.x, 0, 4, 0x3E8, 1);
@ -129,7 +134,7 @@ s32 EnBba01_TestIsTalking(EnBba01* this, GlobalContext* globalCtx) {
if (Actor_ProcessTalkRequest(&this->enHy.actor, &globalCtx->state)) {
isTalking = true;
this->enHy.textId = 0x10B9; // Invalid textId, produces empty textbox
this->enHy.tmpFocusTarget = this->enHy.focusTarget;
this->enHy.tmpTurnTarget = this->enHy.turnTarget;
this->enHy.tmpHeadRot = this->enHy.headRot;
this->enHy.tmpTorsoRot = this->enHy.torsoRot;
this->enHy.tmpActionFunc = this->enHy.actionFunc;
@ -192,7 +197,7 @@ void EnBba01_Talk(EnHy* this, GlobalContext* globalCtx) {
break;
case 2:
this->actor.textId = 0;
this->focusTarget = this->tmpFocusTarget;
this->turnTarget = this->tmpTurnTarget;
this->headRot = this->tmpHeadRot;
this->torsoRot = this->tmpTorsoRot;
this->actor.shape.rot.y = this->actor.world.rot.y;

View File

@ -73,14 +73,14 @@ static AnimationSpeedInfo D_809CDC7C[] = {
void func_809CCDE0(EnBji01* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
Vec3f sp58;
Vec3f pitchTarget;
s32 pad[2];
Math_Vec3f_Copy(&sp58, &player->actor.world.pos);
sp58.y = player->bodyPartsPos[7].y + 3.0f;
func_8013E950(&this->actor.world.pos, &this->actor.focus.pos, this->actor.shape.rot.y, &player->actor.world.pos,
&sp58, &this->headZRotAdj, &this->headXRotAdj, &this->torsoZRotAdj, &this->torsoXRotAdj, 0x1554,
0x1FFE, 0xE38, 0x1C70);
Math_Vec3f_Copy(&pitchTarget, &player->actor.world.pos);
pitchTarget.y = player->bodyPartsPos[7].y + 3.0f;
SubS_TurnToPointStep(&this->actor.world.pos, &this->actor.focus.pos, this->actor.shape.rot.y,
&player->actor.world.pos, &pitchTarget, &this->headZRotStep, &this->headXRotStep,
&this->torsoZRotStep, &this->torsoXRotStep, 0x1554, 0x1FFE, 0xE38, 0x1C70);
}
void func_809CCE98(EnBji01* this, GlobalContext* globalCtx) {
@ -406,12 +406,12 @@ s32 EnBji01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis
}
switch (limbIndex) {
case BJI_LIMB_TORSO:
rot->x += this->torsoXRotAdj;
rot->z += this->torsoZRotAdj;
rot->x += this->torsoXRotStep;
rot->z += this->torsoZRotStep;
break;
case BJI_LIMB_HEAD:
rot->x += this->headXRotAdj;
rot->z += this->headZRotAdj;
rot->x += this->headXRotStep;
rot->z += this->headZRotStep;
break;
}
return false;

View File

@ -45,10 +45,10 @@ typedef struct EnBji01 {
/* 0x29C */ s16 eyeTexIndex;
/* 0x29E */ s16 blinkSeqIndex;
/* 0x2A0 */ s16 blinkTimer;
/* 0x2A2 */ s16 torsoZRotAdj;
/* 0x2A4 */ s16 torsoXRotAdj;
/* 0x2A6 */ s16 headZRotAdj;
/* 0x2A8 */ s16 headXRotAdj;
/* 0x2A2 */ s16 torsoZRotStep;
/* 0x2A4 */ s16 torsoXRotStep;
/* 0x2A6 */ s16 headZRotStep;
/* 0x2A8 */ s16 headXRotStep;
/* 0x2AA */ u16 textId;
/* 0x2AC */ s16 cutscenes[1];
/* 0x2B0 */ ObjMoonStone* moonsTear;

View File

@ -89,22 +89,27 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(0, 0),
};
u16 D_809CBF58[] = { 4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6 };
static TurnOptionsSet sTurnOptions = {
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
};
void EnCne01_UpdateModel(EnCne01* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
Vec3f focus;
Vec3f point;
EnHy_UpdateSkelAnime(&this->enHy, globalCtx);
if (SubS_AngleDiffLessEqual(this->enHy.actor.shape.rot.y, 0x36B0, this->enHy.actor.yawTowardsPlayer)) {
focus.x = player->actor.world.pos.x;
focus.y = player->bodyPartsPos[7].y + 3.0f;
focus.z = player->actor.world.pos.z;
func_8013D2E0(&focus, &this->enHy.actor.focus.pos, &this->enHy.actor.shape.rot, &this->enHy.focusTarget,
&this->enHy.headRot, &this->enHy.torsoRot, D_809CBF58);
point.x = player->actor.world.pos.x;
point.y = player->bodyPartsPos[7].y + 3.0f;
point.z = player->actor.world.pos.z;
SubS_TurnToPoint(&point, &this->enHy.actor.focus.pos, &this->enHy.actor.shape.rot, &this->enHy.turnTarget,
&this->enHy.headRot, &this->enHy.torsoRot, &sTurnOptions);
} else {
Math_SmoothStepToS(&this->enHy.focusTarget.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.focusTarget.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.turnTarget.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.turnTarget.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.headRot.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.headRot.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.torsoRot.x, 0, 4, 0x3E8, 1);
@ -121,7 +126,7 @@ s32 EnCne01_TestIsTalking(EnCne01* this, GlobalContext* globalCtx) {
if (Actor_ProcessTalkRequest(&this->enHy.actor, &globalCtx->state)) {
isTalking = true;
this->enHy.textId = 0x10B9; // Invalid textId, produces empty textbox
this->enHy.tmpFocusTarget = this->enHy.focusTarget;
this->enHy.tmpTurnTarget = this->enHy.turnTarget;
this->enHy.tmpHeadRot = this->enHy.headRot;
this->enHy.tmpTorsoRot = this->enHy.torsoRot;
this->enHy.tmpActionFunc = this->enHy.actionFunc;
@ -182,7 +187,7 @@ void EnCne01_Talk(EnHy* this, GlobalContext* globalCtx) {
break;
case 2:
this->actor.textId = 0;
this->focusTarget = this->tmpFocusTarget;
this->turnTarget = this->tmpTurnTarget;
this->headRot = this->tmpHeadRot;
this->torsoRot = this->tmpTorsoRot;
this->actor.shape.rot.y = this->actor.world.rot.y;

View File

@ -1779,25 +1779,25 @@ void EnGm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
void EnGm_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
EnGm* this = THIS;
s32 phi_v0 = 1;
s32 phi_v1 = 0;
s32 overrideRot = true;
s32 stepRot = false;
if (!(this->unk_3A4 & 0x200)) {
if (this->unk_3A4 & 0x80) {
phi_v0 = 1;
phi_v1 = 1;
overrideRot = true;
stepRot = true;
} else {
phi_v0 = 0;
phi_v1 = 1;
overrideRot = false;
stepRot = true;
}
} else {
phi_v0 = 0;
overrideRot = false;
}
if (limbIndex == 16) {
func_8013AD9C(BINANG_ADD(this->unk_3BC + this->unk_3C0, 0x4000),
BINANG_ADD(this->unk_3BE + this->unk_3C2 + this->actor.shape.rot.y, 0x4000), &this->unk_290,
&this->unk_2A8, phi_v1, phi_v0);
SubS_UpdateLimb(BINANG_ADD(this->unk_3BC + this->unk_3C0, 0x4000),
BINANG_ADD(this->unk_3BE + this->unk_3C2 + this->actor.shape.rot.y, 0x4000), &this->unk_290,
&this->unk_2A8, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_290.x, this->unk_290.y, this->unk_290.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
@ -1806,8 +1806,8 @@ void EnGm_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* this
Matrix_InsertZRotation_s(this->unk_2A8.z, MTXMODE_APPLY);
Matrix_StatePush();
} else if (limbIndex == 9) {
func_8013AD9C(BINANG_ADD(this->unk_3C0, 0x4000), BINANG_ADD(this->unk_3C2 + this->actor.shape.rot.y, 0x4000),
&this->unk_29C, &this->unk_2AE, phi_v1, phi_v0);
SubS_UpdateLimb(BINANG_ADD(this->unk_3C0, 0x4000), BINANG_ADD(this->unk_3C2 + this->actor.shape.rot.y, 0x4000),
&this->unk_29C, &this->unk_2AE, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_29C.x, this->unk_29C.y, this->unk_29C.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);

View File

@ -2011,30 +2011,30 @@ s32 EnGo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
void EnGo_TransfromLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
EnGo* this = THIS;
u16 temp_v0;
s32 phi_v1;
s32 phi_v0;
s32 stepRot;
s32 overrideRot;
if (this->unk_390 & 0x40) {
phi_v1 = false;
stepRot = false;
} else {
phi_v1 = true;
stepRot = true;
}
if (this->unk_390 & 0x10) {
phi_v0 = true;
overrideRot = true;
} else {
phi_v0 = false;
overrideRot = false;
}
if (!phi_v1) {
phi_v0 = false;
if (!stepRot) {
overrideRot = false;
}
switch (limbIndex) {
case 17:
func_8013AD9C(this->unk_3B0 + this->unk_3B4 + 0x4000,
this->unk_3B2 + this->unk_3B6 + this->actor.shape.rot.y + 0x4000, &this->unk_290,
&this->unk_2A8, phi_v1, phi_v0);
SubS_UpdateLimb(this->unk_3B0 + this->unk_3B4 + 0x4000,
this->unk_3B2 + this->unk_3B6 + this->actor.shape.rot.y + 0x4000, &this->unk_290,
&this->unk_2A8, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_290.x, this->unk_290.y, this->unk_290.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
@ -2045,8 +2045,8 @@ void EnGo_TransfromLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* this
break;
case 10:
func_8013AD9C(this->unk_3B4 + 0x4000, this->unk_3B6 + this->actor.shape.rot.y + 0x4000, &this->unk_29C,
&this->unk_2AE, phi_v1, phi_v0);
SubS_UpdateLimb(this->unk_3B4 + 0x4000, this->unk_3B6 + this->actor.shape.rot.y + 0x4000, &this->unk_29C,
&this->unk_2AE, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_29C.x, this->unk_29C.y, this->unk_29C.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);

View File

@ -997,24 +997,24 @@ void EnIg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
void EnIg_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx, Gfx** gfx) {
EnIg* this = THIS;
s32 phi_v0;
s32 phi_v1;
s32 stepRot;
s32 overrideRot;
if (!(this->unk_3D0 & 0x200)) {
if (this->unk_3D0 & 0x80) {
phi_v1 = 1;
overrideRot = true;
} else {
phi_v1 = 0;
overrideRot = false;
}
phi_v0 = 1;
stepRot = true;
} else {
phi_v1 = 0;
phi_v0 = 0;
overrideRot = false;
stepRot = false;
}
if (limbIndex == 9) {
func_8013AD9C(this->unk_3E8 + 0x4000, this->unk_3EA + this->actor.shape.rot.y + 0x4000, &this->unk_2D4,
&this->unk_2E6, phi_v0, phi_v1);
SubS_UpdateLimb(this->unk_3E8 + 0x4000, this->unk_3EA + this->actor.shape.rot.y + 0x4000, &this->unk_2D4,
&this->unk_2E6, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_2D4.x, this->unk_2D4.y, this->unk_2D4.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);

View File

@ -139,8 +139,11 @@ static AnimationInfoS sAnimations[] = {
{ &object_in_Anim_019EB4, 1.0f, 0, -1, ANIMMODE_ONCE, -4 },
};
static u16 D_808F6C0C[] = {
4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6,
static TurnOptionsSet sTurnOptions = {
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
};
s32 func_808F30B0(SkelAnime* skelAnime, s16 animIndex) {
@ -228,24 +231,24 @@ s32 func_808F33B8(void) {
void func_808F3414(EnIn* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
Vec3f sp30;
Vec3f point;
if (this->unk23D == 0) {
this->unk494 = SkelAnime_Update(&this->skelAnime);
}
if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x2710, this->actor.yawTowardsPlayer)) {
sp30.x = player->actor.world.pos.x;
sp30.y = player->bodyPartsPos[7].y + 3.0f;
sp30.z = player->actor.world.pos.z;
func_8013D2E0(&sp30, &this->actor.focus.pos, &this->actor.shape.rot, &this->unk352, &this->unk358,
&this->unk35E, D_808F6C0C);
point.x = player->actor.world.pos.x;
point.y = player->bodyPartsPos[7].y + 3.0f;
point.z = player->actor.world.pos.z;
SubS_TurnToPoint(&point, &this->actor.focus.pos, &this->actor.shape.rot, &this->turnTarget, &this->headRot,
&this->torsoRot, &sTurnOptions);
} else {
Math_SmoothStepToS(&this->unk352.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk352.y, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk358.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk358.y, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk35E.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->unk35E.y, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->turnTarget.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->turnTarget.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->headRot.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->headRot.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->torsoRot.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1);
}
func_808F322C(this, 3);
func_808F3178(this, globalCtx);
@ -1541,14 +1544,14 @@ s32 EnIn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
if (limbIndex == 16) {
Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_InsertXRotation_s(this->unk358.y, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->unk358.x, MTXMODE_APPLY);
Matrix_InsertXRotation_s(this->headRot.y, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->headRot.x, MTXMODE_APPLY);
Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
func_808F6334(this, globalCtx);
}
if (limbIndex == 9) {
Matrix_RotateY(this->unk35E.y, MTXMODE_APPLY);
Matrix_InsertXRotation_s(this->unk35E.x, MTXMODE_APPLY);
Matrix_RotateY(this->torsoRot.y, MTXMODE_APPLY);
Matrix_InsertXRotation_s(this->torsoRot.x, MTXMODE_APPLY);
}
if (limbIndex == 9 || limbIndex == 10 || limbIndex == 13) {
rot->y += (s16)(Math_SinS(this->unk376[limbIndex]) * 200.0f);

View File

@ -36,9 +36,9 @@ typedef struct EnIn {
/* 0x261 */ u8 unk261;
/* 0x262 */ Vec3s jointTable[20];
/* 0x2DA */ Vec3s morphTable[20];
/* 0x352 */ Vec3s unk352;
/* 0x358 */ Vec3s unk358;
/* 0x35E */ Vec3s unk35E;
/* 0x352 */ Vec3s turnTarget;
/* 0x358 */ Vec3s headRot;
/* 0x35E */ Vec3s torsoRot;
/* 0x364 */ char unk364[0x12];
/* 0x376 */ s16 unk376[20];
/* 0x39E */ s16 unk39E[20];

View File

@ -523,30 +523,30 @@ void EnJa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
void EnJa_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
EnJa* this = THIS;
s32 phi_v1;
s32 phi_v0;
s32 stepRot;
s32 overrideRot;
if (this->unk_340 & 0x10) {
phi_v1 = false;
stepRot = false;
} else {
phi_v1 = true;
stepRot = true;
}
if (this->unk_340 & 0x20) {
phi_v0 = true;
overrideRot = true;
} else {
phi_v0 = false;
overrideRot = false;
}
if (!phi_v1) {
phi_v0 = false;
if (!stepRot) {
overrideRot = false;
}
if (limbIndex != 8) {
if (limbIndex == 15) {
func_8013AD9C(this->unk_354 + this->unk_358 + 0x4000,
this->unk_356 + this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1EC,
&this->unk_274, phi_v1, phi_v0);
SubS_UpdateLimb(this->unk_354 + this->unk_358 + 0x4000,
this->unk_356 + this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1EC,
&this->unk_274, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_1EC.x, this->unk_1EC.y, this->unk_1EC.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
@ -556,8 +556,8 @@ void EnJa_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* this
Matrix_StatePush();
}
} else {
func_8013AD9C(this->unk_358 + 0x4000, this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1F8,
&this->unk_27A, phi_v1, phi_v0);
SubS_UpdateLimb(this->unk_358 + 0x4000, this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1F8,
&this->unk_27A, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_1F8.x, this->unk_1F8.y, this->unk_1F8.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);

View File

@ -2143,26 +2143,26 @@ void EnPm_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
}
}
void EnPm_TransformLimbDraw(GlobalContext* globalCtx, s32 arg1, Actor* thisx, Gfx** gfx) {
void EnPm_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx, Gfx** gfx) {
EnPm* this = THIS;
s32 phi_v0;
s32 phi_v1;
s32 stepRot;
s32 overrideRot;
if (!(this->unk_356 & 0x200)) {
if (this->unk_356 & 0x80) {
phi_v1 = 1;
overrideRot = true;
} else {
phi_v1 = 0;
overrideRot = false;
}
phi_v0 = 1;
stepRot = true;
} else {
phi_v1 = 0;
phi_v0 = 0;
overrideRot = false;
stepRot = false;
}
if (arg1 == 15) {
func_8013AD9C(this->unk_370 + 0x4000, this->unk_372 + this->actor.shape.rot.y + 0x4000, &this->unk_284,
&this->unk_290, phi_v0, phi_v1);
if (limbIndex == 15) {
SubS_UpdateLimb(this->unk_370 + 0x4000, this->unk_372 + this->actor.shape.rot.y + 0x4000, &this->unk_284,
&this->unk_290, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_284.x, this->unk_284.y, this->unk_284.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);

View File

@ -403,24 +403,24 @@ void EnShn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
void EnShn_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
EnShn* this = THIS;
s32 phi_v0;
s32 phi_v1;
s32 stepRot;
s32 overrideRot;
if (!(this->unk_1D8 & 0x20)) {
if (this->unk_1D8 & 0x10) {
phi_v1 = 1;
overrideRot = true;
} else {
phi_v1 = 0;
overrideRot = false;
}
phi_v0 = 1;
stepRot = true;
} else {
phi_v1 = 0;
phi_v0 = 0;
overrideRot = false;
stepRot = false;
}
if (limbIndex == BURLY_GUY_LIMB_HEAD) {
func_8013AD9C((this->unk_2BA + 0x4000), (this->unk_2BC + this->actor.shape.rot.y + 0x4000), &this->unk_1E8,
&this->unk_1F4, phi_v0, phi_v1);
SubS_UpdateLimb((this->unk_2BA + 0x4000), (this->unk_2BC + this->actor.shape.rot.y + 0x4000), &this->unk_1E8,
&this->unk_1F4, stepRot, overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_1E8.x, this->unk_1E8.y, this->unk_1E8.z, 0);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1);

View File

@ -120,8 +120,11 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(1, 0xE),
};
static u16 D_80BAE800[] = {
4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6,
static TurnOptionsSet sTurnOptions = {
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
};
static u8 D_80BAE820[] = {
@ -516,7 +519,7 @@ void EnSuttari_GetPaths(EnSuttari* this, GlobalContext* globalCtx) {
void func_80BAB4F0(EnSuttari* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
Vec3f sp30;
Vec3f point;
if (this->flags1 & 0x80) {
EnSuttari_UpdateCollider(this, globalCtx);
@ -524,18 +527,18 @@ void func_80BAB4F0(EnSuttari* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if (!(this->flags1 & 4) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) {
if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer)) {
sp30.x = player->actor.world.pos.x;
sp30.y = player->bodyPartsPos[7].y + 3.0f;
sp30.z = player->actor.world.pos.z;
func_8013D2E0(&sp30, &this->actor.focus.pos, &this->actor.shape.rot, &this->unk2D6, &this->unk2DC,
&this->unk2E2, D_80BAE800);
point.x = player->actor.world.pos.x;
point.y = player->bodyPartsPos[7].y + 3.0f;
point.z = player->actor.world.pos.z;
SubS_TurnToPoint(&point, &this->actor.focus.pos, &this->actor.shape.rot, &this->turnTarget, &this->headRot,
&this->torsoRot, &sTurnOptions);
} else {
Math_SmoothStepToS(&this->unk2D6.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->unk2D6.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->unk2DC.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->unk2DC.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->unk2E2.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->unk2E2.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->turnTarget.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->turnTarget.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->headRot.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->headRot.y, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->torsoRot.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1);
}
}
SubS_FillLimbRotTables(globalCtx, this->unk2FA, this->unk31A, ARRAY_COUNT(this->unk2FA));
@ -1014,12 +1017,12 @@ void func_80BACA14(EnSuttari* this, GlobalContext* globalCtx) {
func_80BAB434(this);
if (player->transformation == PLAYER_FORM_GORON || player->transformation == PLAYER_FORM_ZORA) {
if (this->actor.playerHeightRel < 60.0f && this->actor.xzDistToPlayer < 500.0f) {
this->unk3F2 = this->unk2DC.y;
this->unk3F2 = this->headRot.y;
this->actionFunc = func_80BACBB0;
}
} else if ((player->transformation == PLAYER_FORM_HUMAN) && GET_CUR_EQUIP_VALUE(EQUIP_SWORD) != 0) {
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) {
this->unk3F2 = this->unk2DC.y;
this->unk3F2 = this->headRot.y;
func_80BAAB78(this, globalCtx);
this->actionFunc = func_80BADA9C;
} else if (this->actor.xzDistToPlayer < 200.0f) {
@ -1034,7 +1037,7 @@ void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
s16 target;
this->unk3F2 = this->unk2DC.y;
this->unk3F2 = this->headRot.y;
if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU) {
this->actionFunc = func_80BACA14;
}
@ -1064,7 +1067,7 @@ void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx) {
void func_80BACD2C(EnSuttari* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
this->unk3F2 = this->unk2DC.y;
this->unk3F2 = this->headRot.y;
if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU) {
this->actionFunc = func_80BACA14;
}
@ -1232,7 +1235,7 @@ void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx) {
this->flags2 |= 4;
EnSuttari_SetNextEntrance(globalCtx, 0xD670);
} else {
this->unk3F2 = this->unk2DC.y;
this->unk3F2 = this->headRot.y;
Math_ApproachF(&this->actor.speedXZ, 4.0f, 0.2f, 0.5f);
Actor_MoveWithGravity(&this->actor);
func_80BAB374(this, globalCtx);
@ -1330,7 +1333,7 @@ void func_80BADA9C(EnSuttari* this, GlobalContext* globalCtx) {
s16 frameCount = Animation_GetLastFrame(sAnimations[this->animationIndex].animation);
if (this->flags1 & 1) {
this->unk3F2 = this->unk2DC.y;
this->unk3F2 = this->headRot.y;
func_80BAA9B4(this);
} else if ((this->animationIndex == 7) && (curFrame == frameCount)) {
this->animationIndex = 1;
@ -1406,14 +1409,14 @@ void func_80BADE14(EnSuttari* this, GlobalContext* globalCtx) {
if (this->unk1F4[1] == -0x63) {
this->actor.speedXZ = 0.0f;
} else {
this->unk3F2 = this->unk2DC.y;
this->unk3F2 = this->headRot.y;
Math_ApproachF(&this->actor.speedXZ, 6.0f, 0.2f, 0.5f);
}
Actor_MoveWithGravity(&this->actor);
}
void func_80BADE8C(EnSuttari* this, GlobalContext* globalCtx) {
this->unk3F2 = this->unk2DC.y;
this->unk3F2 = this->headRot.y;
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 0);
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) {
this->actor.flags &= ~ACTOR_FLAG_10000;
@ -1430,7 +1433,7 @@ void func_80BADF3C(EnSuttari* this, GlobalContext* globalCtx) {
if (this->unk1F4[0] == -0x63) {
Actor_MarkForDeath(&this->actor);
}
this->unk3F2 = this->unk2DC.y;
this->unk3F2 = this->headRot.y;
if (DECR(this->unk3F6) == 0) {
Math_ApproachF(&this->actor.speedXZ, 6.0f, 0.2f, 0.5f);
}
@ -1501,13 +1504,13 @@ s32 EnSuttari_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL
if (!(this->flags1 & 4)) {
Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_InsertXRotation_s(this->unk3F2, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->unk2DC.x, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->headRot.x, MTXMODE_APPLY);
Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
}
if (limbIndex == 8) {
Matrix_InsertXRotation_s(-this->unk2E2.y, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->unk2E2.x, MTXMODE_APPLY);
Matrix_InsertXRotation_s(-this->torsoRot.y, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->torsoRot.x, MTXMODE_APPLY);
}
if (limbIndex == 8 || limbIndex == 9 || limbIndex == 0xC) {
rot->y += (s16)(Math_SinS(this->unk2FA[limbIndex]) * 200.0f);

View File

@ -27,9 +27,9 @@ typedef struct EnSuttari {
/* 0x1FC */ UNK_TYPE1 unk_1FC[0x1A];
/* 0x216 */ Vec3s jointTable[16];
/* 0x276 */ Vec3s morphTable[16];
/* 0x2D6 */ Vec3s unk2D6;
/* 0x2DC */ Vec3s unk2DC;
/* 0x2E2 */ Vec3s unk2E2;
/* 0x2D6 */ Vec3s turnTarget;
/* 0x2DC */ Vec3s headRot;
/* 0x2E2 */ Vec3s torsoRot;
/* 0x2E8 */ UNK_TYPE1 unk_2E8[0x12];
/* 0x2FA */ s16 unk2FA[16];
/* 0x31A */ s16 unk31A[16];

View File

@ -584,25 +584,25 @@ void EnTab_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
void EnTab_TransformDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
EnTab* this = THIS;
s32 phi_v0;
s32 phi_v1;
s32 rotStep;
s32 overrideStep;
if (!(this->unk_2FC & 0x40)) {
if (this->unk_2FC & 0x10) {
phi_v1 = 1;
overrideStep = true;
} else {
phi_v1 = 0;
overrideStep = false;
}
phi_v0 = 1;
rotStep = true;
} else {
phi_v1 = 0;
phi_v0 = 0;
overrideStep = false;
rotStep = false;
}
if (limbIndex == 9) {
func_8013AD9C(BINANG_ADD(this->unk_312 + this->unk_316, 0x4000),
BINANG_ADD(this->unk_314 + this->unk_318 + this->actor.shape.rot.y, 0x4000), this->unk_1E8,
this->unk_200, phi_v0, phi_v1);
SubS_UpdateLimb(BINANG_ADD(this->unk_312 + this->unk_316, 0x4000),
BINANG_ADD(this->unk_314 + this->unk_318 + this->actor.shape.rot.y, 0x4000), this->unk_1E8,
this->unk_200, rotStep, overrideStep);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_1E8[0].x, this->unk_1E8[0].y, this->unk_1E8[0].z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);

View File

@ -1195,32 +1195,32 @@ void EnTru_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
void EnTru_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
EnTru* this = THIS;
s32 pad[3];
s32 sp2C;
s32 phi_v1;
s32 overrideRot;
s32 stepRot;
if (this->unk_34E & 0x10) {
phi_v1 = false;
stepRot = false;
} else {
phi_v1 = true;
stepRot = true;
}
if (this->unk_34E & 0x20) {
sp2C = true;
overrideRot = true;
} else {
sp2C = false;
overrideRot = false;
}
if (!phi_v1) {
sp2C = false;
if (!stepRot) {
overrideRot = false;
}
if (limbIndex == 21) {
func_8013AD9C(this->unk_366, this->unk_368 + this->actor.shape.rot.y, &this->unk_1EC, &this->unk_204, phi_v1,
sp2C);
SubS_UpdateLimb(this->unk_366, this->unk_368 + this->actor.shape.rot.y, &this->unk_1EC, &this->unk_204, stepRot,
overrideRot);
Matrix_StatePop();
Matrix_InsertTranslation(this->unk_1EC.x, this->unk_1EC.y, this->unk_1EC.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
if (sp2C) {
if (overrideRot) {
s16 oldZ = this->unk_204.z;
this->unk_204.z = this->unk_204.x;

View File

@ -174,20 +174,25 @@ void EnZo_UpdateCollider(EnZo* this, GlobalContext* globalCtx) {
}
void EnZo_LookAtPlayer(EnZo* this, GlobalContext* globalCtx) {
static u16 D_8099F5AC[] = { 4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6 };
static TurnOptionsSet sTurnOptions = {
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
{ 0xFA0, 4, 1, 3 },
{ 0x1770, 4, 1, 6 },
};
Player* player = GET_PLAYER(globalCtx);
Vec3f focus;
Vec3f point;
SkelAnime_Update(&this->skelAnime);
if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x2710, this->actor.yawTowardsPlayer)) {
focus.x = player->actor.world.pos.x;
focus.y = player->bodyPartsPos[7].y + 3.0f;
focus.z = player->actor.world.pos.z;
func_8013D2E0(&focus, &this->actor.focus.pos, &this->actor.shape.rot, &this->headRotTarget, &this->headRot,
&this->upperBodyRot, D_8099F5AC);
point.x = player->actor.world.pos.x;
point.y = player->bodyPartsPos[7].y + 3.0f;
point.z = player->actor.world.pos.z;
SubS_TurnToPoint(&point, &this->actor.focus.pos, &this->actor.shape.rot, &this->turnTarget, &this->headRot,
&this->upperBodyRot, &sTurnOptions);
} else {
Math_SmoothStepToS(&this->headRotTarget.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->headRotTarget.y, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->turnTarget.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->turnTarget.y, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->headRot.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->headRot.y, 0, 4, 1000, 1);

View File

@ -24,7 +24,7 @@ typedef struct EnZo {
/* 0x01FD */ u8 isRightFootGrounded;
/* 0x01FE */ Vec3s jointTable[20];
/* 0x0276 */ Vec3s morphTable[20];
/* 0x02EE */ Vec3s headRotTarget;
/* 0x02EE */ Vec3s turnTarget;
/* 0x02F4 */ Vec3s headRot;
/* 0x02FA */ Vec3s upperBodyRot;
/* 0x0300 */ UNK_TYPE1 unk_300[0x12];

View File

@ -2659,7 +2659,7 @@
0x8013A860:("SubS_DrawTransformFlexLimb",),
0x8013AB00:("SubS_DrawTransformFlex",),
0x8013AD6C:("SubS_InCsMode",),
0x8013AD9C:("func_8013AD9C",),
0x8013AD9C:("SubS_UpdateLimb",),
0x8013AED4:("SubS_UpdateFlags",),
0x8013AF00:("func_8013AF00",),
0x8013B010:("func_8013B010",),
@ -2679,8 +2679,8 @@
0x8013CC2C:("SubS_FillShadowTex",),
0x8013CD64:("SubS_GenShadowTex",),
0x8013CF04:("SubS_DrawShadowTex",),
0x8013D0E0:("func_8013D0E0",),
0x8013D2E0:("func_8013D2E0",),
0x8013D0E0:("SubS_ComputeTurnToPointRot",),
0x8013D2E0:("SubS_TurnToPoint",),
0x8013D5E8:("SubS_AngleDiffLessEqual",),
0x8013D648:("SubS_GetPathByIndex",),
0x8013D68C:("SubS_CopyPointFromPath",),
@ -2709,7 +2709,7 @@
0x8013E748:("func_8013E748",),
0x8013E7C0:("SubS_ActorAndPlayerFaceEachOther",),
0x8013E8F8:("func_8013E8F8",),
0x8013E950:("func_8013E950",),
0x8013E950:("SubS_TurnToPointStep",),
0x8013EC10:("func_8013EC10",),
0x8013EC44:("func_8013EC44",),
0x8013ECE0:("func_8013ECE0",),
@ -15758,8 +15758,8 @@
0x80BD3854:("EnAh_Init",),
0x80BD396C:("EnAh_Destroy",),
0x80BD3998:("EnAh_Update",),
0x80BD3AA8:("func_80BD3AA8",),
0x80BD3AF8:("func_80BD3AF8",),
0x80BD3AA8:("EnAh_PostLimbDraw",),
0x80BD3AF8:("EnAh_TransformLimbDraw",),
0x80BD3CAC:("EnAh_Draw",),
0x80BD4090:("ObjHgdoor_SetChild",),
0x80BD40D0:("func_80BD40D0",),

View File

@ -422,10 +422,6 @@ wordReplace = {
"func_8016A0AC": "Play_IsUnderwater",
"func_801690CC": "Play_InCsMode",
"func_8017D2FC": "Math3D_LineSegVsPlane",
"func_8013A7C0": "SubS_FindDoor",
"func_8013E640": "SubS_FindActorCustom",
"func_ActorCategoryIterateById": "SubS_FindActor",
"func_8013BB7C": "SubS_FindNearestActor",
"func_800A81F0": "EffectBlure_AddVertex",
"func_800A8514": "EffectBlure_AddSpace",
"Effect_GetParams": "Effect_GetByIndex",
@ -443,11 +439,6 @@ wordReplace = {
"func_800EE2F4": "Cutscene_IsPlaying",
"func_801343C0": "SkelAnime_DrawTransformFlexOpa",
"func_80134148": "SkelAnime_DrawTransformFlexLimbOpa",
"func_8013AB00": "SubS_DrawTransformFlex",
"func_8013A860": "SubS_DrawTransformFlexLimb",
"func_8013BC6C": "SubS_ChangeAnimationByInfoS",
"func_8013E1C8": "SubS_ChangeAnimationBySpeedInfo",
"func_8013D9C8": "SubS_FillLimbRotTables",
"func_80114E90": "Interface_HasEmptyBottle",
"func_80114F2C": "Interface_HasItemInBottle",
"func_80123C90": "Player_SetEquipmentData",
@ -455,13 +446,23 @@ wordReplace = {
"Quake2_SetType": "Distortion_SetType",
"Quake2_SetCountdown": "Distortion_SetCountdown",
"func_800BE680": "Actor_DrawDamageEffects",
"func_8012F22C": "Inventory_GetSkullTokenCount",
"func_8013AB00": "SubS_DrawTransformFlex",
"func_8013A860": "SubS_DrawTransformFlexLimb",
"func_8013BC6C": "SubS_ChangeAnimationByInfoS",
"func_8013E1C8": "SubS_ChangeAnimationBySpeedInfo",
"func_8013D9C8": "SubS_FillLimbRotTables",
"func_8013A7C0": "SubS_FindDoor",
"func_8013E640": "SubS_FindActorCustom",
"func_ActorCategoryIterateById": "SubS_FindActor",
"func_8013BB7C": "SubS_FindNearestActor",
"func_8013E2D4": "SubS_StartActorCutscene",
"func_8013E3B8": "SubS_FillCutscenesList",
"func_8013AED4": "SubS_UpdateFlags",
"func_8013D8DC": "SubS_IsObjectLoaded",
"func_8013D924": "SubS_GetObjectIndex",
"func_8013D5E8": "SubS_AngleDiffLessEqual",
"func_8012F22C": "Inventory_GetSkullTokenCount",
"func_8013DCE0": "SubS_ActorPathing_Init",
"func_8013DE04": "SubS_ActorPathing_Update",
"func_8013DF3C": "SubS_ActorPathing_ComputePointInfo",
@ -480,6 +481,8 @@ wordReplace = {
"func_8013DB90": "SubS_IsFloorAbove",
"func_8013DC40": "SubS_CopyPointFromPathList",
"func_8013DCCC": "SubS_GetPathCount",
"func_8013AD9C": "SubS_UpdateLimb",
"func_8013D2E0": "SubS_TurnToPoint",
"func_80147624": "Message_ShouldAdvance",
"func_80147734": "Message_ShouldAdvanceSilent",

View File

@ -2173,7 +2173,7 @@ asm/non_matchings/code/z_sub_s/SubS_FindDoor.s,SubS_FindDoor,0x8013A7C0,0x28
asm/non_matchings/code/z_sub_s/SubS_DrawTransformFlexLimb.s,SubS_DrawTransformFlexLimb,0x8013A860,0xA8
asm/non_matchings/code/z_sub_s/SubS_DrawTransformFlex.s,SubS_DrawTransformFlex,0x8013AB00,0x9B
asm/non_matchings/code/z_sub_s/SubS_InCsMode.s,SubS_InCsMode,0x8013AD6C,0xC
asm/non_matchings/code/z_sub_s/func_8013AD9C.s,func_8013AD9C,0x8013AD9C,0x4E
asm/non_matchings/code/z_sub_s/SubS_UpdateLimb.s,SubS_UpdateLimb,0x8013AD9C,0x4E
asm/non_matchings/code/z_sub_s/SubS_UpdateFlags.s,SubS_UpdateFlags,0x8013AED4,0xB
asm/non_matchings/code/z_sub_s/func_8013AF00.s,func_8013AF00,0x8013AF00,0x44
asm/non_matchings/code/z_sub_s/func_8013B010.s,func_8013B010,0x8013B010,0x2E
@ -2193,8 +2193,8 @@ asm/non_matchings/code/z_sub_s/func_8013C964.s,func_8013C964,0x8013C964,0xB2
asm/non_matchings/code/z_sub_s/SubS_FillShadowTex.s,SubS_FillShadowTex,0x8013CC2C,0x4E
asm/non_matchings/code/z_sub_s/SubS_GenShadowTex.s,SubS_GenShadowTex,0x8013CD64,0x68
asm/non_matchings/code/z_sub_s/SubS_DrawShadowTex.s,SubS_DrawShadowTex,0x8013CF04,0x77
asm/non_matchings/code/z_sub_s/func_8013D0E0.s,func_8013D0E0,0x8013D0E0,0x80
asm/non_matchings/code/z_sub_s/func_8013D2E0.s,func_8013D2E0,0x8013D2E0,0xC2
asm/non_matchings/code/z_sub_s/SubS_ComputeTurnToPointRot.s,SubS_ComputeTurnToPointRot,0x8013D0E0,0x80
asm/non_matchings/code/z_sub_s/SubS_TurnToPoint.s,SubS_TurnToPoint,0x8013D2E0,0xC2
asm/non_matchings/code/z_sub_s/SubS_AngleDiffLessEqual.s,SubS_AngleDiffLessEqual,0x8013D5E8,0x18
asm/non_matchings/code/z_sub_s/SubS_GetPathByIndex.s,SubS_GetPathByIndex,0x8013D648,0x11
asm/non_matchings/code/z_sub_s/SubS_CopyPointFromPath.s,SubS_CopyPointFromPath,0x8013D68C,0x25
@ -2223,7 +2223,7 @@ asm/non_matchings/code/z_sub_s/SubS_FindActorCustom.s,SubS_FindActorCustom,0x801
asm/non_matchings/code/z_sub_s/func_8013E748.s,func_8013E748,0x8013E748,0x1E
asm/non_matchings/code/z_sub_s/SubS_ActorAndPlayerFaceEachOther.s,SubS_ActorAndPlayerFaceEachOther,0x8013E7C0,0x4E
asm/non_matchings/code/z_sub_s/func_8013E8F8.s,func_8013E8F8,0x8013E8F8,0x16
asm/non_matchings/code/z_sub_s/func_8013E950.s,func_8013E950,0x8013E950,0xB0
asm/non_matchings/code/z_sub_s/SubS_TurnToPointStep.s,SubS_TurnToPointStep,0x8013E950,0xB0
asm/non_matchings/code/code_8013EC10/func_8013EC10.s,func_8013EC10,0x8013EC10,0xD
asm/non_matchings/code/code_8013EC10/func_8013EC44.s,func_8013EC44,0x8013EC44,0x27
asm/non_matchings/code/code_8013EC10/func_8013ECE0.s,func_8013ECE0,0x8013ECE0,0x2F

1 asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s EnAObj_Init 0x800A5AC0 0x2B
2173 asm/non_matchings/code/z_sub_s/SubS_DrawTransformFlexLimb.s SubS_DrawTransformFlexLimb 0x8013A860 0xA8
2174 asm/non_matchings/code/z_sub_s/SubS_DrawTransformFlex.s SubS_DrawTransformFlex 0x8013AB00 0x9B
2175 asm/non_matchings/code/z_sub_s/SubS_InCsMode.s SubS_InCsMode 0x8013AD6C 0xC
2176 asm/non_matchings/code/z_sub_s/func_8013AD9C.s asm/non_matchings/code/z_sub_s/SubS_UpdateLimb.s func_8013AD9C SubS_UpdateLimb 0x8013AD9C 0x4E
2177 asm/non_matchings/code/z_sub_s/SubS_UpdateFlags.s SubS_UpdateFlags 0x8013AED4 0xB
2178 asm/non_matchings/code/z_sub_s/func_8013AF00.s func_8013AF00 0x8013AF00 0x44
2179 asm/non_matchings/code/z_sub_s/func_8013B010.s func_8013B010 0x8013B010 0x2E
2193 asm/non_matchings/code/z_sub_s/SubS_FillShadowTex.s SubS_FillShadowTex 0x8013CC2C 0x4E
2194 asm/non_matchings/code/z_sub_s/SubS_GenShadowTex.s SubS_GenShadowTex 0x8013CD64 0x68
2195 asm/non_matchings/code/z_sub_s/SubS_DrawShadowTex.s SubS_DrawShadowTex 0x8013CF04 0x77
2196 asm/non_matchings/code/z_sub_s/func_8013D0E0.s asm/non_matchings/code/z_sub_s/SubS_ComputeTurnToPointRot.s func_8013D0E0 SubS_ComputeTurnToPointRot 0x8013D0E0 0x80
2197 asm/non_matchings/code/z_sub_s/func_8013D2E0.s asm/non_matchings/code/z_sub_s/SubS_TurnToPoint.s func_8013D2E0 SubS_TurnToPoint 0x8013D2E0 0xC2
2198 asm/non_matchings/code/z_sub_s/SubS_AngleDiffLessEqual.s SubS_AngleDiffLessEqual 0x8013D5E8 0x18
2199 asm/non_matchings/code/z_sub_s/SubS_GetPathByIndex.s SubS_GetPathByIndex 0x8013D648 0x11
2200 asm/non_matchings/code/z_sub_s/SubS_CopyPointFromPath.s SubS_CopyPointFromPath 0x8013D68C 0x25
2223 asm/non_matchings/code/z_sub_s/func_8013E748.s func_8013E748 0x8013E748 0x1E
2224 asm/non_matchings/code/z_sub_s/SubS_ActorAndPlayerFaceEachOther.s SubS_ActorAndPlayerFaceEachOther 0x8013E7C0 0x4E
2225 asm/non_matchings/code/z_sub_s/func_8013E8F8.s func_8013E8F8 0x8013E8F8 0x16
2226 asm/non_matchings/code/z_sub_s/func_8013E950.s asm/non_matchings/code/z_sub_s/SubS_TurnToPointStep.s func_8013E950 SubS_TurnToPointStep 0x8013E950 0xB0
2227 asm/non_matchings/code/code_8013EC10/func_8013EC10.s func_8013EC10 0x8013EC10 0xD
2228 asm/non_matchings/code/code_8013EC10/func_8013EC44.s func_8013EC44 0x8013EC44 0x27
2229 asm/non_matchings/code/code_8013EC10/func_8013ECE0.s func_8013ECE0 0x8013ECE0 0x2F