1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-01-24 17:47:33 +00:00

Fix and match func_800BFCB8 (#196)

This commit is contained in:
Roman971 2020-06-07 16:08:06 +02:00 committed by GitHub
parent 80ca848cfb
commit c10bcdc3c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 143 deletions

View file

@ -1,116 +0,0 @@
.late_rodata
glabel D_80144A08
.float 3.051851E-5
.text
glabel func_800BFCB8
/* B36E58 800BFCB8 27BDFFA0 */ addiu $sp, $sp, -0x60
/* B36E5C 800BFCBC AFBF0014 */ sw $ra, 0x14($sp)
/* B36E60 800BFCC0 AFA40060 */ sw $a0, 0x60($sp)
/* B36E64 800BFCC4 00A03825 */ move $a3, $a1
/* B36E68 800BFCC8 AFA70064 */ sw $a3, 0x64($sp)
/* B36E6C 800BFCCC 27A50050 */ addiu $a1, $sp, 0x50
/* B36E70 800BFCD0 248407C0 */ addiu $a0, $a0, 0x7c0
/* B36E74 800BFCD4 0C00F2CC */ jal func_8003CB30
/* B36E78 800BFCD8 AFA60068 */ sw $a2, 0x68($sp)
/* B36E7C 800BFCDC 3C01C6FA */ li $at, 0xC6FA0000 # 0.000000
/* B36E80 800BFCE0 44812000 */ mtc1 $at, $f4
/* B36E84 800BFCE4 8FA60068 */ lw $a2, 0x68($sp)
/* B36E88 800BFCE8 8FA70064 */ lw $a3, 0x64($sp)
/* B36E8C 800BFCEC 4600203C */ c.lt.s $f4, $f0
/* B36E90 800BFCF0 E7A00040 */ swc1 $f0, 0x40($sp)
/* B36E94 800BFCF4 4502003F */ bc1fl .L800BFDF4
/* B36E98 800BFCF8 44801000 */ mtc1 $zero, $f2
/* B36E9C 800BFCFC 87AE0058 */ lh $t6, 0x58($sp)
/* B36EA0 800BFD00 87AF005A */ lh $t7, 0x5a($sp)
/* B36EA4 800BFD04 87B8005C */ lh $t8, 0x5c($sp)
/* B36EA8 800BFD08 448E3000 */ mtc1 $t6, $f6
/* B36EAC 800BFD0C 448F5000 */ mtc1 $t7, $f10
/* B36EB0 800BFD10 3C018014 */ lui $at, %hi(D_80144A08)
/* B36EB4 800BFD14 46803220 */ cvt.s.w $f8, $f6
/* B36EB8 800BFD18 C4304A08 */ lwc1 $f16, %lo(D_80144A08)($at)
/* B36EBC 800BFD1C 44983000 */ mtc1 $t8, $f6
/* B36EC0 800BFD20 3C013F80 */ li $at, 0x3F800000 # 0.000000
/* B36EC4 800BFD24 44801000 */ mtc1 $zero, $f2
/* B36EC8 800BFD28 46805120 */ cvt.s.w $f4, $f10
/* B36ECC 800BFD2C 46104382 */ mul.s $f14, $f8, $f16
/* B36ED0 800BFD30 46803220 */ cvt.s.w $f8, $f6
/* B36ED4 800BFD34 46102482 */ mul.s $f18, $f4, $f16
/* B36ED8 800BFD38 44812000 */ mtc1 $at, $f4
/* B36EDC 800BFD3C 46104282 */ mul.s $f10, $f8, $f16
/* B36EE0 800BFD40 E7B20038 */ swc1 $f18, 0x38($sp)
/* B36EE4 800BFD44 460E7182 */ mul.s $f6, $f14, $f14
/* B36EE8 800BFD48 E7AA0018 */ swc1 $f10, 0x18($sp)
/* B36EEC 800BFD4C E7AA0034 */ swc1 $f10, 0x34($sp)
/* B36EF0 800BFD50 46062001 */ sub.s $f0, $f4, $f6
/* B36EF4 800BFD54 46007107 */ neg.s $f4, $f14
/* B36EF8 800BFD58 46000004 */ sqrt.s $f0, $f0
/* B36EFC 800BFD5C 46020032 */ c.eq.s $f0, $f2
/* B36F00 800BFD60 00000000 */ nop
/* B36F04 800BFD64 45030007 */ bc1tl .L800BFD84
/* B36F08 800BFD68 46001406 */ mov.s $f16, $f2
/* B36F0C 800BFD6C 46009302 */ mul.s $f12, $f18, $f0
/* B36F10 800BFD70 46005207 */ neg.s $f8, $f10
/* B36F14 800BFD74 46004402 */ mul.s $f16, $f8, $f0
/* B36F18 800BFD78 10000003 */ b .L800BFD88
/* B36F1C 800BFD7C 00000000 */ nop
/* B36F20 800BFD80 46001406 */ mov.s $f16, $f2
.L800BFD84:
/* B36F24 800BFD84 46001306 */ mov.s $f12, $f2
.L800BFD88:
/* B36F28 800BFD88 460C2182 */ mul.s $f6, $f4, $f12
/* B36F2C 800BFD8C E4E00000 */ swc1 $f0, ($a3)
/* B36F30 800BFD90 E4EE0010 */ swc1 $f14, 0x10($a3)
/* B36F34 800BFD94 46107282 */ mul.s $f10, $f14, $f16
/* B36F38 800BFD98 3C013F80 */ li $at, 0x3F800000 # 0.000000
/* B36F3C 800BFD9C E4E60004 */ swc1 $f6, 4($a3)
/* B36F40 800BFDA0 E4EA0008 */ swc1 $f10, 8($a3)
/* B36F44 800BFDA4 C7A80038 */ lwc1 $f8, 0x38($sp)
/* B36F48 800BFDA8 E4E80014 */ swc1 $f8, 0x14($a3)
/* B36F4C 800BFDAC C7A40034 */ lwc1 $f4, 0x34($sp)
/* B36F50 800BFDB0 E4F00024 */ swc1 $f16, 0x24($a3)
/* B36F54 800BFDB4 E4EC0028 */ swc1 $f12, 0x28($a3)
/* B36F58 800BFDB8 E4E2000C */ swc1 $f2, 0xc($a3)
/* B36F5C 800BFDBC E4E2001C */ swc1 $f2, 0x1c($a3)
/* B36F60 800BFDC0 E4E20020 */ swc1 $f2, 0x20($a3)
/* B36F64 800BFDC4 E4E2002C */ swc1 $f2, 0x2c($a3)
/* B36F68 800BFDC8 E4E40018 */ swc1 $f4, 0x18($a3)
/* B36F6C 800BFDCC C4C60000 */ lwc1 $f6, ($a2)
/* B36F70 800BFDD0 44812000 */ mtc1 $at, $f4
/* B36F74 800BFDD4 E4E60030 */ swc1 $f6, 0x30($a3)
/* B36F78 800BFDD8 C7AA0040 */ lwc1 $f10, 0x40($sp)
/* B36F7C 800BFDDC E4EA0034 */ swc1 $f10, 0x34($a3)
/* B36F80 800BFDE0 C4C80008 */ lwc1 $f8, 8($a2)
/* B36F84 800BFDE4 E4E4003C */ swc1 $f4, 0x3c($a3)
/* B36F88 800BFDE8 10000017 */ b .L800BFE48
/* B36F8C 800BFDEC E4E80038 */ swc1 $f8, 0x38($a3)
/* B36F90 800BFDF0 44801000 */ mtc1 $zero, $f2
.L800BFDF4:
/* B36F94 800BFDF4 3C013F80 */ li $at, 0x3F800000 # 0.000000
/* B36F98 800BFDF8 44810000 */ mtc1 $at, $f0
/* B36F9C 800BFDFC E4E20010 */ swc1 $f2, 0x10($a3)
/* B36FA0 800BFE00 E4E20008 */ swc1 $f2, 8($a3)
/* B36FA4 800BFE04 E4E20004 */ swc1 $f2, 4($a3)
/* B36FA8 800BFE08 E4E20000 */ swc1 $f2, ($a3)
/* B36FAC 800BFE0C E4E2002C */ swc1 $f2, 0x2c($a3)
/* B36FB0 800BFE10 E4E20020 */ swc1 $f2, 0x20($a3)
/* B36FB4 800BFE14 E4E2001C */ swc1 $f2, 0x1c($a3)
/* B36FB8 800BFE18 E4E2000C */ swc1 $f2, 0xc($a3)
/* B36FBC 800BFE1C E4E20028 */ swc1 $f2, 0x28($a3)
/* B36FC0 800BFE20 E4E20024 */ swc1 $f2, 0x24($a3)
/* B36FC4 800BFE24 E4E20018 */ swc1 $f2, 0x18($a3)
/* B36FC8 800BFE28 E4E00014 */ swc1 $f0, 0x14($a3)
/* B36FCC 800BFE2C C4C60000 */ lwc1 $f6, ($a2)
/* B36FD0 800BFE30 E4E60030 */ swc1 $f6, 0x30($a3)
/* B36FD4 800BFE34 C4CA0004 */ lwc1 $f10, 4($a2)
/* B36FD8 800BFE38 E4EA0034 */ swc1 $f10, 0x34($a3)
/* B36FDC 800BFE3C C4C80008 */ lwc1 $f8, 8($a2)
/* B36FE0 800BFE40 E4E0003C */ swc1 $f0, 0x3c($a3)
/* B36FE4 800BFE44 E4E80038 */ swc1 $f8, 0x38($a3)
.L800BFE48:
/* B36FE8 800BFE48 8FBF0014 */ lw $ra, 0x14($sp)
/* B36FEC 800BFE4C C7A00040 */ lwc1 $f0, 0x40($sp)
/* B36FF0 800BFE50 27BD0060 */ addiu $sp, $sp, 0x60
/* B36FF4 800BFE54 03E00008 */ jr $ra
/* B36FF8 800BFE58 00000000 */ nop

View file

@ -520,7 +520,7 @@ f32 func_8003C8EC(GlobalContext*, CollisionContext*, CollisionPoly**, Vec3f*);
f32 func_8003C940(CollisionContext*, CollisionPoly**, s32*, Vec3f*);
// ? func_8003C9A4(?);
f32 func_8003CA0C(GlobalContext*, CollisionContext*, CollisionPoly**, u32*, Actor*, Vec3f*);
f32 func_8003CB30(GlobalContext*, CollisionContext*, PosRot*, MtxF*);
f32 func_8003CB30(CollisionContext*, CollisionPoly*, Vec3f*, MtxF*);
f32 func_8003CCA4(CollisionContext*, CollisionPoly**, s32*, Vec3f*);
// ? func_8003CDD4(?);
s32 func_8003D52C(CollisionContext*, Vec3f*, Vec3f*, Vec3f*, f32, CollisionPoly**, u32*, Actor*, f32);

View file

@ -1071,7 +1071,7 @@ void Gameplay_DrawOverlayElements(GlobalContext* globalCtx) {
}
#ifdef NON_MATCHING
// regalloc, stakc usage and minor ordering differences
// regalloc, stack usage and minor ordering differences
void Gameplay_Draw(GlobalContext* globalCtx) {
LightMapper* sp228;
Vec3f sp21C;
@ -1382,47 +1382,46 @@ s32 Gameplay_InCsMode(GlobalContext* globalCtx) {
return (globalCtx->csCtx.state != 0) || func_8008E988(globalCtx);
}
#ifdef NON_MATCHING
// saved register usage differences and possibly stack usage or regalloc differences
f32 func_800BFCB8(GlobalContext* globalCtx, MtxF* mf, Vec3f* vec) {
PosRot sp50;
f32 temp_f0;
f32 phi_f12;
f32 phi_f16;
CollisionPoly sp50;
f32 temp1;
f32 temp2;
f32 temp3;
f32 sp40;
f32 sp3C;
f32 sp38;
f32 sp34;
s32 pad[5];
sp40 = func_8003CB30(globalCtx, &globalCtx->colCtx, &sp50, mf);
sp40 = func_8003CB30(&globalCtx->colCtx, &sp50, vec, mf);
if (sp40 > -32000.0f) {
sp3C = sp50.rot.x * (1.0f / 32767.0f);
sp38 = sp50.rot.y * (1.0f / 32767.0f);
sp34 = sp50.rot.z * (1.0f / 32767.0f);
sp3C = sp50.norm.x * (1.0f / 32767.0f);
sp38 = sp50.norm.y * (1.0f / 32767.0f);
sp34 = sp50.norm.z * (1.0f / 32767.0f);
temp_f0 = sqrtf(1.0f - SQ(sp3C));
temp1 = sqrtf(1.0f - SQ(sp3C));
if (temp_f0 != 0.0f) {
phi_f12 = sp38 * temp_f0;
phi_f16 = -sp34 * temp_f0;
if (temp1 != 0.0f) {
temp2 = sp38 * temp1;
temp3 = -sp34 * temp1;
} else {
phi_f12 = 0.0f;
phi_f16 = 0.0f;
temp3 = 0.0f;
temp2 = 0.0f;
}
mf->xx = temp_f0;
mf->xy = -sp3C * phi_f12;
mf->xz = sp3C * phi_f16;
mf->xx = temp1;
mf->xy = -sp3C * temp2;
mf->xz = sp3C * temp3;
mf->yx = sp3C;
mf->yy = sp38;
mf->zy = phi_f16;
mf->zz = phi_f12;
mf->yz = sp34;
mf->zy = temp3;
mf->zz = temp2;
mf->xw = 0.0f;
mf->yw = 0.0f;
mf->zx = 0.0f;
mf->zw = 0.0f;
mf->yz = sp34;
mf->wx = vec->x;
mf->wy = sp40;
mf->wz = vec->z;
@ -1448,9 +1447,6 @@ f32 func_800BFCB8(GlobalContext* globalCtx, MtxF* mf, Vec3f* vec) {
return sp40;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BFCB8.s")
#endif
void* Gameplay_LoadFile(GlobalContext* globalCtx, RomFile* file) {
u32 size;