1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 23:10:22 +00:00

z_skin_matrix.c decompiled (1 non matching, 1 non equivalent) (#243)

* func_800A7BE4 and func_800A7C20 done

- func_800A7BE4 copy of "Math_Vec3f_ToVec3s" in z_lib.c
- func_800A7C20 copy of "Math_Vec3s_ToVec3f" in z_lib.c

* done func_800A7A24

* func_800A76A4 done

* func_800A6E10 done

* func_800A6EF4 done

* func_800A6FA0 done

* func_800A72FC done

* Deleted z_skin_matrix.data.s and updated spec

* func_800A730C done

* func_800A735C done

* func_800A7E70 done, func_800A7C60 matching but I'm not happy with it (weird types in function params)

* Corrections. func_800A7C60 in skin_matrix done, Matrix_MtxFToMtx in sys_matrix done.

* func_800A7EC0 nonmatching

* func_800A8030 nonmatching but VERY close (two registers swapped)

* func_800A8030 done

* updating comments

* func_800A7704 done

* func_800A7894 done

* halfway through deciphering mips_to_c for func_800A73E0

* func_800A73E0 functional but non-matching (saved register differences and probably regalloc)

* Renaming some arguments and rewriting comments

* Renamed files across whole project and deleted asm nonmatchings

* ran format.sh

* fixed function name

* fixing multiplcation order in SkinMatrix_MtxFMtxFMult

* Corrections in SkinMatrix_MtxFMtxFMult

* Formatting changes after review

* Changes as per code review

* fixing rename error

* fixing rename error

* rename fixes

* fixing function rename error

* ran ./format.sh

* last couple of changes as per code review

* renamed SetScaling -> SetScale

* Skin_Matrix_Invert -> SkinMatrix_Invert

* Renaming and fixing debug message print

* Renamed argument "mf" to more specific "clear" in SkinMatrix_GetClear

* renamed again to "mfp"

* snake case to camel case changes
This commit is contained in:
AdamKiddle 2020-08-08 16:23:16 +01:00 committed by GitHub
parent 34c73dda62
commit 54f762b419
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
85 changed files with 947 additions and 1443 deletions

View file

@ -511,7 +511,7 @@ void BgHakaTrap_Draw(Actor* thisx, GlobalContext* globalCtx) {
sp2C.z = thisx->posRot.pos.z;
sp2C.y = thisx->posRot.pos.y + 110.0f;
func_800A6EF4(&globalCtx->mf_11D60, &sp2C, &this->unk_16C);
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->mf_11D60, &sp2C, &this->unk_16C);
func_80078914(&this->unk_16C, NA_SE_EV_BRIDGE_CLOSE - SFX_FLAG);
}
}

View file

@ -82,7 +82,7 @@ void func_8097C8A8(DemoGo* this, GlobalContext* globalCtx) {
Vec3f* sp1C;
if ((thisx->params == 0) || (thisx->params == 1)) {
func_800A6E10(&globalCtx->mf_11D60, &thisx->posRot.pos, &sp20, &sp1C);
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->mf_11D60, &thisx->posRot.pos, &sp20, &sp1C);
Audio_PlaySoundAtPosition(globalCtx, &sp20, 20, NA_SE_EV_OBJECT_FALL);
}
}

View file

@ -483,7 +483,7 @@ void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_800D1FD4(&globalCtx->mf_11DA0);
func_80093D84(globalCtx->state.gfxCtx);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, (s8)this->unk_160);
if (this->fireMode > 0) {
gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 255, 255, 0);
} else {
@ -502,8 +502,8 @@ void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1833),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(gfxCtx->polyXlu.p++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->unk_174, (s16)this->unk_178, 0x40, 0x40,
1, (s16)this->unk_17C, (s16)this->unk_180, 0x40, 0x40));
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->unk_174, (s16)this->unk_178, 0x40, 0x40, 1,
(s16)this->unk_17C, (s16)this->unk_180, 0x40, 0x40));
gSPDisplayList(gfxCtx->polyXlu.p++, D_0600FAA0);
} else {
osSyncPrintf("FF DRAW 1\n");

View file

@ -65,14 +65,14 @@ void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
scale = this->regs[SS_BOMB_SCALE] / 100.0f;
func_800A7A24(&sp12C, this->pos.x, this->pos.y, this->pos.z);
func_800A76A4(&spEC, scale, scale, 1.0f);
func_800A6FA0(&sp12C, &globalCtx->mf_11DA0, &sp6C);
func_800A6FA0(&sp6C, &spEC, &spAC);
SkinMatrix_SetTranslate(&sp12C, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&spEC, scale, scale, 1.0f);
SkinMatrix_MtxFMtxFMult(&sp12C, &globalCtx->mf_11DA0, &sp6C);
SkinMatrix_MtxFMtxFMult(&sp6C, &spEC, &spAC);
gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mtx = func_800A7E70(gfxCtx, &spAC);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &spAC);
if (mtx != NULL) {
gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View file

@ -87,12 +87,12 @@ void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this)
Graph_OpenDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb2.c", 298);
scale = this->regs[SS_BOMB2_SCALE] * 0.01f;
func_800A7A24(&sp11C, this->pos.x, this->pos.y, this->pos.z);
func_800A76A4(&spDC, scale, scale, 1.0f);
func_800A6FA0(&sp11C, &globalCtx->mf_11DA0, &sp5C);
SkinMatrix_SetTranslate(&sp11C, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&spDC, scale, scale, 1.0f);
SkinMatrix_MtxFMtxFMult(&sp11C, &globalCtx->mf_11DA0, &sp5C);
func_800A6FA0(&sp5C, &spDC, &sp9C);
mtx = func_800A7E70(gfxCtx, &sp9C);
SkinMatrix_MtxFMtxFMult(&sp5C, &spDC, &sp9C);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp9C);
if (mtx != NULL) {
gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@ -134,15 +134,15 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th
temp_f24 = this->regs[SS_BOMB2_A];
scale = this->regs[SS_BOMB2_SCALE] * 0.01f;
func_800A7A24(&sp1B4, this->pos.x, this->pos.y, this->pos.z);
func_800A76A4(&sp174, scale, scale, 1.0f);
func_800A6FA0(&sp1B4, &globalCtx->mf_11DA0, &spF4);
func_800A6FA0(&spF4, &sp174, &sp134);
mtx = func_800A7E70(gfxCtx, &sp134);
SkinMatrix_SetTranslate(&sp1B4, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&sp174, scale, scale, 1.0f);
SkinMatrix_MtxFMtxFMult(&sp1B4, &globalCtx->mf_11DA0, &spF4);
SkinMatrix_MtxFMtxFMult(&spF4, &sp174, &sp134);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp134);
if (mtx != NULL) {
gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mtx2 = func_800A7E70(gfxCtx, &sp134);
mtx2 = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp134);
if (mtx2 != NULL) {
func_80094BC4(gfxCtx);

View file

@ -96,13 +96,13 @@ void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
scale = this->regs[SS_DUST_SCALE] * 0.0025f;
func_800A7A24(&sp144, this->pos.x, this->pos.y, this->pos.z);
func_800A76A4(&sp104, scale, scale, 1.0f);
func_800A6FA0(&sp144, &globalCtx->mf_11DA0, &sp84);
func_800A6FA0(&sp84, &sp104, &spC4);
SkinMatrix_SetTranslate(&sp144, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&sp104, scale, scale, 1.0f);
SkinMatrix_MtxFMtxFMult(&sp144, &globalCtx->mf_11DA0, &sp84);
SkinMatrix_MtxFMtxFMult(&sp84, &sp104, &spC4);
gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mtx = func_800A7E70(gfxCtx, &spC4);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &spC4);
if (mtx != NULL) {
gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View file

@ -94,12 +94,12 @@ void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
scale = this->regs[SS_G_SPK_SCALE] * 0.0025f;
func_800A7A24(&sp11C, this->pos.x, this->pos.y, this->pos.z);
func_800A76A4(&spDC, scale, scale, 1.0f);
func_800A6FA0(&sp11C, &globalCtx->mf_11DA0, &sp5C);
func_800A6FA0(&sp5C, &spDC, &sp9C);
SkinMatrix_SetTranslate(&sp11C, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&spDC, scale, scale, 1.0f);
SkinMatrix_MtxFMtxFMult(&sp11C, &globalCtx->mf_11DA0, &sp5C);
SkinMatrix_MtxFMtxFMult(&sp5C, &spDC, &sp9C);
mtx = func_800A7E70(gfxCtx, &sp9C);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp9C);
if (mtx != NULL) {
gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);