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

Document Save.cutsceneIndex and adjacent data / code #2286

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

Conversation

Feacur
Copy link
Contributor

@Feacur Feacur commented Nov 5, 2024

while studying the game logic flow, i saw there's a pattern between

  • Save.entranceIndex
  • Save.cutsceneIndex
  • SaveContext.sceneLayer

but values weren't yet described. so, it's time to cleanup my notes and shape them in a proper PR.
(UPD: not anymore) it's a WIP, but i'll start with a draft for visibility

P.S.:
the closest thing i see here is #1300, but

  • documented SaveContext.sceneLayer
  • it's merged already

so that it doesn't clutter previous commit. still, allowing `clangd LSP` to run format-on-save yields inconsistent results for me with the project's tooling, especially for header files
include/z64cutscene.h Outdated Show resolved Hide resolved
include/z64cutscene.h Outdated Show resolved Hide resolved
include/z64cutscene.h Outdated Show resolved Hide resolved
include/z64cutscene.h Outdated Show resolved Hide resolved
include/z64cutscene.h Outdated Show resolved Hide resolved
Feacur and others added 10 commits November 5, 2024 11:26
Co-authored-by: mzxrules <mzxrules@gmail.com>
and some additional observations
reverified with
> `check_format.py ...`
> `make ...`

additionally:
- current clang-format lacks a rule for trailing commas
- compiler says about them `cfe: Warning 624`
zeldaret#2286 (comment)

reverified with
> `check_format.py ...`
> `make ...`
it gets assigned to the `nextCutsceneIndex`,
so `CS_INDEX_NONE` name was misleading
the purpose of `CS_INDEX_BARRIER` is not quite clear still
@Feacur Feacur marked this pull request as ready for review November 5, 2024 18:05
Copy link
Contributor

@cadmic cadmic left a comment

Choose a reason for hiding this comment

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

I made a few comments in the resolved threads, could you un-mark them as resolved? I don't have permission to unresolve them myself

include/z64cutscene.h Outdated Show resolved Hide resolved
include/z64cutscene.h Outdated Show resolved Hide resolved
src/overlays/gamestates/ovl_opening/z_opening.c Outdated Show resolved Hide resolved
src/code/z_scene.c Outdated Show resolved Hide resolved
src/code/z_horse.c Show resolved Hide resolved
include/z64cutscene.h Outdated Show resolved Hide resolved
include/z64cutscene.h Outdated Show resolved Hide resolved
include/z64cutscene.h Outdated Show resolved Hide resolved
@fig02
Copy link
Collaborator

fig02 commented Nov 27, 2024

(unresolved as needed)

@Feacur Feacur force-pushed the doc/cutscene_index branch from c91e8c0 to 6efea0a Compare November 29, 2024 10:10
src/code/z_scene_table.c Outdated Show resolved Hide resolved
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.

There has been extensive discussion on the macro names and I think they're mostly fine (wrt how poorly this system is designed), just going to comment on the documentation comments

The only name I have an issue with is CS_INDEX_EMPTY, as mzx said it seems to be very much tied to gSaveContext.cutsceneTrigger, I'm guessing it was just taken as an arbitrary value that verifies >= 0xFFF0 (see Cutscene_UpdateScripted) so that cutsceneTrigger can trigger a scripted cutscene at all
It being reset to default on play state init makes sense in that case, because it would have no meaning on play state init (cutsceneTrigger is meant for interrupting gameplay with a cutscene rather than loading into a cutscene)
Maybe a name could be CS_INDEX_SCRIPT_TRIGGERED, unsure

include/z64cutscene.h Outdated Show resolved Hide resolved
include/z64cutscene.h Outdated Show resolved Hide resolved
include/z64cutscene.h Outdated Show resolved Hide resolved
include/z64cutscene.h Outdated Show resolved Hide resolved
Comment on lines +376 to +377
// sentinel value used for `cutsceneIndex` to indicate that it should be reset to default
#define CS_INDEX_EMPTY 0xFFFD
Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't think the name makes much sense, but I also don't have a strong idea for what to call this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I will once again advocate for CS_INDEX_D (and CS_INDEX_F instead for 0xFFFF), since these also indicate a scripted cutscene despite not corresponding to any scene layer

Copy link
Contributor

@mzxrules mzxrules Jan 11, 2025

Choose a reason for hiding this comment

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

Fair, although now that I think about it I kind of just wish the whole value was written out in full, like...
CS_INDEX_0->CS_INDEX_FFF0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At this point I won't mind. Either way, you should know better than me, and I already expressed my standpoint. I mean, no subtext, I just trust your decision

src/code/z_play.c Outdated Show resolved Hide resolved
src/code/z_play.c Outdated Show resolved Hide resolved
src/code/z_play.c Outdated Show resolved Hide resolved
src/code/z_play.c Outdated Show resolved Hide resolved
src/code/z_scene.c Outdated Show resolved Hide resolved
src/overlays/gamestates/ovl_opening/z_opening.c Outdated Show resolved Hide resolved
Feacur and others added 2 commits January 11, 2025 23:14
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Co-authored-by: mzxrules <mzxrules@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants