Example #1
0
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.vertexCount = filereader.read_uint32()

        self.vertices = []
        for _ in range(self.vertexCount):
            self.vertices.append(filereader.read_vec_f(3))

        self.normalCount = filereader.read_uint32()

        self.normals = []
        self.faceDistancesFromOrigin = []

        for _ in range(self.normalCount):
            self.normals.append(filereader.read_vec_f(3))
            self.faceDistancesFromOrigin.append(filereader.read_float())

        self.faceCount = filereader.read_uint32()

        self.faces = []
        for _ in range(self.faceCount):
            faceObject = RSMAPCollisionFaceInformation()
            faceObject.read(filereader)
            self.faces.append(faceObject)

        self.collisionMeshDefinitionsCount = filereader.read_uint32()
        self.collisionMeshDefinitions = []
        for _ in range(self.collisionMeshDefinitionsCount):
            dataObject = RSMAPCollisionMesh()
            dataObject.read(filereader)
            self.collisionMeshDefinitions.append(dataObject)
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.lightSize: int = filereader.read_uint32()
        self.id: int = filereader.read_uint32()

        #Some maps store a version string, others don't, not quite sure why. Also makes unknown6 quite unclear as to whether they are separate fields or not
        self.name_string: SizedCString = SizedCString(filereader)
        if self.name_string.string == "Version":
            self.version_string: SizedCString = self.name_string
            self.versionNumber: int = filereader.read_uint32()

            self.name_string = SizedCString(filereader)
            self.unknown6: int = filereader.read_uint32()
        else:
            self.unknown7: bytes = filereader.read_bytes(3)

        #3x3 matrix = 9 elements
        self.transformMatrix: List[float] = filereader.read_vec_f(9)

        self.position: List[float] = filereader.read_vec_f(3)
        self.color: List[int] = filereader.read_vec_uint32(3)
        self.constantAttenuation: float = filereader.read_float()
        self.linearAttenuation: float = filereader.read_float()
        self.quadraticAttenuation: float = filereader.read_float()
        #maybe?
        self.falloff: float = filereader.read_float()
        self.energy: float = filereader.read_float()
        self.type: int = filereader.read_bytes(1)[0]
Example #3
0
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.id: int = filereader.read_uint32()
        self.version_string: SizedCString = SizedCString(filereader)
        self.versionNumber: int = filereader.read_uint32()

        self.name_string: SizedCString = SizedCString(filereader)

        self.unknown1: int = filereader.read_bytes(1)[0]  #A
        self.unknown2: int = filereader.read_bytes(1)[0]  #B
        self.unknown3: int = filereader.read_bytes(1)[0]  #C
        if self.unknown1 == 0:
            self.unknown4: int = filereader.read_bytes(1)[0]  #D

        if self.unknown3 == 1:
            self.unknown5: List[float] = filereader.read_vec_f(6)

        if self.unknown1 == 0 and self.unknown4 == 1:
            self.unknown6: List[float] = filereader.read_vec_f(6)

        self.shermanLevelCount: int = filereader.read_uint32()
        self.shermanLevels: List[RSMAPShermanLevelDefinition] = []
        for _ in range(self.shermanLevelCount):
            newObject = RSMAPShermanLevelDefinition()
            newObject.read(filereader)
            self.shermanLevels.append(newObject)

        self.unknown4Count: int = filereader.read_uint32()

        self.unknown7: float = filereader.read_float()
        self.unknown8: List[List[float]] = []
        for _ in range(self.unknown4Count):
            newUnknown8 = filereader.read_vec_f(2)
            self.unknown8.append(newUnknown8)
Example #4
0
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        #3x3 matrix = 9 elements
        self.transformMatrix: List[float] = filereader.read_vec_f(9)
        self.position: List[float] = filereader.read_vec_f(3)
        self.unknown2: List[float] = filereader.read_vec_f(6)  #size?
Example #5
0
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.normal = filereader.read_vec_f(3)
        self.UV = filereader.read_vec_f(2)
        self.unknown10 = filereader.read_float()  # no idea?
        self.color = filereader.read_rgb_color_24bpp_uint()
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.id: int = filereader.read_uint32()
        self.version_string: SizedCString = SizedCString(filereader)
        self.versionNumber: int = filereader.read_uint32()

        self.name_string: SizedCString = SizedCString(filereader)

        self.unknown1: int = filereader.read_bytes(1)[0]
        self.unknown2: int = filereader.read_bytes(1)[0]
        if self.unknown1 == 0:
            self.unknown3: int = filereader.read_bytes(1)[0]

        self.shermanLevelCount: int = filereader.read_uint32()
        self.shermanLevels: List[R6MAPShermanLevelDefinition] = []
        for _ in range(self.shermanLevelCount):
            newObject = R6MAPShermanLevelDefinition()
            newObject.read(filereader)
            self.shermanLevels.append(newObject)

        self.transitionCount: int = filereader.read_uint32()
        self.transitions: List[R6MAPShermanLevelTransitionDefinition] = []
        for _ in range(self.transitionCount):
            tempTransition = R6MAPShermanLevelTransitionDefinition()
            tempTransition.read(filereader)
            self.transitions.append(tempTransition)

        self.levelHeightsCount: int = filereader.read_uint32()
        self.levelHeights: List[float] = filereader.read_vec_f(
            self.levelHeightsCount * 2)

        self.unknown5Count: int = filereader.read_uint32()
        self.unknown5: List[float] = filereader.read_vec_f(self.unknown5Count)
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.name_string: SizedCString = SizedCString(filereader)
        self.AABB: List[float] = filereader.read_vec_f(6)

        self.unknown2Count: int = filereader.read_uint32()
        self.unknown2: List[float] = filereader.read_vec_f(self.unknown2Count)

        self.hasShermanLevelPlanArea: int = filereader.read_bytes(1)[0]
        if self.hasShermanLevelPlanArea == 1:
            self.shermanLevelPlanArea: R6MAPShermanLevelPlanAreaDefinition = R6MAPShermanLevelPlanAreaDefinition(
            )
            self.shermanLevelPlanArea.read(filereader)
Example #8
0
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.FileID: int = filereader.read_uint32()
        self.AmbientLightColor: List[float] = filereader.read_vec_f(4)
        self.unknown5: int = filereader.read_uint32()
        self.lightCount: int = filereader.read_uint32()
Example #9
0
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.vertexIndices: List[int] = filereader.read_vec_uint32(3)
        self.paramIndices: List[int] = filereader.read_vec_uint32(3)
        self.faceNormal: List[float] = filereader.read_vec_f(4)
        self.materialIndex: int = filereader.read_uint32()
Example #10
0
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.materialIndex: int = filereader.read_uint32()

        self.faceCount: int = filereader.read_uint32()

        self.faceNormals: List[List[float]] = []
        self.faceDistancesFromOrigin: List[float] = []

        for _ in range(self.faceCount):
            self.faceNormals.append(filereader.read_vec_f(3))
            self.faceDistancesFromOrigin.append(filereader.read_float())

        self.faceVertexIndices: List[List[int]] = []
        for _ in range(self.faceCount):
            self.faceVertexIndices.append(filereader.read_vec_uint16(3))

        self.faceVertexParamIndices: List[List[int]] = []
        for _ in range(self.faceCount):
            self.faceVertexParamIndices.append(filereader.read_vec_uint16(3))

        self.vertexParams: RSMAPVertexParameterCollection = RSMAPVertexParameterCollection(
        )
        self.vertexParams.read(filereader)
Example #11
0
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.vertexParamCount: int = filereader.read_uint32()

        self.normals: List[List[float]] = []
        for _ in range(self.vertexParamCount):
            self.normals.append(filereader.read_vec_f(3))

        self.UVs: List[List[float]] = []
        for _ in range(self.vertexParamCount):
            self.UVs.append(filereader.read_vec_f(2))

        self.colors: List[List[float]] = []
        for _ in range(self.vertexParamCount):
            self.colors.append(filereader.read_vec_f(4))
Example #12
0
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.name_string: SizedCString = SizedCString(filereader)
        log.debug(self.name_string.string)

        self.coords: List[float] = filereader.read_vec_f(6)
Example #13
0
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.parent_room_string: SizedCString = SizedCString(filereader)

        self.name_string: SizedCString = SizedCString(filereader)
        if self.name_string.string == "Version":
            self.version_string: SizedCString = self.name_string
            self.versionNumber: int = filereader.read_uint32()
            self.name_string = SizedCString(filereader)

            self.unknown6: int = filereader.read_bytes(1)[0]

        self.lightType: int = filereader.read_uint32()
        self.direction: List[float] = filereader.read_vec_f(3)
        self.position: List[float] = filereader.read_vec_f(3)
        self.falloff: float = filereader.read_float()
        self.unknown2: List[float] = filereader.read_vec_f(2)
        self.unknown3: List[float] = filereader.read_vec_f(3)

        self.energy: float = filereader.read_float()
        self.diffuseColor: List[float] = filereader.read_vec_f(4)
        self.specularColor: List[float] = filereader.read_vec_f(4)
        self.ambientColor: List[float] = filereader.read_vec_f(4)
        self.constantAttenuation: float = filereader.read_float()
        self.linearAttenuation: float = filereader.read_float()
        self.quadraticAttenuation: float = filereader.read_float()
        self.spotlightConeAngle: float = filereader.read_float()
        self.type: int = filereader.read_bytes(1)[0]
Example #14
0
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.name_string: SizedCString = SizedCString(filereader)
        self.transformCount: int = filereader.read_uint32()  # ACount
        self.transforms: List[RSMAPShermanLevelTransformInformation] = []
        for _ in range(self.transformCount):
            transformObj = RSMAPShermanLevelTransformInformation()
            transformObj.read(filereader)
            self.transforms.append(transformObj)

        self.unknown3Count: int = filereader.read_uint32()
        self.unknown3: List[float] = filereader.read_vec_f(self.unknown3Count)

        self.unknown4: int = filereader.read_bytes(1)[0]
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.unknown1: int = filereader.read_uint32()
        self.id: int = filereader.read_uint32()

        self.name_string: SizedCString = SizedCString(filereader)
        if self.name_string.string == "Version":
            self.version_string: SizedCString = self.name_string
            self.versionNumber: int = filereader.read_uint32()
            self.name_string = SizedCString(filereader)

        self.unknown2_bytes: bytes = filereader.read_bytes(4)  #ABCD
        self.unknown3: int = filereader.read_uint32()  #U

        self.vertexCount: int = filereader.read_uint32()
        self.vertices: List[List[float]] = []  #coordinate
        for _ in range(self.vertexCount):
            self.vertices.append(filereader.read_vec_f(3))

        self.vertexParamCount: int = filereader.read_uint32()
        self.vertexParams: List[R6VertexParameterCollection] = []  #coordinate2
        for _ in range(self.vertexParamCount):
            newParams = R6VertexParameterCollection()
            newParams.read(filereader)
            self.vertexParams.append(newParams)

        self.faceCount: int = filereader.read_uint32()
        self.faces: List[R6FaceDefinition] = []  #coordinate3
        for _ in range(self.faceCount):
            newFace = R6FaceDefinition()
            newFace.read(filereader)
            self.faces.append(newFace)
        self.unknown5: int = filereader.read_uint32()
        self.unknown6: int = filereader.read_uint32()

        self.unknown_7_string: SizedCString = SizedCString(filereader)

        self.unknown8: int = filereader.read_uint32()
        self.faceIndicesCount: int = filereader.read_uint32()
        self.faceIndices: List[int] = filereader.read_vec_uint32(
            self.faceIndicesCount)

        self.unknown10: int = filereader.read_uint32()
        self.unknown_11_string: SizedCString = SizedCString(filereader)
        self.unknown12: int = filereader.read_uint32()
Example #16
0
    def read(self, filereader: BinaryFileReader):
        super().read(filereader)

        self.portalSize: int = filereader.read_uint32()
        self.id: int = filereader.read_uint32()

        self.version_string: SizedCString = SizedCString(filereader)
        self.versionNumber: int = filereader.read_uint32()

        self.name_string: SizedCString = SizedCString(filereader)

        self.vertexCount: int = filereader.read_uint32()
        self.vertices: List[List[float]] = []
        for _ in range(self.vertexCount):
            self.vertices.append(filereader.read_vec_f(3))

        self.roomA: int = filereader.read_uint32()
        self.roomB: int = filereader.read_uint32()
Example #17
0
 def read_vertices(self, filereader: BinaryFileReader):
     """ Reads a count of the number of vertices, followed by the list of vertices """
     self.vertexCount = filereader.read_uint32()
     self.vertices = []
     for _ in range(self.vertexCount):
         self.vertices.append(filereader.read_vec_f(3))
Example #18
0
 def read_vertices(self, filereader: BinaryFileReader):
     """Reads the list of vertices from the file"""
     self.vertexCount = filereader.read_uint32()
     self.vertices: List[List[float]] = []
     for _ in range(self.vertexCount):
         self.vertices.append(filereader.read_vec_f(3))