Decompile mtx4GetRotation

This commit is contained in:
Ryan Dwyer 2021-11-06 14:29:06 +10:00
parent 1f2e759fab
commit 0db6c2ef08
11 changed files with 83 additions and 119 deletions

View File

@ -7916,7 +7916,7 @@ glabel var7f1a99ecpf
/* f023f3c: 27a40190 */ addiu $a0,$sp,0x190
/* f023f40: 27a501a8 */ addiu $a1,$sp,0x1a8
/* f023f44: 46060282 */ mul.s $f10,$f0,$f6
/* f023f48: 0c00591b */ jal mtx000166dc
/* f023f48: 0c00591b */ jal mtx4LoadTranslation
/* f023f4c: e7aa0198 */ swc1 $f10,0x198($sp)
/* f023f50: 0fc2d706 */ jal currentPlayerGetMatrix1740
/* f023f54: 00000000 */ nop
@ -7986,7 +7986,7 @@ glabel var7f1a99ecpf
/* f024048: 27a4017c */ addiu $a0,$sp,0x17c
/* f02404c: 27a501a8 */ addiu $a1,$sp,0x1a8
/* f024050: 46080482 */ mul.s $f18,$f0,$f8
/* f024054: 0c00591b */ jal mtx000166dc
/* f024054: 0c00591b */ jal mtx4LoadTranslation
/* f024058: e7b20184 */ swc1 $f18,0x184($sp)
/* f02405c: 0fc2d706 */ jal currentPlayerGetMatrix1740
/* f024060: 00000000 */ nop
@ -8265,7 +8265,7 @@ glabel var7f1a99ecpf
/* f024464: e7ae00ec */ swc1 $f14,0xec($sp)
/* f024468: 27a400e8 */ addiu $a0,$sp,0xe8
/* f02446c: 27a5009c */ addiu $a1,$sp,0x9c
/* f024470: 0c00591b */ jal mtx000166dc
/* f024470: 0c00591b */ jal mtx4LoadTranslation
/* f024474: e7b200f0 */ swc1 $f18,0xf0($sp)
/* f024478: c7ac00e4 */ lwc1 $f12,0xe4($sp)
/* f02447c: 0c0056ed */ jal mtx00015e24
@ -9354,7 +9354,7 @@ glabel var7f1a87d8
/* f023e18: 27a40190 */ addiu $a0,$sp,0x190
/* f023e1c: 27a501a8 */ addiu $a1,$sp,0x1a8
/* f023e20: 46080482 */ mul.s $f18,$f0,$f8
/* f023e24: 0c0059b7 */ jal mtx000166dc
/* f023e24: 0c0059b7 */ jal mtx4LoadTranslation
/* f023e28: e7b20198 */ swc1 $f18,0x198($sp)
/* f023e2c: 0fc2d5be */ jal currentPlayerGetMatrix1740
/* f023e30: 00000000 */ nop
@ -9424,7 +9424,7 @@ glabel var7f1a87d8
/* f023f24: 27a4017c */ addiu $a0,$sp,0x17c
/* f023f28: 27a501a8 */ addiu $a1,$sp,0x1a8
/* f023f2c: 460a0102 */ mul.s $f4,$f0,$f10
/* f023f30: 0c0059b7 */ jal mtx000166dc
/* f023f30: 0c0059b7 */ jal mtx4LoadTranslation
/* f023f34: e7a40184 */ swc1 $f4,0x184($sp)
/* f023f38: 0fc2d5be */ jal currentPlayerGetMatrix1740
/* f023f3c: 00000000 */ nop
@ -9703,7 +9703,7 @@ glabel var7f1a87d8
/* f024340: e7ae00ec */ swc1 $f14,0xec($sp)
/* f024344: 27a400e8 */ addiu $a0,$sp,0xe8
/* f024348: 27a5009c */ addiu $a1,$sp,0x9c
/* f02434c: 0c0059b7 */ jal mtx000166dc
/* f02434c: 0c0059b7 */ jal mtx4LoadTranslation
/* f024350: e7b200f0 */ swc1 $f18,0xf0($sp)
/* f024354: c7ac00e4 */ lwc1 $f12,0xe4($sp)
/* f024358: 0c005789 */ jal mtx00015e24
@ -10733,7 +10733,7 @@ glabel var7f1a87d8
/* f023830: 27a40190 */ addiu $a0,$sp,0x190
/* f023834: 27a501a8 */ addiu $a1,$sp,0x1a8
/* f023838: 46080482 */ mul.s $f18,$f0,$f8
/* f02383c: 0c005d9b */ jal mtx000166dc
/* f02383c: 0c005d9b */ jal mtx4LoadTranslation
/* f023840: e7b20198 */ swc1 $f18,0x198($sp)
/* f023844: 0fc2cd16 */ jal currentPlayerGetMatrix1740
/* f023848: 00000000 */ sll $zero,$zero,0x0
@ -10803,7 +10803,7 @@ glabel var7f1a87d8
/* f02393c: 27a4017c */ addiu $a0,$sp,0x17c
/* f023940: 27a501a8 */ addiu $a1,$sp,0x1a8
/* f023944: 460a0102 */ mul.s $f4,$f0,$f10
/* f023948: 0c005d9b */ jal mtx000166dc
/* f023948: 0c005d9b */ jal mtx4LoadTranslation
/* f02394c: e7a40184 */ swc1 $f4,0x184($sp)
/* f023950: 0fc2cd16 */ jal currentPlayerGetMatrix1740
/* f023954: 00000000 */ sll $zero,$zero,0x0
@ -11082,7 +11082,7 @@ glabel var7f1a87d8
/* f023d58: e7ae00ec */ swc1 $f14,0xec($sp)
/* f023d5c: 27a400e8 */ addiu $a0,$sp,0xe8
/* f023d60: 27a5009c */ addiu $a1,$sp,0x9c
/* f023d64: 0c005d9b */ jal mtx000166dc
/* f023d64: 0c005d9b */ jal mtx4LoadTranslation
/* f023d68: e7b200f0 */ swc1 $f18,0xf0($sp)
/* f023d6c: c7ac00e4 */ lwc1 $f12,0xe4($sp)
/* f023d70: 0c005b45 */ jal mtx00015e24

View File

@ -1383,7 +1383,7 @@ void setupSingleMonitor(struct singlemonitorobj *monitor, s32 cmdindex)
spa4.y = -spa4.y;
spa4.z = -spa4.z;
mtx000166dc(&spa4, &sp24);
mtx4LoadTranslation(&spa4, &sp24);
mtx00015be4(&sp64, &sp24, &monitor->base.monitorthing->matrix);
}
} else {

View File

@ -901,7 +901,7 @@ glabel var7f1acc68
/* f0ac860: 00408025 */ or $s0,$v0,$zero
/* f0ac864: afa200c8 */ sw $v0,0xc8($sp)
/* f0ac868: 8fa400fc */ lw $a0,0xfc($sp)
/* f0ac86c: 0c0059b7 */ jal mtx000166dc
/* f0ac86c: 0c0059b7 */ jal mtx4LoadTranslation
/* f0ac870: 27a50084 */ addiu $a1,$sp,0x84
/* f0ac874: 3c013f80 */ lui $at,0x3f80
/* f0ac878: 44812000 */ mtc1 $at,$f4
@ -1566,7 +1566,7 @@ glabel var7f1accf4
/* f0ad14c: 27a50148 */ addiu $a1,$sp,0x148
/* f0ad150: 45020295 */ bc1fl .L0f0adba8
/* f0ad154: 8fbf002c */ lw $ra,0x2c($sp)
/* f0ad158: 0c0059b7 */ jal mtx000166dc
/* f0ad158: 0c0059b7 */ jal mtx4LoadTranslation
/* f0ad15c: afa800d8 */ sw $t0,0xd8($sp)
/* f0ad160: 3c017f1b */ lui $at,%hi(var7f1acccc)
/* f0ad164: c42ccccc */ lwc1 $f12,%lo(var7f1acccc)($at)

View File

@ -7079,7 +7079,7 @@ glabel var7f1b3c40pf
/* f0f4d70: e7aa039c */ swc1 $f10,0x39c($sp)
/* f0f4d74: e7a203a0 */ swc1 $f2,0x3a0($sp)
.PF0f0f4d78:
/* f0f4d78: 0c00591b */ jal mtx000166dc
/* f0f4d78: 0c00591b */ jal mtx4LoadTranslation
/* f0f4d7c: 27a50310 */ addiu $a1,$sp,0x310
/* f0f4d80: 8fac0308 */ lw $t4,0x308($sp)
/* f0f4d84: 5180000a */ beqzl $t4,.PF0f0f4db0
@ -7100,7 +7100,7 @@ glabel var7f1b3c40pf
.PF0f0f4dbc:
/* f0f4dbc: 11e00005 */ beqz $t7,.PF0f0f4dd4
/* f0f4dc0: 27a402fc */ addiu $a0,$sp,0x2fc
/* f0f4dc4: 0c00591b */ jal mtx000166dc
/* f0f4dc4: 0c00591b */ jal mtx4LoadTranslation
/* f0f4dc8: 27a50204 */ addiu $a1,$sp,0x204
/* f0f4dcc: 1000000b */ b .PF0f0f4dfc
/* f0f4dd0: 27b10244 */ addiu $s1,$sp,0x244
@ -7112,7 +7112,7 @@ glabel var7f1b3c40pf
/* f0f4de4: c6100530 */ lwc1 $f16,0x530($s0)
/* f0f4de8: e7b0039c */ swc1 $f16,0x39c($sp)
/* f0f4dec: c6060534 */ lwc1 $f6,0x534($s0)
/* f0f4df0: 0c00591b */ jal mtx000166dc
/* f0f4df0: 0c00591b */ jal mtx4LoadTranslation
/* f0f4df4: e7a603a0 */ swc1 $f6,0x3a0($sp)
/* f0f4df8: 27b10244 */ addiu $s1,$sp,0x244
.PF0f0f4dfc:
@ -8692,7 +8692,7 @@ glabel var7f1b2948
/* f0f4640: e7a4039c */ swc1 $f4,0x39c($sp)
/* f0f4644: e7a203a0 */ swc1 $f2,0x3a0($sp)
.L0f0f4648:
/* f0f4648: 0c0059b7 */ jal mtx000166dc
/* f0f4648: 0c0059b7 */ jal mtx4LoadTranslation
/* f0f464c: 27a50310 */ addiu $a1,$sp,0x310
/* f0f4650: 8faa0308 */ lw $t2,0x308($sp)
/* f0f4654: 5140000a */ beqzl $t2,.L0f0f4680
@ -8713,7 +8713,7 @@ glabel var7f1b2948
.L0f0f468c:
/* f0f468c: 11600005 */ beqz $t3,.L0f0f46a4
/* f0f4690: 27a402fc */ addiu $a0,$sp,0x2fc
/* f0f4694: 0c0059b7 */ jal mtx000166dc
/* f0f4694: 0c0059b7 */ jal mtx4LoadTranslation
/* f0f4698: 27a50204 */ addiu $a1,$sp,0x204
/* f0f469c: 1000000b */ b .L0f0f46cc
/* f0f46a0: 27b10244 */ addiu $s1,$sp,0x244
@ -8725,7 +8725,7 @@ glabel var7f1b2948
/* f0f46b4: c6040530 */ lwc1 $f4,0x530($s0)
/* f0f46b8: e7a4039c */ swc1 $f4,0x39c($sp)
/* f0f46bc: c60a0534 */ lwc1 $f10,0x534($s0)
/* f0f46c0: 0c0059b7 */ jal mtx000166dc
/* f0f46c0: 0c0059b7 */ jal mtx4LoadTranslation
/* f0f46c4: e7aa03a0 */ swc1 $f10,0x3a0($sp)
/* f0f46c8: 27b10244 */ addiu $s1,$sp,0x244
.L0f0f46cc:
@ -10326,7 +10326,7 @@ glabel var7f1b2948
/* f0f11e4: 02002825 */ or $a1,$s0,$zero
.NB0f0f11e8:
/* f0f11e8: 27a403c0 */ addiu $a0,$sp,0x3c0
/* f0f11ec: 0c005d9b */ jal mtx000166dc
/* f0f11ec: 0c005d9b */ jal mtx4LoadTranslation
/* f0f11f0: 27a50338 */ addiu $a1,$sp,0x338
/* f0f11f4: 8faf0330 */ lw $t7,0x330($sp)
/* f0f11f8: 51e0000a */ beqzl $t7,.NB0f0f1224
@ -10347,7 +10347,7 @@ glabel var7f1b2948
.NB0f0f1230:
/* f0f1230: 13000005 */ beqz $t8,.NB0f0f1248
/* f0f1234: 27a40324 */ addiu $a0,$sp,0x324
/* f0f1238: 0c005d9b */ jal mtx000166dc
/* f0f1238: 0c005d9b */ jal mtx4LoadTranslation
/* f0f123c: 27a50208 */ addiu $a1,$sp,0x208
/* f0f1240: 1000000b */ beqz $zero,.NB0f0f1270
/* f0f1244: 27b00248 */ addiu $s0,$sp,0x248
@ -10359,7 +10359,7 @@ glabel var7f1b2948
/* f0f1258: c6240530 */ lwc1 $f4,0x530($s1)
/* f0f125c: e7a403c4 */ swc1 $f4,0x3c4($sp)
/* f0f1260: c62a0534 */ lwc1 $f10,0x534($s1)
/* f0f1264: 0c005d9b */ jal mtx000166dc
/* f0f1264: 0c005d9b */ jal mtx4LoadTranslation
/* f0f1268: e7aa03c8 */ swc1 $f10,0x3c8($sp)
/* f0f126c: 27b00248 */ addiu $s0,$sp,0x248
.NB0f0f1270:

View File

@ -609,7 +609,7 @@ glabel var7f1a7ee8
/* f007438: 0c00566c */ jal mtx4LoadIdentity
/* f00743c: e7a40100 */ swc1 $f4,0x100($sp)
/* f007440: 8fa40154 */ lw $a0,0x154($sp)
/* f007444: 0c0059b7 */ jal mtx000166dc
/* f007444: 0c0059b7 */ jal mtx4LoadTranslation
/* f007448: 02002825 */ or $a1,$s0,$zero
/* f00744c: 0fc2d5be */ jal currentPlayerGetMatrix1740
/* f007450: 00000000 */ nop
@ -2869,7 +2869,7 @@ Gfx *nbombRender(Gfx *gdl, struct nbomb *nbomb, Gfx *subgdl)
sp3c.z = -100;
mtx4LoadIdentity(&sp48);
mtx000166dc(&nbomb->pos, &sp48);
mtx4LoadTranslation(&nbomb->pos, &sp48);
sp3c.x = 0;
sp3c.y = nbomb->unk14 / divider * M_TAU;

View File

@ -11055,7 +11055,7 @@ glabel var7f1aa298
/* f06dc58: 0c005755 */ jal mtx3ToMtx4
/* f06dc5c: 24c4001c */ addiu $a0,$a2,0x1c
/* f06dc60: 27a40148 */ addiu $a0,$sp,0x148
/* f06dc64: 0c005976 */ jal mtx000165d8
/* f06dc64: 0c005976 */ jal mtx4GetRotation
/* f06dc68: 27a50188 */ addiu $a1,$sp,0x188
/* f06dc6c: 27a40188 */ addiu $a0,$sp,0x188
/* f06dc70: 0c005923 */ jal mtx4LoadRotation
@ -11758,7 +11758,7 @@ glabel var7f1aa298
/* f06e634: afa30028 */ sw $v1,0x28($sp)
/* f06e638: afa60030 */ sw $a2,0x30($sp)
/* f06e63c: afa9002c */ sw $t1,0x2c($sp)
/* f06e640: 0c005976 */ jal mtx000165d8
/* f06e640: 0c005976 */ jal mtx4GetRotation
/* f06e644: e7a60104 */ swc1 $f6,0x104($sp)
/* f06e648: 8fa50068 */ lw $a1,0x68($sp)
/* f06e64c: 27a40188 */ addiu $a0,$sp,0x188
@ -12547,7 +12547,7 @@ glabel func0f06ef44
/* f06f008: e7aa002c */ swc1 $f10,0x2c($sp)
/* f06f00c: e7b20030 */ swc1 $f18,0x30($sp)
/* f06f010: 27a40028 */ addiu $a0,$sp,0x28
/* f06f014: 0c0059b7 */ jal mtx000166dc
/* f06f014: 0c0059b7 */ jal mtx4LoadTranslation
/* f06f018: 27a50074 */ addiu $a1,$sp,0x74
/* f06f01c: 2604001c */ addiu $a0,$s0,0x1c
/* f06f020: 0c005755 */ jal mtx3ToMtx4
@ -37860,7 +37860,7 @@ glabel var7f1aa588
/* f079e8c: 8fa70034 */ lw $a3,0x34($sp)
/* f079e90: 00408025 */ or $s0,$v0,$zero
/* f079e94: 00402825 */ or $a1,$v0,$zero
/* f079e98: 0c0059b7 */ jal mtx000166dc
/* f079e98: 0c0059b7 */ jal mtx4LoadTranslation
/* f079e9c: 8ce40004 */ lw $a0,0x4($a3)
/* f079ea0: 8fa40024 */ lw $a0,0x24($sp)
/* f079ea4: 0c0056f8 */ jal mtx00015be0
@ -41093,7 +41093,7 @@ void chopperFireRocket(struct chopperobj *chopper, bool side)
pos.z = -400;
mtx3ToMtx4(chopper->base.realrot, &sp2c);
mtx000166dc(&pos, &sp6c);
mtx4LoadTranslation(&pos, &sp6c);
mtx4MultMtx4InPlace(&sp2c, &sp6c);
pos.x = sp6c.m[3][0] + chopperprop->pos.f[0];
@ -41265,7 +41265,7 @@ glabel var7f1aa610
/* f07b5a8: 0c005755 */ jal mtx3ToMtx4
/* f07b5ac: 27a50050 */ addiu $a1,$sp,0x50
/* f07b5b0: 27a400f0 */ addiu $a0,$sp,0xf0
/* f07b5b4: 0c0059b7 */ jal mtx000166dc
/* f07b5b4: 0c0059b7 */ jal mtx4LoadTranslation
/* f07b5b8: 27a50090 */ addiu $a1,$sp,0x90
/* f07b5bc: 27a40050 */ addiu $a0,$sp,0x50
/* f07b5c0: 0c00567f */ jal mtx4MultMtx4InPlace
@ -41726,7 +41726,7 @@ glabel var7f1aa610
/* f07b5a8: 0c005755 */ jal mtx3ToMtx4
/* f07b5ac: 27a50050 */ addiu $a1,$sp,0x50
/* f07b5b0: 27a400f0 */ addiu $a0,$sp,0xf0
/* f07b5b4: 0c0059b7 */ jal mtx000166dc
/* f07b5b4: 0c0059b7 */ jal mtx4LoadTranslation
/* f07b5b8: 27a50090 */ addiu $a1,$sp,0x90
/* f07b5bc: 27a40050 */ addiu $a0,$sp,0x50
/* f07b5c0: 0c00567f */ jal mtx4MultMtx4InPlace
@ -42187,7 +42187,7 @@ glabel var7f1aa610
/* f07b5a8: 0c005755 */ jal mtx3ToMtx4
/* f07b5ac: 27a50050 */ addiu $a1,$sp,0x50
/* f07b5b0: 27a400f0 */ addiu $a0,$sp,0xf0
/* f07b5b4: 0c0059b7 */ jal mtx000166dc
/* f07b5b4: 0c0059b7 */ jal mtx4LoadTranslation
/* f07b5b8: 27a50090 */ addiu $a1,$sp,0x90
/* f07b5bc: 27a40050 */ addiu $a0,$sp,0x50
/* f07b5c0: 0c00567f */ jal mtx4MultMtx4InPlace
@ -49627,7 +49627,7 @@ glabel func0f07e1fc
/* f07e220: 8e240008 */ lw $a0,0x8($s1)
/* f07e224: 26050040 */ addiu $a1,$s0,0x40
/* f07e228: afa50024 */ sw $a1,0x24($sp)
/* f07e22c: 0c0059b7 */ jal mtx000166dc
/* f07e22c: 0c0059b7 */ jal mtx4LoadTranslation
/* f07e230: 00402025 */ or $a0,$v0,$zero
/* f07e234: 8fa50024 */ lw $a1,0x24($sp)
/* f07e238: 0c0056f8 */ jal mtx00015be0
@ -49637,7 +49637,7 @@ glabel func0f07e1fc
/* f07e248: 24050001 */ addiu $a1,$zero,0x1
/* f07e24c: 26050080 */ addiu $a1,$s0,0x80
/* f07e250: afa50024 */ sw $a1,0x24($sp)
/* f07e254: 0c0059b7 */ jal mtx000166dc
/* f07e254: 0c0059b7 */ jal mtx4LoadTranslation
/* f07e258: 00402025 */ or $a0,$v0,$zero
/* f07e25c: 8fa50024 */ lw $a1,0x24($sp)
/* f07e260: 0c0056f8 */ jal mtx00015be0
@ -49647,7 +49647,7 @@ glabel func0f07e1fc
/* f07e270: 24050002 */ addiu $a1,$zero,0x2
/* f07e274: 260500c0 */ addiu $a1,$s0,0xc0
/* f07e278: afa50024 */ sw $a1,0x24($sp)
/* f07e27c: 0c0059b7 */ jal mtx000166dc
/* f07e27c: 0c0059b7 */ jal mtx4LoadTranslation
/* f07e280: 00402025 */ or $a0,$v0,$zero
/* f07e284: 8fa50024 */ lw $a1,0x24($sp)
/* f07e288: 0c0056f8 */ jal mtx00015be0
@ -49657,7 +49657,7 @@ glabel func0f07e1fc
/* f07e298: 24050003 */ addiu $a1,$zero,0x3
/* f07e29c: 26110100 */ addiu $s1,$s0,0x100
/* f07e2a0: 02202825 */ or $a1,$s1,$zero
/* f07e2a4: 0c0059b7 */ jal mtx000166dc
/* f07e2a4: 0c0059b7 */ jal mtx4LoadTranslation
/* f07e2a8: 00402025 */ or $a0,$v0,$zero
/* f07e2ac: 02002025 */ or $a0,$s0,$zero
/* f07e2b0: 0c0056f8 */ jal mtx00015be0
@ -70094,7 +70094,7 @@ glabel var7f1aaf48
/* f08c78c: 0c005755 */ jal mtx3ToMtx4
/* f08c790: e7a80088 */ swc1 $f8,0x88($sp)
/* f08c794: 27a40080 */ addiu $a0,$sp,0x80
/* f08c798: 0c0059b7 */ jal mtx000166dc
/* f08c798: 0c0059b7 */ jal mtx4LoadTranslation
/* f08c79c: 27a50098 */ addiu $a1,$sp,0x98
/* f08c7a0: 27a40098 */ addiu $a0,$sp,0x98
/* f08c7a4: 0c00567f */ jal mtx4MultMtx4InPlace
@ -70188,7 +70188,7 @@ glabel var7f1aaf48
/* f08c8ec: 0c00567f */ jal mtx4MultMtx4InPlace
/* f08c8f0: 27a500dc */ addiu $a1,$sp,0xdc
/* f08c8f4: 27a4008c */ addiu $a0,$sp,0x8c
/* f08c8f8: 0c0059b7 */ jal mtx000166dc
/* f08c8f8: 0c0059b7 */ jal mtx4LoadTranslation
/* f08c8fc: 27a50098 */ addiu $a1,$sp,0x98
/* f08c900: 27a40098 */ addiu $a0,$sp,0x98
/* f08c904: 0c00567f */ jal mtx4MultMtx4InPlace

View File

@ -258,13 +258,13 @@ Gfx *shardsRenderWood(Gfx *gdl)
/**
* The following function call is really just this:
*
* mtx000166a4(&g_Shards[i].pos, &g_Shards[i].rot, &shardmtx);
* mtx4LoadRotationAndTranslation(&g_Shards[i].pos, &g_Shards[i].rot, &shardmtx);
*
* ... but that causes a mismatch, so I'm using a hacky but
* matching alternative. This hack is @dangerous because it
* assumes the offsets of pos and rot in the shard struct.
*/
mtx000166a4(
mtx4LoadRotationAndTranslation(
(struct coord *)((u8 *)g_Shards + i * sizeof(struct shard) + 0x08),
(struct coord *)((u8 *)g_Shards + i * sizeof(struct shard) + 0x14),
&shardmtx);
@ -488,7 +488,7 @@ glabel shardsRenderWood
/* f14c198: 27a600e0 */ addiu $a2,$sp,0xe0
/* f14c19c: 01f41021 */ addu $v0,$t7,$s4
/* f14c1a0: 24440008 */ addiu $a0,$v0,0x8
/* f14c1a4: 0c005d8d */ jal mtx000166a4
/* f14c1a4: 0c005d8d */ jal mtx4LoadRotationAndTranslation
/* f14c1a8: 24450014 */ addiu $a1,$v0,0x14
/* f14c1ac: 8ee30284 */ lw $v1,0x284($s7)
/* f14c1b0: c7a40110 */ lwc1 $f4,0x110($sp)
@ -858,7 +858,7 @@ Gfx *shardsRenderGlass(Gfx *gdl)
/**
* @dangerous: See comment for similar code in shardsRenderWood.
*/
mtx000166a4(
mtx4LoadRotationAndTranslation(
(struct coord *)((u8 *)g_Shards + i * sizeof(struct shard) + 0x08),
(struct coord *)((u8 *)g_Shards + i * sizeof(struct shard) + 0x14),
&shardmtx);
@ -1126,7 +1126,7 @@ glabel shardsRenderGlass
/* f14c918: 03c03025 */ or $a2,$s8,$zero
/* f14c91c: 03331021 */ addu $v0,$t9,$s3
/* f14c920: 24440008 */ addiu $a0,$v0,0x8
/* f14c924: 0c005d8d */ jal mtx000166a4
/* f14c924: 0c005d8d */ jal mtx4LoadRotationAndTranslation
/* f14c928: 24450014 */ addiu $a1,$v0,0x14
/* f14c92c: 8ec30284 */ lw $v1,0x284($s6)
/* f14c930: c7a40120 */ lwc1 $f4,0x120($sp)

View File

@ -3609,7 +3609,7 @@ glabel var7f1a8468
/* f018c14: 8f2e0004 */ lw $t6,0x4($t9)
/* f018c18: ac8e0004 */ sw $t6,0x4($a0)
/* f018c1c: 8f210008 */ lw $at,0x8($t9)
/* f018c20: 0c00591b */ jal mtx000166dc
/* f018c20: 0c00591b */ jal mtx4LoadTranslation
/* f018c24: ac810008 */ sw $at,0x8($a0)
/* f018c28: 3c013f80 */ lui $at,0x3f80
/* f018c2c: 44814000 */ mtc1 $at,$f8
@ -4940,7 +4940,7 @@ glabel var7f1a8468
/* f018b30: 8f0f0004 */ lw $t7,0x4($t8)
/* f018b34: ac8f0004 */ sw $t7,0x4($a0)
/* f018b38: 8f010008 */ lw $at,0x8($t8)
/* f018b3c: 0c0059b7 */ jal mtx000166dc
/* f018b3c: 0c0059b7 */ jal mtx4LoadTranslation
/* f018b40: ac810008 */ sw $at,0x8($a0)
/* f018b44: 3c013f80 */ lui $at,0x3f80
/* f018b48: 44813000 */ mtc1 $at,$f6

View File

@ -38,9 +38,9 @@ void mtx4LoadXRotation(f32 radians, Mtxf *mtx);
void mtx4LoadYRotation(f32 radians, Mtxf *mtx);
void mtx4LoadZRotation(f32 radians, Mtxf *mtx);
void mtx4LoadRotation(struct coord *rot, Mtxf *mtx);
u32 mtx000165d8(void);
void mtx000166a4(struct coord *pos, struct coord *rot, Mtxf *matrix);
void mtx000166dc(struct coord *pos, Mtxf *matrix);
void mtx4GetRotation(f32 mtx[4][4], struct coord *dst);
void mtx4LoadRotationAndTranslation(struct coord *pos, struct coord *rot, Mtxf *mtx);
void mtx4LoadTranslation(struct coord *pos, Mtxf *mtx);
void mtx00016710(f32 mult, f32 mtx[4][4]);
void mtx00016748(f32 arg0);
void mtx00016760(void);

View File

@ -744,7 +744,7 @@ void model0001b400(struct objticksp476 *arg0, struct model *model, struct modeln
}
if (g_Anims[anim->animnum].flags & ANIMFLAG_02) {
mtx000166dc(sp254, &sp198);
mtx4LoadTranslation(sp254, &sp198);
} else {
if (rwdata->chrinfo.unk18 != 0.0f) {
sp250 = model0001afe8(sp250, rwdata->chrinfo.unk1c, rwdata->chrinfo.unk18);
@ -817,7 +817,7 @@ glabel var70054308
/* 1b884: 8fae0058 */ lw $t6,0x58($sp)
/* 1b888: 8fa400c8 */ lw $a0,0xc8($sp)
/* 1b88c: 8fa500c4 */ lw $a1,0xc4($sp)
/* 1b890: 0c0059a9 */ jal mtx000166a4
/* 1b890: 0c0059a9 */ jal mtx4LoadRotationAndTranslation
/* 1b894: 27a60068 */ addiu $a2,$sp,0x68
/* 1b898: 8fae00cc */ lw $t6,0xcc($sp)
/* 1b89c: 8faf00bc */ lw $t7,0xbc($sp)
@ -888,7 +888,7 @@ glabel var70054308
/* 1b98c: 000c6980 */ sll $t5,$t4,0x6
/* 1b990: 01ae3021 */ addu $a2,$t5,$t6
/* 1b994: afa6001c */ sw $a2,0x1c($sp)
/* 1b998: 0c0059a9 */ jal mtx000166a4
/* 1b998: 0c0059a9 */ jal mtx4LoadRotationAndTranslation
/* 1b99c: 8fa500c4 */ lw $a1,0xc4($sp)
/* 1b9a0: 8faf00cc */ lw $t7,0xcc($sp)
/* 1b9a4: 8fb800bc */ lw $t8,0xbc($sp)
@ -1729,7 +1729,7 @@ glabel var70053fc0pf
/* 1c308: 1200000f */ beqz $s0,.PF0001c348
/* 1c30c: 8fa40158 */ lw $a0,0x158($sp)
/* 1c310: 8fa40158 */ lw $a0,0x158($sp)
/* 1c314: 0c00591b */ jal mtx000166dc
/* 1c314: 0c00591b */ jal mtx4LoadTranslation
/* 1c318: 27a500e8 */ addiu $a1,$sp,0xe8
/* 1c31c: 8fa80158 */ lw $t0,0x158($sp)
/* 1c320: 8faa0164 */ lw $t2,0x164($sp)
@ -1747,7 +1747,7 @@ glabel var70053fc0pf
/* 1c34c: 848f000e */ lh $t7,0xe($a0)
/* 1c350: 8dae000c */ lw $t6,0xc($t5)
/* 1c354: 000fc980 */ sll $t9,$t7,0x6
/* 1c358: 0c00591b */ jal mtx000166dc
/* 1c358: 0c00591b */ jal mtx4LoadTranslation
/* 1c35c: 01d92821 */ addu $a1,$t6,$t9
/* 1c360: 8fbf002c */ lw $ra,0x2c($sp)
.PF0001c364:
@ -2143,7 +2143,7 @@ glabel model0001bfa8
/* 1c548: 1200000f */ beqz $s0,.L0001c588
/* 1c54c: 8fa40158 */ lw $a0,0x158($sp)
/* 1c550: 8fa40158 */ lw $a0,0x158($sp)
/* 1c554: 0c0059b7 */ jal mtx000166dc
/* 1c554: 0c0059b7 */ jal mtx4LoadTranslation
/* 1c558: 27a500e8 */ addiu $a1,$sp,0xe8
/* 1c55c: 8fb80158 */ lw $t8,0x158($sp)
/* 1c560: 8fa90164 */ lw $t1,0x164($sp)
@ -2161,7 +2161,7 @@ glabel model0001bfa8
/* 1c58c: 848e000e */ lh $t6,0xe($a0)
/* 1c590: 8d8d000c */ lw $t5,0xc($t4)
/* 1c594: 000e7980 */ sll $t7,$t6,0x6
/* 1c598: 0c0059b7 */ jal mtx000166dc
/* 1c598: 0c0059b7 */ jal mtx4LoadTranslation
/* 1c59c: 01af2821 */ addu $a1,$t5,$t7
/* 1c5a0: 8fbf002c */ lw $ra,0x2c($sp)
.L0001c5a4:
@ -2187,10 +2187,10 @@ void model0001c5b4(struct objticksp476 *arg0, struct model *model, struct modeln
}
if (sp68) {
mtx000166dc(&rodata->positionheld.pos, &sp28);
mtx4LoadTranslation(&rodata->positionheld.pos, &sp28);
mtx00015be4(sp68, &sp28, &matrices[mtxindex]);
} else {
mtx000166dc(&rodata->positionheld.pos, &matrices[mtxindex]);
mtx4LoadTranslation(&rodata->positionheld.pos, &matrices[mtxindex]);
}
}

View File

@ -174,7 +174,7 @@ void mtx4LoadYRotation(f32 angle, Mtxf *matrix)
void mtx4LoadZRotation(f32 angle, Mtxf *matrix)
{
f32 cos = cosf(angle);
f32 sin = (float)sinf(angle);
f32 sin = sinf(angle);
matrix->m[0][0] = cos;
matrix->m[0][1] = sin;
@ -231,73 +231,37 @@ void mtx4LoadRotation(struct coord *src, Mtxf *dest)
dest->m[3][3] = 1;
}
GLOBAL_ASM(
glabel mtx000165d8
/* 165d8: 27bdffd8 */ addiu $sp,$sp,-40
/* 165dc: afbf001c */ sw $ra,0x1c($sp)
/* 165e0: afb10018 */ sw $s1,0x18($sp)
/* 165e4: afb00014 */ sw $s0,0x14($sp)
/* 165e8: c4800018 */ lwc1 $f0,0x18($a0)
/* 165ec: c4820028 */ lwc1 $f2,0x28($a0)
/* 165f0: 00808025 */ or $s0,$a0,$zero
/* 165f4: 46000102 */ mul.s $f4,$f0,$f0
/* 165f8: 00a08825 */ or $s1,$a1,$zero
/* 165fc: 46021182 */ mul.s $f6,$f2,$f2
/* 16600: 0c012974 */ jal sqrtf
/* 16604: 46062300 */ add.s $f12,$f4,$f6
/* 16608: 3c013600 */ lui $at,0x3600
/* 1660c: 44814000 */ mtc1 $at,$f8
/* 16610: e7a00024 */ swc1 $f0,0x24($sp)
/* 16614: 4600403c */ c.lt.s $f8,$f0
/* 16618: 00000000 */ nop
/* 1661c: 45020010 */ bc1fl .L00016660
/* 16620: 44805000 */ mtc1 $zero,$f10
/* 16624: c60c0018 */ lwc1 $f12,0x18($s0)
/* 16628: 0fc259d4 */ jal atan2f
/* 1662c: c60e0028 */ lwc1 $f14,0x28($s0)
/* 16630: e6200000 */ swc1 $f0,0x0($s1)
/* 16634: c60c0008 */ lwc1 $f12,0x8($s0)
/* 16638: c7ae0024 */ lwc1 $f14,0x24($sp)
/* 1663c: 0fc259d4 */ jal atan2f
/* 16640: 46006307 */ neg.s $f12,$f12
/* 16644: e6200004 */ swc1 $f0,0x4($s1)
/* 16648: c60e0000 */ lwc1 $f14,0x0($s0)
/* 1664c: 0fc259d4 */ jal atan2f
/* 16650: c60c0004 */ lwc1 $f12,0x4($s0)
/* 16654: 1000000e */ b .L00016690
/* 16658: e6200008 */ swc1 $f0,0x8($s1)
/* 1665c: 44805000 */ mtc1 $zero,$f10
.L00016660:
/* 16660: 00000000 */ nop
/* 16664: e62a0000 */ swc1 $f10,0x0($s1)
/* 16668: c60c0008 */ lwc1 $f12,0x8($s0)
/* 1666c: c7ae0024 */ lwc1 $f14,0x24($sp)
/* 16670: 0fc259d4 */ jal atan2f
/* 16674: 46006307 */ neg.s $f12,$f12
/* 16678: e6200004 */ swc1 $f0,0x4($s1)
/* 1667c: c60c0010 */ lwc1 $f12,0x10($s0)
/* 16680: c60e0014 */ lwc1 $f14,0x14($s0)
/* 16684: 0fc259d4 */ jal atan2f
/* 16688: 46006307 */ neg.s $f12,$f12
/* 1668c: e6200008 */ swc1 $f0,0x8($s1)
.L00016690:
/* 16690: 8fbf001c */ lw $ra,0x1c($sp)
/* 16694: 8fb00014 */ lw $s0,0x14($sp)
/* 16698: 8fb10018 */ lw $s1,0x18($sp)
/* 1669c: 03e00008 */ jr $ra
/* 166a0: 27bd0028 */ addiu $sp,$sp,0x28
);
#define EPSILON 0.0000019073486f
void mtx000166a4(struct coord *pos, struct coord *rot, Mtxf *matrix)
void mtx4GetRotation(f32 mtx[4][4], struct coord *dst)
{
mtx4LoadRotation(rot, matrix);
mtx4SetTranslation(pos, matrix);
f32 norm;
f32 sin_x_cos_y = mtx[1][2];
f32 cos_x_cos_y = mtx[2][2];
norm = sqrtf(sin_x_cos_y * sin_x_cos_y + cos_x_cos_y * cos_x_cos_y);
if (EPSILON < norm) {
dst->x = atan2f(mtx[1][2], mtx[2][2]);
dst->y = atan2f(-mtx[0][2], norm);
dst->z = atan2f(mtx[0][1], mtx[0][0]);
} else {
dst->x = 0;
dst->y = atan2f(-mtx[0][2], norm);
dst->z = atan2f(-mtx[1][0], mtx[1][1]);
}
}
void mtx000166dc(struct coord *pos, Mtxf *matrix)
void mtx4LoadRotationAndTranslation(struct coord *pos, struct coord *rot, Mtxf *mtx)
{
mtx4LoadIdentity(matrix);
mtx4SetTranslation(pos, matrix);
mtx4LoadRotation(rot, mtx);
mtx4SetTranslation(pos, mtx);
}
void mtx4LoadTranslation(struct coord *pos, Mtxf *mtx)
{
mtx4LoadIdentity(mtx);
mtx4SetTranslation(pos, mtx);
}
void mtx00016710(f32 mult, f32 mtx[4][4])