From d0c34264e31ae7b5522fc0fee45aaa50184d8bc8 Mon Sep 17 00:00:00 2001 From: Lila Date: Tue, 8 Oct 2024 12:21:23 +0100 Subject: [PATCH] add depth arg to level and collision objects --- fast64_internal/sm64/sm64_collision.py | 4 +-- fast64_internal/sm64/sm64_objects.py | 38 +++++++++++++------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/fast64_internal/sm64/sm64_collision.py b/fast64_internal/sm64/sm64_collision.py index 6e2907f0c..1daf89fad 100644 --- a/fast64_internal/sm64/sm64_collision.py +++ b/fast64_internal/sm64/sm64_collision.py @@ -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 diff --git a/fast64_internal/sm64/sm64_objects.py b/fast64_internal/sm64/sm64_objects.py index 951e8bcc5..62ac31dc9 100644 --- a/fast64_internal/sm64/sm64_objects.py +++ b/fast64_internal/sm64/sm64_objects.py @@ -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(" @@ -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) @@ -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(" @@ -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(" @@ -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 ( @@ -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 ( @@ -467,7 +467,7 @@ def to_c(self): + str(int(round(math.degrees(self.rotation[1])))) + ", " + str(self.bparam) - + "),\n" + + ")" ) @@ -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) @@ -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" @@ -547,7 +547,7 @@ 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 @@ -555,13 +555,13 @@ def to_c_macros(self): 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): @@ -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") @@ -612,7 +612,7 @@ def to_c(self): + str(int(round(self.high[1]))) + ", " + str(int(round(self.height))) - + "),\n" + + ")" ) return data @@ -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) @@ -650,7 +650,7 @@ def to_c(self): + str(int(round(self.scale[2]))) + ", " + str(convertRadiansToS16(self.rotation[1])) - + "}," + + "}" ) return data @@ -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) @@ -719,7 +719,7 @@ def to_c(self): + str(int(round(self.camFocus[1]))) + ", " + str(int(round(self.camFocus[2]))) - + "}," + + "}" ) return data @@ -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()