Skip to content

Commit

Permalink
Merge pull request #314 from Dragorn421/cs_float_ext
Browse files Browse the repository at this point in the history
[OoT] Externalize cutscene float values export/import
  • Loading branch information
sauraen authored Apr 20, 2024
2 parents ce67a47 + a5e4fc1 commit bb49734
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
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

0 comments on commit bb49734

Please sign in to comment.