Fidget Tables Docs (#1316)

* Docs for SubS_FillLimbRotTables and Actor_FillLimbRotTables

* Fidget

* Format

* ///

* UpdateFidgetTables

* Clarify comment

* Adjust comments slightly

* Update src/code/z_actor.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Update src/code/z_sub_s.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

---------

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
Derek Hensley
2023-07-07 07:54:43 +10:00
committed by GitHub
co-authored by engineer124
parent 3bb9b365fc
commit a506e8620a
35 changed files with 162 additions and 133 deletions
+1 -1
View File
@@ -137,7 +137,7 @@ s8 SubS_GetObjectIndex(s16 id, struct PlayState* play);
Actor* SubS_FindActor(struct PlayState* play, Actor* actorListStart, u8 actorCategory, s16 actorId);
s32 SubS_FillLimbRotTables(struct PlayState* play, s16* limbRotTableY, s16* limbRotTableZ, s32 numLimbs);
s32 SubS_UpdateFidgetTables(struct PlayState* play, s16* fidgetTableY, s16* fidgetTableZ, s32 tableLen);
s32 SubS_IsFloorAbove(struct PlayState* play, Vec3f* pos, f32 distAbove);
+2 -2
View File
@@ -63,8 +63,8 @@ typedef struct EnHy {
/* 0x2D8 */ Vec3s prevTrackTarget;
/* 0x2DE */ Vec3s prevHeadRot;
/* 0x2E4 */ Vec3s prevTorsoRot;
/* 0x2EA */ s16 limbRotTableY[16];
/* 0x30A */ s16 limbRotTableZ[16];
/* 0x2EA */ s16 fidgetTableY[ENHY_LIMB_MAX];
/* 0x30A */ s16 fidgetTableZ[ENHY_LIMB_MAX];
/* 0x32C */ Vec3f bodyPartsPos[15];
/* 0x3E0 */ UNK_TYPE1 unk_3E0[0x6];
/* 0x3E6 */ s16 eyeTexIndex;
+17 -5
View File
@@ -4464,14 +4464,26 @@ void Actor_ChangeAnimationByInfo(SkelAnime* skelAnime, AnimationInfo* animationI
frameCount, animationInfo->mode, animationInfo->morphFrames);
}
// Unused
void func_800BDCF4(PlayState* play, s16* arg1, s16* arg2, s32 size) {
/**
* Fills two tables with rotation angles that can be used to simulate idle animations.
*
* The rotation angles are dependent on the current frame, so should be updated regularly, generally every frame.
*
* This is done for the desired limb by taking either the `sin` of the yTable value or the `cos` of the zTable value,
* multiplying by some scale factor (generally 200), and adding that to the already existing rotation.
*
* Note: With the common scale factor of 200, this effect is practically unnoticeable if the current animation already
* has motion involved.
*
* Note: This function goes unused in favor of `SubS_UpdateFidgetTables`.
*/
void Actor_UpdateFidgetTables(PlayState* play, s16* fidgetTableY, s16* fidgetTableZ, s32 tableLen) {
s32 frames = play->gameplayFrames;
s32 i;
for (i = 0; i < size; i++) {
arg1[i] = (0x814 + 50 * i) * frames;
arg2[i] = (0x940 + 50 * i) * frames;
for (i = 0; i < tableLen; i++) {
fidgetTableY[i] = (i * 50 + 0x814) * frames;
fidgetTableZ[i] = (i * 50 + 0x940) * frames;
}
}
+16 -5
View File
@@ -1186,13 +1186,24 @@ Actor* SubS_FindActor(PlayState* play, Actor* actorListStart, u8 actorCategory,
return actor;
}
s32 SubS_FillLimbRotTables(PlayState* play, s16* limbRotTableY, s16* limbRotTableZ, s32 numLimbs) {
s32 i;
/**
* Fills two tables with rotation angles that can be used to simulate idle animations.
*
* The rotation angles are dependent on the current frame, so should be updated regularly, generally every frame.
*
* This is done for the desired limb by taking either the `sin` of the yTable value or the `cos` of the zTable value,
* multiplying by some scale factor (generally 200), and adding that to the already existing rotation.
*
* Note: With the common scale factor of 200, this effect is practically unnoticeable if the current animation already
* has motion involved.
*/
s32 SubS_UpdateFidgetTables(PlayState* play, s16* fidgetTableY, s16* fidgetTableZ, s32 tableLen) {
u32 frames = play->gameplayFrames;
s32 i;
for (i = 0; i < numLimbs; i++) {
limbRotTableY[i] = (i * 50 + 0x814) * frames;
limbRotTableZ[i] = (i * 50 + 0x940) * frames;
for (i = 0; i < tableLen; i++) {
fidgetTableY[i] = (i * 50 + 0x814) * frames;
fidgetTableZ[i] = (i * 50 + 0x940) * frames;
}
return true;
@@ -556,7 +556,7 @@ void EnAob01_UpdateCommon(EnAob01* this, PlayState* play) {
}
EnAob01_Blink(this, EN_AOB01_EYE_MAX);
SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY));
SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, MAMAMU_YAN_LIMB_MAX);
EnAob01_UpdateCollision(this, play);
// This specific code ensures that in-game time passes during the race.
@@ -1188,8 +1188,8 @@ s32 EnAob01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if ((limbIndex == MAMAMU_YAN_LIMB_TORSO) || (limbIndex == MAMAMU_YAN_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == MAMAMU_YAN_LIMB_RIGHT_UPPER_ARM)) {
rot->y += (s16)Math_SinS(this->limbRotTableY[limbIndex]) * 200;
rot->z += (s16)Math_CosS(this->limbRotTableZ[limbIndex]) * 200;
rot->y += (s16)Math_SinS(this->fidgetTableY[limbIndex]) * 200;
rot->z += (s16)Math_CosS(this->fidgetTableZ[limbIndex]) * 200;
}
return false;
@@ -47,8 +47,8 @@ typedef struct EnAob01 {
/* 0x2E6 */ Vec3s prevTrackTarget;
/* 0x2EC */ Vec3s prevHeadRot;
/* 0x2F2 */ Vec3s prevTorsoRot;
/* 0x2F8 */ s16 limbRotTableY[MAMAMU_YAN_LIMB_MAX];
/* 0x318 */ s16 limbRotTableZ[MAMAMU_YAN_LIMB_MAX];
/* 0x2F8 */ s16 fidgetTableY[MAMAMU_YAN_LIMB_MAX];
/* 0x318 */ s16 fidgetTableZ[MAMAMU_YAN_LIMB_MAX];
/* 0x338 */ UNK_TYPE1 unk338[0xB6];
/* 0x3EE */ s16 eyeIndex;
/* 0x3F0 */ s16 blinkTimer;
+3 -3
View File
@@ -355,7 +355,7 @@ void EnBaba_UpdateModel(EnBaba* this, PlayState* play) {
Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1);
}
SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY));
SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, BBA_LIMB_MAX);
if (this->stateFlags & BOMB_SHOP_LADY_STATE_VISIBLE) {
EnBaba_UpdateCollider(this, play);
@@ -773,8 +773,8 @@ s32 EnBaba_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if ((limbIndex == BBA_LIMB_UPPER_ROOT) || (limbIndex == BBA_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == BBA_LIMB_RIGHT_UPPER_ARM)) {
rot->y += (s16)(Math_SinS(this->limbRotTableY[limbIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->limbRotTableZ[limbIndex]) * 200.0f);
rot->y += (s16)(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
}
if (((this->animIndex == BOMB_SHOP_LADY_ANIM_IDLE) || (this->animIndex == BOMB_SHOP_LADY_ANIM_KNOCKED_OVER) ||
+2 -2
View File
@@ -40,8 +40,8 @@ typedef struct EnBaba {
/* 0x2E4 */ Vec3s headRot;
/* 0x2EA */ Vec3s torsoRot;
/* 0x2F0 */ UNK_TYPE1 unk2F0[0x12];
/* 0x302 */ s16 limbRotTableY[18];
/* 0x326 */ s16 limbRotTableZ[18];
/* 0x302 */ s16 fidgetTableY[BBA_LIMB_MAX];
/* 0x326 */ s16 fidgetTableZ[BBA_LIMB_MAX];
/* 0x34A */ UNK_TYPE1 unk34A[0xBA];
/* 0x404 */ s16 sakonDeadTimer;
/* 0x406 */ UNK_TYPE1 unk406[4];
@@ -123,8 +123,7 @@ void EnBba01_UpdateModel(EnBba01* this, PlayState* play) {
Math_SmoothStepToS(&this->enHy.torsoRot.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.torsoRot.y, 0, 4, 0x3E8, 1);
}
SubS_FillLimbRotTables(play, this->enHy.limbRotTableY, this->enHy.limbRotTableZ,
ARRAY_COUNT(this->enHy.limbRotTableY));
SubS_UpdateFidgetTables(play, this->enHy.fidgetTableY, this->enHy.fidgetTableZ, ENHY_LIMB_MAX);
EnHy_UpdateCollider(&this->enHy, play);
}
@@ -286,8 +285,8 @@ s32 EnBba01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
}
if ((limbIndex == BBA_LIMB_BAG) || (limbIndex == BBA_LIMB_TORSO) || (limbIndex == BBA_LIMB_LEFT_FOREARM)) {
rot->y += (s16)(Math_SinS(this->enHy.limbRotTableY[limbIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->enHy.limbRotTableZ[limbIndex]) * 200.0f);
rot->y += (s16)(Math_SinS(this->enHy.fidgetTableY[limbIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->enHy.fidgetTableZ[limbIndex]) * 200.0f);
}
return false;
@@ -115,8 +115,7 @@ void EnCne01_UpdateModel(EnCne01* this, PlayState* play) {
Math_SmoothStepToS(&this->enHy.torsoRot.x, 0, 4, 0x3E8, 1);
Math_SmoothStepToS(&this->enHy.torsoRot.y, 0, 4, 0x3E8, 1);
}
SubS_FillLimbRotTables(play, this->enHy.limbRotTableY, this->enHy.limbRotTableZ,
ARRAY_COUNT(this->enHy.limbRotTableY));
SubS_UpdateFidgetTables(play, this->enHy.fidgetTableY, this->enHy.fidgetTableZ, ENHY_LIMB_MAX);
EnHy_UpdateCollider(&this->enHy, play);
}
@@ -277,8 +276,8 @@ s32 EnCne01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if ((limbIndex == CNE_LIMB_TORSO) || (limbIndex == CNE_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == CNE_LIMB_RIGHT_UPPER_ARM)) {
rot->y += (s16)(Math_SinS(this->enHy.limbRotTableY[limbIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->enHy.limbRotTableZ[limbIndex]) * 200.0f);
rot->y += (s16)(Math_SinS(this->enHy.fidgetTableY[limbIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->enHy.fidgetTableZ[limbIndex]) * 200.0f);
}
return false;
+6 -8
View File
@@ -36,10 +36,6 @@ static AnimationInfo sAnimationInfo[] = {
{ &gDs2nIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f },
};
static Vec3f sZeroVec = { 0, 0, 0 };
static TexturePtr sEyeTextures[] = { gDs2nEyeOpenTex, gDs2nEyeHalfTex, gDs2nEyeClosedTex };
void EnDs2n_SetupIdle(EnDs2n* this) {
this->blinkTimer = 20;
this->blinkState = 0;
@@ -48,7 +44,7 @@ void EnDs2n_SetupIdle(EnDs2n* this) {
}
void EnDs2n_Idle(EnDs2n* this, PlayState* play) {
SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, DS2N_LIMB_MAX);
SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, DS2N_LIMB_MAX);
}
void EnDs2n_UpdateEyes(EnDs2n* this) {
@@ -103,12 +99,12 @@ s32 EnDs2n_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
void EnDs2n_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
EnDs2n* this = THIS;
Vec3f focusOffset = sZeroVec;
Vec3f focusOffset = { 0.0f, 0.0f, 0.0f };
if ((limbIndex == DS2N_LIMB_HIPS) || (limbIndex == DS2N_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == DS2N_LIMB_RIGHT_UPPER_ARM)) {
rot->y += (s16)Math_SinS(this->limbRotTableY[limbIndex]) * 0xC8;
rot->z += (s16)Math_CosS(this->limbRotTableZ[limbIndex]) * 0xC8;
rot->y += (s16)Math_SinS(this->fidgetTableY[limbIndex]) * 200;
rot->z += (s16)Math_CosS(this->fidgetTableZ[limbIndex]) * 200;
}
if (limbIndex == DS2N_LIMB_HEAD) {
@@ -116,6 +112,8 @@ void EnDs2n_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
}
}
static TexturePtr sEyeTextures[] = { gDs2nEyeOpenTex, gDs2nEyeHalfTex, gDs2nEyeClosedTex };
void EnDs2n_Draw(Actor* thisx, PlayState* play) {
EnDs2n* this = THIS;
+2 -2
View File
@@ -13,8 +13,8 @@ typedef struct EnDs2n {
/* 0x144 */ ColliderCylinder collider; // unused
/* 0x190 */ SkelAnime skelAnime;
/* 0x1D4 */ EnDs2nActionFunc actionFunc;
/* 0x1D8 */ s16 limbRotTableY[DS2N_LIMB_MAX];
/* 0x1FE */ s16 limbRotTableZ[DS2N_LIMB_MAX];
/* 0x1D8 */ s16 fidgetTableY[DS2N_LIMB_MAX];
/* 0x1FE */ s16 fidgetTableZ[DS2N_LIMB_MAX];
/* 0x224 */ Vec3s headRot;
/* 0x22A */ Vec3s chestRot; // set by function, but not applied in limbdraw
/* 0x230 */ s16 blinkState;
+11 -12
View File
@@ -1470,10 +1470,9 @@ void EnFsn_Init(Actor* thisx, PlayState* play) {
EnFsn* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f);
// Note: adding 1 to FSN_LIMB_MAX due to bug in object_fsn, see bug in object_fsn.xml
SkelAnime_InitFlex(play, &this->skelAnime, &gFsnSkel, &gFsnIdleAnim, this->jointTable, this->morphTable,
FSN_LIMB_MAX + 1);
ENFSN_LIMB_MAX);
if (ENFSN_IS_SHOP(&this->actor)) {
this->actor.shape.rot.y = BINANG_ROT180(this->actor.shape.rot.y);
this->actor.flags &= ~ACTOR_FLAG_1;
@@ -1508,7 +1507,7 @@ void EnFsn_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
Actor_MoveWithGravity(&this->actor);
Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk27A, this->actor.focus.pos);
SubS_FillLimbRotTables(play, this->limbRotYTable, this->limbRotZTable, ARRAY_COUNT(this->limbRotYTable));
SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENFSN_LIMB_MAX);
EnFsn_Blink(this);
if (ENFSN_IS_SHOP(&this->actor) && EnFsn_HasItemsToSell()) {
EnFsn_UpdateJoystickInputState(this, play);
@@ -1630,7 +1629,7 @@ void EnFsn_DrawStickDirectionPrompts(EnFsn* this, PlayState* play) {
s32 EnFsn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnFsn* this = THIS;
s32 limbRotTableIdx;
s32 fidgetIndex;
if (limbIndex == FSN_LIMB_HEAD) {
Matrix_RotateXS(this->headRot.y, MTXMODE_APPLY);
@@ -1638,24 +1637,24 @@ s32 EnFsn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
if (ENFSN_IS_BACKROOM(&this->actor)) {
switch (limbIndex) {
case FSN_LIMB_TORSO:
limbRotTableIdx = 0;
fidgetIndex = 0;
break;
case FSN_LIMB_LEFT_HAND:
limbRotTableIdx = 1;
fidgetIndex = 1;
break;
case FSN_LIMB_HEAD:
limbRotTableIdx = 2;
fidgetIndex = 2;
break;
default:
limbRotTableIdx = 9;
fidgetIndex = 9;
break;
}
if (limbRotTableIdx < 9) {
rot->y += (s16)(Math_SinS(this->limbRotYTable[limbRotTableIdx]) * 200.0f);
rot->z += (s16)(Math_CosS(this->limbRotZTable[limbRotTableIdx]) * 200.0f);
if (fidgetIndex < 9) {
rot->y += (s16)(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f);
}
}
if (limbIndex == FSN_LIMB_TOUPEE) {
+6 -4
View File
@@ -13,6 +13,8 @@
#define ENFSN_ANGRY (1 << 8)
#define ENFSN_CALM_DOWN (1 << 9)
#define ENFSN_LIMB_MAX FSN_LIMB_MAX + 1 // Note: adding 1 to FSN_LIMB_MAX due to bug in the skeleton, see bug in object_fsn.xml
struct EnFsn;
typedef void (*EnFsnActionFunc)(struct EnFsn*, PlayState*);
@@ -24,12 +26,12 @@ typedef struct EnFsn {
/* 0x1D4 */ EnFsnActionFunc actionFunc;
/* 0x1D8 */ EnFsnActionFunc prevActionFunc; // Used to return to correct browsing function
/* 0x1DC */ ColliderCylinder collider;
/* 0x228 */ s16 limbRotYTable[19];
/* 0x24E */ s16 limbRotZTable[19];
/* 0x228 */ s16 fidgetTableY[ENFSN_LIMB_MAX];
/* 0x24E */ s16 fidgetTableZ[ENFSN_LIMB_MAX];
/* 0x274 */ Vec3s headRot;
/* 0x27A */ Vec3s unk27A; // Set but never used
/* 0x280 */ Vec3s jointTable[FSN_LIMB_MAX + 1]; // Note: adding 1 to FSN_LIMB_MAX due to bug in object_fsn, see bug in object_fsn.xml
/* 0x2F2 */ Vec3s morphTable[FSN_LIMB_MAX + 1];
/* 0x280 */ Vec3s jointTable[ENFSN_LIMB_MAX];
/* 0x2F2 */ Vec3s morphTable[ENFSN_LIMB_MAX];
/* 0x364 */ s16 eyeTexIndex;
/* 0x366 */ s16 blinkTimer;
/* 0x368 */ s16 cutsceneState;
+1 -1
View File
@@ -905,7 +905,7 @@ void EnGeg_Update(Actor* thisx, PlayState* play) {
func_80BB1FCC(this, play);
func_80BB2088(this, play);
func_80BB1C8C(this);
SubS_FillLimbRotTables(play, this->unk_238, this->unk_232, ARRAY_COUNT(this->unk_238));
SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGEG_FIDGET_TABLE_LEN);
func_80BB1D04(this);
func_80BB178C(this, play);
}
+4 -2
View File
@@ -7,6 +7,8 @@ struct EnGeg;
typedef void (*EnGegActionFunc)(struct EnGeg*, PlayState*);
#define ENGEG_FIDGET_TABLE_LEN 3
typedef struct EnGeg {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
@@ -14,8 +16,8 @@ typedef struct EnGeg {
/* 0x18C */ ColliderCylinder colliderCylinder;
/* 0x1D8 */ ColliderSphere colliderSphere;
/* 0x230 */ u16 unk_230;
/* 0x232 */ s16 unk_232[3];
/* 0x238 */ s16 unk_238[3];
/* 0x232 */ s16 fidgetTableZ[ENGEG_FIDGET_TABLE_LEN];
/* 0x238 */ s16 fidgetTableY[ENGEG_FIDGET_TABLE_LEN];
/* 0x23E */ s16 unk_23E;
/* 0x240 */ s16 unk_240;
/* 0x242 */ s16 unk_242;
+10 -10
View File
@@ -1437,7 +1437,7 @@ s32 func_80950690(EnGm* this, PlayState* play) {
break;
}
SubS_FillLimbRotTables(play, this->unk_3D8, this->unk_3D2, ARRAY_COUNT(this->unk_3D8));
SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGM_FIDGET_TABLE_LEN);
return false;
}
@@ -1626,7 +1626,7 @@ void func_80950DB8(EnGm* this, PlayState* play) {
Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&sp34, &sp40), 4, 0x2AA8);
}
}
SubS_FillLimbRotTables(play, this->unk_3D8, this->unk_3D2, ARRAY_COUNT(this->unk_3D8));
SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGM_FIDGET_TABLE_LEN);
}
void func_80950F2C(EnGm* this, PlayState* play) {
@@ -1725,7 +1725,7 @@ void EnGm_Update(Actor* thisx, PlayState* play) {
s32 EnGm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
s32 pad;
EnGm* this = THIS;
s32 phi_v0;
s32 fidgetIndex;
if (limbIndex == 16) {
func_8094F3D0(this, play);
@@ -1733,25 +1733,25 @@ s32 EnGm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
switch (limbIndex) {
case 9:
phi_v0 = 0;
fidgetIndex = 0;
break;
case 10:
phi_v0 = 1;
fidgetIndex = 1;
break;
case 13:
phi_v0 = 2;
fidgetIndex = 2;
break;
default:
phi_v0 = 9;
fidgetIndex = 9;
break;
}
if ((this->unk_3A4 & 0x2000) && (phi_v0 < 9)) {
rot->y += (s16)(Math_SinS(this->unk_3D8[phi_v0]) * 200.0f);
rot->z += (s16)(Math_CosS(this->unk_3D2[phi_v0]) * 200.0f);
if ((this->unk_3A4 & 0x2000) && (fidgetIndex < 9)) {
rot->y += (s16)(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f);
}
return false;
+4 -2
View File
@@ -11,6 +11,8 @@ typedef void (*EnGmUnkFunc2)(struct EnGm*, PlayState*);
#define ENGM_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF)
#define ENGM_FIDGET_TABLE_LEN 3
typedef struct EnGm {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
@@ -61,8 +63,8 @@ typedef struct EnGm {
/* 0x3CC */ s16 unk_3CC;
/* 0x3CE */ s16 unk_3CE;
/* 0x3D0 */ s16 unk_3D0;
/* 0x3D2 */ s16 unk_3D2[3];
/* 0x3D8 */ s16 unk_3D8[3];
/* 0x3D2 */ s16 fidgetTableZ[ENGM_FIDGET_TABLE_LEN];
/* 0x3D8 */ s16 fidgetTableY[ENGM_FIDGET_TABLE_LEN];
/* 0x3DE */ s16 unk_3DE;
/* 0x3E0 */ s16 unk_3E0;
/* 0x3E2 */ s16 unk_3E2;
+11 -11
View File
@@ -2048,7 +2048,7 @@ void EnGo_Sleep(EnGo* this, PlayState* play) {
this->actor.shape.yOffset = ENGO_STANDING_Y_OFFSET;
}
SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY));
SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGO_FIDGET_TABLE_LEN);
Math_ApproachS(&this->actor.shape.rot.y, targetRot, 4, 0x2AA8);
}
@@ -2243,7 +2243,7 @@ void EnGo_HandleSpringArrivalCutscene(EnGo* this, PlayState* play) {
}
}
SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY));
SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGO_FIDGET_TABLE_LEN);
Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel);
}
}
@@ -2388,7 +2388,7 @@ void EnGo_Talk(EnGo* this, PlayState* play) {
Math_Vec3f_Copy(&thisPos, &this->actor.world.pos);
Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&thisPos, &targetPos), 4, 0x2AA8);
}
SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, ARRAY_COUNT(this->limbRotTableY));
SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGO_FIDGET_TABLE_LEN);
return;
}
@@ -2498,7 +2498,7 @@ void EnGo_Draw_NoSkeleton(EnGo* this, PlayState* play) {
s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnGo* this = THIS;
Vec3f worldPos;
s32 rotTableIndex;
s32 fidgetIndex;
if ((ENGO_GET_TYPE(&this->actor) == ENGO_MEDIGORON) && (limbIndex == GORON_LIMB_BODY)) {
Matrix_MultZero(&worldPos);
@@ -2508,25 +2508,25 @@ s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
switch (limbIndex) {
case GORON_LIMB_BODY:
rotTableIndex = 0;
fidgetIndex = 0;
break;
case GORON_LIMB_LEFT_UPPER_ARM:
rotTableIndex = 1;
fidgetIndex = 1;
break;
case GORON_LIMB_RIGHT_UPPER_ARM:
rotTableIndex = 2;
fidgetIndex = 2;
break;
default:
rotTableIndex = 9;
fidgetIndex = 9;
break;
}
if ((this->actionFlags & ENGO_FLAG_STANDING) && (rotTableIndex < 9)) {
rot->y += (s16)(Math_SinS(this->limbRotTableY[rotTableIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->limbRotTableZ[rotTableIndex]) * 200.0f);
if ((this->actionFlags & ENGO_FLAG_STANDING) && (fidgetIndex < 9)) {
rot->y += (s16)(Math_SinS(this->fidgetTableY[fidgetIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->fidgetTableZ[fidgetIndex]) * 200.0f);
}
return false;
}
+4 -2
View File
@@ -15,6 +15,8 @@ typedef s32 (*MsgEventFunc)(Actor*, PlayState*);
#define ENGO_PATH_INDEX_NONE 0xFF
#define ENGO_FIDGET_TABLE_LEN 3
#define ENGO_SNOW_EFFECT_COUNT 16
#define ENGO_OTHER_EFFECT_COUNT 16
#define ENGO_EFFECT_COUNT (ENGO_SNOW_EFFECT_COUNT + ENGO_OTHER_EFFECT_COUNT)
@@ -126,8 +128,8 @@ typedef struct EnGo {
/* 0x3C2 */ s16 cutsceneDelayTimer;
/* 0x3C4 */ s16 gatekeeperAnimState;
/* 0x3C6 */ s16 harmlessTimer;
/* 0x3C8 */ s16 limbRotTableZ[3];
/* 0x3CE */ s16 limbRotTableY[3];
/* 0x3C8 */ s16 fidgetTableZ[ENGO_FIDGET_TABLE_LEN];
/* 0x3CE */ s16 fidgetTableY[ENGO_FIDGET_TABLE_LEN];
/* 0x3D4 */ s16 surprisePhase;
/* 0x3D8 */ MsgEventFunc msgEventFunc;
/* 0x3DC */ s32 curAnimIndex;

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