Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RaycastFloor flags #1328

Merged
merged 8 commits into from
Aug 30, 2022
Merged

Fix RaycastFloor flags #1328

merged 8 commits into from
Aug 30, 2022

Conversation

mzxrules
Copy link
Contributor

Resolves a minor issue where afew RaycastFloor functions were tied to the wrong flags

src/code/z_bgcheck.c Outdated Show resolved Hide resolved
src/code/z_bgcheck.c Outdated Show resolved Hide resolved
@fig02
Copy link
Collaborator

fig02 commented Jul 19, 2022

I would suggest raycastFlags as opposed to frc, for both the member name and define names

Copy link
Collaborator

@Dragorn421 Dragorn421 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on rcFlags -> raycastFlags
also if "floor raycast" means "downwards raycast" maybe "raycast down" would be better than "floor raycast" (afaik all raycasts are downwards but I'm not sure (DynaRaycast -> DynaRaycastDown eventually?))

@fig02
Copy link
Collaborator

fig02 commented Jul 30, 2022

agree with the above. "raycast floor check wall" doesnt make much sense at all. if the first floor is meant to convey raycast down, then that sounds better


if (func_80839034(play, this, sp58, BGCHECK_SCENE)) {
//! @bug groundPoly's bgId is not guaranteed to be BGCHECK_SCENE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a very interesting bug, I think it means the surfacetype array would be sourced from the scene but indexed with the dynapoly's poly's index

I guess if this came up in vanilla we would know by now, but I wonder if with spawning the right actor in the right spot in the right scene you could for example exit the scene by walking on the right dynapoly poly, though the context of having to use a door is very restrictive (or not... SRM can boomerang doors right 4Head)

@@ -527,10 +560,10 @@ void StaticLookup_AddPoly(StaticLookup* lookup, CollisionContext* colCtx, Collis
* Locates the closest static poly directly underneath `pos`, starting at list `ssList`
* returns yIntersect of the closest poly, or `yIntersectMin`
* stores the pointer of the closest poly to `outPoly`
* if (flags & 1), ignore polys with a normal.y < 0 (from vertical walls to ceilings)
* if BGCHECK_GROUND_CHECK_ON, ignore polys with a normal.y < 0 (from vertical walls to ceilings)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* if BGCHECK_GROUND_CHECK_ON, ignore polys with a normal.y < 0 (from vertical walls to ceilings)
* if groundChk & BGCHECK_GROUND_CHECK_ON, ignore polys with a normal.y < 0 (from vertical walls to ceilings)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels unnecessary since BGCHECK_GROUND_CHECK_ON on its own expresses itself as being a groundChk flag in the name

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well the function has a gazillion arguments

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think you necessarily need to show the anding operation in the comment, but it can say something like "if BGCHECK_GROUND_CHECK_ON is passed" or "if BGCHECK_GROUND_CHECK_ON is set" to make it read more like a sentence

but yea I do think it should be clear just by association of the name what its referring to.
But in that same vein, groundChk should just be groundCheck with the whole word, its only two characters and it will better match the define names

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it isn't 2 characters, it's 20, and it would introduce an inconsistent variable names with some abbreviated some not. Unless perhaps you want to eliminate the chk abbr altogether which in that case it would be about 262 characters in bgcheck alone.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obviously i meant 2 characters per usage of the word... and I dont think the total amount of characters it adds is really relevant, when all that really matters is how long individual lines get

its already inconsistent with the enum name, so pick your posion. I think the abbreviating is not necessary and not helping to solve any particular problem, it would be fine as the whole word

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bigger picture point for me and this PR is that chk is an established abbreviation in the code base at the moment, primarily in bgcheck, camera, Math3D, and inherited from event_chk_inf. If groundChk should just be groundCheck, then arguably all chks should be checks, but I'd rather avoid doing something like that in this PR since it falls outside of the scope of what I want to do with this PR.

Either way, groundChk and GROUND_CHECK are equivalent to myself at least.

Copy link
Collaborator

@fig02 fig02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can settle the check vs chk discussion later, bgcheck needs lots of work anyway

Copy link
Collaborator

@Roman971 Roman971 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor suggestions but otherwise it should be good to go

src/overlays/actors/ovl_Boss_Va/z_boss_va.c Outdated Show resolved Hide resolved
src/code/z_bgcheck.c Outdated Show resolved Hide resolved
@Roman971 Roman971 merged commit 327a813 into zeldaret:master Aug 30, 2022
louist103 pushed a commit to louist103/oot that referenced this pull request Jan 3, 2023
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants