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] Externalize cutscene float values export/import #314

Merged
merged 1 commit into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion fast64_internal/oot/cutscene/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
from .motion.utility import getBlenderPosition, getBlenderRotation, getRotation, getInteger


def cs_import_float(v_str: str):
return float(v_str.removesuffix("f"))


# NOTE: ``paramNumber`` is the expected number of parameters inside the parsed commands,
# this account for the unused parameters. Every classes are based on the commands arguments from ``z64cutscene_commands.h``

Expand Down Expand Up @@ -47,7 +51,7 @@ def __post_init__(self):
self.continueFlag = self.params[0]
self.camRoll = getInteger(self.params[1])
self.frame = getInteger(self.params[2])
self.viewAngle = float(self.params[3][:-1])
self.viewAngle = cs_import_float(self.params[3])
self.pos = [getInteger(self.params[4]), getInteger(self.params[5]), getInteger(self.params[6])]


Expand Down
8 changes: 6 additions & 2 deletions fast64_internal/oot/cutscene/exporter/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
)


def cs_export_float(v: float):
return f"{v:f}f"


class CutsceneCmdToC:
"""This class contains functions to create the cutscene commands"""

Expand Down Expand Up @@ -102,7 +106,7 @@ def getActorCueCmd(self, actorCue: CutsceneCmdActorCue, isPlayerActor: bool):
+ "".join(f"{rot}, " for rot in actorCue.rot)
+ "".join(f"{pos}, " for pos in actorCue.startPos)
+ "".join(f"{pos}, " for pos in actorCue.endPos)
+ "0.0f, 0.0f, 0.0f),\n"
+ f"{cs_export_float(0)}, {cs_export_float(0)}, {cs_export_float(0)}),\n"
)

def getCamListCmd(self, cmdName: str, startFrame: int, endFrame: int):
Expand Down Expand Up @@ -133,7 +137,7 @@ def getCamATCmd(self, camAT: CutsceneCmdCamAT):
def getCamPointCmd(self, camPoint: CutsceneCmdCamPoint):
return indent * 3 + (
f"CS_CAM_POINT("
+ f"{camPoint.continueFlag}, {camPoint.camRoll}, {camPoint.frame}, {camPoint.viewAngle}f, "
+ f"{camPoint.continueFlag}, {camPoint.camRoll}, {camPoint.frame}, {cs_export_float(camPoint.viewAngle)}, "
+ "".join(f"{pos}, " for pos in camPoint.pos)
+ "0),\n"
)
Expand Down
Loading