diff --git a/src/game/collisionutils.c b/src/game/collisionutils.c index 73fced054..f2ec4a7c2 100644 --- a/src/game/collisionutils.c +++ b/src/game/collisionutils.c @@ -32,7 +32,7 @@ f32 func0f1577f0(f32 arg0[2], f32 arg1[2], f32 arg2[2], f32 arg3[2]) return a; } -f32 func0f1578c8(struct coord *arg0, struct coord *arg1, struct coord *arg2) +f32 func0f1578c8(struct widthxz *arg0, struct xz *arg1, struct xz *arg2) { f32 value2; f32 value1; @@ -40,13 +40,13 @@ f32 func0f1578c8(struct coord *arg0, struct coord *arg1, struct coord *arg2) f32 mult1; f32 mult2; - mult1 = arg2->x - arg0->y; - mult2 = arg2->y - arg0->z; + mult1 = arg2->x - arg0->x; + mult2 = arg2->z - arg0->z; - value1 = mult2 * arg1->x - mult1 * arg1->y; - value2 = mult1 * arg1->x + mult2 * arg1->y; + value1 = mult2 * arg1->x - mult1 * arg1->z; + value2 = mult1 * arg1->x + mult2 * arg1->z; - sp24 = (arg0->x - value1) * (arg0->x + value1); + sp24 = (arg0->width - value1) * (arg0->width + value1); if (sp24 < 0.0f) { return MAXFLOAT; @@ -55,7 +55,7 @@ f32 func0f1578c8(struct coord *arg0, struct coord *arg1, struct coord *arg2) value2 -= sqrtf(sp24); if (value2 < 0.0f) { - if (value2 * value2 + value1 * value1 <= arg0->x * arg0->x) { + if (value2 * value2 + value1 * value1 <= arg0->width * arg0->width) { return 0.0f; } @@ -65,267 +65,115 @@ f32 func0f1578c8(struct coord *arg0, struct coord *arg1, struct coord *arg2) return value2; } -GLOBAL_ASM( -glabel func0f1579cc -/* f1579cc: 27bdff50 */ addiu $sp,$sp,-176 -/* f1579d0: afbf001c */ sw $ra,0x1c($sp) -/* f1579d4: afb00018 */ sw $s0,0x18($sp) -/* f1579d8: afa600b8 */ sw $a2,0xb8($sp) -/* f1579dc: c4e00000 */ lwc1 $f0,0x0($a3) -/* f1579e0: c4e20004 */ lwc1 $f2,0x4($a3) -/* f1579e4: 00a08025 */ or $s0,$a1,$zero -/* f1579e8: 46000102 */ mul.s $f4,$f0,$f0 -/* f1579ec: afa700bc */ sw $a3,0xbc($sp) -/* f1579f0: afa400b0 */ sw $a0,0xb0($sp) -/* f1579f4: 46021282 */ mul.s $f10,$f2,$f2 -/* f1579f8: 0c012974 */ jal sqrtf -/* f1579fc: 460a2300 */ add.s $f12,$f4,$f10 -/* f157a00: 44803000 */ mtc1 $zero,$f6 -/* f157a04: 8fa400b0 */ lw $a0,0xb0($sp) -/* f157a08: 8fa700bc */ lw $a3,0xbc($sp) -/* f157a0c: 46060032 */ c.eq.s $f0,$f6 -/* f157a10: 46000386 */ mov.s $f14,$f0 -/* f157a14: 3c013f80 */ lui $at,0x3f80 -/* f157a18: 45020006 */ bc1fl .L0f157a34 -/* f157a1c: 44814000 */ mtc1 $at,$f8 -/* f157a20: 3c013f80 */ lui $at,0x3f80 -/* f157a24: 44810000 */ mtc1 $at,$f0 -/* f157a28: 100000dc */ b .L0f157d9c -/* f157a2c: 8fbf001c */ lw $ra,0x1c($sp) -/* f157a30: 44814000 */ mtc1 $at,$f8 -.L0f157a34: -/* f157a34: c4e40000 */ lwc1 $f4,0x0($a3) -/* f157a38: 8fa200b8 */ lw $v0,0xb8($sp) -/* f157a3c: 460e4403 */ div.s $f16,$f8,$f14 -/* f157a40: 46102282 */ mul.s $f10,$f4,$f16 -/* f157a44: e7aa00a0 */ swc1 $f10,0xa0($sp) -/* f157a48: c4e60004 */ lwc1 $f6,0x4($a3) -/* f157a4c: 46103202 */ mul.s $f8,$f6,$f16 -/* f157a50: e7a800a4 */ swc1 $f8,0xa4($sp) -/* f157a54: c60a0000 */ lwc1 $f10,0x0($s0) -/* f157a58: c4440000 */ lwc1 $f4,0x0($v0) -/* f157a5c: c6080004 */ lwc1 $f8,0x4($s0) -/* f157a60: c4460004 */ lwc1 $f6,0x4($v0) -/* f157a64: 460a2001 */ sub.s $f0,$f4,$f10 -/* f157a68: e7b00044 */ swc1 $f16,0x44($sp) -/* f157a6c: e7ae00ac */ swc1 $f14,0xac($sp) -/* f157a70: 46083081 */ sub.s $f2,$f6,$f8 -/* f157a74: 46000102 */ mul.s $f4,$f0,$f0 -/* f157a78: e7a00098 */ swc1 $f0,0x98($sp) -/* f157a7c: afa700bc */ sw $a3,0xbc($sp) -/* f157a80: 46021282 */ mul.s $f10,$f2,$f2 -/* f157a84: e7a2009c */ swc1 $f2,0x9c($sp) -/* f157a88: afa400b0 */ sw $a0,0xb0($sp) -/* f157a8c: 0c012974 */ jal sqrtf -/* f157a90: 460a2300 */ add.s $f12,$f4,$f10 -/* f157a94: 44803000 */ mtc1 $zero,$f6 -/* f157a98: 8fa400b0 */ lw $a0,0xb0($sp) -/* f157a9c: 8fa700bc */ lw $a3,0xbc($sp) -/* f157aa0: 46060032 */ c.eq.s $f0,$f6 -/* f157aa4: 3c013f80 */ lui $at,0x3f80 -/* f157aa8: 27a500a0 */ addiu $a1,$sp,0xa0 -/* f157aac: 45010077 */ bc1t .L0f157c8c -/* f157ab0: 00000000 */ nop -/* f157ab4: 44814000 */ mtc1 $at,$f8 -/* f157ab8: c7a4009c */ lwc1 $f4,0x9c($sp) -/* f157abc: c7a60098 */ lwc1 $f6,0x98($sp) -/* f157ac0: 46004483 */ div.s $f18,$f8,$f0 -/* f157ac4: 02001025 */ or $v0,$s0,$zero -/* f157ac8: 46003207 */ neg.s $f8,$f6 -/* f157acc: 46122282 */ mul.s $f10,$f4,$f18 -/* f157ad0: 00000000 */ nop -/* f157ad4: 46124102 */ mul.s $f4,$f8,$f18 -/* f157ad8: e7aa002c */ swc1 $f10,0x2c($sp) -/* f157adc: e7aa0088 */ swc1 $f10,0x88($sp) -/* f157ae0: e7a40028 */ swc1 $f4,0x28($sp) -/* f157ae4: e7a4008c */ swc1 $f4,0x8c($sp) -/* f157ae8: c4860000 */ lwc1 $f6,0x0($a0) -/* f157aec: e7a60038 */ swc1 $f6,0x38($sp) -/* f157af0: c7a80038 */ lwc1 $f8,0x38($sp) -/* f157af4: c4860004 */ lwc1 $f6,0x4($a0) -/* f157af8: 460a4382 */ mul.s $f14,$f8,$f10 -/* f157afc: e7a60034 */ swc1 $f6,0x34($sp) -/* f157b00: c48a0008 */ lwc1 $f10,0x8($a0) -/* f157b04: 46044402 */ mul.s $f16,$f8,$f4 -/* f157b08: c6020000 */ lwc1 $f2,0x0($s0) -/* f157b0c: c7a80034 */ lwc1 $f8,0x34($sp) -/* f157b10: e7aa0030 */ swc1 $f10,0x30($sp) -/* f157b14: c7aa0030 */ lwc1 $f10,0x30($sp) -/* f157b18: 46024101 */ sub.s $f4,$f8,$f2 -/* f157b1c: c60c0004 */ lwc1 $f12,0x4($s0) -/* f157b20: 460c5201 */ sub.s $f8,$f10,$f12 -/* f157b24: 460e2182 */ mul.s $f6,$f4,$f14 -/* f157b28: 00000000 */ nop -/* f157b2c: 46088102 */ mul.s $f4,$f16,$f8 -/* f157b30: 44804000 */ mtc1 $zero,$f8 -/* f157b34: 46043280 */ add.s $f10,$f6,$f4 -/* f157b38: 4608503c */ c.lt.s $f10,$f8 -/* f157b3c: 00000000 */ nop -/* f157b40: 45000003 */ bc1f .L0f157b50 -/* f157b44: 00000000 */ nop -/* f157b48: 46007387 */ neg.s $f14,$f14 -/* f157b4c: 46008407 */ neg.s $f16,$f16 -.L0f157b50: -/* f157b50: 460e1180 */ add.s $f6,$f2,$f14 -/* f157b54: 8fa300b8 */ lw $v1,0xb8($sp) -/* f157b58: 46106100 */ add.s $f4,$f12,$f16 -/* f157b5c: e7a60078 */ swc1 $f6,0x78($sp) -/* f157b60: e7a4007c */ swc1 $f4,0x7c($sp) -/* f157b64: c46a0000 */ lwc1 $f10,0x0($v1) -/* f157b68: 460e5200 */ add.s $f8,$f10,$f14 -/* f157b6c: e7a80070 */ swc1 $f8,0x70($sp) -/* f157b70: c4660004 */ lwc1 $f6,0x4($v1) -/* f157b74: 46103100 */ add.s $f4,$f6,$f16 -/* f157b78: c7b0002c */ lwc1 $f16,0x2c($sp) -/* f157b7c: e7a40074 */ swc1 $f4,0x74($sp) -/* f157b80: c4ea0004 */ lwc1 $f10,0x4($a3) -/* f157b84: c7a40078 */ lwc1 $f4,0x78($sp) -/* f157b88: e7aa0048 */ swc1 $f10,0x48($sp) -/* f157b8c: c4e80000 */ lwc1 $f8,0x0($a3) -/* f157b90: c7a60048 */ lwc1 $f6,0x48($sp) -/* f157b94: e7a8004c */ swc1 $f8,0x4c($sp) -/* f157b98: 46043282 */ mul.s $f10,$f6,$f4 -/* f157b9c: c7a4004c */ lwc1 $f4,0x4c($sp) -/* f157ba0: c7a8007c */ lwc1 $f8,0x7c($sp) -/* f157ba4: e7a40020 */ swc1 $f4,0x20($sp) -/* f157ba8: 46044202 */ mul.s $f8,$f8,$f4 -/* f157bac: c7a40030 */ lwc1 $f4,0x30($sp) -/* f157bb0: 46085281 */ sub.s $f10,$f10,$f8 -/* f157bb4: c7a80034 */ lwc1 $f8,0x34($sp) -/* f157bb8: e7aa0068 */ swc1 $f10,0x68($sp) -/* f157bbc: e7aa0024 */ swc1 $f10,0x24($sp) -/* f157bc0: 46064202 */ mul.s $f8,$f8,$f6 -/* f157bc4: c7aa0020 */ lwc1 $f10,0x20($sp) -/* f157bc8: 460a2102 */ mul.s $f4,$f4,$f10 -/* f157bcc: 46044381 */ sub.s $f14,$f8,$f4 -/* f157bd0: c7a40070 */ lwc1 $f4,0x70($sp) -/* f157bd4: 46043182 */ mul.s $f6,$f6,$f4 -/* f157bd8: c7a40074 */ lwc1 $f4,0x74($sp) -/* f157bdc: e7ae006c */ swc1 $f14,0x6c($sp) -/* f157be0: 460a2102 */ mul.s $f4,$f4,$f10 -/* f157be4: c7aa0024 */ lwc1 $f10,0x24($sp) -/* f157be8: 46005306 */ mov.s $f12,$f10 -/* f157bec: 46043481 */ sub.s $f18,$f6,$f4 -/* f157bf0: c7a60028 */ lwc1 $f6,0x28($sp) -/* f157bf4: 460a903c */ c.lt.s $f18,$f10 -/* f157bf8: 00000000 */ nop -/* f157bfc: 4502000a */ bc1fl .L0f157c28 -/* f157c00: 460c9032 */ c.eq.s $f18,$f12 -/* f157c04: 46008407 */ neg.s $f16,$f16 -/* f157c08: 46003107 */ neg.s $f4,$f6 -/* f157c0c: 46009306 */ mov.s $f12,$f18 -/* f157c10: 00608025 */ or $s0,$v1,$zero -/* f157c14: 46005486 */ mov.s $f18,$f10 -/* f157c18: 00401825 */ or $v1,$v0,$zero -/* f157c1c: e7a4008c */ swc1 $f4,0x8c($sp) -/* f157c20: e7b00088 */ swc1 $f16,0x88($sp) -/* f157c24: 460c9032 */ c.eq.s $f18,$f12 -.L0f157c28: -/* f157c28: c7b00088 */ lwc1 $f16,0x88($sp) -/* f157c2c: 02003025 */ or $a2,$s0,$zero -/* f157c30: 45020012 */ bc1fl .L0f157c7c -/* f157c34: 460e903c */ c.lt.s $f18,$f14 -/* f157c38: 27a500a0 */ addiu $a1,$sp,0xa0 -/* f157c3c: afa300b8 */ sw $v1,0xb8($sp) -/* f157c40: 0fc55e32 */ jal func0f1578c8 -/* f157c44: afa400b0 */ sw $a0,0xb0($sp) -/* f157c48: 8fa400b0 */ lw $a0,0xb0($sp) -/* f157c4c: 27a500a0 */ addiu $a1,$sp,0xa0 -/* f157c50: 8fa600b8 */ lw $a2,0xb8($sp) -/* f157c54: 0fc55e32 */ jal func0f1578c8 -/* f157c58: e7a00060 */ swc1 $f0,0x60($sp) -/* f157c5c: c7a20060 */ lwc1 $f2,0x60($sp) -/* f157c60: 4602003c */ c.lt.s $f0,$f2 -/* f157c64: 00000000 */ nop -/* f157c68: 45020038 */ bc1fl .L0f157d4c -/* f157c6c: c7a800ac */ lwc1 $f8,0xac($sp) -/* f157c70: 10000035 */ b .L0f157d48 -/* f157c74: 46000086 */ mov.s $f2,$f0 -/* f157c78: 460e903c */ c.lt.s $f18,$f14 -.L0f157c7c: -/* f157c7c: 00000000 */ nop -/* f157c80: 45020007 */ bc1fl .L0f157ca0 -/* f157c84: 460c703c */ c.lt.s $f14,$f12 -/* f157c88: afa300b8 */ sw $v1,0xb8($sp) -.L0f157c8c: -/* f157c8c: 0fc55e32 */ jal func0f1578c8 -/* f157c90: 8fa600b8 */ lw $a2,0xb8($sp) -/* f157c94: 1000002c */ b .L0f157d48 -/* f157c98: 46000086 */ mov.s $f2,$f0 -/* f157c9c: 460c703c */ c.lt.s $f14,$f12 -.L0f157ca0: -/* f157ca0: 27a500a0 */ addiu $a1,$sp,0xa0 -/* f157ca4: c7a80030 */ lwc1 $f8,0x30($sp) -/* f157ca8: 45020006 */ bc1fl .L0f157cc4 -/* f157cac: c60c0004 */ lwc1 $f12,0x4($s0) -/* f157cb0: 0fc55e32 */ jal func0f1578c8 -/* f157cb4: 02003025 */ or $a2,$s0,$zero -/* f157cb8: 10000023 */ b .L0f157d48 -/* f157cbc: 46000086 */ mov.s $f2,$f0 -/* f157cc0: c60c0004 */ lwc1 $f12,0x4($s0) -.L0f157cc4: -/* f157cc4: c7aa008c */ lwc1 $f10,0x8c($sp) -/* f157cc8: c6020000 */ lwc1 $f2,0x0($s0) -/* f157ccc: 460c4181 */ sub.s $f6,$f8,$f12 -/* f157cd0: e7aa0024 */ swc1 $f10,0x24($sp) -/* f157cd4: 3c013f80 */ lui $at,0x3f80 -/* f157cd8: 46065102 */ mul.s $f4,$f10,$f6 -/* f157cdc: c7a60034 */ lwc1 $f6,0x34($sp) -/* f157ce0: 46023281 */ sub.s $f10,$f6,$f2 -/* f157ce4: 46105282 */ mul.s $f10,$f10,$f16 -/* f157ce8: 46045000 */ add.s $f0,$f10,$f4 -/* f157cec: c7aa004c */ lwc1 $f10,0x4c($sp) -/* f157cf0: 460a3100 */ add.s $f4,$f6,$f10 -/* f157cf4: 46022181 */ sub.s $f6,$f4,$f2 -/* f157cf8: c7a40048 */ lwc1 $f4,0x48($sp) -/* f157cfc: 46103282 */ mul.s $f10,$f6,$f16 -/* f157d00: 46044180 */ add.s $f6,$f8,$f4 -/* f157d04: c7a40024 */ lwc1 $f4,0x24($sp) -/* f157d08: 460c3201 */ sub.s $f8,$f6,$f12 -/* f157d0c: 46082182 */ mul.s $f6,$f4,$f8 -/* f157d10: c7a40038 */ lwc1 $f4,0x38($sp) -/* f157d14: 46065380 */ add.s $f14,$f10,$f6 -/* f157d18: 460e0032 */ c.eq.s $f0,$f14 -/* f157d1c: 00000000 */ nop -/* f157d20: 45020005 */ bc1fl .L0f157d38 -/* f157d24: 46040201 */ sub.s $f8,$f0,$f4 -/* f157d28: 44810000 */ mtc1 $at,$f0 -/* f157d2c: 1000001b */ b .L0f157d9c -/* f157d30: 8fbf001c */ lw $ra,0x1c($sp) -/* f157d34: 46040201 */ sub.s $f8,$f0,$f4 -.L0f157d38: -/* f157d38: c7aa00ac */ lwc1 $f10,0xac($sp) -/* f157d3c: 460e0101 */ sub.s $f4,$f0,$f14 -/* f157d40: 460a4182 */ mul.s $f6,$f8,$f10 -/* f157d44: 46043083 */ div.s $f2,$f6,$f4 -.L0f157d48: -/* f157d48: c7a800ac */ lwc1 $f8,0xac($sp) -.L0f157d4c: -/* f157d4c: 3c013f80 */ lui $at,0x3f80 -/* f157d50: 4602403c */ c.lt.s $f8,$f2 -/* f157d54: 00000000 */ nop -/* f157d58: 45020005 */ bc1fl .L0f157d70 -/* f157d5c: 44805000 */ mtc1 $zero,$f10 -/* f157d60: 44810000 */ mtc1 $at,$f0 -/* f157d64: 1000000d */ b .L0f157d9c -/* f157d68: 8fbf001c */ lw $ra,0x1c($sp) -/* f157d6c: 44805000 */ mtc1 $zero,$f10 -.L0f157d70: -/* f157d70: c7a60044 */ lwc1 $f6,0x44($sp) -/* f157d74: 460a103c */ c.lt.s $f2,$f10 -/* f157d78: 00000000 */ nop -/* f157d7c: 45000004 */ bc1f .L0f157d90 -/* f157d80: 00000000 */ nop -/* f157d84: 44800000 */ mtc1 $zero,$f0 -/* f157d88: 10000004 */ b .L0f157d9c -/* f157d8c: 8fbf001c */ lw $ra,0x1c($sp) -.L0f157d90: -/* f157d90: 46061002 */ mul.s $f0,$f2,$f6 -/* f157d94: 00000000 */ nop -/* f157d98: 8fbf001c */ lw $ra,0x1c($sp) -.L0f157d9c: -/* f157d9c: 8fb00018 */ lw $s0,0x18($sp) -/* f157da0: 27bd00b0 */ addiu $sp,$sp,0xb0 -/* f157da4: 03e00008 */ jr $ra -/* f157da8: 00000000 */ nop -); +f32 func0f1579cc(struct widthxz *arg0, struct xz *arg1, struct xz *arg2, struct xz *arg3) +{ + f32 spac; + f32 spa8; + struct xz spa0; + f32 sp9c; + f32 sp98; + f32 sp94; + f32 sp90; + f32 sp8c; + f32 sp88; + f32 sp84; + f32 sp80; + f32 sp7c; + f32 sp78; + f32 sp74; + f32 sp70; + f32 sp6c; + f32 sp68; + f32 sp64; + f32 sp60; + f32 sp5c; + f32 sp58; + f32 sp54; + + spac = sqrtf(arg3->x * arg3->x + arg3->z * arg3->z); + + if (spac == 0.0f) { + return 1.0f; + } + + spa0.x = arg3->x * (1.0f / spac); + spa0.z = arg3->z * (1.0f / spac); + + sp98 = arg2->x - arg1->x; + sp9c = arg2->z - arg1->z; + + sp94 = sqrtf(sp98 * sp98 + sp9c * sp9c); + + if (sp94 == 0.0f) { + goto handlezero; + } + + sp90 = 1.0f / sp94; + sp88 = sp9c * sp90; + sp8c = -sp98 * sp90; + + sp84 = arg0->width * sp88; + sp80 = arg0->width * sp8c; + + if (sp84 * (arg0->x - arg1->x) + sp80 * (arg0->z - arg1->z) < 0.0f) { + sp84 = -sp84; + sp80 = -sp80; + } + + sp78 = arg1->x + sp84; + sp7c = arg1->z + sp80; + sp70 = arg2->x + sp84; + sp74 = arg2->z + sp80; + + sp68 = (arg3->z * sp78) - (sp7c * arg3->x); + sp6c = (arg0->x * arg3->z) - (arg0->z * arg3->x); + sp64 = (arg3->z * sp70) - (sp74 * arg3->x); + + if (sp64 < sp68) { + struct xz *tmp; + + spa8 = sp68; + sp68 = sp64; + sp64 = spa8; + + tmp = arg1; + arg1 = arg2; + arg2 = tmp; + + sp88 = -sp88; + sp8c = -sp8c; + } + + if (sp64 == sp68) { + sp60 = func0f1578c8(arg0, &spa0, arg1); + sp5c = func0f1578c8(arg0, &spa0, arg2); + + if (sp5c < sp60) { + sp60 = sp5c; + } + } else if (sp64 < sp6c) { +handlezero: + sp60 = func0f1578c8(arg0, &spa0, arg2); + } else if (sp6c < sp68) { + sp60 = func0f1578c8(arg0, &spa0, arg1); + } else { + sp58 = sp88 * (arg0->x - arg1->x) + sp8c * (arg0->z - arg1->z); + sp54 = sp88 * (arg0->x + arg3->x - arg1->x) + sp8c * (arg0->z + arg3->z - arg1->z); + + if (sp58 == sp54) { + return 1.0f; + } + + sp60 = (sp58 - arg0->width) * spac / (sp58 - sp54); + } + + if (spac < sp60) { + return 1.0f; + } + + if (sp60 < 0.0f) { + return 0.0f; + } + + return (f32) sp60 * (1.0f / spac); +} diff --git a/src/include/lib/collision.h b/src/include/lib/collision.h index d245c4cb0..468a42500 100644 --- a/src/include/lib/collision.h +++ b/src/include/lib/collision.h @@ -5,8 +5,8 @@ #include "types.h" f32 func0f1577f0(f32 arg0[2], f32 arg1[2], f32 arg2[2], f32 arg3[2]); -f32 func0f1578c8(struct coord *arg0, struct coord *arg1, struct coord *arg2); -f32 func0f1579cc(f32 arg0[3], f32 arg1[2], f32 arg2[2], f32 arg3[2]); +f32 func0f1578c8(struct widthxz *arg0, struct xz *arg1, struct xz *arg2); +f32 func0f1579cc(struct widthxz *arg0, struct xz *arg1, struct xz *arg2, struct xz *arg3); f32 cd00024e40(void); void cd00024e4c(struct coord *arg0, struct coord *arg1, u32 line, char *file); diff --git a/src/include/types.h b/src/include/types.h index cd2580238..18d822f94 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -6368,4 +6368,15 @@ struct xraydata { /*0x24a*/ s16 numtris; }; +struct widthxz { + f32 width; + f32 x; + f32 z; +}; + +struct xz { + f32 x; + f32 z; +}; + #endif diff --git a/src/lib/collision.c b/src/lib/collision.c index 19109a38c..3350bbafc 100644 --- a/src/lib/collision.c +++ b/src/lib/collision.c @@ -170,27 +170,25 @@ void cd00025038(struct coord *arg0, struct coord *arg1, struct prop *prop, f32 a void cd000250cc(struct coord *arg0, struct coord *arg1, f32 width) { - f32 sp38[2]; - f32 sp34; - f32 sp2c[2]; - f32 sp24[2]; - f32 sp1c[2]; + struct widthxz sp34; + struct xz sp2c; + struct xz sp24; + struct xz sp1c; - sp34 = width; + sp34.width = width; + sp34.x = arg0->x; + sp34.z = arg0->z; - sp38[0] = arg0->x; - sp38[1] = arg0->z; + sp1c.x = arg1->x; + sp1c.z = arg1->z; - sp1c[0] = arg1->x; - sp1c[1] = arg1->z; + sp2c.x = var8009a8b8.x; + sp2c.z = var8009a8b8.z; - sp2c[0] = var8009a8b8.x; - sp2c[1] = var8009a8b8.z; + sp24.x = var8009a8c8.x; + sp24.z = var8009a8c8.z; - sp24[0] = var8009a8c8.x; - sp24[1] = var8009a8c8.z; - - var8009a8b0 = func0f1579cc(&sp34, sp2c, sp24, sp1c); + var8009a8b0 = func0f1579cc(&sp34, &sp2c, &sp24, &sp1c); var8009a8ac = 1; } @@ -1717,10 +1715,10 @@ void cd00028df0(struct coord *pos, f32 width, s16 *rooms, u32 types, u16 arg4, u void cd0002901c(struct coord *pos, struct coord *dist, f32 width, struct collisionthing *things) { s32 i; - f32 spf8[3]; - f32 spf0[2]; - f32 spe8[2]; - f32 spe0[2]; + struct widthxz spf8; + struct xz spf0; + struct xz spe8; + struct xz spe0; f32 bestvalue = 0.0f; s32 bestindex = -1; struct collisionthing *bestthing; @@ -1735,21 +1733,24 @@ void cd0002901c(struct coord *pos, struct coord *dist, f32 width, struct collisi if (1); if (geo->type == GEOTYPE_TILE_I) { struct geotilei *tile = (struct geotilei *) geo; - spf8[0] = width; - spf8[1] = pos->x; - spf8[2] = pos->z; - spe0[0] = dist->x; - spe0[1] = dist->z; + + spf8.width = width; + spf8.x = pos->x; + spf8.z = pos->z; + + spe0.x = dist->x; + spe0.z = dist->z; curr = things[i].vertexindex; next = (curr + 1) % tile->header.numvertices; - spf0[0] = tile->vertices[curr][0]; - spf0[1] = tile->vertices[curr][2]; - spe8[0] = tile->vertices[next][0]; - spe8[1] = tile->vertices[next][2]; + spf0.x = tile->vertices[curr][0]; + spf0.z = tile->vertices[curr][2]; - value = func0f1579cc(spf8, spf0, spe8, spe0); + spe8.x = tile->vertices[next][0]; + spe8.z = tile->vertices[next][2]; + + value = func0f1579cc(&spf8, &spf0, &spe8, &spe0); if (bestindex < 0 || value < bestvalue) { bestvalue = value; @@ -1758,21 +1759,23 @@ void cd0002901c(struct coord *pos, struct coord *dist, f32 width, struct collisi } else if (geo->type == GEOTYPE_TILE_F) { struct geotilef *tile = (struct geotilef *) geo; - spf8[0] = width; - spf8[1] = pos->x; - spf8[2] = pos->z; - spe0[0] = dist->x; - spe0[1] = dist->z; + spf8.width = width; + spf8.x = pos->x; + spf8.z = pos->z; + + spe0.x = dist->x; + spe0.z = dist->z; curr = things[i].vertexindex; next = (curr + 1) % tile->header.numvertices; - spf0[0] = tile->vertices[curr].x; - spf0[1] = tile->vertices[curr].z; - spe8[0] = tile->vertices[next].x; - spe8[1] = tile->vertices[next].z; + spf0.x = tile->vertices[curr].x; + spf0.z = tile->vertices[curr].z; - value = func0f1579cc(spf8, spf0, spe8, spe0); + spe8.x = tile->vertices[next].x; + spe8.z = tile->vertices[next].z; + + value = func0f1579cc(&spf8, &spf0, &spe8, &spe0); if (bestindex < 0 || value < bestvalue) { bestvalue = value; @@ -1781,21 +1784,23 @@ void cd0002901c(struct coord *pos, struct coord *dist, f32 width, struct collisi } else if (geo->type == GEOTYPE_BLOCK) { struct geoblock *block = (struct geoblock *) geo; - spf8[0] = width; - spf8[1] = pos->x; - spf8[2] = pos->z; - spe0[0] = dist->x; - spe0[1] = dist->z; + spf8.width = width; + spf8.x = pos->x; + spf8.z = pos->z; + + spe0.x = dist->x; + spe0.z = dist->z; curr = things[i].vertexindex; next = (curr + 1) % block->header.numvertices; - spf0[0] = block->vertices[curr][0]; - spf0[1] = block->vertices[curr][1]; - spe8[0] = block->vertices[next][0]; - spe8[1] = block->vertices[next][1]; + spf0.x = block->vertices[curr][0]; + spf0.z = block->vertices[curr][1]; - value = func0f1579cc(spf8, spf0, spe8, spe0); + spe8.x = block->vertices[next][0]; + spe8.z = block->vertices[next][1]; + + value = func0f1579cc(&spf8, &spf0, &spe8, &spe0); if (bestindex < 0 || value < bestvalue) { bestvalue = value; @@ -1804,17 +1809,20 @@ void cd0002901c(struct coord *pos, struct coord *dist, f32 width, struct collisi } else if (geo->type == GEOTYPE_CYL) { struct geocyl *cyl = (struct geocyl *) geo; - spf8[0] = cyl->radius + width; - spf8[1] = pos->x; - spf8[2] = pos->z; - spe0[0] = dist->x; - spe0[1] = dist->z; - spf0[0] = cyl->x; - spf0[1] = cyl->z; - spe8[0] = cyl->x; - spe8[1] = cyl->z; + spf8.width = cyl->radius + width; + spf8.x = pos->x; + spf8.z = pos->z; - value = func0f1579cc(spf8, spf0, spe8, spe0); + spe0.x = dist->x; + spe0.z = dist->z; + + spf0.x = cyl->x; + spf0.z = cyl->z; + + spe8.x = cyl->x; + spe8.z = cyl->z; + + value = func0f1579cc(&spf8, &spf0, &spe8, &spe0); if (bestindex < 0 || value < bestvalue) { bestvalue = value;