1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-06 16:04:35 +00:00

Fix RaycastFloor flags (#1328)

* fix raycast floor flags

* format.sh

* Name flags

* Rename RaycastFloor functions, clean up caller code, document z_bg_spot15_rrbox

* change comment to prevent format wrap

* change to "if BGCHECK_GROUND_CHECK_ON is set"

* roman suggestions
This commit is contained in:
mzxrules 2022-08-30 11:49:51 -04:00 committed by GitHub
parent fe8d5988b9
commit 327a813b37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 497 additions and 451 deletions

View file

@ -233,7 +233,7 @@ s32 Camera_BGCheckInfo(Camera* camera, Vec3f* from, CamColChk* to) {
toNewPos = to->pos;
toNewPos.y += 5.0f;
floorPolyY = BgCheck_CameraRaycastFloor2(colCtx, &floorPoly, &floorBgId, &toNewPos);
floorPolyY = BgCheck_CameraRaycastDown2(colCtx, &floorPoly, &floorBgId, &toNewPos);
if ((to->pos.y - floorPolyY) > 5.0f) {
// if the y distance from the check point to the floor is more than 5 units
@ -293,7 +293,7 @@ s32 func_80043F94(Camera* camera, Vec3f* from, CamColChk* to) {
to->norm.z = -fromToNorm.z;
toNewPos = to->pos;
toNewPos.y += 5.0f;
floorY = BgCheck_CameraRaycastFloor2(colCtx, &floorPoly, &bgId, &toNewPos);
floorY = BgCheck_CameraRaycastDown2(colCtx, &floorPoly, &bgId, &toNewPos);
if ((to->pos.y - floorY) > 5.0f) {
// to is not on the ground or below it.
to->pos.x += to->norm.x;
@ -377,7 +377,7 @@ s32 Camera_CheckOOB(Camera* camera, Vec3f* from, Vec3f* to) {
f32 Camera_GetFloorYNorm(Camera* camera, Vec3f* floorNorm, Vec3f* chkPos, s32* bgId) {
s32 pad;
CollisionPoly* floorPoly;
f32 floorY = BgCheck_EntityRaycastFloor3(&camera->play->colCtx, &floorPoly, bgId, chkPos);
f32 floorY = BgCheck_EntityRaycastDown3(&camera->play->colCtx, &floorPoly, bgId, chkPos);
if (floorY == BGCHECK_Y_MIN) {
// no floor
@ -418,7 +418,7 @@ f32 Camera_GetFloorYLayer(Camera* camera, Vec3f* norm, Vec3f* pos, s32* bgId) {
s32 i;
for (i = 3; i > 0; i--) {
floorY = BgCheck_CameraRaycastFloor2(colCtx, &floorPoly, bgId, pos);
floorY = BgCheck_CameraRaycastDown2(colCtx, &floorPoly, bgId, pos);
if (floorY == BGCHECK_Y_MIN ||
(camera->playerGroundY < floorY && !(COLPOLY_GET_NORMAL(floorPoly->normal.y) > 0.5f))) {
// no floor, or player is below the floor and floor is not considered steep
@ -492,7 +492,7 @@ Vec3s* Camera_GetBgCamFuncDataUnderPlayer(Camera* camera, u16* bgCamCount) {
Actor_GetWorldPosShapeRot(&playerPosShape, &camera->player->actor);
playerPosShape.pos.y += Player_GetHeight(camera->player);
if (BgCheck_EntityRaycastFloor3(&camera->play->colCtx, &floorPoly, &bgId, &playerPosShape.pos) == BGCHECK_Y_MIN) {
if (BgCheck_EntityRaycastDown3(&camera->play->colCtx, &floorPoly, &bgId, &playerPosShape.pos) == BGCHECK_Y_MIN) {
// no floor
return NULL;
}
@ -3647,7 +3647,7 @@ s32 Camera_KeepOn4(Camera* camera) {
OLib_Vec3fDiffToVecSphGeo(&spA8, at, eyeNext);
D_8015BD50 = playerPosRot->pos;
D_8015BD50.y += playerHeight;
temp_f0_2 = BgCheck_CameraRaycastFloor2(&camera->play->colCtx, &spC0, &i, &D_8015BD50);
temp_f0_2 = BgCheck_CameraRaycastDown2(&camera->play->colCtx, &spC0, &i, &D_8015BD50);
if (temp_f0_2 > (roData->unk_00 + D_8015BD50.y)) {
D_8015BD50.y = temp_f0_2 + 10.0f;
} else {
@ -7407,7 +7407,7 @@ Vec3s Camera_Update(Camera* camera) {
Vec3f viewEye;
Vec3f viewUp;
f32 viewFov;
Vec3f spAC;
Vec3f pos;
s32 bgId;
f32 playerGroundY;
f32 playerXZSpeed;
@ -7441,11 +7441,11 @@ Vec3s Camera_Update(Camera* camera) {
camera->playerPosDelta.x = curPlayerPosRot.pos.x - camera->playerPosRot.pos.x;
camera->playerPosDelta.y = curPlayerPosRot.pos.y - camera->playerPosRot.pos.y;
camera->playerPosDelta.z = curPlayerPosRot.pos.z - camera->playerPosRot.pos.z;
spAC = curPlayerPosRot.pos;
spAC.y += Player_GetHeight(camera->player);
pos = curPlayerPosRot.pos;
pos.y += Player_GetHeight(camera->player);
playerGroundY = BgCheck_EntityRaycastFloor5(camera->play, &camera->play->colCtx, &playerFloorPoly, &bgId,
&camera->player->actor, &spAC);
playerGroundY = BgCheck_EntityRaycastDown5(camera->play, &camera->play->colCtx, &playerFloorPoly, &bgId,
&camera->player->actor, &pos);
if (playerGroundY != BGCHECK_Y_MIN) {
// player is above ground.
sOOBTimer = 0;