summaryrefslogtreecommitdiff
path: root/src/code/code_80043480.c
diff options
context:
space:
mode:
authormzxrules <mzxrules@gmail.com>2021-01-08 06:12:58 -0500
committerGitHub <noreply@github.com>2021-01-08 06:12:58 -0500
commit3cef03f5ff9c0341544afec9636bd0581f87d0cc (patch)
tree91ff5c72cadc5c647b52c285f9432f9f40e327dd /src/code/code_80043480.c
parent209f0d21b87fa01c033a943fd8c862cb46b31315 (diff)
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>
Diffstat (limited to 'src/code/code_80043480.c')
-rw-r--r--src/code/code_80043480.c68
1 files changed, 53 insertions, 15 deletions
diff --git a/src/code/code_80043480.c b/src/code/code_80043480.c
index 54f422a6f..900dd9683 100644
--- a/src/code/code_80043480.c
+++ b/src/code/code_80043480.c
@@ -1,7 +1,7 @@
#include "global.h"
-void DynaPolyInfo_SetActorMove(DynaPolyActor* dynaActor, DynaPolyMoveFlag flags) {
- dynaActor->dynaPolyId = -1;
+void DynaPolyActor_Init(DynaPolyActor* dynaActor, DynaPolyMoveFlag flags) {
+ dynaActor->bgId = -1;
dynaActor->unk_15C = flags;
dynaActor->unk_160 = 0;
dynaActor->unk_150 = 0.0f;
@@ -20,8 +20,8 @@ void func_800434B8(DynaPolyActor* dynaActor) {
dynaActor->unk_160 |= 2;
}
-void func_800434C8(CollisionContext* colCtx, u32 floorPolySource) {
- DynaPolyActor* dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource);
+void func_800434C8(CollisionContext* colCtx, s32 floorPolySource) {
+ DynaPolyActor* dynaActor = (DynaPolyActor*)DynaPoly_GetActor(colCtx, floorPolySource);
if (dynaActor != NULL) {
func_800434B8(dynaActor);
@@ -32,8 +32,8 @@ void func_800434F8(DynaPolyActor* dynaActor) {
dynaActor->unk_160 |= 4;
}
-void func_80043508(CollisionContext* colCtx, u32 floorPolySource) {
- DynaPolyActor* dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource);
+void func_80043508(CollisionContext* colCtx, s32 floorPolySource) {
+ DynaPolyActor* dynaActor = (DynaPolyActor*)DynaPoly_GetActor(colCtx, floorPolySource);
if (dynaActor != NULL) {
func_800434F8(dynaActor);
@@ -46,34 +46,72 @@ void func_80043538(DynaPolyActor* dynaActor) {
s32 func_80043548(DynaPolyActor* dynaActor) {
if (dynaActor->unk_160 & 1) {
- return 1;
+ return true;
} else {
- return 0;
+ return false;
}
}
s32 func_8004356C(DynaPolyActor* dynaActor) {
if (dynaActor->unk_160 & 2) {
- return 1;
+ return true;
} else {
- return 0;
+ return false;
}
}
s32 func_80043590(DynaPolyActor* dynaActor) {
if (dynaActor->unk_160 & 4) {
- return 1;
+ return true;
} else {
- return 0;
+ return false;
}
}
s32 func_800435B4(DynaPolyActor* dynaActor) {
if (dynaActor->unk_160 & 8) {
- return 1;
+ return true;
} else {
- return 0;
+ return false;
}
}
-#pragma GLOBAL_ASM("asm/non_matchings/code/code_80043480/func_800435D8.s")
+s32 func_800435D8(GlobalContext* globalCtx, DynaPolyActor* actor, s16 arg2, s16 arg3, s16 arg4) {
+ Vec3f posA;
+ Vec3f posB;
+ Vec3f posResult;
+ f32 sin;
+ f32 cos;
+ s32 bgId;
+ CollisionPoly* poly;
+ f32 a2;
+ f32 a3;
+ f32 sign;
+
+ sin = Math_SinS(actor->unk_158);
+ cos = Math_CosS(actor->unk_158);
+ sign = (0.0f <= actor->unk_150) ? 1.0f : -1.0f;
+
+ a2 = (f32)arg2 - 0.1f;
+ posA.x = actor->actor.posRot.pos.x + (a2 * cos);
+ posA.y = actor->actor.posRot.pos.y + arg4;
+ posA.z = actor->actor.posRot.pos.z - (a2 * sin);
+
+ a3 = (f32)arg3 - 0.1f;
+ posB.x = sign * a3 * sin + posA.x;
+ posB.y = posA.y;
+ posB.z = sign * a3 * cos + posA.z;
+ if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId,
+ actor, 0.0f)) {
+ return false;
+ }
+ posA.x = (actor->actor.posRot.pos.x * 2) - posA.x;
+ posA.z = (actor->actor.posRot.pos.z * 2) - posA.z;
+ posB.x = sign * a3 * sin + posA.x;
+ posB.z = sign * a3 * cos + posA.z;
+ if (BgCheck_EntityLineTest3(&globalCtx->colCtx, &posA, &posB, &posResult, &poly, true, false, false, true, &bgId,
+ actor, 0.0f)) {
+ return false;
+ }
+ return true;
+}