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

[OoT] Cutscene Implementation Update #208

Merged
merged 47 commits into from
Dec 31, 2023
Merged

Conversation

Yanis42
Copy link
Contributor

@Yanis42 Yanis42 commented Jan 10, 2023

Opening this as a draft so people can make suggestions

Current changes:

  • Added more layout.box() to improve the UI
  • Updated the command names
  • Added enums where it's needed (cutscene destination, ocarina action, BGM, fade out player and misc)
  • Renamed "Cutscene Terminator" to "Cutscene Destination"
  • Moved the commands before the list tabs to make the UI easier to use
  • Renamed "Cmd 9" to "Rumble Controller" and changed the icon to a wave-like one
  • Removed "Cmd Unk" as it's not implemented
  • Used proper names for rumble command
  • Used more indentation to improve the C output
  • Added "custom" option for the enums
  • Use "0" as the default value for unused/not implemented arguments
  • Use proper names for commands sub-properties
  • Used enum names for the music enum
  • Probably other things I forgot

Notes:

  • Current renames are mostly on the UI (but not everything has been renamed yet), it will be part of the code later
  • There's not updater (yet) for older blends
  • zcamedit merge won't be a part of this PR
Output Example
CutsceneData TEST[] = {
    CS_BEGIN_CUTSCENE(10, 100),
        CS_DESTINATION(CS_DEST_CUSTOM, 99, 100),
        CS_TEXT_LIST(3),
            CS_TEXT(0x0001, 31, 51, CS_TEXT_CUSTOM, 0x0000, 0x0000),
            CS_TEXT_NONE(188, 206),
            CS_TEXT_OCARINA_ACTION(OCARINA_ACTION_CUSTOM, 311, 447, 0x0045),
        CS_TRANSITION(CS_TRANS_CUSTOM, 429, 490),
        CS_LIGHT_SETTING_LIST(1),
            CS_LIGHT_SETTING(154, 2574, 0, 0, 0, 0, 0, 0, 0, 0, 0),
        CS_TIME_LIST(1),
            CS_TIME(0, 112, 0, 10, 25),
        CS_START_SEQ_LIST(1),
            CS_START_SEQ(NA_BGM_CUSTOM1, 2100, 0, 0, 0, 0, 0, 0, 0, 0, 0),
        CS_STOP_SEQ_LIST(1),
            CS_STOP_SEQ(NA_BGM_CUSTOM, 3247, 0, 0, 0, 0, 0, 0, 0, 0, 0),
        CS_FADE_OUT_SEQ_LIST(1),
            CS_FADE_OUT_SEQ(CS_FADE_OUT_BGM_MAIN, 3277, 3066, 0, 0, 0, 0, 0, 0, 0, 0),
        CS_MISC_LIST(1),
            CS_MISC(CS_MISC_CUSTOM, 2437, 4689, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
        CS_RUMBLE_CONTROLLER_LIST(1),
            CS_RUMBLE_CONTROLLER(0, 7084, 0, 0x0054, 0x0024, 0x0032, 0, 0),
    CS_END(),
};

As always I'm open to suggestions!

@Yanis42
Copy link
Contributor Author

Yanis42 commented Jan 12, 2023

New changes:

  • renamed the old "subprops" (to explain it better, it's organised like this: 1. list of cs commands then 2. lists of command's data and 3. the actual props to set the data, I renamed those props which are called "subprops" in the code)
  • introduced an upgrade system for old blends, I haven't double checked yet but, as they say, it works on my machine™
  • other minor changes, like comments and small fixes

@Yanis42
Copy link
Contributor Author

Yanis42 commented Jan 13, 2023

New changes:

  • renamed cs lists and related things
  • renamed OOTCutsceneProperty and related things
  • renamed other classes to have better names
  • improved the upgrade code
  • update the readme, added a guide to use the map select to watch cutscenes and updated the names

I think this PR is now ready for review (unless I missed something but I don't think so :thonk:), though I'll wait a bit before marking it ready for review as I want to try things to improve the UI a bit

Also a small note/reminder: in this PR I changed and removed classes and properties, for classes renaming is fine it doesn't break anything it just works™ but for props you need to transfer the data to the new props you want to use (this was introduced with the object list upgrade, see oot_upgrade.py), also enums can't break if you change the identifier since Blender saves the index of the selected element in the item list, but anyway everything seems to work fine for me outside few issues that aren't directly related to this (it just prevents compilation, will fix that soon™)

@Yanis42
Copy link
Contributor Author

Yanis42 commented Jan 13, 2023

Marking this as ready to review as I don't have anything else to change (I think)

@Yanis42 Yanis42 marked this pull request as ready for review January 13, 2023 22:51
@Yanis42 Yanis42 changed the title [OoT] (Draft) Cutscene Implementation Update [OoT] Cutscene Implementation Update Jan 13, 2023
)

elif list.listType in ["StartSeqList", "StopSeqList", "FadeOutSeqList"]:
endFrame = e.endFrame if list.listType == "FadeOutSeqList" else "0"

Choose a reason for hiding this comment

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

why do you force endFrame to be 0?

Copy link
Contributor Author

@Yanis42 Yanis42 Jan 15, 2023

Choose a reason for hiding this comment

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

in decomp it says the end frame isn't used so the value doesn't matter at all (unless I misread the line, which is possible)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but yea I guess I can use the default value of the class, those need a small cleanup anyway but idk if I should do it in this PR

Choose a reason for hiding this comment

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

It should be noted that decomp's implementation of the cutscene structs doesn't match the original implementation. For example, all evidence suggests that CsCmdMisc, CsCmdLightSetting, CsCmdStartSeq, CsCmdStopSeq CsCmdFadeOutSeq are all the same type as CsCmdActorCue. Decomp just implements them separately so that they can hide editor only properties not read by the game, and give a few properties more specialized names.

endFrame is one such property that all commands have, but isn't always needed by the game. But I don't think it makes any sense to deliberately force the value to 0 just because you can get away with it.

Copy link

@mzxrules mzxrules Jan 15, 2023

Choose a reason for hiding this comment

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

and I don't feel that you should be deliberately generating corrupt data

Copy link

Choose a reason for hiding this comment

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

i understand your point of view a little from the perspective of vanilla data.

but for custom cutscenes, how is it corrupt data? you want the commands that dont use an endframe to have one anyway and be confusing for the user? the ui might as well hide it so people dont need to think about it. cause again, it does not matter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, with your (mzx) logic we should also use 1 for unused args? It doesn't make sense to me, I mean I understand the point of view, like ok I get it originally it wasn't split etc, but for Fast64 in a modding context where I and other devs try our best to get something easy to use for everyone I don't think consistency should be considered for this particular thing as it's just confusing, alternatively I can accept using a macro but idk it doesn't seem really useful, also I don't really understand how 0 is corrupted data, especially for a frame value where you can actually want 0 to be used (well, ok 0 for a end frame is weird but you get what I mean hopefully)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tldr I just want Fast64 to be easy to use and understand and having a value for this would be confusing for the users

Choose a reason for hiding this comment

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

Two simple reasons:

  • Storing the endFrame for all commands is a nice thing to have, and the structs already support this.
  • Given that the structs all call the property endFrame in decomp, it makes zero sense to deliberately generate incorrect data for this property, since the user could have their own reasons for reading the data.

Copy link
Contributor

@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.

skimmed through

fast64_internal/oot/README.md Outdated Show resolved Hide resolved
fast64_internal/oot/oot_constants.py Outdated Show resolved Hide resolved
fast64_internal/oot/oot_upgrade.py Outdated Show resolved Hide resolved
Comment on lines 129 to 132
# @TODO: find a way to check properly which seq command it is
if newName == "csSeqID":
setattr(data, "csSeqPlayer", "Custom")
setattr(data, "csSeqPlayerCustom", str(oldData))
Copy link
Contributor

Choose a reason for hiding this comment

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

can't say I understand the todo

like, the seqId value here may be seqPlayer from CS_FADE_OUT_SEQ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should rephrase that but we need a proper way to check if we're dealing with the fade out command or the start/stop one, there's a minor difference between these two, the fade out one doesn't take a seq id but the player type (as defined in sequence.h iirc)

all of this is based on the informations inside z64cutscene_commands.h btw

the main issue at the moment is that we have to use "Custom" when upgrading because everything was assumed to have the same parameters, and now we know for sure this is a wrong assumption

fast64_internal/oot/scene/exporter/to_c/scene_cutscene.py Outdated Show resolved Hide resolved
fast64_internal/oot/scene/exporter/to_c/scene_cutscene.py Outdated Show resolved Hide resolved
csTermEnd: IntProperty(name="End Frm", min=0, default=100)
csUseDestination: BoolProperty(name="Write Terminator (Code Execution)")
csDestination: IntProperty(name="Index", min=0)
csDestinationStartFrame: IntProperty(name="Start Frm", min=0, default=99)
Copy link
Contributor

Choose a reason for hiding this comment

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

does frm need to be abbreviated?

Copy link
Contributor Author

@Yanis42 Yanis42 Jan 20, 2023

Choose a reason for hiding this comment

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

that's the deprecated code, I haven't updated it tbh I don't even know if everything still works for that

imo we should completely remove that legacy system and upgrade the things (though I don't have a cs in a scene so I can't really try if it'd work properly)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should we just remove this thing? I'm not sure anyone still using that now idk if it's worth making the code to update properly

@Yanis42
Copy link
Contributor Author

Yanis42 commented Jan 24, 2023

any updates on this? sorry I just need this to be merged to make things easier with merging zcamedit

@Yanis42
Copy link
Contributor Author

Yanis42 commented Jun 29, 2023

is there anything holding this? except update that branch I guess

@Yanis42
Copy link
Contributor Author

Yanis42 commented Oct 19, 2023

most of things I wanted to do are done, I improved the importer and the exporter and fixed some issues

I just want to improve the UI and I think I'm done with this, also I want to remove support for embedded cutscenes, I don't think anyone is using it, and if I do that I'll move files that are inside motion/exporter/motion/importer outside of the folders as this is handling everything now (with the necessary class/other rename)

also I implemented the preview for everything, not only imported cutscenes

edit: I just wanna improve the previewer a bit then I'll be done for real

@Yanis42 Yanis42 added waiting for author Waiting for the author to answer questions, do changes, ... oot Has to do with the Ocarina of Time 64 side labels Nov 8, 2023
@Yanis42 Yanis42 removed the waiting for author Waiting for the author to answer questions, do changes, ... label Dec 26, 2023
Copy link
Contributor

@sauraen sauraen left a comment

Choose a reason for hiding this comment

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

Some nits, otherwise looks good.

Tested importing a vanilla scene and previewing the cutscene in Blender. Also tested exporting a basic scene with several different command types. Both worked with no issues.

fast64_internal/oot/cutscene/classes.py Outdated Show resolved Hide resolved
fast64_internal/oot/cutscene/classes.py Outdated Show resolved Hide resolved
Comment on lines 468 to 483
actorCueList: list[CutsceneCmdActorCueList] = field(default_factory=list)
playerCueList: list[CutsceneCmdActorCueList] = field(default_factory=list)
camEyeSplineList: list[CutsceneCmdCamEyeSpline] = field(default_factory=list)
camATSplineList: list[CutsceneCmdCamATSpline] = field(default_factory=list)
camEyeSplineRelPlayerList: list[CutsceneCmdCamEyeSplineRelToPlayer] = field(default_factory=list)
camATSplineRelPlayerList: list[CutsceneCmdCamATSplineRelToPlayer] = field(default_factory=list)
camEyeList: list[CutsceneCmdCamEye] = field(default_factory=list)
camATList: list[CutsceneCmdCamAT] = field(default_factory=list)
miscList: list[CutsceneCmdMiscList] = field(default_factory=list)
transitionList: list[CutsceneCmdTransition] = field(default_factory=list)
textList: list[CutsceneCmdTextList] = field(default_factory=list)
lightSettingsList: list[CutsceneCmdLightSettingList] = field(default_factory=list)
timeList: list[CutsceneCmdTimeList] = field(default_factory=list)
seqList: list[CutsceneCmdStartStopSeqList] = field(default_factory=list)
fadeSeqList: list[CutsceneCmdFadeSeqList] = field(default_factory=list)
rumbleList: list[CutsceneCmdRumbleControllerList] = field(default_factory=list)
Copy link
Contributor

Choose a reason for hiding this comment

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

This approach doesn't preserve the order different types of commands appear in. (e.g. CutsceneCmdActorCueList followed by CutsceneCmdCamEyeSpline vs. the other order). However, I don't think that should ever matter in game, and Fast64 has long since stopped matching on vanilla data import -> export (e.g. exported DLs are sometimes more efficient). So this is probably okay.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think the order actually matters for cutscene commands

]

# order here sets order on the UI
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you reorder ootEnumCSListTypeListC above and csListTypeToIcon below to match this order then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm gonna do the reverse so the UI doesn't change (note that things up to camATList are from the zcamedit merge, so this won't change)

fast64_internal/oot/cutscene/classes.py Outdated Show resolved Hide resolved
Copy link
Contributor

@sauraen sauraen left a comment

Choose a reason for hiding this comment

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

Thanks!

@Yanis42 Yanis42 added the merge soon Will be merged in a few days at most if nothing else comes up label Dec 29, 2023
@sauraen sauraen merged commit 71225c7 into Fast-64:main Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge soon Will be merged in a few days at most if nothing else comes up oot Has to do with the Ocarina of Time 64 side
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants