From 06239a7efb67d1904ccb7af8117397e0aa1bf337 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 19 Nov 2020 00:02:58 +1000 Subject: [PATCH] Decompile func0f0295f8 --- src/game/chr/chr.c | 147 +++++++++---------------------------- src/include/game/chr/chr.h | 2 +- 2 files changed, 35 insertions(+), 114 deletions(-) diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index 48c88c8f4..faa409695 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -11133,119 +11133,40 @@ glabel func0f0294cc /* f0295f4: 00000000 */ nop ); -GLOBAL_ASM( -glabel func0f0295f8 -/* f0295f8: 3c013fc0 */ lui $at,0x3fc0 -/* f0295fc: 44811000 */ mtc1 $at,$f2 -/* f029600: 3c014040 */ lui $at,0x4040 -/* f029604: 4602603c */ c.lt.s $f12,$f2 -/* f029608: 00000000 */ nop -/* f02960c: 45020015 */ bc1fl .L0f029664 -/* f029610: 44811000 */ mtc1 $at,$f2 -/* f029614: 460c1001 */ sub.s $f0,$f2,$f12 -/* f029618: 3c0141e0 */ lui $at,0x41e0 -/* f02961c: 44812000 */ mtc1 $at,$f4 -/* f029620: 3c0141a0 */ lui $at,0x41a0 -/* f029624: 44815000 */ mtc1 $at,$f10 -/* f029628: 46040182 */ mul.s $f6,$f0,$f4 -/* f02962c: 24180039 */ addiu $t8,$zero,0x39 -/* f029630: 240a004b */ addiu $t2,$zero,0x4b -/* f029634: 460a0402 */ mul.s $f16,$f0,$f10 -/* f029638: 4600320d */ trunc.w.s $f8,$f6 -/* f02963c: 4600848d */ trunc.w.s $f18,$f16 -/* f029640: 440f4000 */ mfc1 $t7,$f8 -/* f029644: 44099000 */ mfc1 $t1,$f18 -/* f029648: 030fc823 */ subu $t9,$t8,$t7 -/* f02964c: acb90000 */ sw $t9,0x0($a1) -/* f029650: 01495823 */ subu $t3,$t2,$t1 -/* f029654: accb0000 */ sw $t3,0x0($a2) -/* f029658: 03e00008 */ jr $ra -/* f02965c: ace00000 */ sw $zero,0x0($a3) -/* f029660: 44811000 */ mtc1 $at,$f2 -.L0f029664: -/* f029664: 3c014090 */ lui $at,0x4090 -/* f029668: 4602603c */ c.lt.s $f12,$f2 -/* f02966c: 00000000 */ nop -/* f029670: 45020015 */ bc1fl .L0f0296c8 -/* f029674: 44811000 */ mtc1 $at,$f2 -/* f029678: 460c1001 */ sub.s $f0,$f2,$f12 -/* f02967c: 3c0141f0 */ lui $at,0x41f0 -/* f029680: 44812000 */ mtc1 $at,$f4 -/* f029684: 3c014120 */ lui $at,0x4120 -/* f029688: 44815000 */ mtc1 $at,$f10 -/* f02968c: 46040182 */ mul.s $f6,$f0,$f4 -/* f029690: 240e0066 */ addiu $t6,$zero,0x66 -/* f029694: 2408005a */ addiu $t0,$zero,0x5a -/* f029698: 460a0402 */ mul.s $f16,$f0,$f10 -/* f02969c: 4600320d */ trunc.w.s $f8,$f6 -/* f0296a0: 4600848d */ trunc.w.s $f18,$f16 -/* f0296a4: 440d4000 */ mfc1 $t5,$f8 -/* f0296a8: 44199000 */ mfc1 $t9,$f18 -/* f0296ac: 01cdc023 */ subu $t8,$t6,$t5 -/* f0296b0: acb80000 */ sw $t8,0x0($a1) -/* f0296b4: 01195023 */ subu $t2,$t0,$t9 -/* f0296b8: acca0000 */ sw $t2,0x0($a2) -/* f0296bc: 03e00008 */ jr $ra -/* f0296c0: ace00000 */ sw $zero,0x0($a3) -/* f0296c4: 44811000 */ mtc1 $at,$f2 -.L0f0296c8: -/* f0296c8: 3c0140c0 */ lui $at,0x40c0 -/* f0296cc: 4602603c */ c.lt.s $f12,$f2 -/* f0296d0: 00000000 */ nop -/* f0296d4: 45020015 */ bc1fl .L0f02972c -/* f0296d8: 44811000 */ mtc1 $at,$f2 -/* f0296dc: 460c1001 */ sub.s $f0,$f2,$f12 -/* f0296e0: 3c014240 */ lui $at,0x4240 -/* f0296e4: 44812000 */ mtc1 $at,$f4 -/* f0296e8: 3c0141d0 */ lui $at,0x41d0 -/* f0296ec: 44815000 */ mtc1 $at,$f10 -/* f0296f0: 46040182 */ mul.s $f6,$f0,$f4 -/* f0296f4: 240c00ae */ addiu $t4,$zero,0xae -/* f0296f8: 240f0081 */ addiu $t7,$zero,0x81 -/* f0296fc: 460a0402 */ mul.s $f16,$f0,$f10 -/* f029700: 4600320d */ trunc.w.s $f8,$f6 -/* f029704: 4600848d */ trunc.w.s $f18,$f16 -/* f029708: 440b4000 */ mfc1 $t3,$f8 -/* f02970c: 44189000 */ mfc1 $t8,$f18 -/* f029710: 018b7023 */ subu $t6,$t4,$t3 -/* f029714: acae0000 */ sw $t6,0x0($a1) -/* f029718: 01f84023 */ subu $t0,$t7,$t8 -/* f02971c: acc80000 */ sw $t0,0x0($a2) -/* f029720: 03e00008 */ jr $ra -/* f029724: ace00000 */ sw $zero,0x0($a3) -/* f029728: 44811000 */ mtc1 $at,$f2 -.L0f02972c: -/* f02972c: 3c01c100 */ lui $at,0xc100 -/* f029730: 241800a2 */ addiu $t8,$zero,0xa2 -/* f029734: 4602603c */ c.lt.s $f12,$f2 -/* f029738: 24080036 */ addiu $t0,$zero,0x36 -/* f02973c: 45020014 */ bc1fl .L0f029790 -/* f029740: acb80000 */ sw $t8,0x0($a1) -/* f029744: 460c1001 */ sub.s $f0,$f2,$f12 -/* f029748: 44812000 */ mtc1 $at,$f4 -/* f02974c: 3c01c248 */ lui $at,0xc248 -/* f029750: 44815000 */ mtc1 $at,$f10 -/* f029754: 46040182 */ mul.s $f6,$f0,$f4 -/* f029758: 240900a2 */ addiu $t1,$zero,0xa2 -/* f02975c: 240d0036 */ addiu $t5,$zero,0x36 -/* f029760: 460a0402 */ mul.s $f16,$f0,$f10 -/* f029764: 4600320d */ trunc.w.s $f8,$f6 -/* f029768: 4600848d */ trunc.w.s $f18,$f16 -/* f02976c: 440a4000 */ mfc1 $t2,$f8 -/* f029770: 440e9000 */ mfc1 $t6,$f18 -/* f029774: 012a6023 */ subu $t4,$t1,$t2 -/* f029778: acac0000 */ sw $t4,0x0($a1) -/* f02977c: 01ae7823 */ subu $t7,$t5,$t6 -/* f029780: accf0000 */ sw $t7,0x0($a2) -/* f029784: 03e00008 */ jr $ra -/* f029788: ace00000 */ sw $zero,0x0($a3) -/* f02978c: acb80000 */ sw $t8,0x0($a1) -.L0f029790: -/* f029790: acc80000 */ sw $t0,0x0($a2) -/* f029794: ace00000 */ sw $zero,0x0($a3) -/* f029798: 03e00008 */ jr $ra -/* f02979c: 00000000 */ nop -); +void func0f0295f8(f32 arg0, s32 *arg1, s32 *arg2, s32 *arg3) +{ + if (arg0 < 1.5f) { + *arg1 = 57 - (s32)((1.5f - arg0) * 28.0f); + *arg2 = 75 - (s32)((1.5f - arg0) * 20.0f); + *arg3 = 0; + return; + } + + if (arg0 < 3.0f) { + *arg1 = 102 - (s32)((3.0f - arg0) * 30.0f); + *arg2 = 90 - (s32)((3.0f - arg0) * 10.0f); + *arg3 = 0; + return; + } + + if (arg0 < 4.5f) { + *arg1 = 174 - (s32)((4.5f - arg0) * 48.0f); + *arg2 = 129 - (s32)((4.5f - arg0) * 26.0f); + *arg3 = 0; + return; + } + + if (arg0 < 6.0f) { + *arg1 = 162 - (s32)((6.0f - arg0) * -8.0f); + *arg2 = 54 - (s32)((6.0f - arg0) * -50.0f); + *arg3 = 0; + return; + } + + *arg1 = 162; + *arg2 = 54; + *arg3 = 0; +} f32 propGetShieldThing(struct prop **propptr) { diff --git a/src/include/game/chr/chr.h b/src/include/game/chr/chr.h index 953cfcccc..29fe25e6a 100644 --- a/src/include/game/chr/chr.h +++ b/src/include/game/chr/chr.h @@ -54,7 +54,7 @@ void func0f0292bc(struct prop *prop); u32 func0f02932c(void); u32 func0f0293ec(void); u32 func0f0294cc(void); -u32 func0f0295f8(void); +void func0f0295f8(f32 arg0, s32 *arg1, s32 *arg2, s32 *arg3); f32 propGetShieldThing(struct prop **propptr); u32 func0f02983c(void); u32 func0f02b7d4(void);