def convert_sound_shape(sound_shape: SoundShape) -> TerrySoundShape:
    terry_sound_shape = TerrySoundShape()
    terry_sound_shape.key = sound_shape.key
    terry_sound_shape.type = sound_shape.type
    if terry_sound_shape.type != "SST_RIVER":
        terry_sound_shape.ectransform = ECTransform(sound_shape.points[0],
                                                    Rotation3D(0, 0, 0),
                                                    Scale3D(1, 1, 1))
        position_x = sound_shape.points[0].x
        position_y = sound_shape.points[0].y
        position_z = sound_shape.points[0].z
        # subtract position from poluline points
        if terry_sound_shape.type == "SST_MULTI_POINT":
            terry_sound_shape.points_cloud = []
            for i in sound_shape.points:
                x = i.x - sound_shape.points[0].x
                y = i.y - sound_shape.points[0].y
                z = i.z - sound_shape.points[0].z
                point = Point3D(x, y, z)
                terry_sound_shape.points_cloud.append(point)
        else:
            terry_sound_shape.points = []
            for i in sound_shape.points:
                x = i.x - position_x
                y = i.z - position_z
                point = Point2D(x, y)
                terry_sound_shape.points.append(point)

    terry_sound_shape.radius = sound_shape.outer_radius

    return terry_sound_shape
Exemplo n.º 2
0
def read_capture_location(file):
    capture_location = CaptureLocation()
    capture_location.location = (float4(file), float4(file))
    capture_location.radius = float4(file)
    capture_location.valid_for_min_num_players = int4(file)
    capture_location.valid_for_max_num_players = int4(file)
    capture_location.capture_point_type = string(file)
    location_points = int4(file)
    capture_location.location_points_list = []
    for l in range(location_points):
        point = Point2D(float4(file), float4(file))
        capture_location.location_points_list.append(point)
    capture_location.database_key = string(file)
    capture_location.flag_facing = (float4(file), float4(file))
    building_links_amount = int4(file)
    capture_location.building_links = []
    for l in range(building_links_amount):
        building_link = CaptureLocationBuildingLink()
        building_link.version = int2(file)
        building_link.building_index = int4(file)
        building_link.prefab_index = int4(file)
        building_link.link = string(file)
        capture_location.building_links.append(building_link)

    return capture_location
def read_otline(file):
    point_amount = int4(file)
    outline = Outline()
    outline.points = []
    for i in range(point_amount):
        point = Point2D(float4(file), float4(file))
        outline.points.append(point)

    return outline
Exemplo n.º 4
0
def read_polygone(file):
    polygone = Polygone
    polygone.points_amount = int4(file)
    polygone.points = []
    for i in range(polygone.points_amount):
        point = Point2D(float4(file), float4(file))
        polygone.points.append(point)

    return polygone
Exemplo n.º 5
0
def read_boundary(file):
    boundary = Boundary()
    boundary.type = string(file)
    positions = int4(file)
    boundary.positions = []
    for i in range(positions):
        position = Point2D(float4(file), float4(file))
        boundary.positions.append(position)

    return boundary
Exemplo n.º 6
0
def read_polyline(file):
    polyline = PolyLine
    version = int2(file)
    polyline.type = string(file)
    points_amount = int4(file)
    polyline.points = []
    for i in range(points_amount):
        point = Point2D(float4(file), float4(file))
        polyline.points.append(point)

    return polyline
def convert_outline_to_polyline(outline: Outline):
    position_x = outline.points[0].x
    position_z = outline.points[0].y
    polyline = ECPolyline()
    polyline.closed = True
    polyline.polyline = []
    for point in outline.points:
        polyline.polyline.append(
            Point2D((point.x - position_x), (point.y - position_z)))
    position = Point3D(position_x, 0, position_z)

    return polyline, position
Exemplo n.º 8
0
def read_zone_template(file):
    zone_template = ZoneTemplate()
    points_amount = int4(file)
    outline = Outline()
    for i in range(points_amount):
        outline.points.append(Point2D(float4(file), float4(file)))
    zone_template.outline = outline
    # <zone_name> <entity_formation_template name=''> and <lines/>
    file.read(8)
    # transformation matrix
    zone_template.transformation = read_transform_n_x_m(file, 4, 4)

    return zone_template
def convert_custom_material_mesh(
        custom_material_mesh: CustomMaterialMesh) -> TerryCustomMaterialMesh:
    terry_custom_material_mesh = TerryCustomMaterialMesh()
    terry_custom_material_mesh.polyline = []
    terry_custom_material_mesh.material = custom_material_mesh.material
    # calculate tranform from first vertex
    terry_custom_material_mesh.ectransform = ECTransform(
        custom_material_mesh.vertices[0], Rotation3D(0, 0, 0),
        Scale3D(1, 1, 1))
    # subtract position from poluline points
    for i in custom_material_mesh.vertices:
        x = i.x - custom_material_mesh.vertices[0].x
        y = i.z - custom_material_mesh.vertices[0].z
        point = Point2D(x, y)
        # print(point.__dict__)
        terry_custom_material_mesh.polyline.append(point)

    return terry_custom_material_mesh