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

@ -1025,10 +1025,10 @@ void CollisionCheck_Draw(GlobalContext* globalCtx, CollisionCheckContext* colChk
}
}
if (AREG(24)) {
func_80042C3C(globalCtx, &globalCtx->colCtx);
BgCheck_DrawDynaCollision(globalCtx, &globalCtx->colCtx);
}
if (AREG(25)) {
func_80042FC4(globalCtx, &globalCtx->colCtx);
BgCheck_DrawStaticCollision(globalCtx, &globalCtx->colCtx);
}
}
}
@ -1281,13 +1281,14 @@ s32 func_8005DF74(ColliderBody* left, ColliderBody* right) {
void func_8005DF9C(GlobalContext* globalCtx, Collider* collider, Vec3f* v) {
}
void func_8005DFAC(GlobalContext* globalCtx, Collider* collider, Vec3f* v) {
// Blue EffectSpark
void func_8005DFAC(GlobalContext* globalCtx, Collider* collider, Vec3f* pos) {
static EffectSparkInit D_8015D8A0;
s32 sp24;
D_8015D8A0.position.x = (s32)v->x;
D_8015D8A0.position.y = (s32)v->y;
D_8015D8A0.position.z = (s32)v->z;
D_8015D8A0.position.x = (s32)pos->x;
D_8015D8A0.position.y = (s32)pos->y;
D_8015D8A0.position.z = (s32)pos->z;
D_8015D8A0.uDiv = 5;
D_8015D8A0.vDiv = 5;
D_8015D8A0.colorStart[0].r = 10;
@ -1330,13 +1331,14 @@ void func_8005DFAC(GlobalContext* globalCtx, Collider* collider, Vec3f* v) {
Effect_Add(globalCtx, &sp24, EFFECT_SPARK, 0, 1, &D_8015D8A0);
}
void func_8005E10C(GlobalContext* globalCtx, Collider* collider, Vec3f* v) {
// Green EffectSpark
void func_8005E10C(GlobalContext* globalCtx, Collider* collider, Vec3f* pos) {
static EffectSparkInit D_8015DD68;
s32 sp24;
D_8015DD68.position.x = (s32)v->x;
D_8015DD68.position.y = (s32)v->y;
D_8015DD68.position.z = (s32)v->z;
D_8015DD68.position.x = (s32)pos->x;
D_8015DD68.position.y = (s32)pos->y;
D_8015DD68.position.z = (s32)pos->z;
D_8015DD68.uDiv = 5;
D_8015DD68.vDiv = 5;
D_8015DD68.colorStart[0].r = 10;
@ -1590,7 +1592,7 @@ void CollisionCheck_AC_JntSphVsJntSph(GlobalContext* globalCtx, CollisionCheckCo
sp60.x = rItem->dim.worldSphere.center.x;
sp60.y = rItem->dim.worldSphere.center.y;
sp60.z = rItem->dim.worldSphere.center.z;
if (!(fabsf(sp88) < 0.008f)) {
if (!IS_ZERO(sp88)) {
temp_f0 = rItem->dim.worldSphere.radius / sp88;
sp78.x = (((sp6C.x - sp60.x) * temp_f0) + sp60.x);
sp78.y = (((sp6C.y - sp60.y) * temp_f0) + sp60.y);
@ -1639,7 +1641,7 @@ void CollisionCheck_AC_JntSphVsCyl(GlobalContext* globalCtx, CollisionCheckConte
sp58.x = right->dim.pos.x;
sp58.y = right->dim.pos.y;
sp58.z = right->dim.pos.z;
if (!(fabsf(sp7C) < 0.008f)) {
if (!IS_ZERO(sp7C)) {
temp_f0 = right->dim.radius / sp7C;
if (temp_f0 <= 1.0f) {
sp70.x = ((sp64.x - sp58.x) * temp_f0) + sp58.x;
@ -1689,7 +1691,7 @@ void CollisionCheck_AC_CylVsJntSph(GlobalContext* globalCtx, CollisionCheckConte
sp70.x = rItem->dim.worldSphere.center.x;
sp70.y = rItem->dim.worldSphere.center.y;
sp70.z = rItem->dim.worldSphere.center.z;
if (!(fabsf(sp98) < 0.008f)) {
if (!IS_ZERO(sp98)) {
temp_f0 = (f32)rItem->dim.worldSphere.radius / sp98;
if (temp_f0 <= 1.0f) {
sp88.x = ((sp7C.x - sp70.x) * temp_f0) + sp70.x;
@ -1908,7 +1910,7 @@ void CollisionCheck_AC_CylVsCyl(GlobalContext* globalCtx, CollisionCheckContext*
if (Math3D_CylOutsideCylDist(&left->dim, &right->dim, &sp6C, &sp68) == 1) {
Math_Vec3s_ToVec3f(&sp50, &left->dim.pos);
Math_Vec3s_ToVec3f(&sp44, &right->dim.pos);
if (!(fabsf(sp68) < 0.008f)) {
if (!IS_ZERO(sp68)) {
temp_f0 = (f32)right->dim.radius / sp68;
sp5C.y = (f32)right->dim.pos.y + (f32)right->dim.yShift + (f32)right->dim.height * 0.5f;
sp5C.x = ((f32)left->dim.pos.x - right->dim.pos.x) * temp_f0 + right->dim.pos.x;
@ -2489,7 +2491,7 @@ void func_800614A4(Collider* left, ColliderBody* leftBody, Vec3f* leftv, Collide
leftMass = leftActor->colChkInfo.mass;
rightMass = rightActor->colChkInfo.mass;
totalMass = leftMass + rightMass;
if (fabsf(totalMass) < 0.008f) {
if (IS_ZERO(totalMass)) {
totalMass = (leftMass = rightMass = 1.0f) * 2;
}
xDelta = rightv->x - leftv->x;
@ -2525,7 +2527,7 @@ void func_800614A4(Collider* left, ColliderBody* leftBody, Vec3f* leftv, Collide
}
}
if (!(fabsf(xzDist) < 0.008f)) {
if (!IS_ZERO(xzDist)) {
temp_f0 = arg6 / xzDist;
xDelta *= temp_f0;
zDelta *= temp_f0;