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

Name numerous event info flags #2299

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JordanLongstaff
Copy link

A lot of event info flag names copied over from SoH.

Copy link
Contributor

@mzxrules mzxrules left a comment

Choose a reason for hiding this comment

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

I'm concerned that SoH's version of these flags may be modified to match their own code modifications.

#define EVENTCHKINF_1B 0x1B
#define EVENTCHKINF_1C 0x1C
#define EVENTCHKINF_1D 0x1D
#define EVENTCHKINF_OBTAINED_KOKIRI_EMERALD 0x19
Copy link
Contributor

@mzxrules mzxrules Nov 14, 2024

Choose a reason for hiding this comment

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

Is EVENTCHKINF_OBTAINED_KOKIRI_EMERALD even a real flag?

Copy link
Author

Choose a reason for hiding this comment

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

This and the other flag were pulled in from SoH. Not that they see much real use, but they're there.

I'll revert this one only because of skepticism considering there's another flag for this, and this flag is never used.

Copy link
Contributor

@Feacur Feacur Nov 14, 2024

Choose a reason for hiding this comment

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

as an addendum:
i would say that 0x07 and 0x09 are related to that event

// z_door_warp1.c:507
Flags_SetEventChkInf(EVENTCHKINF_07);
Flags_SetEventChkInf(EVENTCHKINF_09);
Item_Give(play, ITEM_KOKIRI_EMERALD);

in one of my fork's branches with some documentation process it looks like that:
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

If they do exist, where are they referenced? Currently no define exists for them because it is never referenced in code, unless I am missing something.
If it doesnt ever get used in code, how can we know what its name should be?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I can confirm that it isn't a real flag, it isn't even referenced anywhere in SoH either.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks.
This goes back to my comment in my previous review, it would be helpful if each flag is carefully examined for accuracy, instead of just blindly copying from SOH.

#define EVENTCHKINF_LEARNED_SERENADE_OF_WATER 0x52
#define EVENTCHKINF_LEARNED_NOCTURNE_OF_SHADOW 0x54
#define EVENTCHKINF_LEARNED_PRELUDE_OF_LIGHT 0x55
#define EVENTCHKINF_LEARNED_SARIAS_SONG 0x57
Copy link
Contributor

@mzxrules mzxrules Nov 14, 2024

Choose a reason for hiding this comment

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

Is EVENTCHKINF_LEARNED_SARIAS_SONG a real flag?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not.

Comment on lines +651 to +655
#define EVENTCHKINF_SKULLTULA_REWARD_10_SHIFT 10
#define EVENTCHKINF_SKULLTULA_REWARD_20_SHIFT 11
#define EVENTCHKINF_SKULLTULA_REWARD_30_SHIFT 12
#define EVENTCHKINF_SKULLTULA_REWARD_40_SHIFT 13
#define EVENTCHKINF_SKULLTULA_REWARD_50_SHIFT 14
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like having defines for these

Copy link
Author

Choose a reason for hiding this comment

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

Is this a deal-breaker? There are plenty of other shift defines elsewhere in this section.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, and I don't particularly like it's usage those cases either.

I feel there's no reason to create defines for these because the values are only ever relevant to exactly one section of code (this file). It just makes the code harder to follow logically for 0 gain.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it can make understanding the code easier (a comment would also work).

#define EVENTCHKINF_COMPLAINED_ABOUT_MIDO 0x03
#define EVENTCHKINF_SHOWED_MIDO_SWORD_SHIELD 0x04
#define EVENTCHKINF_DEKU_TREE_OPENED_MOUTH 0x05
#define EVENTCHKINF_OBTAINED_KOKIRI_EMERALD_DEKU_TREE_DEAD 0x07
Copy link
Contributor

Choose a reason for hiding this comment

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

I find this particular name odd. I'm not sure it should necessarily be associated with obtaining the Kokiri Emerald.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is set when you're given the kokiri emerald and the deku tree dies but it's only referenced by deku tree related stuff so I agree, I think naming it something like EVENTCHKINF_DEKU_TREE_DEAD or EVENTCHKINF_COMPLETED_DEKU_TREE would be better.

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.

In the same vein as the above, it would be good if we can verify all of the names are accurate to the code that they correspond to. For example:

Comment on lines +617 to +619
#define EVENTCHKINF_DISPELLED_GANONS_TOWER_BARRIER 0xC3
#define EVENTCHKINF_RETURNED_TO_TEMPLE_OF_TIME_WITH_ALL_MEDALLIONS 0xC4
#define EVENTCHKINF_SHEIK_SPAWNED_AT_MASTER_SWORD_PEDESTAL 0xC5
Copy link
Collaborator

Choose a reason for hiding this comment

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

EVENTCHKINF_RETURNED_TO_TEMPLE_OF_TIME_WITH_ALL_MEDALLIONS
The cutscene starting only checks for Spirit and Shadow medallions. Even though it can be considered a check for all medallions, assuming no glitches/sequence breaks, it would still be good to keep this accurate.

It can probably be named after starting the Light Arrow Cutscene, which is what the relevant code is doing anyway

Copy link
Contributor

@Feacur Feacur Nov 14, 2024

Choose a reason for hiding this comment

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

as an addendum:

// z_demo.c:2415
       LINK_IS_ADULT && !Flags_GetEventChkInf(EVENTCHKINF_C4) &&
       (gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_TEMPLE_OF_TIME)) {
Flags_SetEventChkInf(EVENTCHKINF_C4);

looks like "if haven't seen this cutscene, mark it and never show again"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably something along the lines of EVENTCHKINF_STARTED_LIGHT_ARROW_CUTSCENE would be better.

@fig02
Copy link
Collaborator

fig02 commented Nov 14, 2024

I think it may be helpful for you and for reviewers if this was split into smaller batches. This way you can check accuracy as you port each flag name over in smaller amounts, and the review process can be easier on people trying to verify your requested changes.

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.

5 participants