Fixed issues with bit packing OOT collision values.

This commit is contained in:
kurethedead
2021-02-20 08:19:42 -08:00
parent 936b12d771
commit f64e672404
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -215,7 +215,7 @@ class OOTPolygonType:
(self.exitID << 8) |\
(self.cameraID << 0)
return convertIntTo2sComplement(value, 4)
return convertIntTo2sComplement(value, 4, False)
def convertLow(self):
value = ((1 if self.isWallDamage else 0) << 27) |\
@@ -227,7 +227,7 @@ class OOTPolygonType:
(int(self.terrain, 16) << 4) |\
(int(self.sound, 16) << 0)
return convertIntTo2sComplement(value, 4)
return convertIntTo2sComplement(value, 4, False)
class OOTCollision:
def __init__(self, ownerName):
@@ -303,7 +303,7 @@ class OOTWaterBox(BoxEmpty):
value = (int(self.roomIndex) << 13) |\
(self.lightingSetting << 8) |\
(self.cameraSetting << 0)
return convertIntTo2sComplement(value, 4)
return convertIntTo2sComplement(value, 4, False)
class OOTCameraData:
def __init__(self, ownerName):
@@ -526,7 +526,7 @@ def addCollisionTriangles(obj, collisionDict, includeChildren, transformMatrix,
faceNormal[0] * planePoint[0] + \
faceNormal[1] * planePoint[1] + \
faceNormal[2] * planePoint[2])))
distance = convertIntTo2sComplement(distance, 2)
distance = convertIntTo2sComplement(distance, 2, True)
nx = (y2 - y1) * (z3 - z2) - (z2 - z1) * (y3 - y2)
ny = (z2 - z1) * (x3 - x2) - (x2 - x1) * (z3 - z2)
+2 -2
View File
@@ -232,8 +232,8 @@ def getCustomProperty(data, prop):
value = getattr(data, prop)
return value if value != "Custom" else getattr(data, prop + str("Custom"))
def convertIntTo2sComplement(value, length):
return int.from_bytes(int(round(value)).to_bytes(length, 'big', signed = True), 'big')
def convertIntTo2sComplement(value, length, signed):
return int.from_bytes(int(round(value)).to_bytes(length, 'big', signed = signed), 'big')
def drawEnumWithCustom(panel, data, attribute, name, customName):
prop_split(panel, data, attribute, name)