1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-12 19:04:38 +00:00

z_bgcheck.c, 800430A0.c, 80043480.c (#256)

* beginning of migrating changes

* got matching

* changed order a bit

* clean up bgcheck

* fix conflict

* fix conflict again

* first stab at identifying types, some oks

* Clean up most bad structs/pointer math, move relevant structs to z64bgcheck.h, get some OKs

* more OKs, z_bgcheck.bss migration, update some sys_math3d.c args

* couple more OKs

* pushing some OKs

* fix compilation issues

* code_800430A0.c OK, more files decomp'd

* 8003A3E0 big OK :)

* Decomp most of func_8003C614, decomp helper funcs

* Decomp SurfaceType, CamData, and WaterBox property related functions

* more OKs, big OK in 8003C078

* more OKs, more progress, move a function definition in z_collision_check to functions.h

* more clean-ups, more OKs, dyn_vtx is now defined as u8*

* 8003A5B8, 8003A7D8, 8003C614, 8003DD6C OK, document function args better

* data migrated, more OKs

* 80041240 OK, func_8003B3C8 and func_8003BB18 disassembled

* func_80040284, 800409A8 non_matching, add IS_ZERO macro

* All asm files have C representations, some big OKs, lots of minor tweaks

* More OKs, non-matching code cleanup

* 8003FBF4 and 80040BE4 OK, improve codegen for most functions

* format z_bgcheck.c

* fix warnings, compile errors on NON_MATCHING

* func_8003EE80 is now NON_MATCHING

* begin documenting some functions

* formatting

* more documentation, func_8003A95C OK

* fix PHYSICAL_TO_VIRTUAL changes

* fix var rename

* More documentation, functions 80040E40, 80041648 OK, change types to not be compatible with ZAP

* func_8004239C ok, more NON_MATCHING improvements, more documentation

* Implement most suggested changes

* Convert comments to slower comments

* /**

* Implement ZAP2 changes

* my anti-virus ate my format.sh results

* Rename a couple hundred functions, fix minor stuff

* rename var so that clang formats correctly

* run format.sh

* implement Petrie's matches/suggestions

* format

* matches

* and the asm

* slight error

* Add SSList

* two more matches

* stuff

* implement code changes

* clean up Petrie's matchings

Co-authored-by: Arthur <arthurtilly413@gmail.com>
Co-authored-by: fig02 <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
This commit is contained in:
mzxrules 2021-01-08 06:12:58 -05:00 committed by GitHub
parent 209f0d21b8
commit 3cef03f5ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
416 changed files with 6610 additions and 13487 deletions

View file

@ -1379,39 +1379,39 @@ s32 Gameplay_InCsMode(GlobalContext* globalCtx) {
}
f32 func_800BFCB8(GlobalContext* globalCtx, MtxF* mf, Vec3f* vec) {
CollisionPoly sp50;
CollisionPoly poly;
f32 temp1;
f32 temp2;
f32 temp3;
f32 sp40;
f32 sp3C;
f32 sp38;
f32 sp34;
f32 floorY;
f32 nx;
f32 ny;
f32 nz;
s32 pad[5];
sp40 = func_8003CB30(&globalCtx->colCtx, &sp50, vec, mf);
floorY = BgCheck_AnyRaycastFloor1(&globalCtx->colCtx, &poly, vec);
if (sp40 > -32000.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);
if (floorY > BGCHECK_Y_MIN) {
nx = COLPOLY_GET_NORMAL(poly.normal.x);
ny = COLPOLY_GET_NORMAL(poly.normal.y);
nz = COLPOLY_GET_NORMAL(poly.normal.z);
temp1 = sqrtf(1.0f - SQ(sp3C));
temp1 = sqrtf(1.0f - SQ(nx));
if (temp1 != 0.0f) {
temp2 = sp38 * temp1;
temp3 = -sp34 * temp1;
temp2 = ny * temp1;
temp3 = -nz * temp1;
} else {
temp3 = 0.0f;
temp2 = 0.0f;
}
mf->xx = temp1;
mf->xy = -sp3C * temp2;
mf->xz = sp3C * temp3;
mf->yx = sp3C;
mf->yy = sp38;
mf->yz = sp34;
mf->xy = -nx * temp2;
mf->xz = nx * temp3;
mf->yx = nx;
mf->yy = ny;
mf->yz = nz;
mf->zy = temp3;
mf->zz = temp2;
mf->xw = 0.0f;
@ -1419,7 +1419,7 @@ f32 func_800BFCB8(GlobalContext* globalCtx, MtxF* mf, Vec3f* vec) {
mf->zx = 0.0f;
mf->zw = 0.0f;
mf->wx = vec->x;
mf->wy = sp40;
mf->wy = floorY;
mf->wz = vec->z;
mf->ww = 1.0f;
} else {
@ -1441,7 +1441,7 @@ f32 func_800BFCB8(GlobalContext* globalCtx, MtxF* mf, Vec3f* vec) {
mf->ww = 1.0f;
}
return sp40;
return floorY;
}
void* Gameplay_LoadFile(GlobalContext* globalCtx, RomFile* file) {
@ -1826,18 +1826,20 @@ s32 func_800C0D34(GlobalContext* globalCtx, Actor* actor, s16* yaw) {
return 1;
}
s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* arg1) {
WaterBox* sp3C;
CollisionPoly* sp38;
Vec3f sp2C;
s32 sp28;
s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* pos) {
WaterBox* waterBox;
CollisionPoly* poly;
Vec3f waterSurfacePos;
s32 bgId;
sp2C = *arg1;
waterSurfacePos = *pos;
if ((func_8004213C(globalCtx, &globalCtx->colCtx, sp2C.x, sp2C.z, &sp2C.y, &sp3C) == 1) && (arg1->y < sp2C.y) &&
(func_8003C940(&globalCtx->colCtx, &sp38, &sp28, &sp2C) != -32000.0f)) {
return 1;
if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, waterSurfacePos.x, waterSurfacePos.z, &waterSurfacePos.y,
&waterBox) == true &&
pos->y < waterSurfacePos.y &&
BgCheck_EntityRaycastFloor3(&globalCtx->colCtx, &poly, &bgId, &waterSurfacePos) != BGCHECK_Y_MIN) {
return true;
} else {
return 0;
return false;
}
}