Skip to content

Commit

Permalink
add depth arg to level and collision objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilaa3 committed Oct 8, 2024
1 parent f405972 commit d0c3426
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions fast64_internal/sm64/sm64_collision.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ def to_c(self):
if len(self.specials) > 0:
data.source += "\tCOL_SPECIAL_INIT(" + str(len(self.specials)) + "),\n"
for special in self.specials:
data.source += "\t" + special.to_c()
data.source += "\t" + special.to_c(1)
if len(self.water_boxes) > 0:
data.source += "\tCOL_WATER_BOX_INIT(" + str(len(self.water_boxes)) + "),\n"
for waterBox in self.water_boxes:
data.source += "\t" + waterBox.to_c()
data.source += "\t" + waterBox.to_c(1)
data.source += "\tCOL_END()\n" + "};\n"
return data

Expand Down
38 changes: 19 additions & 19 deletions fast64_internal/sm64/sm64_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def __init__(self, model, position, rotation, behaviour, bparam, acts, name):
self.rotation = rotation
self.name = name # to sort by when exporting

def to_c(self):
def to_c(self, depth=0):
if self.acts == 0x1F:
return (
"OBJECT("
Expand Down Expand Up @@ -349,7 +349,7 @@ def __init__(self, index, condition, strength, position):
self.position = position
self.name = "whirlpool" # for sorting

def to_c(self):
def to_c(self, depth=0):
return (
"WHIRPOOL("
+ str(self.index)
Expand All @@ -374,7 +374,7 @@ def __init__(self, preset, position, rotation, bparam):
self.position = position
self.rotation = rotation

def to_c(self):
def to_c(self, depth=0):
if self.bparam is None:
return (
"MACRO_OBJECT("
Expand Down Expand Up @@ -426,7 +426,7 @@ def to_binary(self):
data.extend(int(self.bparam).to_bytes(2, "big"))
return data

def to_c(self):
def to_c(self, depth=0):
if self.rotation is None:
return (
"SPECIAL_OBJECT("
Expand All @@ -437,7 +437,7 @@ def to_c(self):
+ str(int(round(self.position[1])))
+ ", "
+ str(int(round(self.position[2])))
+ "),\n"
+ ")"
)
elif self.bparam is None:
return (
Expand All @@ -451,7 +451,7 @@ def to_c(self):
+ str(int(round(self.position[2])))
+ ", "
+ str(int(round(math.degrees(self.rotation[1]))))
+ "),\n"
+ ")"
)
else:
return (
Expand All @@ -467,7 +467,7 @@ def to_c(self):
+ str(int(round(math.degrees(self.rotation[1]))))
+ ", "
+ str(self.bparam)
+ "),\n"
+ ")"
)


Expand All @@ -478,7 +478,7 @@ def __init__(self, area, position, rotation):
self.rotation = rotation
self.name = "Mario" # for sorting

def to_c(self):
def to_c(self, depth=0):
return (
"MARIO_POS("
+ str(self.area)
Expand Down Expand Up @@ -526,7 +526,7 @@ def to_c_script(self, includeRooms, persistentBlockString: str = ""):
data += "\t\t" + warpNode + ",\n"
# export objects in name order
for obj in sorted(self.objects, key=(lambda obj: obj.name)):
data += "\t\t" + obj.to_c() + ",\n"
data += "\t\t" + obj.to_c(2) + ",\n"
data += "\t\tTERRAIN(" + self.collision.name + "),\n"
if includeRooms:
data += "\t\tROOMS(" + self.collision.rooms_name() + "),\n"
Expand All @@ -547,21 +547,21 @@ def to_c_macros(self):
data.header = "extern const MacroObject " + self.macros_name() + "[];\n"
data.source += "const MacroObject " + self.macros_name() + "[] = {\n"
for macro in self.macros:
data.source += "\t" + macro.to_c() + ",\n"
data.source += "\t" + macro.to_c(1) + ",\n"
data.source += "\tMACRO_OBJECT_END(),\n};\n\n"

return data

def to_c_camera_volumes(self):
data = ""
for camVolume in self.cameraVolumes:
data += "\t" + camVolume.to_c() + "\n"
data += "\t" + camVolume.to_c(1) + ",\n"
return data

def to_c_puppycam_volumes(self):
data = ""
for puppycamVolume in self.puppycamVolumes:
data += "\t" + puppycamVolume.to_c() + "\n"
data += "\t" + puppycamVolume.to_c(1) + ",\n"
return data

def hasCutsceneSpline(self):
Expand Down Expand Up @@ -598,7 +598,7 @@ def to_binary(self):
data.extend(int(round(self.height)).to_bytes(2, "big", signed=True))
return data

def to_c(self):
def to_c(self, depth=0):
data = (
"COL_WATER_BOX("
+ ("0x00" if self.waterBoxType == "Water" else "0x32")
Expand All @@ -612,7 +612,7 @@ def to_c(self):
+ str(int(round(self.high[1])))
+ ", "
+ str(int(round(self.height)))
+ "),\n"
+ ")"
)
return data

Expand All @@ -630,7 +630,7 @@ def __init__(self, area, functionName, position, rotation, scale, emptyScale):
def to_binary(self):
raise PluginError("Binary exporting not implemented for camera volumens.")

def to_c(self):
def to_c(self, depth=0):
data = (
"{"
+ str(self.area)
Expand All @@ -650,7 +650,7 @@ def to_c(self):
+ str(int(round(self.scale[2])))
+ ", "
+ str(convertRadiansToS16(self.rotation[1]))
+ "},"
+ "}"
)
return data

Expand Down Expand Up @@ -683,7 +683,7 @@ def __init__(self, area, level, permaswap, functionName, position, scale, emptyS
def to_binary(self):
raise PluginError("Binary exporting not implemented for puppycam volumes.")

def to_c(self):
def to_c(self, depth=0):
data = (
"{"
+ str(self.level)
Expand Down Expand Up @@ -719,7 +719,7 @@ def to_c(self):
+ str(int(round(self.camFocus[1])))
+ ", "
+ str(int(round(self.camFocus[2])))
+ "},"
+ "}"
)
return data

Expand Down Expand Up @@ -2346,7 +2346,7 @@ def calc_offsets_from_objects(self, reverse=False):
ret.z = int(round(-difference.y * bpy.context.scene.blenderF3DScale))
return ret

def to_c(self):
def to_c(self, depth=0):
if self.warpType == "Instant":
offset = Vector()

Expand Down

0 comments on commit d0c3426

Please sign in to comment.