1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-01 23:36:00 +00:00

Document Actor "Fidget Tables" (#2287)

* Document `func_80034F54` and related data

new name: `UpdateLimbOverrides`
reason:
- `0x814` and `0x940` constants
- `*_OverrideLimbDraw` functions

additionally:
- move constants into `z64animation.h`
- use these constant for existing formulas
- properly name corresponding actors' fields
- add occasional explicit limbs limit constants

* port over the MM "fidget" naming

* remove redundant comments
* move and rename `FIDGET_*` constants
* introduce a `FIDGET_SCALE` constant, as no other value is applied

* remove generally unrelated changes

* apply PR suggestion

Co-authored-by: mzxrules <mzxrules@gmail.com>

* fix (?) fidgetTable size

following the https://github.com/zeldaret/oot/pull/2287#discussion_r1832371833 suggestion

* remove an unused `struct EnMu` field @ `0x024A`

a continuation to the 211263295c
automatic padding commpensates its absence

* remove MM mention as "it would get unruly fast"

https://github.com/zeldaret/oot/pull/2287#discussion_r1833470468

* rename `overridePerLimb` -> `fidgetFrequency`

https://github.com/zeldaret/oot/pull/2287#discussion_r1837211873

* give better names to the constants

https://github.com/zeldaret/oot/pull/2287#discussion_r1837211873

* remove unnecesasry braces from a comment

https://github.com/zeldaret/oot/pull/2287#discussion_r1842642196

* make the comment multiline "officially"

* restore `limbIndex` naming for this PR

43afb7b7cb (r1842644602)

* apply a PR suggestion

https://github.com/zeldaret/oot/pull/2287#discussion_r1842787653

---------

Co-authored-by: mzxrules <mzxrules@gmail.com>
This commit is contained in:
Leonid Kapitonov 2024-11-27 19:50:44 +01:00 committed by GitHub
parent 33391c0a5b
commit 53962a2cd8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 97 additions and 78 deletions

View file

@ -14,6 +14,13 @@
#define MASS_IMMOVABLE 0xFF // Cannot be pushed by OC colliders
#define MASS_HEAVY 0xFE // Can only be pushed by OC colliders from actors with IMMOVABLE or HEAVY mass.
// These are default parameters used for "animation fidgeting", which procedurally generate actor idle animations.
// These calculations may be performed within individual actors, or by using fidget tables with `Actor_UpdateFidgetTables`.
#define FIDGET_FREQ_Y 0x814
#define FIDGET_FREQ_Z 0x940
#define FIDGET_FREQ_LIMB 0x32
#define FIDGET_AMPLITUDE 200.0f
struct Actor;
struct ActorEntry;
struct CollisionPoly;
@ -926,7 +933,7 @@ void func_80034BA0(struct PlayState* play, SkelAnime* skelAnime, OverrideLimbDra
void func_80034CC4(struct PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw,
PostLimbDraw postLimbDraw, Actor* actor, s16 alpha);
s16 func_80034DD4(Actor* actor, struct PlayState* play, s16 arg2, f32 arg3);
void func_80034F54(struct PlayState* play, s16* arg1, s16* arg2, s32 arg3);
void Actor_UpdateFidgetTables(struct PlayState* play, s16* fidgetTableY, s16* fidgetTableZ, s32 tableLen);
void Actor_Noop(Actor* actor, struct PlayState* play);
void Gfx_DrawDListOpa(struct PlayState* play, Gfx* dlist);

View file

@ -4441,13 +4441,24 @@ void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo,
frameCount, animationInfo->mode, animationInfo->morphFrames);
}
void func_80034F54(PlayState* play, s16* arg1, s16* arg2, s32 arg3) {
/**
* 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.
*/
void Actor_UpdateFidgetTables(PlayState* play, s16* fidgetTableY, s16* fidgetTableZ, s32 tableLen) {
u32 frames = play->gameplayFrames;
s32 i;
for (i = 0; i < arg3; i++) {
arg1[i] = (0x814 + 50 * i) * frames;
arg2[i] = (0x940 + 50 * i) * frames;
for (i = 0; i < tableLen; i++) {
fidgetTableY[i] = (FIDGET_FREQ_Y + FIDGET_FREQ_LIMB * i) * frames;
fidgetTableZ[i] = (FIDGET_FREQ_Z + FIDGET_FREQ_LIMB * i) * frames;
}
}

View file

@ -561,8 +561,8 @@ s32 EnDivingGame_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, V
}
if (this->notPlayingMinigame && (limbIndex == 8 || limbIndex == 9 || limbIndex == 12)) {
rot->y += Math_SinS((play->state.frames * (limbIndex * 50 + 0x814))) * 200.0f;
rot->z += Math_CosS((play->state.frames * (limbIndex * 50 + 0x940))) * 200.0f;
rot->y += Math_SinS((play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y))) * FIDGET_AMPLITUDE;
rot->z += Math_CosS((play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z))) * FIDGET_AMPLITUDE;
}
return 0;

View file

@ -278,8 +278,8 @@ s32 EnFu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
}
if (limbIndex == FU_LIMB_CHEST_MUSIC_BOX) {
rot->y += (Math_SinS((play->state.frames * (limbIndex * 50 + 0x814))) * 200.0f);
rot->z += (Math_CosS((play->state.frames * (limbIndex * 50 + 0x940))) * 200.0f);
rot->y += Math_SinS((play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y))) * FIDGET_AMPLITUDE;
rot->z += Math_CosS((play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z))) * FIDGET_AMPLITUDE;
}
return false;
}

View file

@ -777,8 +777,8 @@ s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
// The purpose of the state flag GE1_STATE_STOP_FIDGET is to skip this code, which this actor has in lieu of an idle
// animation.
if ((limbIndex == GE1_LIMB_TORSO) || (limbIndex == GE1_LIMB_L_FOREARM) || (limbIndex == GE1_LIMB_R_FOREARM)) {
rot->y += Math_SinS(play->state.frames * (limbIndex * 50 + 0x814)) * 200.0f;
rot->z += Math_CosS(play->state.frames * (limbIndex * 50 + 0x940)) * 200.0f;
rot->y += Math_SinS(play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y)) * FIDGET_AMPLITUDE;
rot->z += Math_CosS(play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z)) * FIDGET_AMPLITUDE;
}
return 0;
}

View file

@ -1033,7 +1033,7 @@ void EnGo_Update(Actor* thisx, PlayState* play) {
if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_FireGenericActionFunc ||
this->actionFunc == func_80A40B1C) {
func_80034F54(play, this->jointTable, this->morphTable, 18);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 18);
}
EnGo_UpdateShadow(this);
@ -1103,8 +1103,8 @@ s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Ve
}
if ((limb == 10) || (limb == 11) || (limb == 14)) {
rot->y += Math_SinS(this->jointTable[limb]) * 200.0f;
rot->z += Math_CosS(this->morphTable[limb]) * 200.0f;
rot->y += Math_SinS(this->fidgetTableY[limb]) * FIDGET_AMPLITUDE;
rot->z += Math_CosS(this->fidgetTableZ[limb]) * FIDGET_AMPLITUDE;
}
return 0;

View file

@ -22,7 +22,6 @@ typedef s16 (*callback2_80A3ED24)(PlayState*, struct EnGo*);
// /* 0x80 */ // Not Used
// /* 0x90 */ GORON1_DMT_BIGGORON,
#define EN_GO_EFFECT_COUNT 20
typedef struct EnGoEffect {
@ -55,8 +54,8 @@ typedef struct EnGo {
/* 0x021A */ s16 unk_21A;
/* 0x021C */ s16 unk_21C;
/* 0x021E */ s16 unk_21E;
/* 0x0220 */ s16 jointTable[18];
/* 0x0244 */ s16 morphTable[18];
/* 0x0220 */ s16 fidgetTableY[18];
/* 0x0244 */ s16 fidgetTableZ[18];
/* 0x0268 */ EnGoEffect effects[EN_GO_EFFECT_COUNT];
} EnGo; // size = 0x06C8

View file

@ -1995,7 +1995,7 @@ void EnGo2_Update(Actor* thisx, PlayState* play) {
#endif
this->actionFunc(this, play);
if (this->unk_211 == true) {
func_80034F54(play, this->unk_226, this->unk_24A, 18);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 18);
}
func_80A45288(this, play);
EnGo2_EyeMouthTexState(this);
@ -2048,8 +2048,8 @@ s32 EnGo2_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, V
Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
}
if ((limb == 10) || (limb == 11) || (limb == 14)) {
rot->y += Math_SinS(this->unk_226[limb]) * 200.0f;
rot->z += Math_CosS(this->unk_24A[limb]) * 200.0f;
rot->y += Math_SinS(this->fidgetTableY[limb]) * FIDGET_AMPLITUDE;
rot->z += Math_CosS(this->fidgetTableZ[limb]) * FIDGET_AMPLITUDE;
}
return 0;
}

View file

@ -92,8 +92,8 @@ typedef struct EnGo2 {
/* 0x021C */ char unk_21C[0x04];
/* 0x0220 */ f32 alpha; // Set to 0, used by func_80A45360, smoothed to this->actor.shape.shadowAlpha from either 0 or 255.0f
/* 0x0224 */ s16 blinkTimer;
/* 0x0226 */ s16 unk_226[18]; // Remains unknown
/* 0x024A */ s16 unk_24A[18]; // Remains unknown
/* 0x0226 */ s16 fidgetTableY[18];
/* 0x024A */ s16 fidgetTableZ[18];
/* 0x026E */ u16 trackingMode;
/* 0x0270 */ EnGoEffect effects[EN_GO2_EFFECT_COUNT];
/* 0x04A0 */ Vec3f subCamEye;

View file

@ -157,7 +157,7 @@ void func_80A505CC(Actor* thisx, PlayState* play) {
}
Npc_TrackPoint(&this->actor, &this->interactInfo, 6, NPC_TRACKING_HEAD_AND_TORSO);
func_80034F54(play, this->unk_2CC, this->unk_2EC, 16);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment);
@ -200,8 +200,8 @@ s32 EnGuest_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
}
if (limbIndex == 8 || limbIndex == 9 || limbIndex == 12) {
rot->y += Math_SinS(this->unk_2CC[limbIndex]) * 200.0f;
rot->z += Math_CosS(this->unk_2EC[limbIndex]) * 200.0f;
rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE;
rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE;
}
CLOSE_DISPS(play->state.gfxCtx, "../z_en_guest.c", 388);

View file

@ -18,8 +18,8 @@ typedef struct EnGuest {
/* 0x02A0 */ NpcInteractInfo interactInfo;
/* 0x02C8 */ s16 unk_2C8;
/* 0x02CA */ s16 unk_2CA;
/* 0x02CC */ s16 unk_2CC[16];
/* 0x02EC */ s16 unk_2EC[16];
/* 0x02CC */ s16 fidgetTableY[16];
/* 0x02EC */ s16 fidgetTableZ[16];
/* 0x030C */ s8 osAnimeObjectSlot;
/* 0x030D */ u8 unk_30D;
/* 0x030E */ u8 unk_30E;

View file

@ -1252,7 +1252,7 @@ void EnHy_Walk(EnHy* this, PlayState* play) {
}
void EnHy_Fidget(EnHy* this, PlayState* play) {
func_80034F54(play, this->fidgetTableY, this->fidgetTableZ, 16);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENHY_LIMB_MAX);
}
void EnHy_DoNothing(EnHy* this, PlayState* play) {
@ -1265,7 +1265,7 @@ void EnHy_SetupPace(EnHy* this, PlayState* play) {
this->actionFunc = EnHy_Pace;
}
func_80034F54(play, this->fidgetTableY, this->fidgetTableZ, 16);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENHY_LIMB_MAX);
}
void EnHy_Pace(EnHy* this, PlayState* play) {
@ -1390,8 +1390,8 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if ((limbIndex == ENHY_LIMB_TORSO) || (limbIndex == ENHY_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == ENHY_LIMB_RIGHT_UPPER_ARM)) {
rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f;
rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f;
rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE;
rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE;
}
CLOSE_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2228);

View file

@ -74,8 +74,8 @@ typedef struct EnHy {
/* 0x0216 */ char unk_216[2]; // unused
/* 0x0218 */ s16 curEyeIndex;
/* 0x021A */ s16 nextEyeIndexTimer;
/* 0x021C */ s16 fidgetTableY[16];
/* 0x023C */ s16 fidgetTableZ[16];
/* 0x021C */ s16 fidgetTableY[ENHY_LIMB_MAX];
/* 0x023C */ s16 fidgetTableZ[ENHY_LIMB_MAX];
/* 0x025C */ f32 interactRange;
/* 0x0260 */ s32 getItemId;
/* 0x0264 */ Vec3f modelOffset;

View file

@ -709,7 +709,7 @@ s32 func_80A97D68(EnKo* this, PlayState* play) {
s32 func_80A97E18(EnKo* this, PlayState* play) {
s16 trackingMode;
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16);
if (EnKo_IsWithinTalkAngle(this) == true) {
trackingMode = NPC_TRACKING_HEAD_AND_TORSO;
} else {
@ -728,7 +728,7 @@ s32 func_80A97EB0(EnKo* this, PlayState* play) {
s16 trackingMode;
s32 result;
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16);
result = EnKo_IsWithinTalkAngle(this);
trackingMode = (result == true) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE;
Npc_TrackPoint(&this->actor, &this->interactInfo, 2, trackingMode);
@ -736,7 +736,7 @@ s32 func_80A97EB0(EnKo* this, PlayState* play) {
}
s32 func_80A97F20(EnKo* this, PlayState* play) {
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16);
Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY);
return 1;
}
@ -748,7 +748,7 @@ s32 func_80A97F70(EnKo* this, PlayState* play) {
if ((this->skelAnime.animation == &gKokiriBlockingAnim) == false) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_BLOCKING_STATIC);
}
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16);
trackingMode = NPC_TRACKING_HEAD_AND_TORSO;
} else {
if ((this->skelAnime.animation == &gKokiriCuttingGrassAnim) == false) {
@ -768,7 +768,7 @@ s32 func_80A98034(EnKo* this, PlayState* play) {
if ((this->skelAnime.animation == &gKokiriBlockingAnim) == false) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENKO_ANIM_BLOCKING_STATIC);
}
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16);
result = EnKo_IsWithinTalkAngle(this);
trackingMode = (result == true) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE;
} else {
@ -784,7 +784,7 @@ s32 func_80A98034(EnKo* this, PlayState* play) {
// Same as func_80A97F20
s32 func_80A98124(EnKo* this, PlayState* play) {
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16);
Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_FULL_BODY);
return 1;
}
@ -798,7 +798,7 @@ s32 func_80A98174(EnKo* this, PlayState* play) {
this->skelAnime.playSpeed = 1.0f;
}
if (this->skelAnime.playSpeed == 0.0f) {
func_80034F54(play, this->unk_2E4, this->unk_304, 16);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16);
}
Npc_TrackPoint(&this->actor, &this->interactInfo, 2,
(this->skelAnime.playSpeed == 0.0f) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE);
@ -1335,8 +1335,8 @@ s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
Matrix_Translate(-1200.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == 8 || limbIndex == 9 || limbIndex == 12) {
rot->y += Math_SinS(this->unk_2E4[limbIndex]) * 200.0f;
rot->z += Math_CosS(this->unk_304[limbIndex]) * 200.0f;
rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE;
rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE;
}
return false;
}

View file

@ -28,8 +28,8 @@ typedef struct EnKo {
/* 0x0220 */ f32 modelAlpha;
/* 0x0224 */ Vec3s jointTable[16];
/* 0x0284 */ Vec3s morphTable[16];
/* 0x02E4 */ s16 unk_2E4[16];
/* 0x0304 */ s16 unk_304[16];
/* 0x02E4 */ s16 fidgetTableY[16];
/* 0x0304 */ s16 fidgetTableZ[16];
} EnKo; // size = 0x0324
typedef enum KokiriChildren {

View file

@ -416,7 +416,7 @@ void EnKz_PreMweepWait(EnKz* this, PlayState* play) {
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->actionFunc = EnKz_SetupMweep;
} else {
func_80034F54(play, this->unk_2A6, this->unk_2BE, 12);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 12);
}
}
@ -479,7 +479,7 @@ void EnKz_Wait(EnKz* this, PlayState* play) {
this->actionFunc = EnKz_SetupGetItem;
EnKz_SetupGetItem(this, play);
} else {
func_80034F54(play, this->unk_2A6, this->unk_2BE, 12);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 12);
}
}
@ -546,8 +546,8 @@ s32 EnKz_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
EnKz* this = (EnKz*)thisx;
if (limbIndex == 8 || limbIndex == 9 || limbIndex == 10) {
rot->y += Math_SinS(this->unk_2A6[limbIndex]) * 200.0f;
rot->z += Math_CosS(this->unk_2BE[limbIndex]) * 200.0f;
rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE;
rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE;
}
if (limbIndex) {}
return false;

View file

@ -24,8 +24,8 @@ typedef struct EnKz {
/* 0x0214 */ s16 returnToCamId;
/* 0x0216 */ Vec3s jointTable[12];
/* 0x025E */ Vec3s morphTable[12];
/* 0x02A6 */ s16 unk_2A6[12];
/* 0x02BE */ s16 unk_2BE[12];
/* 0x02A6 */ s16 fidgetTableY[12];
/* 0x02BE */ s16 fidgetTableZ[12];
} EnKz; // size = 0x02D8
#endif

View file

@ -695,7 +695,7 @@ void EnMd_Destroy(Actor* thisx, PlayState* play) {
void func_80AAB874(EnMd* this, PlayState* play) {
if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) {
func_80034F54(play, this->unk_214, this->unk_236, ENMD_LIMB_MAX);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX);
} else if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (this->unk_20B != 7)) {
func_80AAA92C(this, 7);
}
@ -705,7 +705,7 @@ void func_80AAB874(EnMd* this, PlayState* play) {
void func_80AAB8F8(EnMd* this, PlayState* play) {
if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) {
func_80034F54(play, this->unk_214, this->unk_236, ENMD_LIMB_MAX);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX);
}
func_80AAA93C(this);
}
@ -757,7 +757,7 @@ void func_80AAB948(EnMd* this, PlayState* play) {
}
if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) {
func_80034F54(play, this->unk_214, this->unk_236, ENMD_LIMB_MAX);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX);
}
if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (play->sceneId == SCENE_LOST_WOODS)) {
@ -795,7 +795,7 @@ void func_80AABC10(EnMd* this, PlayState* play) {
}
void func_80AABD0C(EnMd* this, PlayState* play) {
func_80034F54(play, this->unk_214, this->unk_236, ENMD_LIMB_MAX);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX);
func_80AAA93C(this);
if (!(EnMd_FollowPath(this, play)) || (this->waypoint != 0)) {
@ -853,8 +853,8 @@ s32 EnMd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if (((limbIndex == ENMD_LIMB_TORSO) || (limbIndex == ENMD_LIMB_LEFT_UPPER_ARM)) ||
(limbIndex == ENMD_LIMB_RIGHT_UPPER_ARM)) {
rot->y += Math_SinS(this->unk_214[limbIndex]) * 200.0f;
rot->z += Math_CosS(this->unk_236[limbIndex]) * 200.0f;
rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE;
rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE;
}
return false;

View file

@ -43,8 +43,8 @@ typedef struct EnMd {
/* 0x020E */ s16 eyeIdx;
/* 0x0210 */ s16 alpha;
/* 0x0212 */ s16 waypoint;
/* 0x0214 */ s16 unk_214[ENMD_LIMB_MAX];
/* 0x0236 */ s16 unk_236[ENMD_LIMB_MAX];
/* 0x0214 */ s16 fidgetTableY[ENMD_LIMB_MAX];
/* 0x0236 */ s16 fidgetTableZ[ENMD_LIMB_MAX];
/* 0x0258 */ Vec3s jointTable[ENMD_LIMB_MAX];
/* 0x02BE */ Vec3s morphTable[ENMD_LIMB_MAX];
} EnMd; // size = 0x0324

View file

@ -152,7 +152,7 @@ void EnMu_Destroy(Actor* thisx, PlayState* play) {
}
void EnMu_Pose(EnMu* this, PlayState* play) {
func_80034F54(play, this->unk_20A, this->unk_22A, 16);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16);
}
void EnMu_Update(Actor* thisx, PlayState* play) {
@ -183,8 +183,8 @@ s32 EnMu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
if ((limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 11) || (limbIndex == 12) ||
(limbIndex == 13) || (limbIndex == 14)) {
rot->y += Math_SinS(this->unk_20A[limbIndex]) * 200.0f;
rot->z += Math_CosS(this->unk_22A[limbIndex]) * 200.0f;
rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE;
rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE;
}
return false;
}

View file

@ -15,8 +15,8 @@ typedef struct EnMu {
/* 0x0194 */ ColliderCylinder collider;
/* 0x01E0 */ NpcInteractInfo npcInfo;
/* 0x0208 */ u16 defaultTextId;
/* 0x020A */ s16 unk_20A[16];
/* 0x022A */ s16 unk_22A[17];
/* 0x020A */ s16 fidgetTableY[16];
/* 0x022A */ s16 fidgetTableZ[16];
} EnMu; // size = 0x024C
#endif

View file

@ -578,8 +578,10 @@ s32 EnNiwLady_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3
}
if (this->unk_275 != 0) {
if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) {
rot->y += (Math_SinS((play->state.frames * ((limbIndex * 0x32) + 0x814))) * 200.0f);
rot->z += (Math_CosS((play->state.frames * ((limbIndex * 0x32) + 0x940))) * 200.0f);
// clang-format off
rot->y += Math_SinS((play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y))) * FIDGET_AMPLITUDE;
rot->z += Math_CosS((play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z))) * FIDGET_AMPLITUDE;
// clang-format on
}
}
return false;

View file

@ -336,7 +336,7 @@ void EnSth_Update2(Actor* thisx, PlayState* play) {
s32 EnSth_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnSth* this = (EnSth*)thisx;
s32 temp_v1;
s32 fidgetFrequency;
if (limbIndex == 15) {
rot->x += this->headRot.y;
@ -350,9 +350,9 @@ s32 EnSth_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
}
if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) {
temp_v1 = limbIndex * 0x32;
rot->y += (Math_SinS(play->state.frames * (temp_v1 + 0x814)) * 200.0f);
rot->z += (Math_CosS(play->state.frames * (temp_v1 + 0x940)) * 200.0f);
fidgetFrequency = limbIndex * FIDGET_FREQ_LIMB;
rot->y += Math_SinS(play->state.frames * (fidgetFrequency + FIDGET_FREQ_Y)) * FIDGET_AMPLITUDE;
rot->z += Math_CosS(play->state.frames * (fidgetFrequency + FIDGET_FREQ_Z)) * FIDGET_AMPLITUDE;
}
return 0;
}

View file

@ -1282,10 +1282,10 @@ s32 EnTa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
this->stateFlags &= ~TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM;
} else if ((limbIndex == ENTA_LIMB_CHEST) || (limbIndex == ENTA_LIMB_LEFT_ARM) ||
(limbIndex == ENTA_LIMB_RIGHT_ARM)) {
s32 limbIdx50 = limbIndex * 50;
s32 fidgetFrequency = limbIndex * FIDGET_FREQ_LIMB;
rot->y += Math_SinS(play->state.frames * (limbIdx50 + 0x814)) * 200.0f;
rot->z += Math_CosS(play->state.frames * (limbIdx50 + 0x940)) * 200.0f;
rot->y += Math_SinS(play->state.frames * (fidgetFrequency + FIDGET_FREQ_Y)) * FIDGET_AMPLITUDE;
rot->z += Math_CosS(play->state.frames * (fidgetFrequency + FIDGET_FREQ_Z)) * FIDGET_AMPLITUDE;
}
return false;

View file

@ -612,7 +612,7 @@ void EnZo_Destroy(Actor* thisx, PlayState* play) {
void EnZo_Standing(EnZo* this, PlayState* play) {
s16 angle;
func_80034F54(play, this->unk_656, this->unk_67E, 20);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 20);
EnZo_SetAnimation(this);
if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
this->trackingMode = NPC_TRACKING_FULL_BODY;
@ -654,7 +654,7 @@ void EnZo_Surface(EnZo* this, PlayState* play) {
}
void EnZo_TreadWater(EnZo* this, PlayState* play) {
func_80034F54(play, this->unk_656, this->unk_67E, 20);
Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 20);
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->canSpeak = true;
this->trackingMode = NPC_TRACKING_FULL_BODY;
@ -770,8 +770,8 @@ s32 EnZo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
}
if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 12)) {
rot->y += (Math_SinS(this->unk_656[limbIndex]) * 200.0f);
rot->z += (Math_CosS(this->unk_67E[limbIndex]) * 200.0f);
rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE;
rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE;
}
return 0;

View file

@ -38,8 +38,8 @@ typedef struct EnZo {
/* 0x0650 */ s16 timeToDive;
/* 0x0652 */ s16 blinkTimer;
/* 0x0654 */ s16 eyeTexture;
/* 0x0656 */ s16 unk_656[20];
/* 0x067E */ s16 unk_67E[20];
/* 0x0656 */ s16 fidgetTableY[20];
/* 0x067E */ s16 fidgetTableZ[20];
} EnZo; // size = 0x06A8
#endif