diff --git a/include/z64actor.h b/include/z64actor.h index 5b362c290f..73bdc86491 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -17,10 +17,10 @@ // 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 +#define FIDGET_FREQ_Y 0x814 +#define FIDGET_FREQ_Z 0x940 +#define FIDGET_FREQ_LIMB 0x32 +#define FIDGET_AMPLITUDE 200.0f struct Actor; struct ActorEntry; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 64d5c5c71e..30573b19e4 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -4448,8 +4448,8 @@ void Actor_UpdateFidgetTables(PlayState* play, s16* fidgetTableY, s16* fidgetTab s32 i; for (i = 0; i < tableLen; i++) { - fidgetTableY[i] = (FIDGET_ADD_Y + FIDGET_MUL_I * i) * frames; - fidgetTableZ[i] = (FIDGET_ADD_Z + FIDGET_MUL_I * i) * frames; + fidgetTableY[i] = (FIDGET_FREQ_Y + FIDGET_FREQ_LIMB * i) * frames; + fidgetTableZ[i] = (FIDGET_FREQ_Z + FIDGET_FREQ_LIMB * i) * frames; } } diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index 1d41acb1a9..d96b725fee 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -547,22 +547,22 @@ Gfx* EnDivingGame_EmptyDList(GraphicsContext* gfxCtx) { return displayList; } -s32 EnDivingGame_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnDivingGame_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnDivingGame* this = (EnDivingGame*)thisx; s32 pad; - if (limbIndex == 6) { + if (limb == 6) { rot->x += this->torsoRot.y; } - if (limbIndex == 15) { + if (limb == 15) { rot->x += this->headRot.y; rot->z += this->headRot.z; } - if (this->notPlayingMinigame && (limbIndex == 8 || limbIndex == 9 || limbIndex == 12)) { - rot->y += Math_SinS((play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Y))) * FIDGET_SCALE; - rot->z += Math_CosS((play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Z))) * FIDGET_SCALE; + if (this->notPlayingMinigame && (limb == 8 || limb == 9 || limb == 12)) { + rot->y += Math_SinS((play->state.frames * (limb * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y))) * FIDGET_AMPLITUDE; + rot->z += Math_CosS((play->state.frames * (limb * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z))) * FIDGET_AMPLITUDE; } return 0; diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index b1dcabeb27..f2544a8114 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -257,14 +257,14 @@ void EnFu_Update(Actor* thisx, PlayState* play) { } } -s32 EnFu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnFu_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnFu* this = (EnFu*)thisx; s32 pad; - if (limbIndex == FU_LIMB_UNK) { + if (limb == FU_LIMB_UNK) { return false; } - switch (limbIndex) { + switch (limb) { case FU_LIMB_HEAD: rot->x += this->lookAngleOffset.y; rot->z += this->lookAngleOffset.x; @@ -277,9 +277,9 @@ s32 EnFu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po return false; } - if (limbIndex == FU_LIMB_CHEST_MUSIC_BOX) { - rot->y += Math_SinS((play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Y))) * FIDGET_SCALE; - rot->z += Math_CosS((play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Z))) * FIDGET_SCALE; + if (limb == FU_LIMB_CHEST_MUSIC_BOX) { + rot->y += Math_SinS((play->state.frames * (limb * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y))) * FIDGET_AMPLITUDE; + rot->z += Math_CosS((play->state.frames * (limb * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z))) * FIDGET_AMPLITUDE; } return false; } diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 4eddf236ea..ff5d4a2a8e 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -760,11 +760,11 @@ void EnGe1_StopFidget(EnGe1* this) { } } -s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { s32 pad; EnGe1* this = (EnGe1*)thisx; - if (limbIndex == GE1_LIMB_HEAD) { + if (limb == GE1_LIMB_HEAD) { rot->x += this->headRot.y; rot->z += this->headRot.x; } @@ -776,9 +776,9 @@ 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 * FIDGET_MUL_I + FIDGET_ADD_Y)) * FIDGET_SCALE; - rot->z += Math_CosS(play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Z)) * FIDGET_SCALE; + if ((limb == GE1_LIMB_TORSO) || (limb == GE1_LIMB_L_FOREARM) || (limb == GE1_LIMB_R_FOREARM)) { + rot->y += Math_SinS(play->state.frames * (limb * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y)) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(play->state.frames * (limb * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z)) * FIDGET_AMPLITUDE; } return 0; } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index e316b220bd..42d0f2fb67 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -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->fidgetTableY[limb]) * FIDGET_SCALE; - rot->z += Math_CosS(this->fidgetTableZ[limb]) * FIDGET_SCALE; + rot->y += Math_SinS(this->fidgetTableY[limb]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limb]) * FIDGET_AMPLITUDE; } return 0; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index e4e549f735..1c15f28230 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -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->fidgetTableY[limb]) * FIDGET_SCALE; - rot->z += Math_CosS(this->fidgetTableZ[limb]) * FIDGET_SCALE; + rot->y += Math_SinS(this->fidgetTableY[limb]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limb]) * FIDGET_AMPLITUDE; } return 0; } diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index 93fe37fcce..5594103fd4 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -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->fidgetTableY[limbIndex]) * FIDGET_SCALE; - rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_SCALE; + 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); diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 4cbe010cbe..b861717e86 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -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]) * FIDGET_SCALE; - rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_SCALE; + 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); diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index f58a322f82..7b17e3c0e7 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -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->fidgetTableY[limbIndex]) * FIDGET_SCALE; - rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_SCALE; + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } return false; } diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index e1218a636a..18ea64aa3e 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -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->fidgetTableY[limbIndex]) * FIDGET_SCALE; - rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_SCALE; + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } if (limbIndex) {} return false; diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 864b44f11e..26062ea006 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -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->fidgetTableY[limbIndex]) * FIDGET_SCALE; - rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_SCALE; + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } return false; diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.c b/src/overlays/actors/ovl_En_Mu/z_en_mu.c index 1ca62ee0aa..01c3788df9 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.c +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.c @@ -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->fidgetTableY[limbIndex]) * FIDGET_SCALE; - rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_SCALE; + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } return false; } diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index d26f38d352..c9af199d72 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -565,21 +565,21 @@ Gfx* EnNiwLady_EmptyDList(GraphicsContext* gfxCtx) { return dList; } -s32 EnNiwLady_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnNiwLady_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNiwLady* this = (EnNiwLady*)thisx; s32 pad; - if (limbIndex == 15) { + if (limb == 15) { rot->x += this->headRot.y; rot->z += this->headRot.x; } - if (limbIndex == 8) { + if (limb == 8) { rot->x += this->torsoRot.y; } if (this->unk_275 != 0) { - if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { - rot->y += Math_SinS((play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Y))) * FIDGET_SCALE; - rot->z += Math_CosS((play->state.frames * (limbIndex * FIDGET_MUL_I + FIDGET_ADD_Z))) * FIDGET_SCALE; + if ((limb == 8) || (limb == 10) || (limb == 13)) { + rot->y += Math_SinS((play->state.frames * (limb * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y))) * FIDGET_AMPLITUDE; + rot->z += Math_CosS((play->state.frames * (limb * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z))) * FIDGET_AMPLITUDE; } } return false; diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 716641a6e5..1d42d4c43c 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -350,9 +350,9 @@ s32 EnSth_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p } if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) { - fidgetFrequency = limbIndex * FIDGET_MUL_I; - rot->y += Math_SinS(play->state.frames * (fidgetFrequency + FIDGET_ADD_Y)) * FIDGET_SCALE; - rot->z += Math_CosS(play->state.frames * (fidgetFrequency + FIDGET_ADD_Z)) * FIDGET_SCALE; + 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; } diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index 10534ae0cc..c94f1acef9 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -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 fidgetFrequency = limbIndex * FIDGET_MUL_I; + s32 fidgetFrequency = limbIndex * FIDGET_FREQ_LIMB; - rot->y += Math_SinS(play->state.frames * (fidgetFrequency + FIDGET_ADD_Y)) * FIDGET_SCALE; - rot->z += Math_CosS(play->state.frames * (fidgetFrequency + FIDGET_ADD_Z)) * FIDGET_SCALE; + 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; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 59f955ab3c..c3080986e1 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -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->fidgetTableY[limbIndex]) * FIDGET_SCALE; - rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_SCALE; + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } return 0;