1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-21 14:25:22 +00:00

give better names to the constants

https://github.com/zeldaret/oot/pull/2287#discussion_r1837211873
This commit is contained in:
feacur 2024-11-13 15:36:21 +01:00
parent efa74ebc03
commit 43afb7b7cb
17 changed files with 53 additions and 53 deletions

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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);

View file

@ -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);

View file

@ -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;
}

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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;
}

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 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;

View file

@ -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;