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

Create enum for g_CastleFlags #1624

Merged
merged 2 commits into from
Sep 18, 2024
Merged

Conversation

bismurphy
Copy link
Collaborator

I went through every use of g_CastleFlags and created enum members for the different flags. This will allow us to better keep track of what flags exist and how they are used. This will also aid in tracking the arrangement of the overlays in the flags, as there seems to be some level of organization. As we add more gameplay overlays we can hopefully learn how these all work together.

Some functions were using local const int declarations to give names to flags. For example, there was const int jewelSwordRoomUnlock = 51;. For these ones, which had flag purposes identified in code, I went ahead and gave their global castle flag a similar name (in this case, JEWEL_SWORD_ROOM). For all other flags, I kept the name as a placeholder of CASTLE_FLAG_###; later someone else can identify what the individual flags are.

This should be a good step in making the castle flags more understandable, as well as to connect the different functions across the game and properly see which ones are touching the same flags. When a castle flag is written as 0x32 in some places, and 50 in others, it makes it harder to search. Now that we can use CASTLE_FLAG_50, hopefully we will have better understanding of all the uses of the flag.

Copy link
Collaborator

@sozud sozud left a comment

Choose a reason for hiding this comment

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

This seems good to me, in my opinion some of the names are too abbreviated like HG_CS_DONE and SG_RETR_ENTR. I would not be able to guess what these mean even knowing the game is SOTN

@bismurphy
Copy link
Collaborator Author

This seems good to me, in my opinion some of the names are too abbreviated like HG_CS_DONE and SG_RETR_ENTR. I would not be able to guess what these mean even knowing the game is SOTN

Yes; unfortunately these are kind of the consequences of enforcing our strict column limit. I thought it would be better to focus on brevity and then give a full comment in the enum (in this case, elaborating HG_CS as "Holy Glasses cutscene" and SG_RETR_ENTR as "Slogra/Gaibon retreated from Entrance encounter").

If you use VS code, these comments also show up on mouseover, as shown here:
image

@sozud
Copy link
Collaborator

sozud commented Sep 18, 2024

Ok, I think let's get Xeeynamo's feedback on this one before merging

Copy link
Owner

@Xeeynamo Xeeynamo left a comment

Choose a reason for hiding this comment

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

It is not the naming scheme I would have chosen either. But I would have chosen something that wouldn't have appealed you either. Naming for this one is too much of an opinionated topic and we would not end to get this merged for a while. We can have these renamed any time in the future anyway. I like the value this PR brings regardless and I am happy to merge this as it is!

@Xeeynamo Xeeynamo merged commit 77f0f5e into Xeeynamo:master Sep 18, 2024
15 checks passed
@bismurphy
Copy link
Collaborator Author

But I would have chosen something that wouldn't have appealed you either.

Does this refer to Sozud or me? I don't have any strong feelings about any particular naming, I just put these in as a starting point. If there are any other preferred names (even if they're longer) I'd be happy to swap them out. For me personally this isn't an opinionated topic. Sozud made a good point about the names being over-abbreviated but I'm not sure what the less-abreviated forms should be. We can agree that full descriptions featuring prepositions and conjunctions (SLOGRA_AND_GAIBON_HAVE_RETREATED_FROM_ENTRANCE) would be excessive, but then the amount of trimming is hard to decide. If it should be SLOGRA_GAIBON_RETREATED_ENTRANCE that's good with me. Just as a starting point I figured 32 characters for a single enum felt like a lot.

@bismurphy bismurphy deleted the castleflags branch September 18, 2024 18:06
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.

3 participants