1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-26 22:56:20 +00:00

Finish code_8007BF90 (#95)

* Finish code_8007BF90

* Review changes

Co-Authored-By: Roman971 <32455037+Roman971@users.noreply.github.com>

Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
This commit is contained in:
Synray 2020-04-25 19:55:19 -07:00 committed by GitHub
parent aa91a7ee32
commit ff25b89b13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 67 additions and 241 deletions

View file

@ -1,25 +0,0 @@
glabel func_8007C0A8
/* AF3248 8007C0A8 46006005 */ abs.s $f0, $f12
/* AF324C 8007C0AC 460E003E */ c.le.s $f0, $f14
/* AF3250 8007C0B0 00000000 */ nop
/* AF3254 8007C0B4 45020005 */ bc1fl .L8007C0CC
/* AF3258 8007C0B8 44802000 */ mtc1 $zero, $f4
/* AF325C 8007C0BC 46006086 */ mov.s $f2, $f12
/* AF3260 8007C0C0 03E00008 */ jr $ra
/* AF3264 8007C0C4 46006006 */ mov.s $f0, $f12
/* AF3268 8007C0C8 44802000 */ mtc1 $zero, $f4
.L8007C0CC:
/* AF326C 8007C0CC 00000000 */ nop
/* AF3270 8007C0D0 460C203E */ c.le.s $f4, $f12
/* AF3274 8007C0D4 00000000 */ nop
/* AF3278 8007C0D8 45020004 */ bc1fl .L8007C0EC
/* AF327C 8007C0DC 46007007 */ neg.s $f0, $f14
/* AF3280 8007C0E0 10000002 */ b .L8007C0EC
/* AF3284 8007C0E4 46007006 */ mov.s $f0, $f14
/* AF3288 8007C0E8 46007007 */ neg.s $f0, $f14
.L8007C0EC:
/* AF328C 8007C0EC 46000086 */ mov.s $f2, $f0
/* AF3290 8007C0F0 03E00008 */ jr $ra
/* AF3294 8007C0F4 46001006 */ mov.s $f0, $f2

View file

@ -1,107 +0,0 @@
.late_rodata
glabel D_8013CB84
.float 57.295776
glabel D_8013CB88
.float 182.04167
glabel D_8013CB8C
.float 57.295776
glabel D_8013CB90
.float 182.04167
.text
glabel func_8007C29C
/* AF343C 8007C29C 27BDFFD0 */ addiu $sp, $sp, -0x30
/* AF3440 8007C2A0 AFBF0014 */ sw $ra, 0x14($sp)
/* AF3444 8007C2A4 AFA40030 */ sw $a0, 0x30($sp)
/* AF3448 8007C2A8 C4AC0000 */ lwc1 $f12, ($a1)
/* AF344C 8007C2AC C4A20008 */ lwc1 $f2, 8($a1)
/* AF3450 8007C2B0 44809000 */ mtc1 $zero, $f18
/* AF3454 8007C2B4 460C6102 */ mul.s $f4, $f12, $f12
/* AF3458 8007C2B8 00000000 */ nop
/* AF345C 8007C2BC 46021182 */ mul.s $f6, $f2, $f2
/* AF3460 8007C2C0 46062400 */ add.s $f16, $f4, $f6
/* AF3464 8007C2C4 46008004 */ sqrt.s $f0, $f16
/* AF3468 8007C2C8 46120032 */ c.eq.s $f0, $f18
/* AF346C 8007C2CC E7A00020 */ swc1 $f0, 0x20($sp)
/* AF3470 8007C2D0 C7AC0020 */ lwc1 $f12, 0x20($sp)
/* AF3474 8007C2D4 45000008 */ bc1f .L8007C2F8
/* AF3478 8007C2D8 00000000 */ nop
/* AF347C 8007C2DC C4A80004 */ lwc1 $f8, 4($a1)
/* AF3480 8007C2E0 46089032 */ c.eq.s $f18, $f8
/* AF3484 8007C2E4 00000000 */ nop
/* AF3488 8007C2E8 45020004 */ bc1fl .L8007C2FC
/* AF348C 8007C2EC C4AE0004 */ lwc1 $f14, 4($a1)
/* AF3490 8007C2F0 10000015 */ b .L8007C348
/* AF3494 8007C2F4 A7A0002C */ sh $zero, 0x2c($sp)
.L8007C2F8:
/* AF3498 8007C2F8 C4AE0004 */ lwc1 $f14, 4($a1)
.L8007C2FC:
/* AF349C 8007C2FC E7B00024 */ swc1 $f16, 0x24($sp)
/* AF34A0 8007C300 0C03F494 */ jal Math_atan2f
/* AF34A4 8007C304 AFA50034 */ sw $a1, 0x34($sp)
/* AF34A8 8007C308 3C018014 */ lui $at, %hi(D_8013CB84)
/* AF34AC 8007C30C C42ACB84 */ lwc1 $f10, %lo(D_8013CB84)($at)
/* AF34B0 8007C310 3C018014 */ lui $at, %hi(D_8013CB88)
/* AF34B4 8007C314 C426CB88 */ lwc1 $f6, %lo(D_8013CB88)($at)
/* AF34B8 8007C318 460A0102 */ mul.s $f4, $f0, $f10
/* AF34BC 8007C31C 3C013F00 */ li $at, 0x3F000000 # 0.000000
/* AF34C0 8007C320 44815000 */ mtc1 $at, $f10
/* AF34C4 8007C324 44809000 */ mtc1 $zero, $f18
/* AF34C8 8007C328 8FA50034 */ lw $a1, 0x34($sp)
/* AF34CC 8007C32C C7B00024 */ lwc1 $f16, 0x24($sp)
/* AF34D0 8007C330 46062202 */ mul.s $f8, $f4, $f6
/* AF34D4 8007C334 460A4100 */ add.s $f4, $f8, $f10
/* AF34D8 8007C338 4600218D */ trunc.w.s $f6, $f4
/* AF34DC 8007C33C 440F3000 */ mfc1 $t7, $f6
/* AF34E0 8007C340 00000000 */ nop
/* AF34E4 8007C344 A7AF002C */ sh $t7, 0x2c($sp)
.L8007C348:
/* AF34E8 8007C348 C4A20004 */ lwc1 $f2, 4($a1)
/* AF34EC 8007C34C 46021202 */ mul.s $f8, $f2, $f2
/* AF34F0 8007C350 46104000 */ add.s $f0, $f8, $f16
/* AF34F4 8007C354 46000004 */ sqrt.s $f0, $f0
/* AF34F8 8007C358 E7A00028 */ swc1 $f0, 0x28($sp)
/* AF34FC 8007C35C C4AC0000 */ lwc1 $f12, ($a1)
/* AF3500 8007C360 460C9032 */ c.eq.s $f18, $f12
/* AF3504 8007C364 00000000 */ nop
/* AF3508 8007C368 45000008 */ bc1f .L8007C38C
/* AF350C 8007C36C 00000000 */ nop
/* AF3510 8007C370 C4AA0008 */ lwc1 $f10, 8($a1)
/* AF3514 8007C374 460A9032 */ c.eq.s $f18, $f10
/* AF3518 8007C378 00000000 */ nop
/* AF351C 8007C37C 45000003 */ bc1f .L8007C38C
/* AF3520 8007C380 00000000 */ nop
/* AF3524 8007C384 10000010 */ b .L8007C3C8
/* AF3528 8007C388 A7A0002E */ sh $zero, 0x2e($sp)
.L8007C38C:
/* AF352C 8007C38C 0C03F494 */ jal Math_atan2f
/* AF3530 8007C390 C4AE0008 */ lwc1 $f14, 8($a1)
/* AF3534 8007C394 3C018014 */ lui $at, %hi(D_8013CB8C)
/* AF3538 8007C398 C424CB8C */ lwc1 $f4, %lo(D_8013CB8C)($at)
/* AF353C 8007C39C 3C018014 */ lui $at, %hi(D_8013CB90)
/* AF3540 8007C3A0 C428CB90 */ lwc1 $f8, %lo(D_8013CB90)($at)
/* AF3544 8007C3A4 46040182 */ mul.s $f6, $f0, $f4
/* AF3548 8007C3A8 3C013F00 */ li $at, 0x3F000000 # 0.000000
/* AF354C 8007C3AC 44812000 */ mtc1 $at, $f4
/* AF3550 8007C3B0 46083282 */ mul.s $f10, $f6, $f8
/* AF3554 8007C3B4 46045180 */ add.s $f6, $f10, $f4
/* AF3558 8007C3B8 4600320D */ trunc.w.s $f8, $f6
/* AF355C 8007C3BC 44194000 */ mfc1 $t9, $f8
/* AF3560 8007C3C0 00000000 */ nop
/* AF3564 8007C3C4 A7B9002E */ sh $t9, 0x2e($sp)
.L8007C3C8:
/* AF3568 8007C3C8 27A90028 */ addiu $t1, $sp, 0x28
/* AF356C 8007C3CC 8D2B0000 */ lw $t3, ($t1)
/* AF3570 8007C3D0 8FA80030 */ lw $t0, 0x30($sp)
/* AF3574 8007C3D4 AD0B0000 */ sw $t3, ($t0)
/* AF3578 8007C3D8 8D2A0004 */ lw $t2, 4($t1)
/* AF357C 8007C3DC AD0A0004 */ sw $t2, 4($t0)
/* AF3580 8007C3E0 8FBF0014 */ lw $ra, 0x14($sp)
/* AF3584 8007C3E4 8FA20030 */ lw $v0, 0x30($sp)
/* AF3588 8007C3E8 27BD0030 */ addiu $sp, $sp, 0x30
/* AF358C 8007C3EC 03E00008 */ jr $ra
/* AF3590 8007C3F0 00000000 */ nop

View file

@ -1,20 +0,0 @@
glabel func_8007C3F4
/* AF3594 8007C3F4 27BDFFE0 */ addiu $sp, $sp, -0x20
/* AF3598 8007C3F8 AFBF0014 */ sw $ra, 0x14($sp)
/* AF359C 8007C3FC AFA40020 */ sw $a0, 0x20($sp)
/* AF35A0 8007C400 0C01F0A7 */ jal func_8007C29C
/* AF35A4 8007C404 27A40018 */ addiu $a0, $sp, 0x18
/* AF35A8 8007C408 87AE001C */ lh $t6, 0x1c($sp)
/* AF35AC 8007C40C 240F3FFF */ li $t7, 16383
/* AF35B0 8007C410 27B90018 */ addiu $t9, $sp, 0x18
/* AF35B4 8007C414 01EEC023 */ subu $t8, $t7, $t6
/* AF35B8 8007C418 A7B8001C */ sh $t8, 0x1c($sp)
/* AF35BC 8007C41C 8FA20020 */ lw $v0, 0x20($sp)
/* AF35C0 8007C420 8F290000 */ lw $t1, ($t9)
/* AF35C4 8007C424 AC490000 */ sw $t1, ($v0)
/* AF35C8 8007C428 8F280004 */ lw $t0, 4($t9)
/* AF35CC 8007C42C AC480004 */ sw $t0, 4($v0)
/* AF35D0 8007C430 8FBF0014 */ lw $ra, 0x14($sp)
/* AF35D4 8007C434 27BD0020 */ addiu $sp, $sp, 0x20
/* AF35D8 8007C438 03E00008 */ jr $ra
/* AF35DC 8007C43C 00000000 */ nop

View file

@ -1,33 +0,0 @@
.late_rodata
glabel D_8013CB94
.float 57.295776
.text
glabel func_8007C574
/* AF3714 8007C574 27BDFFD0 */ addiu $sp, $sp, -0x30
/* AF3718 8007C578 AFBF0014 */ sw $ra, 0x14($sp)
/* AF371C 8007C57C AFA40030 */ sw $a0, 0x30($sp)
/* AF3720 8007C580 0C01F138 */ jal func_8007C4E0
/* AF3724 8007C584 27A40024 */ addiu $a0, $sp, 0x24
/* AF3728 8007C588 3C018014 */ lui $at, %hi(D_8013CB94)
/* AF372C 8007C58C C420CB94 */ lwc1 $f0, %lo(D_8013CB94)($at)
/* AF3730 8007C590 C7A40024 */ lwc1 $f4, 0x24($sp)
/* AF3734 8007C594 C7A80028 */ lwc1 $f8, 0x28($sp)
/* AF3738 8007C598 44808000 */ mtc1 $zero, $f16
/* AF373C 8007C59C 46002182 */ mul.s $f6, $f4, $f0
/* AF3740 8007C5A0 27AE0018 */ addiu $t6, $sp, 0x18
/* AF3744 8007C5A4 E7B00020 */ swc1 $f16, 0x20($sp)
/* AF3748 8007C5A8 46004282 */ mul.s $f10, $f8, $f0
/* AF374C 8007C5AC 8FA20030 */ lw $v0, 0x30($sp)
/* AF3750 8007C5B0 E7A60018 */ swc1 $f6, 0x18($sp)
/* AF3754 8007C5B4 E7AA001C */ swc1 $f10, 0x1c($sp)
/* AF3758 8007C5B8 8DD80000 */ lw $t8, ($t6)
/* AF375C 8007C5BC AC580000 */ sw $t8, ($v0)
/* AF3760 8007C5C0 8DCF0004 */ lw $t7, 4($t6)
/* AF3764 8007C5C4 AC4F0004 */ sw $t7, 4($v0)
/* AF3768 8007C5C8 8DD80008 */ lw $t8, 8($t6)
/* AF376C 8007C5CC AC580008 */ sw $t8, 8($v0)
/* AF3770 8007C5D0 8FBF0014 */ lw $ra, 0x14($sp)
/* AF3774 8007C5D4 27BD0030 */ addiu $sp, $sp, 0x30
/* AF3778 8007C5D8 03E00008 */ jr $ra
/* AF377C 8007C5DC 00000000 */ nop

View file

@ -1,48 +0,0 @@
.late_rodata
glabel D_8013CB98
.float 57.295776
glabel D_8013CB9C
.float 182.04167
.text
glabel func_8007C5E0
/* AF3780 8007C5E0 27BDFFD0 */ addiu $sp, $sp, -0x30
/* AF3784 8007C5E4 AFBF0014 */ sw $ra, 0x14($sp)
/* AF3788 8007C5E8 AFA40030 */ sw $a0, 0x30($sp)
/* AF378C 8007C5EC 0C01F138 */ jal func_8007C4E0
/* AF3790 8007C5F0 27A40024 */ addiu $a0, $sp, 0x24
/* AF3794 8007C5F4 3C018014 */ lui $at, %hi(D_8013CB98)
/* AF3798 8007C5F8 C420CB98 */ lwc1 $f0, %lo(D_8013CB98)($at)
/* AF379C 8007C5FC C7A40024 */ lwc1 $f4, 0x24($sp)
/* AF37A0 8007C600 3C018014 */ lui $at, %hi(D_8013CB9C)
/* AF37A4 8007C604 C422CB9C */ lwc1 $f2, %lo(D_8013CB9C)($at)
/* AF37A8 8007C608 46002182 */ mul.s $f6, $f4, $f0
/* AF37AC 8007C60C C7B20028 */ lwc1 $f18, 0x28($sp)
/* AF37B0 8007C610 3C013F00 */ li $at, 0x3F000000 # 0.000000
/* AF37B4 8007C614 44816000 */ mtc1 $at, $f12
/* AF37B8 8007C618 A7A00020 */ sh $zero, 0x20($sp)
/* AF37BC 8007C61C 27A8001C */ addiu $t0, $sp, 0x1c
/* AF37C0 8007C620 8FA20030 */ lw $v0, 0x30($sp)
/* AF37C4 8007C624 46023202 */ mul.s $f8, $f6, $f2
/* AF37C8 8007C628 00000000 */ nop
/* AF37CC 8007C62C 46009102 */ mul.s $f4, $f18, $f0
/* AF37D0 8007C630 460C4280 */ add.s $f10, $f8, $f12
/* AF37D4 8007C634 46022182 */ mul.s $f6, $f4, $f2
/* AF37D8 8007C638 4600540D */ trunc.w.s $f16, $f10
/* AF37DC 8007C63C 460C3200 */ add.s $f8, $f6, $f12
/* AF37E0 8007C640 440F8000 */ mfc1 $t7, $f16
/* AF37E4 8007C644 4600428D */ trunc.w.s $f10, $f8
/* AF37E8 8007C648 A7AF001C */ sh $t7, 0x1c($sp)
/* AF37EC 8007C64C 44195000 */ mfc1 $t9, $f10
/* AF37F0 8007C650 00000000 */ nop
/* AF37F4 8007C654 A7B9001E */ sh $t9, 0x1e($sp)
/* AF37F8 8007C658 8D0A0000 */ lw $t2, ($t0)
/* AF37FC 8007C65C A84A0000 */ swl $t2, ($v0)
/* AF3800 8007C660 B84A0003 */ swr $t2, 3($v0)
/* AF3804 8007C664 950A0004 */ lhu $t2, 4($t0)
/* AF3808 8007C668 A44A0004 */ sh $t2, 4($v0)
/* AF380C 8007C66C 8FBF0014 */ lw $ra, 0x14($sp)
/* AF3810 8007C670 27BD0030 */ addiu $sp, $sp, 0x30
/* AF3814 8007C674 03E00008 */ jr $ra
/* AF3818 8007C678 00000000 */ nop

View file

@ -27,7 +27,9 @@ f32 func_8007C058(f32 arg0, f32 arg1) {
return (arg1 <= fabsf(arg0)) ? arg0 : ((arg0 >= 0) ? arg1 : -arg1);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C0A8.s")
f32 func_8007C0A8(f32 arg0, f32 arg1) {
return (fabsf(arg0) <= arg1) ? arg0 : ((arg0 >= 0) ? arg1 : -arg1);
}
Vec3f* func_8007C0F8(Vec3f* dest, Vec3f* a, Vec3f* b) {
Vec3f v1;
@ -70,8 +72,6 @@ Vec3f* func_8007C1AC(Vec3f* dest, struct_80045714* arg1) {
return dest;
}
void func_8007C3F4(struct_80045714* arg0, Vec3f* arg1);
void func_8007C25C(Vec3f* dest, struct_80045714* arg1) {
struct_80045714 var;
@ -82,11 +82,43 @@ void func_8007C25C(Vec3f* dest, struct_80045714* arg1) {
func_8007C1AC(dest, &var);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C29C.s")
struct_80045714* func_8007C29C(struct_80045714* arg0, Vec3f* arg1) {
struct_80045714 sp28;
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C3F4.s")
f32 distSquared;
f32 dist;
void func_8007C29C(struct_80045714* arg0, Vec3f* arg1);
distSquared = SQ(arg1->x) + SQ(arg1->z);
dist = sqrtf(distSquared);
if ((dist == 0.0f) && (arg1->y == 0.0f)) {
sp28.unk_04 = 0;
} else {
sp28.unk_04 = Math_atan2f(dist, arg1->y) * 57.295776f * 182.04167f + 0.5f;
}
sp28.unk_00 = sqrtf(SQ(arg1->y) + distSquared);
if ((arg1->x == 0.0f) && (arg1->z == 0.0f)) {
sp28.unk_06 = 0;
} else {
sp28.unk_06 = Math_atan2f(arg1->x, arg1->z) * 57.295776f * 182.04167f + 0.5f;
}
*arg0 = sp28;
return arg0;
}
struct_80045714* func_8007C3F4(struct_80045714* arg0, Vec3f* arg1) {
struct_80045714 sp18;
func_8007C29C(&sp18, arg1);
sp18.unk_04 = 0x3FFF - sp18.unk_04;
*arg0 = sp18;
return arg0;
}
void func_8007C440(struct_80045714* arg0, Vec3f* a, Vec3f* b) {
Vec3f var;
@ -120,6 +152,33 @@ Vec3f* func_8007C4E0(Vec3f* dest, Vec3f* a, Vec3f* b) {
return dest;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C574.s")
Vec3f* func_8007C574(Vec3f* arg0, Vec3f* arg1, Vec3f* arg2) {
Vec3f sp24;
Vec3f sp18;
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C5E0.s")
func_8007C4E0(&sp24, arg1, arg2);
// ~180 / pi
sp18.x = sp24.x * 57.295776f;
sp18.y = sp24.y * 57.295776f;
sp18.z = 0.0f;
*arg0 = sp18;
return arg0;
}
Vec3s* func_8007C5E0(Vec3s* arg0, Vec3f* arg1, Vec3f* arg2) {
Vec3f sp24;
Vec3s sp18;
func_8007C4E0(&sp24, arg1, arg2);
sp18.x = (((sp24.x * 57.295776f)) * 182.04167f) + 0.5f;
sp18.y = (((sp24.y * 57.295776f)) * 182.04167f) + 0.5f;
sp18.z = 0.0f;
*arg0 = sp18;
return arg0;
}