From 52de2dcdaef4cdf25a4d0ba41e95728f651fd6ff Mon Sep 17 00:00:00 2001 From: fig02 Date: Mon, 2 Dec 2024 16:49:39 -0500 Subject: [PATCH 1/3] update CS_HEADER and CS_END_OF_SCRIPT --- fast64_internal/oot/cutscene/constants.py | 6 +++--- fast64_internal/oot/cutscene/exporter/classes.py | 2 +- fast64_internal/oot/cutscene/importer/classes.py | 8 ++++---- fast64_internal/oot/cutscene/operators.py | 6 +++--- fast64_internal/oot/cutscene_docs.md | 4 ++-- fast64_internal/oot/exporter/cutscene/__init__.py | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/fast64_internal/oot/cutscene/constants.py b/fast64_internal/oot/cutscene/constants.py index b3525246a..d5e155e5b 100644 --- a/fast64_internal/oot/cutscene/constants.py +++ b/fast64_internal/oot/cutscene/constants.py @@ -207,14 +207,14 @@ ] ootCSSingleCommands = [ - "CS_BEGIN_CUTSCENE", - "CS_END", + "CS_HEADER", + "CS_END_OF_SCRIPT", "CS_TRANSITION", "CS_DESTINATION", ] ootCSListAndSingleCommands = ootCSSingleCommands + ootCSListCommands -ootCSListAndSingleCommands.remove("CS_BEGIN_CUTSCENE") +ootCSListAndSingleCommands.remove("CS_HEADER") ootCutsceneCommandsC = ootCSSingleCommands + ootCSListCommands + ootCSListEntryCommands cmdToClass = { diff --git a/fast64_internal/oot/cutscene/exporter/classes.py b/fast64_internal/oot/cutscene/exporter/classes.py index f655b5483..66966b462 100644 --- a/fast64_internal/oot/cutscene/exporter/classes.py +++ b/fast64_internal/oot/cutscene/exporter/classes.py @@ -458,5 +458,5 @@ def getExportData(self): self.frameCount += self.motionFrameCount - self.frameCount return ( - (indent + f"CS_BEGIN_CUTSCENE({self.entryTotal}, {self.frameCount}),\n") + csData + (indent + "CS_END(),\n") + (indent + f"CS_HEADER({self.entryTotal}, {self.frameCount}),\n") + csData + (indent + "CS_END_OF_SCRIPT(),\n") ) diff --git a/fast64_internal/oot/cutscene/importer/classes.py b/fast64_internal/oot/cutscene/importer/classes.py index ce76b694f..46e9df3eb 100644 --- a/fast64_internal/oot/cutscene/importer/classes.py +++ b/fast64_internal/oot/cutscene/importer/classes.py @@ -69,7 +69,7 @@ def getCmdParams(self, data: str, cmdName: str, paramNumber: int): return params def getNewCutscene(self, csData: str, name: str): - params = self.getCmdParams(csData, "CS_BEGIN_CUTSCENE", Cutscene.paramNumber) + params = self.getCmdParams(csData, "CS_HEADER", Cutscene.paramNumber) return Cutscene(name, getInteger(params[0]), getInteger(params[1])) def getParsedCutscenes(self): @@ -158,7 +158,7 @@ def getParsedCutscenes(self): if curCmd in ootCutsceneCommandsC: line = line.removesuffix(",") + "\n" - if curCmd in ootCSSingleCommands and curCmd != "CS_END": + if curCmd in ootCSSingleCommands and curCmd != "CS_END_OF_SCRIPT": parsedData += line if not cmdListFound and curCmd in ootCSListCommands: @@ -180,7 +180,7 @@ def getParsedCutscenes(self): print(f"{csName}, command:\n{line}") raise PluginError(f"ERROR: Found a list entry outside a list inside ``{csName}``!") - if cmdListFound and nextCmd == "CS_END" or nextCmd in ootCSListAndSingleCommands: + if cmdListFound and nextCmd == "CS_END_OF_SCRIPT" or nextCmd in ootCSListAndSingleCommands: cmdListFound = False parsedCS.append(parsedData) parsedData = "" @@ -213,7 +213,7 @@ def getCutsceneList(self): cmdListName = cmdListData.strip().split("(")[0] # create a new cutscene data - if cmdListName == "CS_BEGIN_CUTSCENE": + if cmdListName == "CS_HEADER": cutscene = self.getNewCutscene(data, parsedCS.csName) # if we have a cutscene, create and add the commands data in it diff --git a/fast64_internal/oot/cutscene/operators.py b/fast64_internal/oot/cutscene/operators.py index d8ac08975..f956158f4 100644 --- a/fast64_internal/oot/cutscene/operators.py +++ b/fast64_internal/oot/cutscene/operators.py @@ -67,13 +67,13 @@ def insertCutsceneData(filePath: str, csName: str): foundCutscene = True if foundCutscene: - if "CS_BEGIN_CUTSCENE" in line: + if "CS_HEADER" in line: # save the index of the line that contains the entry total and the framecount for later use beginIndex = i # looking at next line to see if we reached the end of the cs script index = i + 1 - if index < len(fileLines) and "CS_END" in fileLines[index]: + if index < len(fileLines) and "CS_END_OF_SCRIPT" in fileLines[index]: # exporting first to get the new framecount and the total of entries values fileLines.insert(index, motionExporter.getExportData()) @@ -90,7 +90,7 @@ def insertCutsceneData(filePath: str, csName: str): frames = re.sub(r"\b([0-9a-fA-F]*)\)", f"{frameCount + motionExporter.frameCount})", beginLine) fileLines[beginIndex] = f"{entries.split(', ')[0]}, {frames.split(', ')[1]}" else: - raise PluginError("ERROR: Can't find `CS_BEGIN_CUTSCENE()` parameters!") + raise PluginError("ERROR: Can't find `CS_HEADER()` parameters!") break fileData = CData() diff --git a/fast64_internal/oot/cutscene_docs.md b/fast64_internal/oot/cutscene_docs.md index e22acb573..069154344 100644 --- a/fast64_internal/oot/cutscene_docs.md +++ b/fast64_internal/oot/cutscene_docs.md @@ -10,8 +10,8 @@ ### Commands More detailed informations and commands' parameters can be found [here](https://github.com/zeldaret/oot/blob/master/include/z64cutscene_commands.h) -- ``CS_BEGIN_CUTSCENE``: defines the beginning of a cutscene script -- ``CS_END``: defines the end of a cutscene script +- ``CS_HEADER``: defines the length and the total number of command entries for a cutscene script +- ``CS_END_OF_SCRIPT``: the end of a command list in a cutscene script - ``CS_CAM_POINT``: defines a single camera point, it can be used with any of the "eye" or "at" camera commands - ``CS_CAM_EYE``: defines a single eye point, this feature is not used in the final game and lacks polish - ``CS_CAM_EYE_SPLINE``: declares a list of "eye" camera points that forms a spline diff --git a/fast64_internal/oot/exporter/cutscene/__init__.py b/fast64_internal/oot/exporter/cutscene/__init__.py index f1cca53b6..a9d8c5b1a 100644 --- a/fast64_internal/oot/exporter/cutscene/__init__.py +++ b/fast64_internal/oot/exporter/cutscene/__init__.py @@ -83,10 +83,10 @@ def getC(self): csData.source = ( declarationBase + " = {\n" - + (indent + f"CS_BEGIN_CUTSCENE({self.totalEntries}, {self.frameCount}),\n") + + (indent + f"CS_HEADER({self.totalEntries}, {self.frameCount}),\n") + (self.data.destination.getCmd() if self.data.destination is not None else "") + "".join(entry.getCmd() for curList in dataListNames for entry in getattr(self.data, curList)) - + (indent + "CS_END(),\n") + + (indent + "CS_END_OF_SCRIPT(),\n") + "};\n\n" ) From 6775d940ef53bd99805e06dd3133e343f80c94d1 Mon Sep 17 00:00:00 2001 From: fig02 Date: Mon, 2 Dec 2024 16:54:14 -0500 Subject: [PATCH 2/3] deleted a word --- fast64_internal/oot/cutscene_docs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fast64_internal/oot/cutscene_docs.md b/fast64_internal/oot/cutscene_docs.md index 069154344..c80d5413f 100644 --- a/fast64_internal/oot/cutscene_docs.md +++ b/fast64_internal/oot/cutscene_docs.md @@ -11,7 +11,7 @@ More detailed informations and commands' parameters can be found [here](https://github.com/zeldaret/oot/blob/master/include/z64cutscene_commands.h) - ``CS_HEADER``: defines the length and the total number of command entries for a cutscene script -- ``CS_END_OF_SCRIPT``: the end of a command list in a cutscene script +- ``CS_END_OF_SCRIPT``: defines the end of a command list in a cutscene script - ``CS_CAM_POINT``: defines a single camera point, it can be used with any of the "eye" or "at" camera commands - ``CS_CAM_EYE``: defines a single eye point, this feature is not used in the final game and lacks polish - ``CS_CAM_EYE_SPLINE``: declares a list of "eye" camera points that forms a spline From 71548a1668159c89d078b8e7b6f2c31a650a4a9d Mon Sep 17 00:00:00 2001 From: fig02 Date: Mon, 2 Dec 2024 17:01:52 -0500 Subject: [PATCH 3/3] format --- fast64_internal/oot/cutscene/exporter/classes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fast64_internal/oot/cutscene/exporter/classes.py b/fast64_internal/oot/cutscene/exporter/classes.py index 66966b462..8b42ca5ef 100644 --- a/fast64_internal/oot/cutscene/exporter/classes.py +++ b/fast64_internal/oot/cutscene/exporter/classes.py @@ -458,5 +458,7 @@ def getExportData(self): self.frameCount += self.motionFrameCount - self.frameCount return ( - (indent + f"CS_HEADER({self.entryTotal}, {self.frameCount}),\n") + csData + (indent + "CS_END_OF_SCRIPT(),\n") + (indent + f"CS_HEADER({self.entryTotal}, {self.frameCount}),\n") + + csData + + (indent + "CS_END_OF_SCRIPT(),\n") )