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

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
This commit is contained in:
feacur 2024-11-07 01:02:55 +01:00
parent 6f59f4f146
commit 1fcacd202e
27 changed files with 97 additions and 92 deletions

View file

@ -14,6 +14,14 @@
#define MASS_IMMOVABLE 0xFF // Cannot be pushed by OC colliders #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. #define MASS_HEAVY 0xFE // Can only be pushed by OC colliders from actors with IMMOVABLE or HEAVY mass.
// These constants are the [default] parameters for the ubiqutous "fidgeting" formulas.
// Some actors call `Actor_UpdateFidgetTables` function and cache their results in `fidgetTable*` fields.
// Others compute them on the fly. Both variants are applied inside `*_OverrideLimbDraw` as input angles.
#define FIDGET_ADD_Y 0x814
#define FIDGET_ADD_Z 0x940
#define FIDGET_MUL_I 0x32
#define FIDGET_SCALE 200.0f
struct Actor; struct Actor;
struct ActorEntry; struct ActorEntry;
struct CollisionPoly; struct CollisionPoly;
@ -917,7 +925,7 @@ void func_80034BA0(struct PlayState* play, SkelAnime* skelAnime, OverrideLimbDra
void func_80034CC4(struct PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, void func_80034CC4(struct PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw,
PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); PostLimbDraw postLimbDraw, Actor* actor, s16 alpha);
s16 func_80034DD4(Actor* actor, struct PlayState* play, s16 arg2, f32 arg3); s16 func_80034DD4(Actor* actor, struct PlayState* play, s16 arg2, f32 arg3);
void UpdateLimbOverrides(struct PlayState* play, s16* tableY, s16* tableZ, s32 count); void Actor_UpdateFidgetTables(struct PlayState* play, s16* fidgetTableY, s16* fidgetTableZ, s32 tableLen);
void Actor_Noop(Actor* actor, struct PlayState* play); void Actor_Noop(Actor* actor, struct PlayState* play);
void Gfx_DrawDListOpa(struct PlayState* play, Gfx* dlist); void Gfx_DrawDListOpa(struct PlayState* play, Gfx* dlist);

View file

@ -16,13 +16,6 @@ struct SkelAnime;
#define LIMB_DONE 0xFF #define LIMB_DONE 0xFF
// These constants are ubiqutous limb override formulas parameters.
// Some actors call `UpdateLimbOverrides` function and cache their results in `limbOverrides*` tables.
// Others compute them on the fly. Both variants are applied inside `*_OverrideLimbDraw` as input angles.
#define LIMB_OVERRIDE_BASE_Y 0x814
#define LIMB_OVERRIDE_BASE_Z 0x940
#define LIMB_OVERRIDE_PER_I 0x32
typedef struct StandardLimb { typedef struct StandardLimb {
/* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent
/* 0x06 */ u8 child; /* 0x06 */ u8 child;

View file

@ -4432,16 +4432,26 @@ void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo,
frameCount, animationInfo->mode, animationInfo->morphFrames); frameCount, animationInfo->mode, animationInfo->morphFrames);
} }
/* /**
* computes `.limbOverrides` values for `*_OverrideLimbDraw` functions * 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: MM gets this function unused in favor of `SubS_UpdateFidgetTables` @ `z_sub_s.c`.
*/ */
void UpdateLimbOverrides(PlayState* play, s16* tableY, s16* tableZ, s32 count) { void Actor_UpdateFidgetTables(PlayState* play, s16* fidgetTableY, s16* fidgetTableZ, s32 tableLen) {
u32 frames = play->gameplayFrames; u32 frames = play->gameplayFrames;
s32 i; s32 i;
for (i = 0; i < count; i++) { for (i = 0; i < tableLen; i++) {
tableY[i] = (LIMB_OVERRIDE_BASE_Y + LIMB_OVERRIDE_PER_I * i) * frames; fidgetTableY[i] = (FIDGET_ADD_Y + FIDGET_MUL_I * i) * frames;
tableZ[i] = (LIMB_OVERRIDE_BASE_Z + LIMB_OVERRIDE_PER_I * i) * frames; fidgetTableZ[i] = (FIDGET_ADD_Z + FIDGET_MUL_I * i) * frames;
} }
} }

View file

@ -561,9 +561,8 @@ s32 EnDivingGame_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, V
} }
if (this->notPlayingMinigame && (limbIndex == 8 || limbIndex == 9 || limbIndex == 12)) { if (this->notPlayingMinigame && (limbIndex == 8 || limbIndex == 9 || limbIndex == 12)) {
// pad = limbIndex * LIMB_OVERRIDE_PER_I; // likely rot->y += Math_SinS((play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Y))) * FIDGET_SCALE;
rot->y += Math_SinS((play->state.frames * (limbIndex * LIMB_OVERRIDE_PER_I + LIMB_OVERRIDE_BASE_Y))) * 200.0f; rot->z += Math_CosS((play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Z))) * FIDGET_SCALE;
rot->z += Math_CosS((play->state.frames * (limbIndex * LIMB_OVERRIDE_PER_I + LIMB_OVERRIDE_BASE_Z))) * 200.0f;
} }
return 0; return 0;

View file

@ -278,9 +278,8 @@ s32 EnFu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
} }
if (limbIndex == FU_LIMB_CHEST_MUSIC_BOX) { if (limbIndex == FU_LIMB_CHEST_MUSIC_BOX) {
// pad = limbIndex * LIMB_OVERRIDE_PER_I; // likely rot->y += Math_SinS((play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Y))) * FIDGET_SCALE;
rot->y += Math_SinS((play->state.frames * (limbIndex * LIMB_OVERRIDE_PER_I + LIMB_OVERRIDE_BASE_Y))) * 200.0f; rot->z += Math_CosS((play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Z))) * FIDGET_SCALE;
rot->z += Math_CosS((play->state.frames * (limbIndex * LIMB_OVERRIDE_PER_I + LIMB_OVERRIDE_BASE_Z))) * 200.0f;
} }
return false; return false;
} }

View file

@ -777,9 +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 // 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. // animation.
if ((limbIndex == GE1_LIMB_TORSO) || (limbIndex == GE1_LIMB_L_FOREARM) || (limbIndex == GE1_LIMB_R_FOREARM)) { if ((limbIndex == GE1_LIMB_TORSO) || (limbIndex == GE1_LIMB_L_FOREARM) || (limbIndex == GE1_LIMB_R_FOREARM)) {
// pad = limbIndex * LIMB_OVERRIDE_PER_I; // likely rot->y += Math_SinS(play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Y)) * FIDGET_SCALE;
rot->y += Math_SinS(play->state.frames * (limbIndex * LIMB_OVERRIDE_PER_I + LIMB_OVERRIDE_BASE_Y)) * 200.0f; rot->z += Math_CosS(play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Z)) * FIDGET_SCALE;
rot->z += Math_CosS(play->state.frames * (limbIndex * LIMB_OVERRIDE_PER_I + LIMB_OVERRIDE_BASE_Z)) * 200.0f;
} }
return 0; return 0;
} }

View file

@ -1033,7 +1033,7 @@ void EnGo_Update(Actor* thisx, PlayState* play) {
if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_FireGenericActionFunc || if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_FireGenericActionFunc ||
this->actionFunc == func_80A40B1C) { this->actionFunc == func_80A40B1C) {
UpdateLimbOverrides(play, this->limbOverridesY, this->limbOverridesZ, GORON_LIMB_MAX); Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, GORON_LIMB_MAX);
} }
EnGo_UpdateShadow(this); 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)) { if ((limb == 10) || (limb == 11) || (limb == 14)) {
rot->y += Math_SinS(this->limbOverridesY[limb]) * 200.0f; rot->y += Math_SinS(this->fidgetTableY[limb]) * FIDGET_SCALE;
rot->z += Math_CosS(this->limbOverridesZ[limb]) * 200.0f; rot->z += Math_CosS(this->fidgetTableZ[limb]) * FIDGET_SCALE;
} }
return 0; return 0;

View file

@ -56,8 +56,8 @@ typedef struct EnGo {
/* 0x021A */ s16 unk_21A; /* 0x021A */ s16 unk_21A;
/* 0x021C */ s16 unk_21C; /* 0x021C */ s16 unk_21C;
/* 0x021E */ s16 unk_21E; /* 0x021E */ s16 unk_21E;
/* 0x0220 */ s16 limbOverridesY[GORON_LIMB_MAX]; /* 0x0220 */ s16 fidgetTableY[GORON_LIMB_MAX];
/* 0x0244 */ s16 limbOverridesZ[GORON_LIMB_MAX]; /* 0x0244 */ s16 fidgetTableZ[GORON_LIMB_MAX];
/* 0x0268 */ EnGoEffect effects[EN_GO_EFFECT_COUNT]; /* 0x0268 */ EnGoEffect effects[EN_GO_EFFECT_COUNT];
} EnGo; // size = 0x06C8 } EnGo; // size = 0x06C8

View file

@ -1995,7 +1995,7 @@ void EnGo2_Update(Actor* thisx, PlayState* play) {
#endif #endif
this->actionFunc(this, play); this->actionFunc(this, play);
if (this->unk_211 == true) { if (this->unk_211 == true) {
UpdateLimbOverrides(play, this->limbOverridesY, this->limbOverridesZ, GORON2_LIMB_MAX); Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, GORON2_LIMB_MAX);
} }
func_80A45288(this, play); func_80A45288(this, play);
EnGo2_EyeMouthTexState(this); 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); Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
} }
if ((limb == 10) || (limb == 11) || (limb == 14)) { if ((limb == 10) || (limb == 11) || (limb == 14)) {
rot->y += Math_SinS(this->limbOverridesY[limb]) * 200.0f; rot->y += Math_SinS(this->fidgetTableY[limb]) * FIDGET_SCALE;
rot->z += Math_CosS(this->limbOverridesZ[limb]) * 200.0f; rot->z += Math_CosS(this->fidgetTableZ[limb]) * FIDGET_SCALE;
} }
return 0; return 0;
} }

View file

@ -94,8 +94,8 @@ typedef struct EnGo2 {
/* 0x021C */ char unk_21C[0x04]; /* 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 /* 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; /* 0x0224 */ s16 blinkTimer;
/* 0x0226 */ s16 limbOverridesY[GORON2_LIMB_MAX]; /* 0x0226 */ s16 fidgetTableY[GORON2_LIMB_MAX];
/* 0x024A */ s16 limbOverridesZ[GORON2_LIMB_MAX]; /* 0x024A */ s16 fidgetTableZ[GORON2_LIMB_MAX];
/* 0x026E */ u16 trackingMode; /* 0x026E */ u16 trackingMode;
/* 0x0270 */ EnGoEffect effects[EN_GO2_EFFECT_COUNT]; /* 0x0270 */ EnGoEffect effects[EN_GO2_EFFECT_COUNT];
/* 0x04A0 */ Vec3f subCamEye; /* 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); Npc_TrackPoint(&this->actor, &this->interactInfo, 6, NPC_TRACKING_HEAD_AND_TORSO);
UpdateLimbOverrides(play, this->limbOverridesY, this->limbOverridesZ, GUEST_LIMB_MAX); Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, GUEST_LIMB_MAX);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); 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) { if (limbIndex == 8 || limbIndex == 9 || limbIndex == 12) {
rot->y += Math_SinS(this->limbOverridesY[limbIndex]) * 200.0f; rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_SCALE;
rot->z += Math_CosS(this->limbOverridesZ[limbIndex]) * 200.0f; rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_SCALE;
} }
CLOSE_DISPS(play->state.gfxCtx, "../z_en_guest.c", 388); CLOSE_DISPS(play->state.gfxCtx, "../z_en_guest.c", 388);

View file

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

View file

@ -1252,7 +1252,7 @@ void EnHy_Walk(EnHy* this, PlayState* play) {
} }
void EnHy_Fidget(EnHy* this, PlayState* play) { void EnHy_Fidget(EnHy* this, PlayState* play) {
UpdateLimbOverrides(play, this->limbOverridesY, this->limbOverridesZ, ENHY_LIMB_MAX); Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENHY_LIMB_MAX);
} }
void EnHy_DoNothing(EnHy* this, PlayState* play) { void EnHy_DoNothing(EnHy* this, PlayState* play) {
@ -1265,7 +1265,7 @@ void EnHy_SetupPace(EnHy* this, PlayState* play) {
this->actionFunc = EnHy_Pace; this->actionFunc = EnHy_Pace;
} }
UpdateLimbOverrides(play, this->limbOverridesY, this->limbOverridesZ, ENHY_LIMB_MAX); Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENHY_LIMB_MAX);
} }
void EnHy_Pace(EnHy* this, PlayState* play) { 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) || if ((limbIndex == ENHY_LIMB_TORSO) || (limbIndex == ENHY_LIMB_LEFT_UPPER_ARM) ||
(limbIndex == ENHY_LIMB_RIGHT_UPPER_ARM)) { (limbIndex == ENHY_LIMB_RIGHT_UPPER_ARM)) {
rot->y += Math_SinS(this->limbOverridesY[limbIndex]) * 200.0f; rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_SCALE;
rot->z += Math_CosS(this->limbOverridesZ[limbIndex]) * 200.0f; rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_SCALE;
} }
CLOSE_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2228); 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 /* 0x0216 */ char unk_216[2]; // unused
/* 0x0218 */ s16 curEyeIndex; /* 0x0218 */ s16 curEyeIndex;
/* 0x021A */ s16 nextEyeIndexTimer; /* 0x021A */ s16 nextEyeIndexTimer;
/* 0x021C */ s16 limbOverridesY[ENHY_LIMB_MAX]; /* 0x021C */ s16 fidgetTableY[ENHY_LIMB_MAX];
/* 0x023C */ s16 limbOverridesZ[ENHY_LIMB_MAX]; /* 0x023C */ s16 fidgetTableZ[ENHY_LIMB_MAX];
/* 0x025C */ f32 interactRange; /* 0x025C */ f32 interactRange;
/* 0x0260 */ s32 getItemId; /* 0x0260 */ s32 getItemId;
/* 0x0264 */ Vec3f modelOffset; /* 0x0264 */ Vec3f modelOffset;

View file

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

View file

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

View file

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

View file

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

View file

@ -695,7 +695,7 @@ void EnMd_Destroy(Actor* thisx, PlayState* play) {
void func_80AAB874(EnMd* this, PlayState* play) { void func_80AAB874(EnMd* this, PlayState* play) {
if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) {
UpdateLimbOverrides(play, this->limbOverridesY, this->limbOverridesZ, 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)) { } else if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (this->unk_20B != 7)) {
func_80AAA92C(this, 7); func_80AAA92C(this, 7);
} }
@ -705,7 +705,7 @@ void func_80AAB874(EnMd* this, PlayState* play) {
void func_80AAB8F8(EnMd* this, PlayState* play) { void func_80AAB8F8(EnMd* this, PlayState* play) {
if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) {
UpdateLimbOverrides(play, this->limbOverridesY, this->limbOverridesZ, ENMD_LIMB_MAX); Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX);
} }
func_80AAA93C(this); func_80AAA93C(this);
} }
@ -757,7 +757,7 @@ void func_80AAB948(EnMd* this, PlayState* play) {
} }
if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) {
UpdateLimbOverrides(play, this->limbOverridesY, this->limbOverridesZ, 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)) { 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) { void func_80AABD0C(EnMd* this, PlayState* play) {
UpdateLimbOverrides(play, this->limbOverridesY, this->limbOverridesZ, ENMD_LIMB_MAX); Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX);
func_80AAA93C(this); func_80AAA93C(this);
if (!(EnMd_FollowPath(this, play)) || (this->waypoint != 0)) { 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)) || if (((limbIndex == ENMD_LIMB_TORSO) || (limbIndex == ENMD_LIMB_LEFT_UPPER_ARM)) ||
(limbIndex == ENMD_LIMB_RIGHT_UPPER_ARM)) { (limbIndex == ENMD_LIMB_RIGHT_UPPER_ARM)) {
rot->y += Math_SinS(this->limbOverridesY[limbIndex]) * 200.0f; rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_SCALE;
rot->z += Math_CosS(this->limbOverridesZ[limbIndex]) * 200.0f; rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_SCALE;
} }
return false; return false;

View file

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

View file

@ -152,7 +152,7 @@ void EnMu_Destroy(Actor* thisx, PlayState* play) {
} }
void EnMu_Pose(EnMu* this, PlayState* play) { void EnMu_Pose(EnMu* this, PlayState* play) {
UpdateLimbOverrides(play, this->limbOverridesY, this->limbOverridesZ, MU_LIMB_MAX); Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, MU_LIMB_MAX);
} }
void EnMu_Update(Actor* thisx, PlayState* play) { 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) || if ((limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 11) || (limbIndex == 12) ||
(limbIndex == 13) || (limbIndex == 14)) { (limbIndex == 13) || (limbIndex == 14)) {
rot->y += Math_SinS(this->limbOverridesY[limbIndex]) * 200.0f; rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_SCALE;
rot->z += Math_CosS(this->limbOverridesZ[limbIndex]) * 200.0f; rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_SCALE;
} }
return false; return false;
} }

View file

@ -8,7 +8,7 @@ struct EnMu;
typedef void (*EnMuActionFunc)(struct EnMu*, struct PlayState*); typedef void (*EnMuActionFunc)(struct EnMu*, struct PlayState*);
#define MU_LIMB_MAX 16 // @note: correct, because `UpdateLimbOverrides` uses it #define MU_LIMB_MAX 16 // @note: correct, because `Actor_UpdateFidgetTables` uses it
#define MU_LIMB_MAX_BUG 17 // @bug: should be the same value #define MU_LIMB_MAX_BUG 17 // @bug: should be the same value
typedef struct EnMu { typedef struct EnMu {
@ -18,8 +18,8 @@ typedef struct EnMu {
/* 0x0194 */ ColliderCylinder collider; /* 0x0194 */ ColliderCylinder collider;
/* 0x01E0 */ NpcInteractInfo npcInfo; /* 0x01E0 */ NpcInteractInfo npcInfo;
/* 0x0208 */ u16 defaultTextId; /* 0x0208 */ u16 defaultTextId;
/* 0x020A */ s16 limbOverridesY[MU_LIMB_MAX]; /* 0x020A */ s16 fidgetTableY[MU_LIMB_MAX];
/* 0x022A */ s16 limbOverridesZ[MU_LIMB_MAX_BUG]; /* 0x022A */ s16 fidgetTableZ[MU_LIMB_MAX_BUG];
} EnMu; // size = 0x024C } EnMu; // size = 0x024C
#endif #endif

View file

@ -578,11 +578,8 @@ s32 EnNiwLady_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3
} }
if (this->unk_275 != 0) { if (this->unk_275 != 0) {
if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) {
// pad = limbIndex * LIMB_OVERRIDE_PER_I; // likely rot->y += Math_SinS((play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Y))) * FIDGET_SCALE;
rot->y += rot->z += Math_CosS((play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Z))) * FIDGET_SCALE;
Math_SinS((play->state.frames * (limbIndex * LIMB_OVERRIDE_PER_I + LIMB_OVERRIDE_BASE_Y))) * 200.0f;
rot->z +=
Math_CosS((play->state.frames * (limbIndex * LIMB_OVERRIDE_PER_I + LIMB_OVERRIDE_BASE_Z))) * 200.0f;
} }
} }
return false; return false;

View file

@ -350,9 +350,9 @@ s32 EnSth_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
} }
if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) {
overridePerLimb = limbIndex * LIMB_OVERRIDE_PER_I; overridePerLimb = limbIndex * FIDGET_MUL_I;
rot->y += Math_SinS(play->state.frames * (overridePerLimb + LIMB_OVERRIDE_BASE_Y)) * 200.0f; rot->y += Math_SinS(play->state.frames * (overridePerLimb + FIDGET_ADD_Y)) * FIDGET_SCALE;
rot->z += Math_CosS(play->state.frames * (overridePerLimb + LIMB_OVERRIDE_BASE_Z)) * 200.0f; rot->z += Math_CosS(play->state.frames * (overridePerLimb + FIDGET_ADD_Z)) * FIDGET_SCALE;
} }
return 0; 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; this->stateFlags &= ~TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM;
} else if ((limbIndex == ENTA_LIMB_CHEST) || (limbIndex == ENTA_LIMB_LEFT_ARM) || } else if ((limbIndex == ENTA_LIMB_CHEST) || (limbIndex == ENTA_LIMB_LEFT_ARM) ||
(limbIndex == ENTA_LIMB_RIGHT_ARM)) { (limbIndex == ENTA_LIMB_RIGHT_ARM)) {
s32 overridePerLimb = limbIndex * LIMB_OVERRIDE_PER_I; s32 overridePerLimb = limbIndex * FIDGET_MUL_I;
rot->y += Math_SinS(play->state.frames * (overridePerLimb + LIMB_OVERRIDE_BASE_Y)) * 200.0f; rot->y += Math_SinS(play->state.frames * (overridePerLimb + FIDGET_ADD_Y)) * FIDGET_SCALE;
rot->z += Math_CosS(play->state.frames * (overridePerLimb + LIMB_OVERRIDE_BASE_Z)) * 200.0f; rot->z += Math_CosS(play->state.frames * (overridePerLimb + FIDGET_ADD_Z)) * FIDGET_SCALE;
} }
return false; return false;

View file

@ -612,7 +612,7 @@ void EnZo_Destroy(Actor* thisx, PlayState* play) {
void EnZo_Standing(EnZo* this, PlayState* play) { void EnZo_Standing(EnZo* this, PlayState* play) {
s16 angle; s16 angle;
UpdateLimbOverrides(play, this->limbOverridesY, this->limbOverridesZ, ZORA_LIMB_MAX); Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ZORA_LIMB_MAX);
EnZo_SetAnimation(this); EnZo_SetAnimation(this);
if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
this->trackingMode = NPC_TRACKING_FULL_BODY; this->trackingMode = NPC_TRACKING_FULL_BODY;
@ -654,7 +654,7 @@ void EnZo_Surface(EnZo* this, PlayState* play) {
} }
void EnZo_TreadWater(EnZo* this, PlayState* play) { void EnZo_TreadWater(EnZo* this, PlayState* play) {
UpdateLimbOverrides(play, this->limbOverridesY, this->limbOverridesZ, ZORA_LIMB_MAX); Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ZORA_LIMB_MAX);
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->canSpeak = true; this->canSpeak = true;
this->trackingMode = NPC_TRACKING_FULL_BODY; 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)) { if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 12)) {
rot->y += (Math_SinS(this->limbOverridesY[limbIndex]) * 200.0f); rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_SCALE;
rot->z += (Math_CosS(this->limbOverridesZ[limbIndex]) * 200.0f); rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_SCALE;
} }
return 0; return 0;

View file

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