From a64921a5196c1bff0f2a2d1a697db0fa1b882f6e Mon Sep 17 00:00:00 2001 From: Jcw87 Date: Fri, 6 Oct 2023 03:19:54 -0700 Subject: [PATCH] m_Do_mtx (#1956) --- asm/m_Do/m_Do_mtx/__dt__14mDoMtx_stack_cFv.s | 17 - .../m_Do_mtx/__dt__18mDoMtx_quatStack_cFv.s | 17 - asm/m_Do/m_Do_mtx/__sinit_m_Do_mtx_cpp.s | 32 -- .../mDoMtx_MtxToRot__FPA4_CfP5csXyz.s | 56 --- asm/m_Do/m_Do_mtx/mDoMtx_XrotS__FPA4_fs.s | 23 - asm/m_Do/m_Do_mtx/mDoMtx_YrotS__FPA4_fs.s | 23 - asm/m_Do/m_Do_mtx/mDoMtx_ZrotS__FPA4_fs.s | 23 - .../mDoMtx_inverseTranspose__FPA4_CfPA4_f.s | 110 ----- ...mDoMtx_lookAt__FPA4_fPC3VecPC3VecPC3Vecs.s | 116 ----- .../mDoMtx_lookAt__FPA4_fPC3VecPC3Vecs.s | 131 ------ include/m_Do/m_Do_mtx.h | 48 ++- src/m_Do/m_Do_mtx.cpp | 397 ++++++------------ 12 files changed, 162 insertions(+), 831 deletions(-) delete mode 100644 asm/m_Do/m_Do_mtx/__dt__14mDoMtx_stack_cFv.s delete mode 100644 asm/m_Do/m_Do_mtx/__dt__18mDoMtx_quatStack_cFv.s delete mode 100644 asm/m_Do/m_Do_mtx/__sinit_m_Do_mtx_cpp.s delete mode 100644 asm/m_Do/m_Do_mtx/mDoMtx_MtxToRot__FPA4_CfP5csXyz.s delete mode 100644 asm/m_Do/m_Do_mtx/mDoMtx_XrotS__FPA4_fs.s delete mode 100644 asm/m_Do/m_Do_mtx/mDoMtx_YrotS__FPA4_fs.s delete mode 100644 asm/m_Do/m_Do_mtx/mDoMtx_ZrotS__FPA4_fs.s delete mode 100644 asm/m_Do/m_Do_mtx/mDoMtx_inverseTranspose__FPA4_CfPA4_f.s delete mode 100644 asm/m_Do/m_Do_mtx/mDoMtx_lookAt__FPA4_fPC3VecPC3VecPC3Vecs.s delete mode 100644 asm/m_Do/m_Do_mtx/mDoMtx_lookAt__FPA4_fPC3VecPC3Vecs.s diff --git a/asm/m_Do/m_Do_mtx/__dt__14mDoMtx_stack_cFv.s b/asm/m_Do/m_Do_mtx/__dt__14mDoMtx_stack_cFv.s deleted file mode 100644 index e54caee09aa..00000000000 --- a/asm/m_Do/m_Do_mtx/__dt__14mDoMtx_stack_cFv.s +++ /dev/null @@ -1,17 +0,0 @@ -lbl_8000D070: -/* 8000D070 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 8000D074 7C 08 02 A6 */ mflr r0 -/* 8000D078 90 01 00 14 */ stw r0, 0x14(r1) -/* 8000D07C 93 E1 00 0C */ stw r31, 0xc(r1) -/* 8000D080 7C 7F 1B 79 */ or. r31, r3, r3 -/* 8000D084 41 82 00 10 */ beq lbl_8000D094 -/* 8000D088 7C 80 07 35 */ extsh. r0, r4 -/* 8000D08C 40 81 00 08 */ ble lbl_8000D094 -/* 8000D090 48 2C 1C AD */ bl __dl__FPv -lbl_8000D094: -/* 8000D094 7F E3 FB 78 */ mr r3, r31 -/* 8000D098 83 E1 00 0C */ lwz r31, 0xc(r1) -/* 8000D09C 80 01 00 14 */ lwz r0, 0x14(r1) -/* 8000D0A0 7C 08 03 A6 */ mtlr r0 -/* 8000D0A4 38 21 00 10 */ addi r1, r1, 0x10 -/* 8000D0A8 4E 80 00 20 */ blr diff --git a/asm/m_Do/m_Do_mtx/__dt__18mDoMtx_quatStack_cFv.s b/asm/m_Do/m_Do_mtx/__dt__18mDoMtx_quatStack_cFv.s deleted file mode 100644 index ca099e138cc..00000000000 --- a/asm/m_Do/m_Do_mtx/__dt__18mDoMtx_quatStack_cFv.s +++ /dev/null @@ -1,17 +0,0 @@ -lbl_8000D034: -/* 8000D034 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 8000D038 7C 08 02 A6 */ mflr r0 -/* 8000D03C 90 01 00 14 */ stw r0, 0x14(r1) -/* 8000D040 93 E1 00 0C */ stw r31, 0xc(r1) -/* 8000D044 7C 7F 1B 79 */ or. r31, r3, r3 -/* 8000D048 41 82 00 10 */ beq lbl_8000D058 -/* 8000D04C 7C 80 07 35 */ extsh. r0, r4 -/* 8000D050 40 81 00 08 */ ble lbl_8000D058 -/* 8000D054 48 2C 1C E9 */ bl __dl__FPv -lbl_8000D058: -/* 8000D058 7F E3 FB 78 */ mr r3, r31 -/* 8000D05C 83 E1 00 0C */ lwz r31, 0xc(r1) -/* 8000D060 80 01 00 14 */ lwz r0, 0x14(r1) -/* 8000D064 7C 08 03 A6 */ mtlr r0 -/* 8000D068 38 21 00 10 */ addi r1, r1, 0x10 -/* 8000D06C 4E 80 00 20 */ blr diff --git a/asm/m_Do/m_Do_mtx/__sinit_m_Do_mtx_cpp.s b/asm/m_Do/m_Do_mtx/__sinit_m_Do_mtx_cpp.s deleted file mode 100644 index e60b53983cc..00000000000 --- a/asm/m_Do/m_Do_mtx/__sinit_m_Do_mtx_cpp.s +++ /dev/null @@ -1,32 +0,0 @@ -lbl_8000CFB8: -/* 8000CFB8 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 8000CFBC 7C 08 02 A6 */ mflr r0 -/* 8000CFC0 90 01 00 14 */ stw r0, 0x14(r1) -/* 8000CFC4 93 E1 00 0C */ stw r31, 0xc(r1) -/* 8000CFC8 3C 60 80 3E */ lis r3, now__14mDoMtx_stack_c@ha /* 0x803DD470@ha */ -/* 8000CFCC 3B E3 D4 70 */ addi r31, r3, now__14mDoMtx_stack_c@l /* 0x803DD470@l */ -/* 8000CFD0 38 7F 00 30 */ addi r3, r31, 0x30 -/* 8000CFD4 90 6D 80 28 */ stw r3, next__14mDoMtx_stack_c(r13) -/* 8000CFD8 38 03 03 00 */ addi r0, r3, 0x300 -/* 8000CFDC 90 0D 80 2C */ stw r0, end__14mDoMtx_stack_c(r13) -/* 8000CFE0 38 6D 86 98 */ la r3, mDoMtx_stack(r13) /* 80450C18-_SDA_BASE_ */ -/* 8000CFE4 3C 80 80 01 */ lis r4, __dt__14mDoMtx_stack_cFv@ha /* 0x8000D070@ha */ -/* 8000CFE8 38 84 D0 70 */ addi r4, r4, __dt__14mDoMtx_stack_cFv@l /* 0x8000D070@l */ -/* 8000CFEC 38 BF 03 30 */ addi r5, r31, 0x330 -/* 8000CFF0 48 35 4C 35 */ bl __register_global_object -/* 8000CFF4 38 7F 03 48 */ addi r3, r31, 0x348 -/* 8000CFF8 38 03 00 04 */ addi r0, r3, 4 -/* 8000CFFC 90 1F 03 48 */ stw r0, 0x348(r31) -/* 8000D000 38 03 00 14 */ addi r0, r3, 0x14 -/* 8000D004 90 03 01 14 */ stw r0, 0x114(r3) -/* 8000D008 38 03 01 14 */ addi r0, r3, 0x114 -/* 8000D00C 90 03 01 18 */ stw r0, 0x118(r3) -/* 8000D010 3C 80 80 01 */ lis r4, __dt__18mDoMtx_quatStack_cFv@ha /* 0x8000D034@ha */ -/* 8000D014 38 84 D0 34 */ addi r4, r4, __dt__18mDoMtx_quatStack_cFv@l /* 0x8000D034@l */ -/* 8000D018 38 BF 03 3C */ addi r5, r31, 0x33c -/* 8000D01C 48 35 4C 09 */ bl __register_global_object -/* 8000D020 83 E1 00 0C */ lwz r31, 0xc(r1) -/* 8000D024 80 01 00 14 */ lwz r0, 0x14(r1) -/* 8000D028 7C 08 03 A6 */ mtlr r0 -/* 8000D02C 38 21 00 10 */ addi r1, r1, 0x10 -/* 8000D030 4E 80 00 20 */ blr diff --git a/asm/m_Do/m_Do_mtx/mDoMtx_MtxToRot__FPA4_CfP5csXyz.s b/asm/m_Do/m_Do_mtx/mDoMtx_MtxToRot__FPA4_CfP5csXyz.s deleted file mode 100644 index 8f7eaf5200e..00000000000 --- a/asm/m_Do/m_Do_mtx/mDoMtx_MtxToRot__FPA4_CfP5csXyz.s +++ /dev/null @@ -1,56 +0,0 @@ -lbl_8000CC00: -/* 8000CC00 94 21 FF F0 */ stwu r1, -0x10(r1) -/* 8000CC04 7C 08 02 A6 */ mflr r0 -/* 8000CC08 90 01 00 14 */ stw r0, 0x14(r1) -/* 8000CC0C 93 E1 00 0C */ stw r31, 0xc(r1) -/* 8000CC10 93 C1 00 08 */ stw r30, 8(r1) -/* 8000CC14 7C 7E 1B 78 */ mr r30, r3 -/* 8000CC18 7C 9F 23 78 */ mr r31, r4 -/* 8000CC1C C0 23 00 08 */ lfs f1, 8(r3) -/* 8000CC20 EC 21 00 72 */ fmuls f1, f1, f1 -/* 8000CC24 C0 03 00 28 */ lfs f0, 0x28(r3) -/* 8000CC28 EC 00 00 32 */ fmuls f0, f0, f0 -/* 8000CC2C EC 21 00 2A */ fadds f1, f1, f0 -/* 8000CC30 C0 02 81 0C */ lfs f0, lit_3677(r2) -/* 8000CC34 FC 01 00 40 */ fcmpo cr0, f1, f0 -/* 8000CC38 40 81 00 10 */ ble lbl_8000CC48 -/* 8000CC3C FC 00 08 34 */ frsqrte f0, f1 -/* 8000CC40 EC 40 00 72 */ fmuls f2, f0, f1 -/* 8000CC44 48 00 00 08 */ b lbl_8000CC4C -lbl_8000CC48: -/* 8000CC48 FC 40 08 90 */ fmr f2, f1 -lbl_8000CC4C: -/* 8000CC4C C0 1E 00 18 */ lfs f0, 0x18(r30) -/* 8000CC50 FC 20 00 50 */ fneg f1, f0 -/* 8000CC54 48 25 AA 21 */ bl cM_atan2s__Fff -/* 8000CC58 B0 7F 00 00 */ sth r3, 0(r31) -/* 8000CC5C A8 1F 00 00 */ lha r0, 0(r31) -/* 8000CC60 2C 00 40 00 */ cmpwi r0, 0x4000 -/* 8000CC64 41 82 00 0C */ beq lbl_8000CC70 -/* 8000CC68 2C 00 C0 00 */ cmpwi r0, -16384 -/* 8000CC6C 40 82 00 24 */ bne lbl_8000CC90 -lbl_8000CC70: -/* 8000CC70 38 00 00 00 */ li r0, 0 -/* 8000CC74 B0 1F 00 04 */ sth r0, 4(r31) -/* 8000CC78 C0 1E 00 20 */ lfs f0, 0x20(r30) -/* 8000CC7C FC 20 00 50 */ fneg f1, f0 -/* 8000CC80 C0 5E 00 00 */ lfs f2, 0(r30) -/* 8000CC84 48 25 A9 F1 */ bl cM_atan2s__Fff -/* 8000CC88 B0 7F 00 02 */ sth r3, 2(r31) -/* 8000CC8C 48 00 00 24 */ b lbl_8000CCB0 -lbl_8000CC90: -/* 8000CC90 C0 3E 00 08 */ lfs f1, 8(r30) -/* 8000CC94 C0 5E 00 28 */ lfs f2, 0x28(r30) -/* 8000CC98 48 25 A9 DD */ bl cM_atan2s__Fff -/* 8000CC9C B0 7F 00 02 */ sth r3, 2(r31) -/* 8000CCA0 C0 3E 00 10 */ lfs f1, 0x10(r30) -/* 8000CCA4 C0 5E 00 14 */ lfs f2, 0x14(r30) -/* 8000CCA8 48 25 A9 CD */ bl cM_atan2s__Fff -/* 8000CCAC B0 7F 00 04 */ sth r3, 4(r31) -lbl_8000CCB0: -/* 8000CCB0 83 E1 00 0C */ lwz r31, 0xc(r1) -/* 8000CCB4 83 C1 00 08 */ lwz r30, 8(r1) -/* 8000CCB8 80 01 00 14 */ lwz r0, 0x14(r1) -/* 8000CCBC 7C 08 03 A6 */ mtlr r0 -/* 8000CCC0 38 21 00 10 */ addi r1, r1, 0x10 -/* 8000CCC4 4E 80 00 20 */ blr diff --git a/asm/m_Do/m_Do_mtx/mDoMtx_XrotS__FPA4_fs.s b/asm/m_Do/m_Do_mtx/mDoMtx_XrotS__FPA4_fs.s deleted file mode 100644 index 47fa9458c74..00000000000 --- a/asm/m_Do/m_Do_mtx/mDoMtx_XrotS__FPA4_fs.s +++ /dev/null @@ -1,23 +0,0 @@ -lbl_8000C344: -/* 8000C344 3C A0 80 44 */ lis r5, sincosTable___5JMath@ha /* 0x80439A20@ha */ -/* 8000C348 38 A5 9A 20 */ addi r5, r5, sincosTable___5JMath@l /* 0x80439A20@l */ -/* 8000C34C 54 80 04 38 */ rlwinm r0, r4, 0, 0x10, 0x1c -/* 8000C350 7C 85 02 14 */ add r4, r5, r0 -/* 8000C354 C0 44 00 04 */ lfs f2, 4(r4) -/* 8000C358 7C 65 04 2E */ lfsx f3, r5, r0 -/* 8000C35C C0 02 81 08 */ lfs f0, lit_3676(r2) -/* 8000C360 D0 03 00 00 */ stfs f0, 0(r3) -/* 8000C364 C0 22 81 0C */ lfs f1, lit_3677(r2) -/* 8000C368 D0 23 00 04 */ stfs f1, 4(r3) -/* 8000C36C D0 23 00 08 */ stfs f1, 8(r3) -/* 8000C370 D0 23 00 0C */ stfs f1, 0xc(r3) -/* 8000C374 D0 23 00 10 */ stfs f1, 0x10(r3) -/* 8000C378 D0 43 00 14 */ stfs f2, 0x14(r3) -/* 8000C37C FC 00 18 50 */ fneg f0, f3 -/* 8000C380 D0 03 00 18 */ stfs f0, 0x18(r3) -/* 8000C384 D0 23 00 1C */ stfs f1, 0x1c(r3) -/* 8000C388 D0 23 00 20 */ stfs f1, 0x20(r3) -/* 8000C38C D0 63 00 24 */ stfs f3, 0x24(r3) -/* 8000C390 D0 43 00 28 */ stfs f2, 0x28(r3) -/* 8000C394 D0 23 00 2C */ stfs f1, 0x2c(r3) -/* 8000C398 4E 80 00 20 */ blr diff --git a/asm/m_Do/m_Do_mtx/mDoMtx_YrotS__FPA4_fs.s b/asm/m_Do/m_Do_mtx/mDoMtx_YrotS__FPA4_fs.s deleted file mode 100644 index 2e532bf25ce..00000000000 --- a/asm/m_Do/m_Do_mtx/mDoMtx_YrotS__FPA4_fs.s +++ /dev/null @@ -1,23 +0,0 @@ -lbl_8000C3DC: -/* 8000C3DC 3C A0 80 44 */ lis r5, sincosTable___5JMath@ha /* 0x80439A20@ha */ -/* 8000C3E0 38 A5 9A 20 */ addi r5, r5, sincosTable___5JMath@l /* 0x80439A20@l */ -/* 8000C3E4 54 80 04 38 */ rlwinm r0, r4, 0, 0x10, 0x1c -/* 8000C3E8 7C 85 02 14 */ add r4, r5, r0 -/* 8000C3EC C0 44 00 04 */ lfs f2, 4(r4) -/* 8000C3F0 7C 65 04 2E */ lfsx f3, r5, r0 -/* 8000C3F4 D0 43 00 00 */ stfs f2, 0(r3) -/* 8000C3F8 C0 22 81 0C */ lfs f1, lit_3677(r2) -/* 8000C3FC D0 23 00 04 */ stfs f1, 4(r3) -/* 8000C400 D0 63 00 08 */ stfs f3, 8(r3) -/* 8000C404 D0 23 00 0C */ stfs f1, 0xc(r3) -/* 8000C408 D0 23 00 10 */ stfs f1, 0x10(r3) -/* 8000C40C C0 02 81 08 */ lfs f0, lit_3676(r2) -/* 8000C410 D0 03 00 14 */ stfs f0, 0x14(r3) -/* 8000C414 D0 23 00 18 */ stfs f1, 0x18(r3) -/* 8000C418 D0 23 00 1C */ stfs f1, 0x1c(r3) -/* 8000C41C FC 00 18 50 */ fneg f0, f3 -/* 8000C420 D0 03 00 20 */ stfs f0, 0x20(r3) -/* 8000C424 D0 23 00 24 */ stfs f1, 0x24(r3) -/* 8000C428 D0 43 00 28 */ stfs f2, 0x28(r3) -/* 8000C42C D0 23 00 2C */ stfs f1, 0x2c(r3) -/* 8000C430 4E 80 00 20 */ blr diff --git a/asm/m_Do/m_Do_mtx/mDoMtx_ZrotS__FPA4_fs.s b/asm/m_Do/m_Do_mtx/mDoMtx_ZrotS__FPA4_fs.s deleted file mode 100644 index 68b3781b00a..00000000000 --- a/asm/m_Do/m_Do_mtx/mDoMtx_ZrotS__FPA4_fs.s +++ /dev/null @@ -1,23 +0,0 @@ -lbl_8000C474: -/* 8000C474 3C A0 80 44 */ lis r5, sincosTable___5JMath@ha /* 0x80439A20@ha */ -/* 8000C478 38 A5 9A 20 */ addi r5, r5, sincosTable___5JMath@l /* 0x80439A20@l */ -/* 8000C47C 54 80 04 38 */ rlwinm r0, r4, 0, 0x10, 0x1c -/* 8000C480 7C 85 02 14 */ add r4, r5, r0 -/* 8000C484 C0 44 00 04 */ lfs f2, 4(r4) -/* 8000C488 7C 65 04 2E */ lfsx f3, r5, r0 -/* 8000C48C D0 43 00 00 */ stfs f2, 0(r3) -/* 8000C490 FC 00 18 50 */ fneg f0, f3 -/* 8000C494 D0 03 00 04 */ stfs f0, 4(r3) -/* 8000C498 C0 22 81 0C */ lfs f1, lit_3677(r2) -/* 8000C49C D0 23 00 08 */ stfs f1, 8(r3) -/* 8000C4A0 D0 23 00 0C */ stfs f1, 0xc(r3) -/* 8000C4A4 D0 63 00 10 */ stfs f3, 0x10(r3) -/* 8000C4A8 D0 43 00 14 */ stfs f2, 0x14(r3) -/* 8000C4AC D0 23 00 18 */ stfs f1, 0x18(r3) -/* 8000C4B0 D0 23 00 1C */ stfs f1, 0x1c(r3) -/* 8000C4B4 D0 23 00 20 */ stfs f1, 0x20(r3) -/* 8000C4B8 D0 23 00 24 */ stfs f1, 0x24(r3) -/* 8000C4BC C0 02 81 08 */ lfs f0, lit_3676(r2) -/* 8000C4C0 D0 03 00 28 */ stfs f0, 0x28(r3) -/* 8000C4C4 D0 23 00 2C */ stfs f1, 0x2c(r3) -/* 8000C4C8 4E 80 00 20 */ blr diff --git a/asm/m_Do/m_Do_mtx/mDoMtx_inverseTranspose__FPA4_CfPA4_f.s b/asm/m_Do/m_Do_mtx/mDoMtx_inverseTranspose__FPA4_CfPA4_f.s deleted file mode 100644 index 993c50fb1c7..00000000000 --- a/asm/m_Do/m_Do_mtx/mDoMtx_inverseTranspose__FPA4_CfPA4_f.s +++ /dev/null @@ -1,110 +0,0 @@ -lbl_8000C9B0: -/* 8000C9B0 94 21 FF 90 */ stwu r1, -0x70(r1) -/* 8000C9B4 DB E1 00 60 */ stfd f31, 0x60(r1) -/* 8000C9B8 F3 E1 00 68 */ psq_st f31, 104(r1), 0, 0 /* qr0 */ -/* 8000C9BC DB C1 00 50 */ stfd f30, 0x50(r1) -/* 8000C9C0 F3 C1 00 58 */ psq_st f30, 88(r1), 0, 0 /* qr0 */ -/* 8000C9C4 DB A1 00 40 */ stfd f29, 0x40(r1) -/* 8000C9C8 F3 A1 00 48 */ psq_st f29, 72(r1), 0, 0 /* qr0 */ -/* 8000C9CC DB 81 00 30 */ stfd f28, 0x30(r1) -/* 8000C9D0 F3 81 00 38 */ psq_st f28, 56(r1), 0, 0 /* qr0 */ -/* 8000C9D4 DB 61 00 20 */ stfd f27, 0x20(r1) -/* 8000C9D8 F3 61 00 28 */ psq_st f27, 40(r1), 0, 0 /* qr0 */ -/* 8000C9DC DB 41 00 10 */ stfd f26, 0x10(r1) -/* 8000C9E0 F3 41 00 18 */ psq_st f26, 24(r1), 0, 0 /* qr0 */ -/* 8000C9E4 C0 E3 00 24 */ lfs f7, 0x24(r3) -/* 8000C9E8 C1 A3 00 00 */ lfs f13, 0(r3) -/* 8000C9EC C3 E3 00 18 */ lfs f31, 0x18(r3) -/* 8000C9F0 C1 63 00 04 */ lfs f11, 4(r3) -/* 8000C9F4 C0 C3 00 10 */ lfs f6, 0x10(r3) -/* 8000C9F8 C1 83 00 28 */ lfs f12, 0x28(r3) -/* 8000C9FC C1 03 00 14 */ lfs f8, 0x14(r3) -/* 8000CA00 C1 23 00 20 */ lfs f9, 0x20(r3) -/* 8000CA04 C1 43 00 08 */ lfs f10, 8(r3) -/* 8000CA08 EC 6A 01 B2 */ fmuls f3, f10, f6 -/* 8000CA0C EC 87 00 F2 */ fmuls f4, f7, f3 -/* 8000CA10 EC 4D 02 32 */ fmuls f2, f13, f8 -/* 8000CA14 EC 2C 00 B2 */ fmuls f1, f12, f2 -/* 8000CA18 EF 8B 07 F2 */ fmuls f28, f11, f31 -/* 8000CA1C EC 09 07 32 */ fmuls f0, f9, f28 -/* 8000CA20 EC 01 00 2A */ fadds f0, f1, f0 -/* 8000CA24 EC 24 00 2A */ fadds f1, f4, f0 -/* 8000CA28 EF C9 02 32 */ fmuls f30, f9, f8 -/* 8000CA2C EC 0A 07 B2 */ fmuls f0, f10, f30 -/* 8000CA30 EC 81 00 28 */ fsubs f4, f1, f0 -/* 8000CA34 EC 26 02 F2 */ fmuls f1, f6, f11 -/* 8000CA38 EC 0C 00 72 */ fmuls f0, f12, f1 -/* 8000CA3C EC 84 00 28 */ fsubs f4, f4, f0 -/* 8000CA40 EF AD 01 F2 */ fmuls f29, f13, f7 -/* 8000CA44 EC 1F 07 72 */ fmuls f0, f31, f29 -/* 8000CA48 EC A4 00 28 */ fsubs f5, f4, f0 -/* 8000CA4C C0 02 81 0C */ lfs f0, lit_3677(r2) -/* 8000CA50 FC 00 28 00 */ fcmpu cr0, f0, f5 -/* 8000CA54 40 82 00 0C */ bne lbl_8000CA60 -/* 8000CA58 38 60 00 00 */ li r3, 0 -/* 8000CA5C 48 00 00 C8 */ b lbl_8000CB24 -lbl_8000CA60: -/* 8000CA60 C0 82 81 08 */ lfs f4, lit_3676(r2) -/* 8000CA64 EF 64 28 24 */ fdivs f27, f4, f5 -/* 8000CA68 EC A8 03 32 */ fmuls f5, f8, f12 -/* 8000CA6C EC 87 07 F2 */ fmuls f4, f7, f31 -/* 8000CA70 EC 85 20 28 */ fsubs f4, f5, f4 -/* 8000CA74 EC 9B 01 32 */ fmuls f4, f27, f4 -/* 8000CA78 EF 46 03 32 */ fmuls f26, f6, f12 -/* 8000CA7C EC A9 07 F2 */ fmuls f5, f9, f31 -/* 8000CA80 EC BA 28 28 */ fsubs f5, f26, f5 -/* 8000CA84 FC A0 28 50 */ fneg f5, f5 -/* 8000CA88 EC BB 01 72 */ fmuls f5, f27, f5 -/* 8000CA8C EC C6 01 F2 */ fmuls f6, f6, f7 -/* 8000CA90 EC C6 F0 28 */ fsubs f6, f6, f30 -/* 8000CA94 EC DB 01 B2 */ fmuls f6, f27, f6 -/* 8000CA98 EF CB 03 32 */ fmuls f30, f11, f12 -/* 8000CA9C EC E7 02 B2 */ fmuls f7, f7, f10 -/* 8000CAA0 EC FE 38 28 */ fsubs f7, f30, f7 -/* 8000CAA4 FC E0 38 50 */ fneg f7, f7 -/* 8000CAA8 EC FB 01 F2 */ fmuls f7, f27, f7 -/* 8000CAAC EF CD 03 32 */ fmuls f30, f13, f12 -/* 8000CAB0 ED 89 02 B2 */ fmuls f12, f9, f10 -/* 8000CAB4 ED 9E 60 28 */ fsubs f12, f30, f12 -/* 8000CAB8 ED 9B 03 32 */ fmuls f12, f27, f12 -/* 8000CABC ED 29 02 F2 */ fmuls f9, f9, f11 -/* 8000CAC0 ED 3D 48 28 */ fsubs f9, f29, f9 -/* 8000CAC4 FD 20 48 50 */ fneg f9, f9 -/* 8000CAC8 ED 3B 02 72 */ fmuls f9, f27, f9 -/* 8000CACC ED 08 02 B2 */ fmuls f8, f8, f10 -/* 8000CAD0 ED 1C 40 28 */ fsubs f8, f28, f8 -/* 8000CAD4 ED 1B 02 32 */ fmuls f8, f27, f8 -/* 8000CAD8 D1 04 00 20 */ stfs f8, 0x20(r4) -/* 8000CADC ED 0D 07 F2 */ fmuls f8, f13, f31 -/* 8000CAE0 EC 68 18 28 */ fsubs f3, f8, f3 -/* 8000CAE4 FC 60 18 50 */ fneg f3, f3 -/* 8000CAE8 EC 7B 00 F2 */ fmuls f3, f27, f3 -/* 8000CAEC D0 64 00 24 */ stfs f3, 0x24(r4) -/* 8000CAF0 EC 22 08 28 */ fsubs f1, f2, f1 -/* 8000CAF4 EC 3B 00 72 */ fmuls f1, f27, f1 -/* 8000CAF8 D0 24 00 28 */ stfs f1, 0x28(r4) -/* 8000CAFC D0 84 00 00 */ stfs f4, 0(r4) -/* 8000CB00 D0 A4 00 04 */ stfs f5, 4(r4) -/* 8000CB04 D0 C4 00 08 */ stfs f6, 8(r4) -/* 8000CB08 D0 04 00 0C */ stfs f0, 0xc(r4) -/* 8000CB0C D0 E4 00 10 */ stfs f7, 0x10(r4) -/* 8000CB10 D1 84 00 14 */ stfs f12, 0x14(r4) -/* 8000CB14 D1 24 00 18 */ stfs f9, 0x18(r4) -/* 8000CB18 D0 04 00 1C */ stfs f0, 0x1c(r4) -/* 8000CB1C D0 04 00 2C */ stfs f0, 0x2c(r4) -/* 8000CB20 38 60 00 01 */ li r3, 1 -lbl_8000CB24: -/* 8000CB24 E3 E1 00 68 */ psq_l f31, 104(r1), 0, 0 /* qr0 */ -/* 8000CB28 CB E1 00 60 */ lfd f31, 0x60(r1) -/* 8000CB2C E3 C1 00 58 */ psq_l f30, 88(r1), 0, 0 /* qr0 */ -/* 8000CB30 CB C1 00 50 */ lfd f30, 0x50(r1) -/* 8000CB34 E3 A1 00 48 */ psq_l f29, 72(r1), 0, 0 /* qr0 */ -/* 8000CB38 CB A1 00 40 */ lfd f29, 0x40(r1) -/* 8000CB3C E3 81 00 38 */ psq_l f28, 56(r1), 0, 0 /* qr0 */ -/* 8000CB40 CB 81 00 30 */ lfd f28, 0x30(r1) -/* 8000CB44 E3 61 00 28 */ psq_l f27, 40(r1), 0, 0 /* qr0 */ -/* 8000CB48 CB 61 00 20 */ lfd f27, 0x20(r1) -/* 8000CB4C E3 41 00 18 */ psq_l f26, 24(r1), 0, 0 /* qr0 */ -/* 8000CB50 CB 41 00 10 */ lfd f26, 0x10(r1) -/* 8000CB54 38 21 00 70 */ addi r1, r1, 0x70 -/* 8000CB58 4E 80 00 20 */ blr diff --git a/asm/m_Do/m_Do_mtx/mDoMtx_lookAt__FPA4_fPC3VecPC3VecPC3Vecs.s b/asm/m_Do/m_Do_mtx/mDoMtx_lookAt__FPA4_fPC3VecPC3VecPC3Vecs.s deleted file mode 100644 index a18988a5446..00000000000 --- a/asm/m_Do/m_Do_mtx/mDoMtx_lookAt__FPA4_fPC3VecPC3VecPC3Vecs.s +++ /dev/null @@ -1,116 +0,0 @@ -lbl_8000C710: -/* 8000C710 94 21 FF 70 */ stwu r1, -0x90(r1) -/* 8000C714 7C 08 02 A6 */ mflr r0 -/* 8000C718 90 01 00 94 */ stw r0, 0x94(r1) -/* 8000C71C 93 E1 00 8C */ stw r31, 0x8c(r1) -/* 8000C720 93 C1 00 88 */ stw r30, 0x88(r1) -/* 8000C724 7C 7E 1B 78 */ mr r30, r3 -/* 8000C728 7C FF 3B 78 */ mr r31, r7 -/* 8000C72C C0 04 00 00 */ lfs f0, 0(r4) -/* 8000C730 D0 01 00 44 */ stfs f0, 0x44(r1) -/* 8000C734 C0 04 00 04 */ lfs f0, 4(r4) -/* 8000C738 D0 01 00 48 */ stfs f0, 0x48(r1) -/* 8000C73C C0 04 00 08 */ lfs f0, 8(r4) -/* 8000C740 D0 01 00 4C */ stfs f0, 0x4c(r1) -/* 8000C744 C0 05 00 00 */ lfs f0, 0(r5) -/* 8000C748 D0 01 00 38 */ stfs f0, 0x38(r1) -/* 8000C74C C0 05 00 04 */ lfs f0, 4(r5) -/* 8000C750 D0 01 00 3C */ stfs f0, 0x3c(r1) -/* 8000C754 C0 05 00 08 */ lfs f0, 8(r5) -/* 8000C758 D0 01 00 40 */ stfs f0, 0x40(r1) -/* 8000C75C C0 06 00 00 */ lfs f0, 0(r6) -/* 8000C760 D0 01 00 2C */ stfs f0, 0x2c(r1) -/* 8000C764 C0 06 00 04 */ lfs f0, 4(r6) -/* 8000C768 D0 01 00 30 */ stfs f0, 0x30(r1) -/* 8000C76C C0 06 00 08 */ lfs f0, 8(r6) -/* 8000C770 D0 01 00 34 */ stfs f0, 0x34(r1) -/* 8000C774 38 61 00 08 */ addi r3, r1, 8 -/* 8000C778 38 81 00 44 */ addi r4, r1, 0x44 -/* 8000C77C 38 A1 00 38 */ addi r5, r1, 0x38 -/* 8000C780 48 25 A3 B5 */ bl __mi__4cXyzCFRC3Vec -/* 8000C784 C0 01 00 08 */ lfs f0, 8(r1) -/* 8000C788 D0 01 00 20 */ stfs f0, 0x20(r1) -/* 8000C78C C0 01 00 0C */ lfs f0, 0xc(r1) -/* 8000C790 D0 01 00 24 */ stfs f0, 0x24(r1) -/* 8000C794 C0 01 00 10 */ lfs f0, 0x10(r1) -/* 8000C798 D0 01 00 28 */ stfs f0, 0x28(r1) -/* 8000C79C 38 61 00 20 */ addi r3, r1, 0x20 -/* 8000C7A0 48 25 A8 3D */ bl normalizeRS__4cXyzFv -/* 8000C7A4 54 60 06 3F */ clrlwi. r0, r3, 0x18 -/* 8000C7A8 40 82 00 14 */ bne lbl_8000C7BC -/* 8000C7AC C0 21 00 40 */ lfs f1, 0x40(r1) -/* 8000C7B0 C0 02 81 08 */ lfs f0, lit_3676(r2) -/* 8000C7B4 EC 01 00 2A */ fadds f0, f1, f0 -/* 8000C7B8 D0 01 00 40 */ stfs f0, 0x40(r1) -lbl_8000C7BC: -/* 8000C7BC C0 01 00 2C */ lfs f0, 0x2c(r1) -/* 8000C7C0 FC 00 02 10 */ fabs f0, f0 -/* 8000C7C4 FC 00 00 18 */ frsp f0, f0 -/* 8000C7C8 C0 2D 8C 00 */ lfs f1, G_CM3D_F_ABS_MIN(r13) -/* 8000C7CC FC 00 08 40 */ fcmpo cr0, f0, f1 -/* 8000C7D0 40 80 00 34 */ bge lbl_8000C804 -/* 8000C7D4 C0 01 00 30 */ lfs f0, 0x30(r1) -/* 8000C7D8 FC 00 02 10 */ fabs f0, f0 -/* 8000C7DC FC 00 00 18 */ frsp f0, f0 -/* 8000C7E0 FC 00 08 40 */ fcmpo cr0, f0, f1 -/* 8000C7E4 40 80 00 20 */ bge lbl_8000C804 -/* 8000C7E8 C0 01 00 34 */ lfs f0, 0x34(r1) -/* 8000C7EC FC 00 02 10 */ fabs f0, f0 -/* 8000C7F0 FC 00 00 18 */ frsp f0, f0 -/* 8000C7F4 FC 00 08 40 */ fcmpo cr0, f0, f1 -/* 8000C7F8 40 80 00 0C */ bge lbl_8000C804 -/* 8000C7FC C0 02 81 08 */ lfs f0, lit_3676(r2) -/* 8000C800 D0 01 00 30 */ stfs f0, 0x30(r1) -lbl_8000C804: -/* 8000C804 7F C3 F3 78 */ mr r3, r30 -/* 8000C808 38 81 00 44 */ addi r4, r1, 0x44 -/* 8000C80C 38 A1 00 2C */ addi r5, r1, 0x2c -/* 8000C810 38 C1 00 38 */ addi r6, r1, 0x38 -/* 8000C814 48 33 A2 79 */ bl C_MTXLookAt -/* 8000C818 38 61 00 50 */ addi r3, r1, 0x50 -/* 8000C81C 7F E4 FB 78 */ mr r4, r31 -/* 8000C820 4B FF FC 55 */ bl mDoMtx_ZrotS__FPA4_fs -/* 8000C824 38 61 00 50 */ addi r3, r1, 0x50 -/* 8000C828 7F C4 F3 78 */ mr r4, r30 -/* 8000C82C 7F C5 F3 78 */ mr r5, r30 -/* 8000C830 48 33 9C B5 */ bl PSMTXConcat -/* 8000C834 C0 5E 00 24 */ lfs f2, 0x24(r30) -/* 8000C838 C0 3E 00 14 */ lfs f1, 0x14(r30) -/* 8000C83C C0 02 81 0C */ lfs f0, lit_3677(r2) -/* 8000C840 D0 01 00 14 */ stfs f0, 0x14(r1) -/* 8000C844 D0 21 00 18 */ stfs f1, 0x18(r1) -/* 8000C848 D0 41 00 1C */ stfs f2, 0x1c(r1) -/* 8000C84C E0 01 00 14 */ psq_l f0, 20(r1), 0, 0 /* qr0 */ -/* 8000C850 10 00 00 32 */ ps_mul f0, f0, f0 -/* 8000C854 10 42 00 BA */ ps_madd f2, f2, f2, f0 -/* 8000C858 10 42 00 14 */ ps_sum0 f2, f2, f0, f0 -/* 8000C85C C0 22 81 10 */ lfs f1, lit_3840(r2) -/* 8000C860 3C 60 80 45 */ lis r3, __float_epsilon@ha /* 0x80450AEC@ha */ -/* 8000C864 C0 03 0A EC */ lfs f0, __float_epsilon@l(r3) /* 0x80450AEC@l */ -/* 8000C868 EC 01 00 32 */ fmuls f0, f1, f0 -/* 8000C86C FC 02 00 40 */ fcmpo cr0, f2, f0 -/* 8000C870 4C 40 13 82 */ cror 2, 0, 2 -/* 8000C874 40 82 00 44 */ bne lbl_8000C8B8 -/* 8000C878 C0 21 00 3C */ lfs f1, 0x3c(r1) -/* 8000C87C C0 02 81 08 */ lfs f0, lit_3676(r2) -/* 8000C880 EC 01 00 2A */ fadds f0, f1, f0 -/* 8000C884 D0 01 00 3C */ stfs f0, 0x3c(r1) -/* 8000C888 7F C3 F3 78 */ mr r3, r30 -/* 8000C88C 38 81 00 44 */ addi r4, r1, 0x44 -/* 8000C890 38 A1 00 2C */ addi r5, r1, 0x2c -/* 8000C894 38 C1 00 38 */ addi r6, r1, 0x38 -/* 8000C898 48 33 A1 F5 */ bl C_MTXLookAt -/* 8000C89C 38 61 00 50 */ addi r3, r1, 0x50 -/* 8000C8A0 7F E4 FB 78 */ mr r4, r31 -/* 8000C8A4 4B FF FB D1 */ bl mDoMtx_ZrotS__FPA4_fs -/* 8000C8A8 38 61 00 50 */ addi r3, r1, 0x50 -/* 8000C8AC 7F C4 F3 78 */ mr r4, r30 -/* 8000C8B0 7F C5 F3 78 */ mr r5, r30 -/* 8000C8B4 48 33 9C 31 */ bl PSMTXConcat -lbl_8000C8B8: -/* 8000C8B8 83 E1 00 8C */ lwz r31, 0x8c(r1) -/* 8000C8BC 83 C1 00 88 */ lwz r30, 0x88(r1) -/* 8000C8C0 80 01 00 94 */ lwz r0, 0x94(r1) -/* 8000C8C4 7C 08 03 A6 */ mtlr r0 -/* 8000C8C8 38 21 00 90 */ addi r1, r1, 0x90 -/* 8000C8CC 4E 80 00 20 */ blr diff --git a/asm/m_Do/m_Do_mtx/mDoMtx_lookAt__FPA4_fPC3VecPC3Vecs.s b/asm/m_Do/m_Do_mtx/mDoMtx_lookAt__FPA4_fPC3VecPC3Vecs.s deleted file mode 100644 index 01f0ec6703e..00000000000 --- a/asm/m_Do/m_Do_mtx/mDoMtx_lookAt__FPA4_fPC3VecPC3Vecs.s +++ /dev/null @@ -1,131 +0,0 @@ -lbl_8000C50C: -/* 8000C50C 94 21 FF 30 */ stwu r1, -0xd0(r1) -/* 8000C510 7C 08 02 A6 */ mflr r0 -/* 8000C514 90 01 00 D4 */ stw r0, 0xd4(r1) -/* 8000C518 93 E1 00 CC */ stw r31, 0xcc(r1) -/* 8000C51C 93 C1 00 C8 */ stw r30, 0xc8(r1) -/* 8000C520 7C 7E 1B 78 */ mr r30, r3 -/* 8000C524 7C DF 33 78 */ mr r31, r6 -/* 8000C528 C0 04 00 00 */ lfs f0, 0(r4) -/* 8000C52C D0 01 00 8C */ stfs f0, 0x8c(r1) -/* 8000C530 C0 04 00 04 */ lfs f0, 4(r4) -/* 8000C534 D0 01 00 90 */ stfs f0, 0x90(r1) -/* 8000C538 C0 04 00 08 */ lfs f0, 8(r4) -/* 8000C53C D0 01 00 94 */ stfs f0, 0x94(r1) -/* 8000C540 C0 05 00 00 */ lfs f0, 0(r5) -/* 8000C544 D0 01 00 5C */ stfs f0, 0x5c(r1) -/* 8000C548 C0 05 00 04 */ lfs f0, 4(r5) -/* 8000C54C D0 01 00 60 */ stfs f0, 0x60(r1) -/* 8000C550 C0 05 00 08 */ lfs f0, 8(r5) -/* 8000C554 D0 01 00 64 */ stfs f0, 0x64(r1) -/* 8000C558 38 61 00 50 */ addi r3, r1, 0x50 -/* 8000C55C 38 81 00 8C */ addi r4, r1, 0x8c -/* 8000C560 38 A1 00 5C */ addi r5, r1, 0x5c -/* 8000C564 48 25 A5 D1 */ bl __mi__4cXyzCFRC3Vec -/* 8000C568 C0 01 00 50 */ lfs f0, 0x50(r1) -/* 8000C56C D0 01 00 68 */ stfs f0, 0x68(r1) -/* 8000C570 C0 01 00 54 */ lfs f0, 0x54(r1) -/* 8000C574 D0 01 00 6C */ stfs f0, 0x6c(r1) -/* 8000C578 C0 01 00 58 */ lfs f0, 0x58(r1) -/* 8000C57C D0 01 00 70 */ stfs f0, 0x70(r1) -/* 8000C580 38 61 00 44 */ addi r3, r1, 0x44 -/* 8000C584 38 81 00 68 */ addi r4, r1, 0x68 -/* 8000C588 48 25 A9 6D */ bl normalize__4cXyzFv -/* 8000C58C C0 22 81 0C */ lfs f1, lit_3677(r2) -/* 8000C590 D0 21 00 80 */ stfs f1, 0x80(r1) -/* 8000C594 C0 02 81 08 */ lfs f0, lit_3676(r2) -/* 8000C598 D0 01 00 84 */ stfs f0, 0x84(r1) -/* 8000C59C D0 21 00 88 */ stfs f1, 0x88(r1) -/* 8000C5A0 38 61 00 38 */ addi r3, r1, 0x38 -/* 8000C5A4 38 81 00 80 */ addi r4, r1, 0x80 -/* 8000C5A8 38 A1 00 68 */ addi r5, r1, 0x68 -/* 8000C5AC 48 25 A7 11 */ bl outprod__4cXyzCFRC3Vec -/* 8000C5B0 C0 01 00 38 */ lfs f0, 0x38(r1) -/* 8000C5B4 D0 01 00 80 */ stfs f0, 0x80(r1) -/* 8000C5B8 C0 01 00 3C */ lfs f0, 0x3c(r1) -/* 8000C5BC D0 01 00 84 */ stfs f0, 0x84(r1) -/* 8000C5C0 C0 01 00 40 */ lfs f0, 0x40(r1) -/* 8000C5C4 D0 01 00 88 */ stfs f0, 0x88(r1) -/* 8000C5C8 38 61 00 80 */ addi r3, r1, 0x80 -/* 8000C5CC 48 25 AA 11 */ bl normalizeRS__4cXyzFv -/* 8000C5D0 54 60 06 3F */ clrlwi. r0, r3, 0x18 -/* 8000C5D4 40 82 00 50 */ bne lbl_8000C624 -/* 8000C5D8 C0 01 00 6C */ lfs f0, 0x6c(r1) -/* 8000C5DC FC 00 00 50 */ fneg f0, f0 -/* 8000C5E0 D0 01 00 80 */ stfs f0, 0x80(r1) -/* 8000C5E4 C0 02 81 0C */ lfs f0, lit_3677(r2) -/* 8000C5E8 D0 01 00 84 */ stfs f0, 0x84(r1) -/* 8000C5EC D0 01 00 88 */ stfs f0, 0x88(r1) -/* 8000C5F0 38 61 00 2C */ addi r3, r1, 0x2c -/* 8000C5F4 38 81 00 80 */ addi r4, r1, 0x80 -/* 8000C5F8 38 A1 00 68 */ addi r5, r1, 0x68 -/* 8000C5FC 48 25 A6 C1 */ bl outprod__4cXyzCFRC3Vec -/* 8000C600 C0 01 00 2C */ lfs f0, 0x2c(r1) -/* 8000C604 D0 01 00 80 */ stfs f0, 0x80(r1) -/* 8000C608 C0 01 00 30 */ lfs f0, 0x30(r1) -/* 8000C60C D0 01 00 84 */ stfs f0, 0x84(r1) -/* 8000C610 C0 01 00 34 */ lfs f0, 0x34(r1) -/* 8000C614 D0 01 00 88 */ stfs f0, 0x88(r1) -/* 8000C618 38 61 00 20 */ addi r3, r1, 0x20 -/* 8000C61C 38 81 00 80 */ addi r4, r1, 0x80 -/* 8000C620 48 25 A8 D5 */ bl normalize__4cXyzFv -lbl_8000C624: -/* 8000C624 38 61 00 14 */ addi r3, r1, 0x14 -/* 8000C628 38 81 00 68 */ addi r4, r1, 0x68 -/* 8000C62C 38 A1 00 80 */ addi r5, r1, 0x80 -/* 8000C630 48 25 A6 8D */ bl outprod__4cXyzCFRC3Vec -/* 8000C634 C0 01 00 14 */ lfs f0, 0x14(r1) -/* 8000C638 D0 01 00 74 */ stfs f0, 0x74(r1) -/* 8000C63C C0 01 00 18 */ lfs f0, 0x18(r1) -/* 8000C640 D0 01 00 78 */ stfs f0, 0x78(r1) -/* 8000C644 C0 01 00 1C */ lfs f0, 0x1c(r1) -/* 8000C648 D0 01 00 7C */ stfs f0, 0x7c(r1) -/* 8000C64C 38 61 00 08 */ addi r3, r1, 8 -/* 8000C650 38 81 00 74 */ addi r4, r1, 0x74 -/* 8000C654 48 25 A8 A1 */ bl normalize__4cXyzFv -/* 8000C658 C0 01 00 80 */ lfs f0, 0x80(r1) -/* 8000C65C D0 1E 00 00 */ stfs f0, 0(r30) -/* 8000C660 C0 01 00 84 */ lfs f0, 0x84(r1) -/* 8000C664 D0 1E 00 04 */ stfs f0, 4(r30) -/* 8000C668 C0 01 00 88 */ lfs f0, 0x88(r1) -/* 8000C66C D0 1E 00 08 */ stfs f0, 8(r30) -/* 8000C670 38 61 00 80 */ addi r3, r1, 0x80 -/* 8000C674 38 81 00 8C */ addi r4, r1, 0x8c -/* 8000C678 48 33 AB 1D */ bl PSVECDotProduct -/* 8000C67C FC 00 08 50 */ fneg f0, f1 -/* 8000C680 D0 1E 00 0C */ stfs f0, 0xc(r30) -/* 8000C684 C0 01 00 74 */ lfs f0, 0x74(r1) -/* 8000C688 D0 1E 00 10 */ stfs f0, 0x10(r30) -/* 8000C68C C0 01 00 78 */ lfs f0, 0x78(r1) -/* 8000C690 D0 1E 00 14 */ stfs f0, 0x14(r30) -/* 8000C694 C0 01 00 7C */ lfs f0, 0x7c(r1) -/* 8000C698 D0 1E 00 18 */ stfs f0, 0x18(r30) -/* 8000C69C 38 61 00 74 */ addi r3, r1, 0x74 -/* 8000C6A0 38 81 00 8C */ addi r4, r1, 0x8c -/* 8000C6A4 48 33 AA F1 */ bl PSVECDotProduct -/* 8000C6A8 FC 00 08 50 */ fneg f0, f1 -/* 8000C6AC D0 1E 00 1C */ stfs f0, 0x1c(r30) -/* 8000C6B0 C0 01 00 68 */ lfs f0, 0x68(r1) -/* 8000C6B4 D0 1E 00 20 */ stfs f0, 0x20(r30) -/* 8000C6B8 C0 01 00 6C */ lfs f0, 0x6c(r1) -/* 8000C6BC D0 1E 00 24 */ stfs f0, 0x24(r30) -/* 8000C6C0 C0 01 00 70 */ lfs f0, 0x70(r1) -/* 8000C6C4 D0 1E 00 28 */ stfs f0, 0x28(r30) -/* 8000C6C8 38 61 00 68 */ addi r3, r1, 0x68 -/* 8000C6CC 38 81 00 8C */ addi r4, r1, 0x8c -/* 8000C6D0 48 33 AA C5 */ bl PSVECDotProduct -/* 8000C6D4 FC 00 08 50 */ fneg f0, f1 -/* 8000C6D8 D0 1E 00 2C */ stfs f0, 0x2c(r30) -/* 8000C6DC 38 61 00 98 */ addi r3, r1, 0x98 -/* 8000C6E0 7F E4 FB 78 */ mr r4, r31 -/* 8000C6E4 4B FF FD 91 */ bl mDoMtx_ZrotS__FPA4_fs -/* 8000C6E8 38 61 00 98 */ addi r3, r1, 0x98 -/* 8000C6EC 7F C4 F3 78 */ mr r4, r30 -/* 8000C6F0 7F C5 F3 78 */ mr r5, r30 -/* 8000C6F4 48 33 9D F1 */ bl PSMTXConcat -/* 8000C6F8 83 E1 00 CC */ lwz r31, 0xcc(r1) -/* 8000C6FC 83 C1 00 C8 */ lwz r30, 0xc8(r1) -/* 8000C700 80 01 00 D4 */ lwz r0, 0xd4(r1) -/* 8000C704 7C 08 03 A6 */ mtlr r0 -/* 8000C708 38 21 00 D0 */ addi r1, r1, 0xd0 -/* 8000C70C 4E 80 00 20 */ blr diff --git a/include/m_Do/m_Do_mtx.h b/include/m_Do/m_Do_mtx.h index 6682dc45643..20fa0d21dc9 100644 --- a/include/m_Do/m_Do_mtx.h +++ b/include/m_Do/m_Do_mtx.h @@ -22,7 +22,7 @@ void mDoMtx_lookAt(Mtx param_0, Vec const* param_1, Vec const* param_2, Vec cons s16 param_4); void mDoMtx_concatProjView(f32 const (*param_0)[4], f32 const (*param_1)[4], f32 (*param_2)[4]); void mDoMtx_ZrotM(Mtx mtx, s16 z); -void mDoMtx_inverseTranspose(f32 const (*param_0)[4], f32 (*param_1)[4]); +bool mDoMtx_inverseTranspose(f32 const (*param_0)[4], f32 (*param_1)[4]); void mDoMtx_QuatConcat(Quaternion const* param_0, Quaternion const* param_1, Quaternion* param_2); inline void mDoMtx_multVecSR(Mtx m, const Vec* src, Vec* dst) { @@ -111,15 +111,28 @@ inline void mDoMtx_inverse(const Mtx a, Mtx b) { MTXInverse(a, b); } +inline void mDoMtx_scale(Mtx m, f32 x, f32 y, f32 z) { + MTXScale(m, x, y, z); +} + +inline void mDoMtx_quat(Mtx m, const Quaternion* q) { + MTXQuat(m, q); +} + inline void cMtx_inverse(const Mtx a, Mtx b) { mDoMtx_inverse(a, b); } class mDoMtx_stack_c { public: + mDoMtx_stack_c() { + next = buffer; + end = buffer + 16; + } + /* 8000CCC8 */ static bool push(); /* 8000CD14 */ static bool pop(); - + /** * Translates the `now` Matrix by the given cXyz * @param xyz The xyz translation vector @@ -177,7 +190,7 @@ public: /* 8000CF44 */ static void ZXYrotM(csXyz const& xyz); /* 8000CF7C */ static void quatM(Quaternion const*); - /* 8000D070 */ ~mDoMtx_stack_c(); // inline + /* 8000D070 */ ~mDoMtx_stack_c() {} // inline /** * Returns the `now` Matrix @@ -200,7 +213,7 @@ public: * @param z The z-axis scale value */ static void scaleS(f32 x, f32 y, f32 z) { MTXScale(now, x, y, z); } - + /** * Multiplies a given Vec `a` by the `now` Matrix and places the result into Vec `b` * @param a The source Vec @@ -228,7 +241,7 @@ public: } static void XYZrotS(s16 x, s16 y, s16 z) { mDoMtx_XYZrotS(now, x, y, z); } - + /** * Rotates the `now` matrix by the given X, Y, and Z values in the order Z, Y, X * @param x The x-axis rotation value @@ -236,9 +249,9 @@ public: * @param z The z-axis rotation value */ static void XYZrotM(s16 x, s16 y, s16 z) { mDoMtx_XYZrotM(now, x, y, z); } - + static void ZXYrotS(s16 x, s16 y, s16 z) { mDoMtx_ZXYrotS(now, x, y, z); } - + /** * Rotates the `now` matrix by the given X, Y, and Z values in the order X, Y, Z * @param x The x-axis rotation value @@ -246,7 +259,7 @@ public: * @param z The z-axis rotation value */ static void ZXYrotM(s16 x, s16 y, s16 z) { mDoMtx_ZXYrotM(now, x, y, z); } - + /** * Rotates a new matrix on the Y-axis then concatenates it with the `now` matrix * @param y The rotation value @@ -309,15 +322,18 @@ inline MtxP mDoMtx_getIdentity() { class mDoMtx_quatStack_c { public: - ~mDoMtx_quatStack_c(); // inline + mDoMtx_quatStack_c() { + field_0x0 = &field_0x4; + field_0x114 = field_0x14; + field_0x118 = &field_0x114; + } + ~mDoMtx_quatStack_c() {} // inline - /* 0x000 */ mDoMtx_quatStack_c* field_0x0; - /* 0x004 */ mDoMtx_quatStack_c* field_0x4; - /* 0x008 */ u8 field_0x8[0xC]; - /* 0x014 */ mDoMtx_quatStack_c* field_0x14; - /* 0x018 */ u8 field_0x18[0xFC]; - /* 0x114 */ mDoMtx_quatStack_c* field_0x114; - /* 0x118 */ mDoMtx_quatStack_c* field_0x118; + /* 0x000 */ Quaternion* field_0x0; + /* 0x004 */ Quaternion field_0x4; + /* 0x014 */ Quaternion field_0x14[16]; + /* 0x114 */ Quaternion* field_0x114; + /* 0x118 */ Quaternion** field_0x118; }; // Size: 0x11C #endif /* M_DO_M_DO_MTX_H */ diff --git a/src/m_Do/m_Do_mtx.cpp b/src/m_Do/m_Do_mtx.cpp index cf98562503f..b88cf3f23f6 100644 --- a/src/m_Do/m_Do_mtx.cpp +++ b/src/m_Do/m_Do_mtx.cpp @@ -4,69 +4,13 @@ */ #include "m_Do/m_Do_mtx.h" -#include "dol2asm.h" -#include "dolphin/types.h" +#include "JSystem/JGeometry.h" #include "JSystem/JMath/JMATrigonometric.h" #include "JSystem/JMath/JMath.h" +#include "JSystem/JUtility/JUTAssert.h" +#include "SSystem/SComponent/c_m3d.h" #include "SSystem/SComponent/c_math.h" -// -// Forward References: -// - -extern "C" static void mDoMtx_XYZrotS__FPA4_fsss(); -extern "C" void mDoMtx_XYZrotM__FPA4_fsss(); -extern "C" void mDoMtx_ZXYrotS__FPA4_fsss(); -extern "C" void mDoMtx_ZXYrotM__FPA4_fsss(); -extern "C" void mDoMtx_XrotS__FPA4_fs(); -extern "C" void mDoMtx_XrotM__FPA4_fs(); -extern "C" void mDoMtx_YrotS__FPA4_fs(); -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void mDoMtx_ZrotS__FPA4_fs(); -extern "C" void mDoMtx_ZrotM__FPA4_fs(); -extern "C" void mDoMtx_lookAt__FPA4_fPC3VecPC3Vecs(); -extern "C" void mDoMtx_lookAt__FPA4_fPC3VecPC3VecPC3Vecs(); -extern "C" void mDoMtx_concatProjView__FPA4_CfPA4_CfPA4_f(); -extern "C" void mDoMtx_inverseTranspose__FPA4_CfPA4_f(); -extern "C" void mDoMtx_QuatConcat__FPC10QuaternionPC10QuaternionP10Quaternion(); -extern "C" void mDoMtx_MtxToRot__FPA4_CfP5csXyz(); -extern "C" void push__14mDoMtx_stack_cFv(); -extern "C" void pop__14mDoMtx_stack_cFv(); -extern "C" void transS__14mDoMtx_stack_cFRC4cXyz(); -extern "C" void transM__14mDoMtx_stack_cFfff(); -extern "C" void transM__14mDoMtx_stack_cFRC4cXyz(); -extern "C" void scaleS__14mDoMtx_stack_cFRC4cXyz(); -extern "C" void scaleM__14mDoMtx_stack_cFfff(); -extern "C" void scaleM__14mDoMtx_stack_cFRC4cXyz(); -extern "C" void XYZrotS__14mDoMtx_stack_cFRC5csXyz(); -extern "C" void XYZrotM__14mDoMtx_stack_cFRC5csXyz(); -extern "C" void ZXYrotS__14mDoMtx_stack_cFRC5csXyz(); -extern "C" void ZXYrotM__14mDoMtx_stack_cFRC5csXyz(); -extern "C" void quatM__14mDoMtx_stack_cFPC10Quaternion(); -extern "C" void __sinit_m_Do_mtx_cpp(); -extern "C" void __dt__18mDoMtx_quatStack_cFv(); -extern "C" void __dt__14mDoMtx_stack_cFv(); -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" u8 buffer__14mDoMtx_stack_c[768]; -extern "C" void* next__14mDoMtx_stack_c; -extern "C" void* end__14mDoMtx_stack_c; - -// -// External References: -// - -extern "C" void __mi__4cXyzCFRC3Vec(); -extern "C" void outprod__4cXyzCFRC3Vec(); -extern "C" void normalize__4cXyzFv(); -extern "C" void normalizeRS__4cXyzFv(); -extern "C" void cM_atan2s__Fff(); -extern "C" void __dl__FPv(); -extern "C" void __register_global_object(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_29(); -extern "C" u8 sincosTable___5JMath[65536]; -extern "C" extern f32 G_CM3D_F_ABS_MIN[1 + 1 /* padding */]; - // // Declarations: // @@ -77,17 +21,17 @@ void mDoMtx_XYZrotS(Mtx mtx, s16 x, s16 y, s16 z) { if (z != 0) { mDoMtx_ZrotS(mtx, z); } else { - MTXIdentity(mtx); + mDoMtx_identity(mtx); } if (y != 0) { mDoMtx_YrotS(tmp, y); - MTXConcat(mtx, tmp, mtx); + mDoMtx_concat(mtx, tmp, mtx); } if (x != 0) { mDoMtx_XrotS(tmp, x); - MTXConcat(mtx, tmp, mtx); + mDoMtx_concat(mtx, tmp, mtx); } } @@ -96,17 +40,17 @@ void mDoMtx_XYZrotM(Mtx mtx, s16 x, s16 y, s16 z) { Mtx tmp; if (z != 0) { mDoMtx_ZrotS(tmp, z); - MTXConcat(mtx, tmp, mtx); + mDoMtx_concat(mtx, tmp, mtx); } if (y != 0) { mDoMtx_YrotS(tmp, y); - MTXConcat(mtx, tmp, mtx); + mDoMtx_concat(mtx, tmp, mtx); } if (x != 0) { mDoMtx_XrotS(tmp, x); - MTXConcat(mtx, tmp, mtx); + mDoMtx_concat(mtx, tmp, mtx); } } @@ -116,17 +60,17 @@ void mDoMtx_ZXYrotS(Mtx mtx, s16 x, s16 y, s16 z) { if (y != 0) { mDoMtx_YrotS(mtx, y); } else { - MTXIdentity(mtx); + mDoMtx_identity(mtx); } if (x != 0) { mDoMtx_XrotS(tmp, x); - MTXConcat(mtx, tmp, mtx); + mDoMtx_concat(mtx, tmp, mtx); } if (z != 0) { mDoMtx_ZrotS(tmp, z); - MTXConcat(mtx, tmp, mtx); + mDoMtx_concat(mtx, tmp, mtx); } } @@ -135,35 +79,21 @@ void mDoMtx_ZXYrotM(Mtx mtx, s16 x, s16 y, s16 z) { Mtx tmp; if (y != 0) { mDoMtx_YrotS(tmp, y); - MTXConcat(mtx, tmp, mtx); + mDoMtx_concat(mtx, tmp, mtx); } if (x != 0) { mDoMtx_XrotS(tmp, x); - MTXConcat(mtx, tmp, mtx); + mDoMtx_concat(mtx, tmp, mtx); } if (z != 0) { mDoMtx_ZrotS(tmp, z); - MTXConcat(mtx, tmp, mtx); + mDoMtx_concat(mtx, tmp, mtx); } } -/* ############################################################################################## */ -/* 80451B08-80451B0C 000108 0004+00 6/6 0/0 0/0 .sdata2 @3676 */ -SECTION_SDATA2 static f32 lit_3676 = 1.0f; - -/* 80451B0C-80451B10 00010C 0004+00 7/7 0/0 0/0 .sdata2 @3677 */ -SECTION_SDATA2 static u8 lit_3677[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; - /* 8000C344-8000C39C 006C84 0058+00 5/5 7/7 38/38 .text mDoMtx_XrotS__FPA4_fs */ -#ifdef NONMATCHING -// matches with literals void mDoMtx_XrotS(Mtx mtx, s16 x) { f32 l_cos = JMASCos(x); f32 l_sin = JMASSin(x); @@ -183,16 +113,6 @@ void mDoMtx_XrotS(Mtx mtx, s16 x) { mtx[2][2] = l_cos; mtx[2][3] = 0.0f; } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void mDoMtx_XrotS(f32 (*param_0)[4], s16 param_1) { - nofralloc -#include "asm/m_Do/m_Do_mtx/mDoMtx_XrotS__FPA4_fs.s" -} -#pragma pop -#endif /* 8000C39C-8000C3DC 006CDC 0040+00 0/0 11/11 425/425 .text mDoMtx_XrotM__FPA4_fs */ void mDoMtx_XrotM(Mtx mtx, s16 x) { @@ -202,8 +122,6 @@ void mDoMtx_XrotM(Mtx mtx, s16 x) { } /* 8000C3DC-8000C434 006D1C 0058+00 5/5 24/24 809/809 .text mDoMtx_YrotS__FPA4_fs */ -#ifdef NONMATCHING -// matches with literals void mDoMtx_YrotS(Mtx mtx, s16 y) { f32 l_cos = JMASCos(y); f32 l_sin = JMASSin(y); @@ -217,22 +135,12 @@ void mDoMtx_YrotS(Mtx mtx, s16 y) { mtx[1][1] = 1.0; mtx[1][2] = 0.0; mtx[1][3] = 0.0f; - + mtx[2][0] = -l_sin; mtx[2][1] = 0.0f; mtx[2][2] = l_cos; mtx[2][3] = 0.0f; } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void mDoMtx_YrotS(f32 (*param_0)[4], s16 param_1) { - nofralloc -#include "asm/m_Do/m_Do_mtx/mDoMtx_YrotS__FPA4_fs.s" -} -#pragma pop -#endif /* 8000C434-8000C474 006D74 0040+00 0/0 44/44 775/775 .text mDoMtx_YrotM__FPA4_fs */ void mDoMtx_YrotM(Mtx mtx, s16 y) { @@ -242,8 +150,6 @@ void mDoMtx_YrotM(Mtx mtx, s16 y) { } /* 8000C474-8000C4CC 006DB4 0058+00 7/7 1/1 6/6 .text mDoMtx_ZrotS__FPA4_fs */ -#ifdef NONMATCHING -// matches with literals void mDoMtx_ZrotS(Mtx mtx, s16 z) { f32 l_cos = JMASCos(z); f32 l_sin = JMASSin(z); @@ -257,22 +163,12 @@ void mDoMtx_ZrotS(Mtx mtx, s16 z) { mtx[1][1] = l_cos; mtx[1][2] = 0.0; mtx[1][3] = 0.0f; - + mtx[2][0] = 0.0f; mtx[2][1] = 0.0f; mtx[2][2] = 1.0f; mtx[2][3] = 0.0f; } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void mDoMtx_ZrotS(f32 (*param_0)[4], s16 param_1) { - nofralloc -#include "asm/m_Do/m_Do_mtx/mDoMtx_ZrotS__FPA4_fs.s" -} -#pragma pop -#endif /* 8000C4CC-8000C50C 006E0C 0040+00 0/0 9/9 302/302 .text mDoMtx_ZrotM__FPA4_fs */ void mDoMtx_ZrotM(Mtx mtx, s16 z) { @@ -283,79 +179,76 @@ void mDoMtx_ZrotM(Mtx mtx, s16 z) { /* 8000C50C-8000C710 006E4C 0204+00 0/0 3/3 0/0 .text mDoMtx_lookAt__FPA4_fPC3VecPC3Vecs */ -#ifdef NONMATCHING -// stack issues void mDoMtx_lookAt(Mtx mtx, Vec const* param_1, Vec const* param_2, s16 param_3) { - cXyz l_p1 = (cXyz)*param_1; - cXyz l_pos2; - cXyz l_pos1 = l_p1 - (cXyz)*param_2; + cXyz stack_48(*(cXyz*)param_1); + cXyz local_54; + cXyz local_60; + cXyz local_6c = stack_48 - cXyz(*(cXyz*)param_2); - l_pos2.set(0.0f, 1.0f, 0.0f); - l_pos2 = l_pos2.outprod(l_pos1.normalize()); + local_6c.normalize(); + local_54.set(0.0f, 1.0f, 0.0f); + local_54 = local_54.outprod(local_6c); - if (!l_pos2.normalizeRS()) { - l_pos2.set(-l_pos1.y,0.0f,0.0f); - l_pos2 = l_pos2.outprod(l_pos1); - l_pos2.normalize(); + if (!local_54.normalizeRS()) { + local_54.set(-local_6c.y, 0.0f, 0.0f); + local_54 = local_54.outprod(local_6c); + local_54.normalize(); } - l_pos2 = l_pos2.outprod(l_pos1); - l_pos2.normalize(); + local_60 = local_6c.outprod(local_54); + local_60.normalize(); - mtx[0][0] = l_pos2.x; - mtx[0][1] = l_pos2.y; - mtx[0][2] = l_pos2.z; - mtx[0][3] = -l_pos2.inprod(l_p1); + mtx[0][0] = local_54.x; + mtx[0][1] = local_54.y; + mtx[0][2] = local_54.z; + mtx[0][3] = -local_54.inprod(stack_48); - mtx[1][0] = l_pos1.x; - mtx[1][1] = l_pos1.y; - mtx[1][2] = l_pos1.z; - mtx[1][3] = -l_pos1.inprod(l_p1); + mtx[1][0] = local_60.x; + mtx[1][1] = local_60.y; + mtx[1][2] = local_60.z; + mtx[1][3] = -local_60.inprod(stack_48); - mtx[2][0] = l_pos2.x; - mtx[2][1] = l_pos2.y; - mtx[2][2] = l_pos2.z; - mtx[2][3] = -l_pos2.inprod(l_p1); + mtx[2][0] = local_6c.x; + mtx[2][1] = local_6c.y; + mtx[2][2] = local_6c.z; + mtx[2][3] = -local_6c.inprod(stack_48); Mtx tmp; mDoMtx_ZrotS(tmp, param_3); mDoMtx_concat(tmp, mtx, mtx); } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void mDoMtx_lookAt(f32 (*param_0)[4], Vec const* param_1, Vec const* param_2, s16 param_3) { - nofralloc -#include "asm/m_Do/m_Do_mtx/mDoMtx_lookAt__FPA4_fPC3VecPC3Vecs.s" -} -#pragma pop -#endif - -/* ############################################################################################## */ -/* 80451B10-80451B18 000110 0004+04 1/1 0/0 0/0 .sdata2 @3840 */ -SECTION_SDATA2 static f32 lit_3840[1 + 1 /* padding */] = { - 32.0f, - /* padding */ - 0.0f, -}; /* 8000C710-8000C8D0 007050 01C0+00 0/0 10/10 1/1 .text mDoMtx_lookAt__FPA4_fPC3VecPC3VecPC3Vecs */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void mDoMtx_lookAt(f32 (*param_0)[4], Vec const* param_1, Vec const* param_2, - Vec const* param_3, s16 param_4) { - nofralloc -#include "asm/m_Do/m_Do_mtx/mDoMtx_lookAt__FPA4_fPC3VecPC3VecPC3Vecs.s" +void mDoMtx_lookAt(Mtx mtx, Vec const* param_1, Vec const* param_2, Vec const* param_3, + s16 param_4) { + cXyz local_4c(*(cXyz*)param_1); + cXyz local_58(*(cXyz*)param_2); + cXyz local_64(*(cXyz*)param_3); + cXyz local_70 = local_4c - local_58; + if (!local_70.normalizeRS()) { + local_58.z += 1.0f; + } + if (cM3d_IsZero(local_64.x) && cM3d_IsZero(local_64.y) && cM3d_IsZero(local_64.z)) { + local_64.y = 1.0f; + } + C_MTXLookAt(mtx, &local_4c, &local_64, &local_58); + Mtx local_40; + mDoMtx_ZrotS(local_40, param_4); + mDoMtx_concat(local_40, mtx, mtx); + JGeometry::TVec3 local_7c; + local_7c.set(0.0f, mtx[1][1], mtx[2][1]); + if (local_7c.isZero()) { + local_58.y += 1.0f; + C_MTXLookAt(mtx, &local_4c, &local_64, &local_58); + mDoMtx_ZrotS(local_40, param_4); + mDoMtx_concat(local_40, mtx, mtx); + } } -#pragma pop /* 8000C8D0-8000C9B0 007210 00E0+00 0/0 2/2 0/0 .text mDoMtx_concatProjView__FPA4_CfPA4_CfPA4_f */ -void mDoMtx_concatProjView(const Mtx a, const Mtx b, - Mtx c) { - mDoMtx_concat(a,b,c); +void mDoMtx_concatProjView(const Mtx a, const Mtx b, Mtx c) { + mDoMtx_concat(a, b, c); c[3][0] = a[3][0] * b[0][0] + a[3][1] * b[1][0] + a[3][2] * b[2][0]; c[3][1] = a[3][0] * b[0][1] + a[3][1] * b[1][1] + a[3][2] * b[2][1]; c[3][2] = a[3][0] * b[0][2] + a[3][1] * b[1][2] + a[3][2] * b[2][2]; @@ -363,19 +256,44 @@ void mDoMtx_concatProjView(const Mtx a, const Mtx b, } /* 8000C9B0-8000CB5C 0072F0 01AC+00 0/0 1/1 1/1 .text mDoMtx_inverseTranspose__FPA4_CfPA4_f */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void mDoMtx_inverseTranspose(f32 const (*param_0)[4], f32 (*param_1)[4]) { - nofralloc -#include "asm/m_Do/m_Do_mtx/mDoMtx_inverseTranspose__FPA4_CfPA4_f.s" +bool mDoMtx_inverseTranspose(const Mtx a, Mtx b) { + f32 f31 = a[0][0] * a[1][1] * a[2][2] + a[0][1] * a[1][2] * a[2][0] + + a[0][2] * a[1][0] * a[2][1] - a[2][0] * a[1][1] * a[0][2] - + a[1][0] * a[0][1] * a[2][2] - a[0][0] * a[2][1] * a[1][2]; + + if (f31 == 0.0f) { + return false; + } + + f31 = 1.0f / f31; + + Mtx23 tmp; + tmp[0][0] = f31 * (a[1][1] * a[2][2] - a[2][1] * a[1][2]); + tmp[0][1] = f31 * -(a[1][0] * a[2][2] - a[2][0] * a[1][2]); + tmp[0][2] = f31 * (a[1][0] * a[2][1] - a[2][0] * a[1][1]); + tmp[1][0] = f31 * -(a[0][1] * a[2][2] - a[2][1] * a[0][2]); + tmp[1][1] = f31 * (a[0][0] * a[2][2] - a[2][0] * a[0][2]); + tmp[1][2] = f31 * -(a[0][0] * a[2][1] - a[2][0] * a[0][1]); + + b[2][0] = f31 * (a[0][1] * a[1][2] - a[1][1] * a[0][2]); + b[2][1] = f31 * -(a[0][0] * a[1][2] - a[1][0] * a[0][2]); + b[2][2] = f31 * (a[0][0] * a[1][1] - a[1][0] * a[0][1]); + b[0][0] = tmp[0][0]; + b[0][1] = tmp[0][1]; + b[0][2] = tmp[0][2]; + b[0][3] = 0.0f; + b[1][0] = tmp[1][0]; + b[1][1] = tmp[1][1]; + b[1][2] = tmp[1][2]; + b[1][3] = 0.0f; + b[2][3] = 0.0f; + + return true; } -#pragma pop /* 8000CB5C-8000CC00 00749C 00A4+00 0/0 2/2 2/2 .text * mDoMtx_QuatConcat__FPC10QuaternionPC10QuaternionP10Quaternion */ -void mDoMtx_QuatConcat(Quaternion const* a, Quaternion const* b, - Quaternion* c) { +void mDoMtx_QuatConcat(const Quaternion* a, const Quaternion* b, Quaternion* c) { c->w = (a->w * b->w) - (a->x * b->x) - (a->y * b->y) - (a->z * b->z); c->x = (a->w * b->x) + (a->x * b->w) + (a->y * b->z) - (a->z * b->y); c->y = (a->w * b->y) + (a->y * b->w) + (a->z * b->x) - (a->x * b->z); @@ -384,33 +302,23 @@ void mDoMtx_QuatConcat(Quaternion const* a, Quaternion const* b, /* 8000CC00-8000CCC8 007540 00C8+00 0/0 11/11 26/26 .text mDoMtx_MtxToRot__FPA4_CfP5csXyz */ -#ifdef NONMATCHING -// something wrong with JMAFastSqrt? -void mDoMtx_MtxToRot(CMtxP param_0, csXyz* param_1) { - f32 tmp2 = param_0[0][2] * param_0[0][2]; - f32 tmp3 = param_0[2][2] * param_0[2][2]; - f32 sqrt = JMAFastSqrt(tmp2 + tmp3); +void mDoMtx_MtxToRot(CMtxP m, csXyz* o_rot) { + f32 f31 = m[0][2]; + f31 *= f31; + f32 f30 = m[2][2]; + f31 += f30 * f30; + f31 = JMAFastSqrt(f31); - param_1->x = cM_atan2s(sqrt,-param_0[1][2]); + o_rot->x = cM_atan2s(-m[1][2], f31); - if (param_1->x == 0x4000 || param_1->x == -0x4000) { - param_1->z = 0; - param_1->y = cM_atan2s(-param_0[2][0],param_0[0][0]); + if (o_rot->x == 0x4000 || o_rot->x == -0x4000) { + o_rot->z = 0; + o_rot->y = cM_atan2s(-m[2][0], m[0][0]); } else { - param_1->y = cM_atan2s(param_0[0][2],param_0[2][2]); - param_1->z = cM_atan2s(param_0[1][0],param_0[1][1]); + o_rot->y = cM_atan2s(m[0][2], m[2][2]); + o_rot->z = cM_atan2s(m[1][0], m[1][1]); } } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void mDoMtx_MtxToRot(CMtxP param_0, csXyz* param_1) { - nofralloc -#include "asm/m_Do/m_Do_mtx/mDoMtx_MtxToRot__FPA4_CfP5csXyz.s" -} -#pragma pop -#endif /* ############################################################################################## */ /* 803DD470-803DD4A0 00A190 0030+00 12/12 142/142 1820/1820 .bss now__14mDoMtx_stack_c @@ -420,32 +328,31 @@ Mtx mDoMtx_stack_c::now; /* 803DD4A0-803DD7A0 00A1C0 0300+00 2/2 0/0 0/0 .bss buffer__14mDoMtx_stack_c */ Mtx mDoMtx_stack_c::buffer[16]; -/* 803DD7A0-803DD7AC 00A4C0 000C+00 1/1 0/0 0/0 .bss @4048 */ -static u8 lit_4048[12]; - /* 804505A8-804505AC -00001 0004+00 3/3 0/0 0/0 .sdata next__14mDoMtx_stack_c */ -SECTION_SDATA Mtx* mDoMtx_stack_c::next = (Mtx*)&mDoMtx_stack_c::buffer; +Mtx* mDoMtx_stack_c::next = mDoMtx_stack_c::buffer; /* 804505AC-804505B0 -00001 0004+00 2/2 0/0 0/0 .sdata end__14mDoMtx_stack_c */ -SECTION_SDATA Mtx* mDoMtx_stack_c::end = (Mtx*)&lit_4048; +Mtx* mDoMtx_stack_c::end = mDoMtx_stack_c::buffer + 16; /* 8000CCC8-8000CD14 007608 004C+00 0/0 0/0 24/24 .text push__14mDoMtx_stack_cFv */ bool mDoMtx_stack_c::push() { if (next >= end) { + JUT_ASSERT(729, next < end) return false; } Mtx* old = next++; - MTXCopy(now, *old); + mDoMtx_copy(now, *old); return true; } /* 8000CD14-8000CD64 007654 0050+00 0/0 0/0 24/24 .text pop__14mDoMtx_stack_cFv */ bool mDoMtx_stack_c::pop() { if (next <= buffer) { + JUT_ASSERT(751, next > buffer); return false; } next--; - MTXCopy(*next, now); + mDoMtx_copy(*next, now); return true; } @@ -458,8 +365,8 @@ void mDoMtx_stack_c::transS(cXyz const& param_0) { */ void mDoMtx_stack_c::transM(f32 x, f32 y, f32 z) { Mtx tmp; - MTXTrans(tmp, x, y, z); - MTXConcat(now, tmp, now); + mDoMtx_trans(tmp, x, y, z); + mDoMtx_concat(now, tmp, now); } /* 8000CDD4-8000CE00 007714 002C+00 0/0 3/3 40/40 .text transM__14mDoMtx_stack_cFRC4cXyz @@ -477,8 +384,8 @@ void mDoMtx_stack_c::scaleS(cXyz const& param_0) { */ void mDoMtx_stack_c::scaleM(f32 x, f32 y, f32 z) { Mtx tmp; - MTXScale(tmp, x, y, z); - MTXConcat(now, tmp, now); + mDoMtx_scale(tmp, x, y, z); + mDoMtx_concat(now, tmp, now); } /* 8000CE70-8000CE9C 0077B0 002C+00 0/0 7/7 79/79 .text scaleM__14mDoMtx_stack_cFRC4cXyz @@ -512,64 +419,20 @@ void mDoMtx_stack_c::ZXYrotM(csXyz const& param_0) { /* 8000CF7C-8000CFB8 0078BC 003C+00 0/0 1/1 6/6 .text quatM__14mDoMtx_stack_cFPC10Quaternion */ void mDoMtx_stack_c::quatM(Quaternion const* param_0) { Mtx tmp; - MTXQuat(tmp, param_0); - MTXConcat(now, tmp, now); + mDoMtx_quat(tmp, param_0); + mDoMtx_concat(now, tmp, now); } -/* ############################################################################################## */ -/* 803DD7AC-803DD7B8 00A4CC 000C+00 0/1 0/0 0/0 .bss @4078 */ -#pragma push -#pragma force_active on -static u8 lit_4078[12]; -#pragma pop - -/* 803DD7B8-803DD8D8 00A4D8 011C+04 0/1 0/0 0/0 .bss mDoMtx_quatStack */ -#pragma push -#pragma force_active on -static u8 mDoMtx_quatStack[284 + 4 /* padding */]; -#pragma pop - /* 80450C18-80450C20 000118 0001+07 1/1 0/0 0/0 .sbss mDoMtx_stack */ -static u8 mDoMtx_stack[1 + 7 /* padding */]; +static mDoMtx_stack_c mDoMtx_stack; -/* 8000CFB8-8000D034 0078F8 007C+00 0/0 1/0 0/0 .text __sinit_m_Do_mtx_cpp */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void __sinit_m_Do_mtx_cpp() { - nofralloc -#include "asm/m_Do/m_Do_mtx/__sinit_m_Do_mtx_cpp.s" -} -#pragma pop +/* 803DD7B8-803DD8D8 00A4D8 011C+04 0/1 0/0 0/0 .bss mDoMtx_quatStack */ +static mDoMtx_quatStack_c mDoMtx_quatStack; -#pragma push -#pragma force_active on -REGISTER_CTORS(0x8000CFB8, __sinit_m_Do_mtx_cpp); -#pragma pop - -/* 8000D034-8000D070 007974 003C+00 1/1 0/0 0/0 .text __dt__18mDoMtx_quatStack_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm mDoMtx_quatStack_c::~mDoMtx_quatStack_c() { - nofralloc -#include "asm/m_Do/m_Do_mtx/__dt__18mDoMtx_quatStack_cFv.s" -} -#pragma pop - -/* 8000D070-8000D0AC 0079B0 003C+00 1/1 0/0 0/0 .text __dt__14mDoMtx_stack_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm mDoMtx_stack_c::~mDoMtx_stack_c() { - nofralloc -#include "asm/m_Do/m_Do_mtx/__dt__14mDoMtx_stack_cFv.s" -} -#pragma pop /* ############################################################################################## */ /* 803A2FD8-803A3020 0000F8 0030+18 0/0 23/23 4/4 .data g_mDoMtx_identity */ -SECTION_DATA extern Mtx g_mDoMtx_identity = { +extern Mtx g_mDoMtx_identity = { {1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f, 0.0f},