1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-08 00:44:42 +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

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