diff --git a/fast64_internal/f3d_writer.py b/fast64_internal/f3d_writer.py index a45b0fe..a6603bf 100644 --- a/fast64_internal/f3d_writer.py +++ b/fast64_internal/f3d_writer.py @@ -300,16 +300,10 @@ def edgeValid(edgeValidDict, face, otherFace): else: return edgeValidDict[(otherFace, face)] -def getLowestUnvisitedNeighborCountFace(faces, visitedFaces, infoDict): - lowestNeighborFace = None - for face in faces: - if face not in visitedFaces: - lowestNeighborFace = face - break +def getLowestUnvisitedNeighborCountFace(unvisitedFaces, infoDict): + lowestNeighborFace = unvisitedFaces[0] lowestNeighborCount = len(infoDict['validNeighbors'][lowestNeighborFace]) - for face in faces: - if face in visitedFaces: - continue + for face in unvisitedFaces: neighborCount = len(infoDict['validNeighbors'][face]) if neighborCount < lowestNeighborCount: lowestNeighborFace = face @@ -351,10 +345,10 @@ def saveTriangleStrip(faces, convertInfo, triList, vtxList, f3d, texDimensions, transformMatrix, isPointSampled, exportVertexColors, existingVertexData, existingVertexMaterialRegions, infoDict, mesh): visitedFaces = [] + unvisitedFaces = copy.copy(faces) possibleFaces = [] lastEdgeKey = None - neighborFace = getLowestUnvisitedNeighborCountFace( - faces, visitedFaces, infoDict) + neighborFace = getLowestUnvisitedNeighborCountFace(unvisitedFaces, infoDict) triConverter = TriangleConverter(mesh, convertInfo, triList, vtxList, f3d, texDimensions, transformMatrix, isPointSampled, exportVertexColors, @@ -371,13 +365,14 @@ def saveTriangleStrip(faces, convertInfo, triList, vtxList, f3d, else: #print('get new neighbor') neighborFace = getLowestUnvisitedNeighborCountFace( - faces, visitedFaces, infoDict) + unvisitedFaces, infoDict) lastEdgeKey = None triConverter.addFace(neighborFace) if neighborFace in visitedFaces: raise ValueError("Repeated face") visitedFaces.append(neighborFace) + unvisitedFaces.remove(neighborFace) if neighborFace in possibleFaces: possibleFaces.remove(neighborFace) for otherFace in infoDict['validNeighbors'][neighborFace]: diff --git a/fast64_internal/sm64_geolayout_bone.py b/fast64_internal/sm64_geolayout_bone.py index 46f5c4e..41a2606 100644 --- a/fast64_internal/sm64_geolayout_bone.py +++ b/fast64_internal/sm64_geolayout_bone.py @@ -54,6 +54,8 @@ enumShadowType = [ ('10', 'Square Permanent', 'Square Permanent'), ('11', 'Square Scalable', 'Square Scalable'), ('12', 'Square Togglable', 'Square Togglable'), + ('50', 'Rectangle', 'Rectangle'), + ('99', 'Circle Player', 'Circle Player'), ] enumSwitchOptions = [ diff --git a/fast64_internal/sm64_geolayout_parser.py b/fast64_internal/sm64_geolayout_parser.py index b205790..3a120b5 100644 --- a/fast64_internal/sm64_geolayout_parser.py +++ b/fast64_internal/sm64_geolayout_parser.py @@ -6,6 +6,7 @@ import copy from math import pi from .sm64_level_parser import * +from .sm64_geolayout_bone import enumShadowType from .sm64_geolayout_constants import * from .sm64_geolayout_utility import * from .f3d_parser import * @@ -929,6 +930,13 @@ def parseShadow(romfile, currentAddress, currentTransform, romfile.seek(currentAddress) command = romfile.read(commandSize) shadowType = int.from_bytes(command[2:4], 'big') + if str(shadowType) not in enumShadowType: + if shadowType > 12 and shadowType < 50: # Square Shadow + shadowType = 12 + elif shadowType > 50 and shadowType < 99: # Rectangle Shadow + shadowType = 50 + else: # Invalid shadow + shadowType = 0 shadowSolidity = int.from_bytes(command[4:6], 'big') shadowScale = int.from_bytes(command[6:8], 'big')