mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-23 06:54:14 -04:00
SubS Skelanime functions (#572)
* Bring code over * Change ActorDraw typedefs from actor to thisx * Rename functions * Format * Rename and clean up limb draws * Some more limb draw cleanup * Some more cleanup * Function comments * Last bit of cleanup * update tutorial * More tutorial and format * Remove extra newlines form actorfixer * Missed one * Remove some unnecessary casts * Fix SkelAnime transform functions in functions.h * Remove bug comments, and add note * Remove some more unneeded casts and rename one variable * format * Fix merge * Format
This commit is contained in:
@@ -262,7 +262,7 @@ void EnRecepgirl_Draw(Actor *thisx, GlobalContext *globalCtx) {
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, D_80C106B0[this->unk_2AC]);
|
||||
|
||||
func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, &this->actor);
|
||||
SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, &this->actor);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
@@ -273,7 +273,7 @@ void EnRecepgirl_Draw(Actor *thisx, GlobalContext *globalCtx) {
|
||||
|
||||
(We can delete the `GLOBAL_ASM` lines now.)
|
||||
|
||||
The worst part of documentation is finding somewhere to start. We have a decent place to start here, though, in that we already know the function (or rather, the use) of a couple of the functions, namely the LimbDraws. So we can rename `func_80C10558` to `EnRecepgirl_OverrideLimbDraw` and `func_80C10590` to `EnRecepgirl_UnkLimbDraw`. Remember to do a global rename so that the functions in the assembly are renamed, use `rename_global_asm`,
|
||||
The worst part of documentation is finding somewhere to start. We have a decent place to start here, though, in that we already know the function (or rather, the use) of a couple of the functions, namely the LimbDraws. So we can rename `func_80C10558` to `EnRecepgirl_OverrideLimbDraw` and `func_80C10590` to `EnRecepgirl_TransformLimbDraw`. Remember to do a global rename so that the functions in the assembly are renamed, use `rename_global_asm`,
|
||||
```
|
||||
$ ./tools/rename_global_asm.py
|
||||
asm/non_matchings/overlays/ovl_En_Recepgirl/func_80C10558.s --> asm/non_matchings/overlays/ovl_En_Recepgirl/EnRecepgirl_OverrideLimbDraw.s
|
||||
|
||||
@@ -34,7 +34,7 @@ void EnRecepgirl_Draw(Actor *thisx, GlobalContext *globalCtx) {
|
||||
sp30->polyOpa.p = temp_v1 + 8;
|
||||
temp_v1->words.w0 = 0xDB060020;
|
||||
temp_v1->words.w1 = (u32) D_80C106B0[this->unk_2AC];
|
||||
func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32) this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, (Actor *) this);
|
||||
SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32) this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, (Actor *) this);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -107,7 +107,7 @@ void EnRecepgirl_Draw(Actor *thisx, GlobalContext *globalCtx) {
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, D_80C106B0[this->unk_2AC]);
|
||||
|
||||
func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, &this->actor);
|
||||
SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80C10558, NULL, func_80C10590, &this->actor);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
@@ -115,28 +115,28 @@ void EnRecepgirl_Draw(Actor *thisx, GlobalContext *globalCtx) {
|
||||
|
||||
And this matches.
|
||||
|
||||
The last two functions in the actor are used as arguments in `func_801343C0`. This is a `SkelAnime` function, except unlike the OoT ones, it has three function callback arguments instead of two: in `functions.h` or `z_skelanime.c`, we find
|
||||
The last two functions in the actor are used as arguments in `SkelAnime_DrawTransformFlexOpa`. This is a `SkelAnime` function, except unlike the OoT ones, it has three function callback arguments instead of two: in `functions.h` or `z_skelanime.c`, we find
|
||||
```C
|
||||
void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
|
||||
OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, UnkActorDraw unkDraw, Actor* actor)
|
||||
void SkelAnime_DrawTransformFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount,
|
||||
OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, TransformLimbDrawOpa transformLimbDraw, Actor* actor)
|
||||
```
|
||||
The typedefs of the callbacks it uses are in `z64animation.h`:
|
||||
```C
|
||||
typedef s32 (*OverrideLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
struct Actor* actor);
|
||||
typedef s32 (*OverrideLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
struct Actor* thisx);
|
||||
|
||||
typedef void (*PostLimbDraw)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot,
|
||||
struct Actor* actor);
|
||||
typedef void (*PostLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot,
|
||||
struct Actor* thisx);
|
||||
|
||||
[...]
|
||||
|
||||
typedef void (*UnkActorDraw)(struct GlobalContext* globalCtx, s32 limbIndex, struct Actor* actor);
|
||||
typedef void (*TransformLimbDrawOpa)(struct GlobalContext* globalCtx, s32 limbIndex, struct Actor* thisx);
|
||||
```
|
||||
which is where mips2c got them from.
|
||||
|
||||
In this case, only two of them are used, and it is these that are the last functions standing between us and a decompiled actor.
|
||||
|
||||
## OverrideLimbDraw, PostLimbDraw, UnkActorDraw
|
||||
## OverrideLimbDraw, PostLimbDraw, TransformLimbDraw
|
||||
|
||||
Well, we don't have a PostLimbDraw here, but as we see from the prototype, it's much the same as the OverrideLimbDraw but without the `pos` argument and no return value.
|
||||
```C
|
||||
@@ -159,7 +159,7 @@ s32 func_80C10558(GlobalContext *globalCtx, s32 limbIndex, Gfx **dList, Vec3f *p
|
||||
}
|
||||
```
|
||||
|
||||
As for the UnkActorDraw, it has a much simpler prototype. mips2c gives
|
||||
As for the TransformLimbDraw, it has a much simpler prototype. mips2c gives
|
||||
```C
|
||||
void func_80C10590(GlobalContext *globalCtx, s32 limbIndex, Actor *actor) {
|
||||
if (limbIndex == 5) {
|
||||
|
||||
Reference in New Issue
Block a user