mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-11 03:39:59 +00:00
Matched functions in sys_matrix (#505)
* Darkmeiro decompilation Bg_Gnd_Darkmeiro decompiled, matched, and documented. * give this a shot * fix conflict * one more try * could be useful * whoops * ZAP2 stuff * ZAP why * ZAP again * first match * more matching
This commit is contained in:
parent
4b04e6cb66
commit
140a554f8e
3 changed files with 106 additions and 237 deletions
|
@ -1,111 +0,0 @@
|
|||
glabel func_800D1694
|
||||
/* B48834 800D1694 27BDFFC8 */ addiu $sp, $sp, -0x38
|
||||
/* B48838 800D1698 AFB00014 */ sw $s0, 0x14($sp)
|
||||
/* B4883C 800D169C AFBF001C */ sw $ra, 0x1c($sp)
|
||||
/* B48840 800D16A0 AFB10018 */ sw $s1, 0x18($sp)
|
||||
/* B48844 800D16A4 E7AC0038 */ swc1 $f12, 0x38($sp)
|
||||
/* B48848 800D16A8 E7AE003C */ swc1 $f14, 0x3c($sp)
|
||||
/* B4884C 800D16AC AFA60040 */ sw $a2, 0x40($sp)
|
||||
/* B48850 800D16B0 3C108017 */ lui $s0, %hi(sCurrentMatrix)
|
||||
/* B48854 800D16B4 00E08825 */ move $s1, $a3
|
||||
/* B48858 800D16B8 8E10A7C4 */ lw $s0, %lo(sCurrentMatrix)($s0)
|
||||
/* B4885C 800D16BC 0C01DE1C */ jal Math_Sins
|
||||
/* B48860 800D16C0 84E40002 */ lh $a0, 2($a3)
|
||||
/* B48864 800D16C4 86240002 */ lh $a0, 2($s1)
|
||||
/* B48868 800D16C8 0C01DE0D */ jal Math_Coss
|
||||
/* B4886C 800D16CC E7A00030 */ swc1 $f0, 0x30($sp)
|
||||
/* B48870 800D16D0 C7AE0030 */ lwc1 $f14, 0x30($sp)
|
||||
/* B48874 800D16D4 E6000000 */ swc1 $f0, ($s0)
|
||||
/* B48878 800D16D8 44808000 */ mtc1 $zero, $f16
|
||||
/* B4887C 800D16DC 46007107 */ neg.s $f4, $f14
|
||||
/* B48880 800D16E0 3C013F80 */ li $at, 0x3F800000 # 0.000000
|
||||
/* B48884 800D16E4 E6040008 */ swc1 $f4, 8($s0)
|
||||
/* B48888 800D16E8 C7A60038 */ lwc1 $f6, 0x38($sp)
|
||||
/* B4888C 800D16EC 44811000 */ mtc1 $at, $f2
|
||||
/* B48890 800D16F0 46000306 */ mov.s $f12, $f0
|
||||
/* B48894 800D16F4 E6060030 */ swc1 $f6, 0x30($s0)
|
||||
/* B48898 800D16F8 C7A8003C */ lwc1 $f8, 0x3c($sp)
|
||||
/* B4889C 800D16FC E6080034 */ swc1 $f8, 0x34($s0)
|
||||
/* B488A0 800D1700 C7AA0040 */ lwc1 $f10, 0x40($sp)
|
||||
/* B488A4 800D1704 E610000C */ swc1 $f16, 0xc($s0)
|
||||
/* B488A8 800D1708 E610001C */ swc1 $f16, 0x1c($s0)
|
||||
/* B488AC 800D170C E610002C */ swc1 $f16, 0x2c($s0)
|
||||
/* B488B0 800D1710 E602003C */ swc1 $f2, 0x3c($s0)
|
||||
/* B488B4 800D1714 E60A0038 */ swc1 $f10, 0x38($s0)
|
||||
/* B488B8 800D1718 86240000 */ lh $a0, ($s1)
|
||||
/* B488BC 800D171C 50800018 */ beql $a0, $zero, .L800D1780
|
||||
/* B488C0 800D1720 E6000028 */ swc1 $f0, 0x28($s0)
|
||||
/* B488C4 800D1724 E7AC002C */ swc1 $f12, 0x2c($sp)
|
||||
/* B488C8 800D1728 0C01DE1C */ jal Math_Sins
|
||||
/* B488CC 800D172C E7AE0030 */ swc1 $f14, 0x30($sp)
|
||||
/* B488D0 800D1730 86240000 */ lh $a0, ($s1)
|
||||
/* B488D4 800D1734 0C01DE0D */ jal Math_Coss
|
||||
/* B488D8 800D1738 E7A00024 */ swc1 $f0, 0x24($sp)
|
||||
/* B488DC 800D173C C7AC002C */ lwc1 $f12, 0x2c($sp)
|
||||
/* B488E0 800D1740 C7A20024 */ lwc1 $f2, 0x24($sp)
|
||||
/* B488E4 800D1744 C7AE0030 */ lwc1 $f14, 0x30($sp)
|
||||
/* B488E8 800D1748 46006482 */ mul.s $f18, $f12, $f0
|
||||
/* B488EC 800D174C 46001287 */ neg.s $f10, $f2
|
||||
/* B488F0 800D1750 44808000 */ mtc1 $zero, $f16
|
||||
/* B488F4 800D1754 46026102 */ mul.s $f4, $f12, $f2
|
||||
/* B488F8 800D1758 E60A0024 */ swc1 $f10, 0x24($s0)
|
||||
/* B488FC 800D175C E6000014 */ swc1 $f0, 0x14($s0)
|
||||
/* B48900 800D1760 46007182 */ mul.s $f6, $f14, $f0
|
||||
/* B48904 800D1764 E6120028 */ swc1 $f18, 0x28($s0)
|
||||
/* B48908 800D1768 46027202 */ mul.s $f8, $f14, $f2
|
||||
/* B4890C 800D176C E6040018 */ swc1 $f4, 0x18($s0)
|
||||
/* B48910 800D1770 E6060020 */ swc1 $f6, 0x20($s0)
|
||||
/* B48914 800D1774 10000007 */ b .L800D1794
|
||||
/* B48918 800D1778 E6080010 */ swc1 $f8, 0x10($s0)
|
||||
/* B4891C 800D177C E6000028 */ swc1 $f0, 0x28($s0)
|
||||
.L800D1780:
|
||||
/* B48920 800D1780 E60E0020 */ swc1 $f14, 0x20($s0)
|
||||
/* B48924 800D1784 E6100024 */ swc1 $f16, 0x24($s0)
|
||||
/* B48928 800D1788 E6100018 */ swc1 $f16, 0x18($s0)
|
||||
/* B4892C 800D178C E6100010 */ swc1 $f16, 0x10($s0)
|
||||
/* B48930 800D1790 E6020014 */ swc1 $f2, 0x14($s0)
|
||||
.L800D1794:
|
||||
/* B48934 800D1794 86240004 */ lh $a0, 4($s1)
|
||||
/* B48938 800D1798 50800024 */ beql $a0, $zero, .L800D182C
|
||||
/* B4893C 800D179C E6100004 */ swc1 $f16, 4($s0)
|
||||
/* B48940 800D17A0 0C01DE1C */ jal Math_Sins
|
||||
/* B48944 800D17A4 00000000 */ nop
|
||||
/* B48948 800D17A8 86240004 */ lh $a0, 4($s1)
|
||||
/* B4894C 800D17AC 0C01DE0D */ jal Math_Coss
|
||||
/* B48950 800D17B0 E7A00024 */ swc1 $f0, 0x24($sp)
|
||||
/* B48954 800D17B4 C60E0000 */ lwc1 $f14, ($s0)
|
||||
/* B48958 800D17B8 C7A20024 */ lwc1 $f2, 0x24($sp)
|
||||
/* B4895C 800D17BC C60C0010 */ lwc1 $f12, 0x10($s0)
|
||||
/* B48960 800D17C0 46007482 */ mul.s $f18, $f14, $f0
|
||||
/* B48964 800D17C4 00000000 */ nop
|
||||
/* B48968 800D17C8 46026102 */ mul.s $f4, $f12, $f2
|
||||
/* B4896C 800D17CC 00000000 */ nop
|
||||
/* B48970 800D17D0 46006202 */ mul.s $f8, $f12, $f0
|
||||
/* B48974 800D17D4 C60C0018 */ lwc1 $f12, 0x18($s0)
|
||||
/* B48978 800D17D8 46027282 */ mul.s $f10, $f14, $f2
|
||||
/* B4897C 800D17DC C60E0008 */ lwc1 $f14, 8($s0)
|
||||
/* B48980 800D17E0 46049180 */ add.s $f6, $f18, $f4
|
||||
/* B48984 800D17E4 46007102 */ mul.s $f4, $f14, $f0
|
||||
/* B48988 800D17E8 E6060000 */ swc1 $f6, ($s0)
|
||||
/* B4898C 800D17EC 46026182 */ mul.s $f6, $f12, $f2
|
||||
/* B48990 800D17F0 460A4481 */ sub.s $f18, $f8, $f10
|
||||
/* B48994 800D17F4 46006282 */ mul.s $f10, $f12, $f0
|
||||
/* B48998 800D17F8 C60C0014 */ lwc1 $f12, 0x14($s0)
|
||||
/* B4899C 800D17FC E6120010 */ swc1 $f18, 0x10($s0)
|
||||
/* B489A0 800D1800 46027482 */ mul.s $f18, $f14, $f2
|
||||
/* B489A4 800D1804 46062200 */ add.s $f8, $f4, $f6
|
||||
/* B489A8 800D1808 46026182 */ mul.s $f6, $f12, $f2
|
||||
/* B489AC 800D180C E6080008 */ swc1 $f8, 8($s0)
|
||||
/* B489B0 800D1810 46006202 */ mul.s $f8, $f12, $f0
|
||||
/* B489B4 800D1814 46125101 */ sub.s $f4, $f10, $f18
|
||||
/* B489B8 800D1818 E6060004 */ swc1 $f6, 4($s0)
|
||||
/* B489BC 800D181C E6040018 */ swc1 $f4, 0x18($s0)
|
||||
/* B489C0 800D1820 10000002 */ b .L800D182C
|
||||
/* B489C4 800D1824 E6080014 */ swc1 $f8, 0x14($s0)
|
||||
/* B489C8 800D1828 E6100004 */ swc1 $f16, 4($s0)
|
||||
.L800D182C:
|
||||
/* B489CC 800D182C 8FBF001C */ lw $ra, 0x1c($sp)
|
||||
/* B489D0 800D1830 8FB00014 */ lw $s0, 0x14($sp)
|
||||
/* B489D4 800D1834 8FB10018 */ lw $s1, 0x18($sp)
|
||||
/* B489D8 800D1838 03E00008 */ jr $ra
|
||||
/* B489DC 800D183C 27BD0038 */ addiu $sp, $sp, 0x38
|
|
@ -1,63 +0,0 @@
|
|||
glabel func_800D2CEC
|
||||
/* B49E8C 800D2CEC 3C014780 */ li $at, 0x47800000 # 0.000000
|
||||
/* B49E90 800D2CF0 44810000 */ mtc1 $at, $f0
|
||||
/* B49E94 800D2CF4 44856000 */ mtc1 $a1, $f12
|
||||
/* B49E98 800D2CF8 44867000 */ mtc1 $a2, $f14
|
||||
/* B49E9C 800D2CFC AFA7000C */ sw $a3, 0xc($sp)
|
||||
/* B49EA0 800D2D00 46006102 */ mul.s $f4, $f12, $f0
|
||||
/* B49EA4 800D2D04 AC800004 */ sw $zero, 4($a0)
|
||||
/* B49EA8 800D2D08 AC800024 */ sw $zero, 0x24($a0)
|
||||
/* B49EAC 800D2D0C 46007202 */ mul.s $f8, $f14, $f0
|
||||
/* B49EB0 800D2D10 AC80000C */ sw $zero, 0xc($a0)
|
||||
/* B49EB4 800D2D14 AC80002C */ sw $zero, 0x2c($a0)
|
||||
/* B49EB8 800D2D18 AC800010 */ sw $zero, 0x10($a0)
|
||||
/* B49EBC 800D2D1C 4600218D */ trunc.w.s $f6, $f4
|
||||
/* B49EC0 800D2D20 4600428D */ trunc.w.s $f10, $f8
|
||||
/* B49EC4 800D2D24 44023000 */ mfc1 $v0, $f6
|
||||
/* B49EC8 800D2D28 44035000 */ mfc1 $v1, $f10
|
||||
/* B49ECC 800D2D2C AC820000 */ sw $v0, ($a0)
|
||||
/* B49ED0 800D2D30 00027C00 */ sll $t7, $v0, 0x10
|
||||
/* B49ED4 800D2D34 0003CC02 */ srl $t9, $v1, 0x10
|
||||
/* B49ED8 800D2D38 3069FFFF */ andi $t1, $v1, 0xffff
|
||||
/* B49EDC 800D2D3C A4800002 */ sh $zero, 2($a0)
|
||||
/* B49EE0 800D2D40 AC8F0020 */ sw $t7, 0x20($a0)
|
||||
/* B49EE4 800D2D44 AC990008 */ sw $t9, 8($a0)
|
||||
/* B49EE8 800D2D48 AC890028 */ sw $t1, 0x28($a0)
|
||||
/* B49EEC 800D2D4C C7B0000C */ lwc1 $f16, 0xc($sp)
|
||||
/* B49EF0 800D2D50 AC800030 */ sw $zero, 0x30($a0)
|
||||
/* B49EF4 800D2D54 46008482 */ mul.s $f18, $f16, $f0
|
||||
/* B49EF8 800D2D58 4600910D */ trunc.w.s $f4, $f18
|
||||
/* B49EFC 800D2D5C 44052000 */ mfc1 $a1, $f4
|
||||
/* B49F00 800D2D60 00000000 */ nop
|
||||
/* B49F04 800D2D64 AC850014 */ sw $a1, 0x14($a0)
|
||||
/* B49F08 800D2D68 00055C00 */ sll $t3, $a1, 0x10
|
||||
/* B49F0C 800D2D6C A4800016 */ sh $zero, 0x16($a0)
|
||||
/* B49F10 800D2D70 AC8B0034 */ sw $t3, 0x34($a0)
|
||||
/* B49F14 800D2D74 C7A60010 */ lwc1 $f6, 0x10($sp)
|
||||
/* B49F18 800D2D78 46003202 */ mul.s $f8, $f6, $f0
|
||||
/* B49F1C 800D2D7C 4600428D */ trunc.w.s $f10, $f8
|
||||
/* B49F20 800D2D80 440F5000 */ mfc1 $t7, $f10
|
||||
/* B49F24 800D2D84 00000000 */ nop
|
||||
/* B49F28 800D2D88 000F7402 */ srl $t6, $t7, 0x10
|
||||
/* B49F2C 800D2D8C A48E0018 */ sh $t6, 0x18($a0)
|
||||
/* B49F30 800D2D90 A48F0038 */ sh $t7, 0x38($a0)
|
||||
/* B49F34 800D2D94 C7B00014 */ lwc1 $f16, 0x14($sp)
|
||||
/* B49F38 800D2D98 240E0001 */ li $t6, 1
|
||||
/* B49F3C 800D2D9C 46008482 */ mul.s $f18, $f16, $f0
|
||||
/* B49F40 800D2DA0 4600910D */ trunc.w.s $f4, $f18
|
||||
/* B49F44 800D2DA4 440A2000 */ mfc1 $t2, $f4
|
||||
/* B49F48 800D2DA8 00000000 */ nop
|
||||
/* B49F4C 800D2DAC 000A4C02 */ srl $t1, $t2, 0x10
|
||||
/* B49F50 800D2DB0 A489001A */ sh $t1, 0x1a($a0)
|
||||
/* B49F54 800D2DB4 A48A003A */ sh $t2, 0x3a($a0)
|
||||
/* B49F58 800D2DB8 C7A60018 */ lwc1 $f6, 0x18($sp)
|
||||
/* B49F5C 800D2DBC A48E001E */ sh $t6, 0x1e($a0)
|
||||
/* B49F60 800D2DC0 46003202 */ mul.s $f8, $f6, $f0
|
||||
/* B49F64 800D2DC4 4600428D */ trunc.w.s $f10, $f8
|
||||
/* B49F68 800D2DC8 44085000 */ mfc1 $t0, $f10
|
||||
/* B49F6C 800D2DCC 00000000 */ nop
|
||||
/* B49F70 800D2DD0 00086C02 */ srl $t5, $t0, 0x10
|
||||
/* B49F74 800D2DD4 00087C00 */ sll $t7, $t0, 0x10
|
||||
/* B49F78 800D2DD8 A48D001C */ sh $t5, 0x1c($a0)
|
||||
/* B49F7C 800D2DDC 03E00008 */ jr $ra
|
||||
/* B49F80 800D2DE0 AC8F003C */ sw $t7, 0x3c($a0)
|
|
@ -473,8 +473,6 @@ void Matrix_JointPosition(Vec3f* position, Vec3s* rotation) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc differences
|
||||
void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) {
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
f32 sp30;
|
||||
|
@ -499,12 +497,12 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) {
|
|||
sp24 = Math_Sins(vec->x);
|
||||
sp28 = Math_Coss(vec->x);
|
||||
|
||||
cmf->zy = -sp24;
|
||||
cmf->yy = sp28;
|
||||
cmf->zz = sp2C * sp28;
|
||||
cmf->yz = sp2C * sp24;
|
||||
cmf->zx = sp30 * sp28;
|
||||
cmf->yx = sp30 * sp24;
|
||||
cmf->zy = -sp24;
|
||||
cmf->yy = sp28;
|
||||
} else {
|
||||
cmf->zz = sp2C;
|
||||
cmf->zx = sp30;
|
||||
|
@ -535,9 +533,6 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) {
|
|||
cmf->xy = 0.0f;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_800D1694.s")
|
||||
#endif
|
||||
|
||||
Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) {
|
||||
s32 temp;
|
||||
|
@ -713,21 +708,33 @@ void Matrix_Reverse(MtxF* mf) {
|
|||
void func_800D1FD4(MtxF* mf) {
|
||||
MtxF* cmf = sCurrentMatrix;
|
||||
f32 temp;
|
||||
f32 temp2;
|
||||
f32 temp3;
|
||||
|
||||
temp = sqrtf(SQ(cmf->xx) + SQ(cmf->xy) + SQ(cmf->xz));
|
||||
cmf->xx = mf->xx * temp;
|
||||
cmf->xy = mf->xy * temp;
|
||||
cmf->xz = mf->xz * temp;
|
||||
temp = cmf->xx;
|
||||
temp *= temp;
|
||||
temp += SQ(cmf->xy);
|
||||
temp += SQ(cmf->xz);
|
||||
|
||||
temp = sqrtf(SQ(cmf->yx) + SQ(cmf->yy) + SQ(cmf->yz));
|
||||
cmf->yx = mf->yx * temp;
|
||||
cmf->yy = mf->yy * temp;
|
||||
cmf->yz = mf->yz * temp;
|
||||
cmf->xx = mf->xx * sqrtf(temp);
|
||||
cmf->xy = mf->xy * sqrtf(temp);
|
||||
cmf->xz = mf->xz * sqrtf(temp);
|
||||
|
||||
temp = sqrtf(SQ(cmf->zx) + SQ(cmf->zy) + SQ(cmf->zz));
|
||||
cmf->zx = mf->zx * temp;
|
||||
cmf->zy = mf->zy * temp;
|
||||
cmf->zz = mf->zz * temp;
|
||||
temp = cmf->yx;
|
||||
temp *= temp;
|
||||
temp += SQ(cmf->yy);
|
||||
temp += SQ(cmf->yz);
|
||||
cmf->yx = mf->yx * sqrtf(temp);
|
||||
cmf->yy = mf->yy * sqrtf(temp);
|
||||
cmf->yz = mf->yz * sqrtf(temp);
|
||||
|
||||
temp = cmf->zx;
|
||||
temp *= temp;
|
||||
temp += SQ(cmf->zy);
|
||||
temp += SQ(cmf->zz);
|
||||
cmf->zx = mf->zx * sqrtf(temp);
|
||||
cmf->zy = mf->zy * sqrtf(temp);
|
||||
cmf->zz = mf->zz * sqrtf(temp);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_800D1FD4.s")
|
||||
|
@ -736,22 +743,48 @@ void func_800D1FD4(MtxF* mf) {
|
|||
#ifdef NON_MATCHING
|
||||
// same differences as func_800D2264
|
||||
void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag) {
|
||||
vec->x = Math_atan2f(-mf->zy, sqrtf(SQ(mf->zx) + SQ(mf->zz))) * (32768 / M_PI);
|
||||
f32 temp;
|
||||
f32 temp2;
|
||||
f32 temp3;
|
||||
f32 temp4;
|
||||
f32 temp5;
|
||||
|
||||
temp = mf->zx;
|
||||
temp *= temp;
|
||||
temp += SQ(mf->zz);
|
||||
vec->x = Math_atan2f(-mf->zy, sqrtf(temp)) * (32768 / M_PI);
|
||||
|
||||
if ((vec->x == 0x4000) || (vec->x == -0x4000)) {
|
||||
vec->z = 0;
|
||||
|
||||
vec->y = Math_atan2f(-mf->xz, mf->xx) * (32768 / M_PI);
|
||||
return;
|
||||
}
|
||||
|
||||
vec->y = Math_atan2f(mf->zx, mf->zz) * (32768 / M_PI);
|
||||
|
||||
if (!flag) {
|
||||
vec->z = Math_atan2f(mf->xy, mf->yy) * (32768 / M_PI);
|
||||
} else {
|
||||
vec->z = Math_atan2f(mf->xy / sqrtf(SQ(mf->xx) + SQ(mf->xz) + SQ(mf->xy)),
|
||||
mf->yy / sqrtf(SQ(mf->yx) + SQ(mf->yz) + SQ(mf->yy))) *
|
||||
(32768 / M_PI);
|
||||
vec->y = Math_atan2f(mf->zx, mf->zz) * (32768 / M_PI);
|
||||
|
||||
if (!flag) {
|
||||
vec->z = Math_atan2f(mf->xy, mf->yy) * (32768 / M_PI);
|
||||
} else {
|
||||
temp = mf->xx;
|
||||
temp4 = mf->xz;
|
||||
temp3 = mf->yz;
|
||||
|
||||
temp *= temp;
|
||||
temp += SQ(temp4);
|
||||
temp2 = mf->xy;
|
||||
temp += SQ(temp2);
|
||||
temp = sqrtf(temp);
|
||||
temp = temp2 / temp;
|
||||
|
||||
temp2 = mf->yx;
|
||||
temp2 *= temp2;
|
||||
temp2 += SQ(temp3);
|
||||
temp3 = mf->yy;
|
||||
temp2 += SQ(temp3);
|
||||
temp2 = sqrtf(temp2);
|
||||
temp2 = temp3 / temp2;
|
||||
|
||||
vec->z = Math_atan2f(temp, temp2) * (32768 / M_PI);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -761,7 +794,13 @@ void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag) {
|
|||
#ifdef NON_MATCHING
|
||||
// same differences as func_800D20CC
|
||||
void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag) {
|
||||
vec->y = Math_atan2f(-mf->xz, sqrtf(SQ(mf->xx) + SQ(mf->xy))) * (32768 / M_PI);
|
||||
f32 temp;
|
||||
f32 temp2;
|
||||
|
||||
temp = mf->xx;
|
||||
temp *= temp;
|
||||
temp += SQ(mf->xy);
|
||||
vec->y = Math_atan2f(-mf->xz, sqrtf(temp)) * (32768 / M_PI);
|
||||
|
||||
if ((vec->y == 0x4000) || (vec->y == -0x4000)) {
|
||||
vec->x = 0;
|
||||
|
@ -774,9 +813,21 @@ void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag) {
|
|||
if (!flag) {
|
||||
vec->x = Math_atan2f(mf->yz, mf->zz) * (32768 / M_PI);
|
||||
} else {
|
||||
vec->x = Math_atan2f(mf->yz / sqrtf(SQ(mf->yx) + SQ(mf->yy) + SQ(mf->yz)),
|
||||
mf->zz / sqrtf(SQ(mf->zx) + SQ(mf->zy) + SQ(mf->zz))) *
|
||||
(32768 / M_PI);
|
||||
temp = mf->yx;
|
||||
temp *= temp;
|
||||
temp += SQ(mf->yy);
|
||||
temp += SQ(mf->yz);
|
||||
temp = sqrtf(temp);
|
||||
temp = mf->yz / temp;
|
||||
|
||||
temp2 = mf->zx;
|
||||
temp2 *= temp2;
|
||||
temp2 += SQ(mf->zy);
|
||||
temp2 += SQ(mf->zz);
|
||||
temp2 = sqrtf(temp2);
|
||||
temp2 = mf->zz / temp2;
|
||||
|
||||
vec->x = Math_atan2f(temp, temp2) * (32768 / M_PI);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -790,10 +841,12 @@ void func_800D23FC(f32 f, Vec3f* vec, u8 mode) {
|
|||
f32 sin;
|
||||
f32 cos;
|
||||
f32 rCos;
|
||||
f32 vrs;
|
||||
f32 temp1;
|
||||
f32 temp2;
|
||||
f32 temp3;
|
||||
f32 temp4;
|
||||
f32 temp5;
|
||||
|
||||
if (mode == MTXMODE_APPLY) {
|
||||
if (f != 0) {
|
||||
|
@ -853,12 +906,7 @@ void func_800D23FC(f32 f, Vec3f* vec, u8 mode) {
|
|||
cmf->yz = temp1 + temp2;
|
||||
cmf->zy = temp1 - temp2;
|
||||
|
||||
cmf->xw = 0.0f;
|
||||
cmf->yw = 0.0f;
|
||||
cmf->zw = 0.0f;
|
||||
cmf->wx = 0.0f;
|
||||
cmf->wy = 0.0f;
|
||||
cmf->wz = 0.0f;
|
||||
cmf->xw = cmf->yw = cmf->zw = cmf->wx = cmf->wy = cmf->wz = 0.0f;
|
||||
cmf->ww = 1.0f;
|
||||
} else {
|
||||
cmf->xy = 0.0f;
|
||||
|
@ -1035,35 +1083,34 @@ void func_800D2BD0(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f
|
|||
m2[15] = 0;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// minor ordering and regalloc differences
|
||||
void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) {
|
||||
u16* m1 = (u16*)&mtx->m[0][0];
|
||||
u16* m2 = (u16*)&mtx->m[2][0];
|
||||
Mtx_t* m = &mtx->m;
|
||||
u16* m1 = (u16*)(*m)[0];
|
||||
u16* m2 = (u16*)(*m)[2];
|
||||
u32 temp;
|
||||
|
||||
mtx->m[0][1] = 0;
|
||||
mtx->m[2][1] = 0;
|
||||
mtx->m[0][3] = 0;
|
||||
mtx->m[2][3] = 0;
|
||||
mtx->m[0][4] = 0;
|
||||
(*m)[0][1] = 0;
|
||||
(*m)[2][1] = 0;
|
||||
(*m)[0][3] = 0;
|
||||
(*m)[2][3] = 0;
|
||||
(*m)[0][4] = 0;
|
||||
|
||||
temp = (s32)(arg1 * 65536.0f);
|
||||
m1[0] = temp & 0xFFFF;
|
||||
mtx->m[2][0] = temp << 16;
|
||||
|
||||
temp = (s32)(arg2 * 65536.0f);
|
||||
mtx->m[0][2] = temp >> 16;
|
||||
mtx->m[2][2] = temp & 0xFFFF;
|
||||
(*m)[0][0] = temp;
|
||||
|
||||
m1[1] = 0;
|
||||
(*m)[2][0] = temp << 16;
|
||||
|
||||
mtx->m[2][4] = 0;
|
||||
temp = (s32)(arg2 * 65536.0f);
|
||||
(*m)[0][2] = temp >> 16;
|
||||
(*m)[2][2] = temp & 0xFFFF;
|
||||
|
||||
temp = (s32)(arg3 * 65536.0f);
|
||||
mtx->m[1][1] = temp;
|
||||
(*m)[1][1] = temp;
|
||||
m1[11] = 0;
|
||||
mtx->m[3][1] = temp << 16;
|
||||
(*m)[3][1] = temp << 16;
|
||||
|
||||
(*m)[2][4] = 0;
|
||||
|
||||
temp = (s32)(arg4 * 65536.0f);
|
||||
m1[12] = (temp >> 16) & 0xFFFF;
|
||||
|
@ -1075,10 +1122,6 @@ void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f
|
|||
|
||||
temp = (s32)(arg6 * 65536.0f);
|
||||
m1[14] = (temp >> 16) & 0xFFFF;
|
||||
mtx->m[3][3] = temp << 16;
|
||||
|
||||
m1[15] = 1;
|
||||
(*m)[3][3] = temp << 16;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_800D2CEC.s")
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue