1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 15:04:31 +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

@ -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;