Decompile func0f140750

This commit is contained in:
Ryan Dwyer 2021-02-03 08:22:35 +10:00
parent 32cb412f0c
commit a25524113e
2 changed files with 62 additions and 101 deletions

View File

@ -69,7 +69,7 @@ const char var7f1b5cd0[] = "Wallhit colour %d not implemented, substituting blac
u32 var8007f740 = 0x00000000;
u8 var8007f744[4] = {0x40, 0x0a, 0x0a, 0x00};
u32 var8007f748 = 0x3f800000;
u32 var8007f74c = 0x3f800000;
f32 var8007f74c = 1;
u32 var8007f750 = 0x00000000;
f32 var8007f754 = 0;
f32 var8007f758 = 0;
@ -2670,105 +2670,66 @@ glabel var7f1b5d6c
/* f14074c: 27bd0200 */ addiu $sp,$sp,0x200
);
GLOBAL_ASM(
glabel func0f140750
/* f140750: 3c0e800a */ lui $t6,%hi(g_Vars+0x284)
/* f140754: 8dcea244 */ lw $t6,%lo(g_Vars+0x284)($t6)
/* f140758: c4860000 */ lwc1 $f6,0x0($a0)
/* f14075c: 44807000 */ mtc1 $zero,$f14
/* f140760: 8dc2174c */ lw $v0,0x174c($t6)
/* f140764: 3c038008 */ lui $v1,%hi(var8007f740)
/* f140768: 2463f740 */ addiu $v1,$v1,%lo(var8007f740)
/* f14076c: c4440030 */ lwc1 $f4,0x30($v0)
/* f140770: 8c6f0000 */ lw $t7,0x0($v1)
/* f140774: c48a0004 */ lwc1 $f10,0x4($a0)
/* f140778: 46062001 */ sub.s $f0,$f4,$f6
/* f14077c: c4920008 */ lwc1 $f18,0x8($a0)
/* f140780: c4480034 */ lwc1 $f8,0x34($v0)
/* f140784: c4500038 */ lwc1 $f16,0x38($v0)
/* f140788: 460e003c */ c.lt.s $f0,$f14
/* f14078c: 25f80001 */ addiu $t8,$t7,0x1
/* f140790: ac780000 */ sw $t8,0x0($v1)
/* f140794: 460a4081 */ sub.s $f2,$f8,$f10
/* f140798: 45000002 */ bc1f .L0f1407a4
/* f14079c: 46128301 */ sub.s $f12,$f16,$f18
/* f1407a0: 46000007 */ neg.s $f0,$f0
.L0f1407a4:
/* f1407a4: 460e103c */ c.lt.s $f2,$f14
/* f1407a8: 3c018008 */ lui $at,%hi(var8007f74c)
/* f1407ac: 45020003 */ bc1fl .L0f1407bc
/* f1407b0: 460e603c */ c.lt.s $f12,$f14
/* f1407b4: 46001087 */ neg.s $f2,$f2
/* f1407b8: 460e603c */ c.lt.s $f12,$f14
.L0f1407bc:
/* f1407bc: 00000000 */ nop
/* f1407c0: 45020003 */ bc1fl .L0f1407d0
/* f1407c4: 4602003c */ c.lt.s $f0,$f2
/* f1407c8: 46006307 */ neg.s $f12,$f12
/* f1407cc: 4602003c */ c.lt.s $f0,$f2
.L0f1407d0:
/* f1407d0: 00000000 */ nop
/* f1407d4: 45020003 */ bc1fl .L0f1407e4
/* f1407d8: 460c003c */ c.lt.s $f0,$f12
/* f1407dc: 46001006 */ mov.s $f0,$f2
/* f1407e0: 460c003c */ c.lt.s $f0,$f12
.L0f1407e4:
/* f1407e4: 00000000 */ nop
/* f1407e8: 45000002 */ bc1f .L0f1407f4
/* f1407ec: 00000000 */ nop
/* f1407f0: 46006006 */ mov.s $f0,$f12
.L0f1407f4:
/* f1407f4: c424f74c */ lwc1 $f4,%lo(var8007f74c)($at)
/* f1407f8: 3c0144c8 */ lui $at,0x44c8
/* f1407fc: 44813000 */ mtc1 $at,$f6
/* f140800: 46040082 */ mul.s $f2,$f0,$f4
/* f140804: 3c0143c8 */ lui $at,0x43c8
/* f140808: 4602303c */ c.lt.s $f6,$f2
/* f14080c: 00000000 */ nop
/* f140810: 45020004 */ bc1fl .L0f140824
/* f140814: 44814000 */ mtc1 $at,$f8
/* f140818: 03e00008 */ jr $ra
/* f14081c: 24020004 */ addiu $v0,$zero,0x4
/* f140820: 44814000 */ mtc1 $at,$f8
.L0f140824:
/* f140824: 3c014396 */ lui $at,0x4396
/* f140828: 4602403c */ c.lt.s $f8,$f2
/* f14082c: 00000000 */ nop
/* f140830: 45020004 */ bc1fl .L0f140844
/* f140834: 44815000 */ mtc1 $at,$f10
/* f140838: 03e00008 */ jr $ra
/* f14083c: 24020008 */ addiu $v0,$zero,0x8
/* f140840: 44815000 */ mtc1 $at,$f10
.L0f140844:
/* f140844: 3c014348 */ lui $at,0x4348
/* f140848: 4602503c */ c.lt.s $f10,$f2
/* f14084c: 00000000 */ nop
/* f140850: 45020004 */ bc1fl .L0f140864
/* f140854: 44818000 */ mtc1 $at,$f16
/* f140858: 03e00008 */ jr $ra
/* f14085c: 24020010 */ addiu $v0,$zero,0x10
/* f140860: 44818000 */ mtc1 $at,$f16
.L0f140864:
/* f140864: 3c0142c8 */ lui $at,0x42c8
/* f140868: 4602803c */ c.lt.s $f16,$f2
/* f14086c: 00000000 */ nop
/* f140870: 45020004 */ bc1fl .L0f140884
/* f140874: 44819000 */ mtc1 $at,$f18
/* f140878: 03e00008 */ jr $ra
/* f14087c: 24020020 */ addiu $v0,$zero,0x20
/* f140880: 44819000 */ mtc1 $at,$f18
.L0f140884:
/* f140884: 24020080 */ addiu $v0,$zero,0x80
/* f140888: 4602903c */ c.lt.s $f18,$f2
/* f14088c: 00000000 */ nop
/* f140890: 45000003 */ bc1f .L0f1408a0
/* f140894: 00000000 */ nop
/* f140898: 03e00008 */ jr $ra
/* f14089c: 24020040 */ addiu $v0,$zero,0x40
.L0f1408a0:
/* f1408a0: 03e00008 */ jr $ra
/* f1408a4: 00000000 */ nop
);
/**
* Maybe a LOD calculation?
*/
s32 func0f140750(struct coord *coord)
{
f32 x;
f32 y;
f32 z;
f32 tmp;
x = g_Vars.currentplayer->unk174c->m[3][0] - coord->f[0];
y = g_Vars.currentplayer->unk174c->m[3][1] - coord->f[1];
z = g_Vars.currentplayer->unk174c->m[3][2] - coord->f[2];
var8007f740++;
if (x < 0) {
x = -x;
}
if (y < 0) {
y = -y;
}
if (z < 0) {
z = -z;
}
if (y > x) {
x = y;
}
if (z > x) {
x = z;
}
tmp = x * var8007f74c;
if (tmp > 1600) {
return 4;
}
if (tmp > 400) {
return 8;
}
if (tmp > 300) {
return 16;
}
if (tmp > 200) {
return 32;
}
if (tmp > 100) {
return 64;
}
return 128;
}
GLOBAL_ASM(
glabel func0f1408a8

View File

@ -14,7 +14,7 @@ u32 func0f13e994(void);
void func0f13eb44(void);
u32 func0f13f3f4(void);
u32 func0f13f504(void);
u32 func0f140750(void);
s32 func0f140750(struct coord *coord);
u32 func0f1408a8(void);
u32 func0f140b7c(void);
u32 func0f140e20(void);