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-06 14:54:43 -07:00
committed by GitHub
parent 3bb9b365fc
commit a506e8620a
35 changed files with 162 additions and 133 deletions
+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;