コード例 #1
0
def read_deployment_list(file: BinaryIO):
    version = int2(file)  # version
    amount = int4(file)
    deployment_list = []
    for i in range(amount):
        deployment_area_version = int2(file)
        deployment_list.append(read_deployment_area(file))

    return deployment_list
コード例 #2
0
def read_terrain_stencil_triangle_list(file: BinaryIO):
    version = int2(file)  # version
    amount = int4(file)
    terrain_stencil_triangle_list = []
    for i in range(amount):
        terrain_stencil_triangle_version = int2(file)
        terrain_stencil_triangle_list.append(
            read_terrain_stencil_triangle(file))

    return terrain_stencil_triangle_list
コード例 #3
0
def read_bmd_catchment_area_list(file: BinaryIO):
    version = int2(file)  # version
    amount = int4(file)
    for i in range(amount):
        bmd_catchment_area_version = int2(file)
        bmd_catchment_area_name = string(file)
        some_floats = (float4(file), float4(file), float4(file), float4(file))
        file.read(10)
        # print(bmd_catchment_area_version, bmd_catchment_area_name, some_floats)
    # assert int4(file) == 0, "BMD_CATCHMENT_AREA_LIST has items"
コード例 #4
0
def read_sound_shape_common(file):
    sound_shape = SoundShape()
    sound_shape.key = string(file)
    sound_shape.type = string(file)
    points = int4(file)
    sound_shape.points = []
    for j in range(points):
        point = Point3D(float4(file), float4(file), float4(file))
        sound_shape.points.append(point)
    sound_shape.inner_radius = float4(file)
    sound_shape.outer_radius = float4(file)
    sound_shape.inner_cube = Cube(float4(file), float4(file), float4(file),
                                  float4(file), float4(file), float4(file))
    sound_shape.outer_cube = Cube(float4(file), float4(file), float4(file),
                                  float4(file), float4(file), float4(file))
    river_nodes_amount = int4(file)
    sound_shape.river_nodes = []
    for i in range(river_nodes_amount):
        river_node_version = int2(file)
        sound_shape.river_nodes.append(
            river_node_versions.get_reader(river_node_version)(file))
    sound_shape.clamp_to_surface = bool1(file)
    sound_shape.height_mode = string(file)
    sound_shape.campaign_type_mask = int4(file)

    return sound_shape
コード例 #5
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
コード例 #6
0
def read_building_v8(file):
    building = Building()
    building.flags = {}
    building.building_id = string(file)
    building.parent_id = int2(file)
    building.building_key = string(file)
    building.position_type = string(file)
    building.transform = read_transform_n_x_m(file, 4, 3)

    property_version = int2(file)
    building.properties = building_property_versions.get_reader(
        property_version)(file)

    building.height_mode = string(file)

    #print(building.__dict__)
    return building
コード例 #7
0
def read_capture_location_set(file: BinaryIO):
    version = int2(file)  # version
    capture_locations_lists = int4(file)
    capture_locations_set = []
    for i in range(capture_locations_lists):
        capture_locations_set.append(read_capture_location_list(file))

    return capture_locations_set
コード例 #8
0
def read_prefab_instance_list(file: BinaryIO):
    version = int2(file)  # version
    prefab_amount = int4(file)
    prefab_instance_list = []
    for i in range(prefab_amount):
        prefab_instance_list.append(read_prefab_instance(file))

    return prefab_instance_list
コード例 #9
0
def read_boundary_list(file):
    boundary_list = []
    amount = int4(file)
    for i in range(amount):
        boundary_version = int2(file)
        boundary_list.append(read_boundary(file))

    return boundary_list
コード例 #10
0
def read_deployment_area(file):
    deployment_area = DeploymentArea()
    deployment_area.category = string(file)
    deployment_zones_amount = int4(file)
    deployment_area.deployment_zone_regions = []
    for i in range(deployment_zones_amount):
        deployment_zone_region_version = int2(file)
        deployment_area.deployment_zone_regions.append(read_deployment_zone_region(file))

    return deployment_area
コード例 #11
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
コード例 #12
0
def read_particle_flags(file):
    assert_version('PARTICLE_EMITTER->flags', 2, int2(file))
    return {
        'allow_in_outfield': bool1(file),
        'clamp_to_surface': bool1(file),
        'clamp_to_water_surface': bool1(file),
        'spring': bool1(file),
        'summer': bool1(file),
        'autumn': bool1(file),
        'winter': bool1(file)
    }
コード例 #13
0
def read_deployment_zone_region(file):
    deployment_zone_region = DeploymentZoneRegion()

    boundary_list_amount = int4(file)
    deployment_zone_region.boundary_list = []
    for i in range(boundary_list_amount):
        boundary_version = int2(file)
        deployment_zone_region.boundary_list.append(read_boundary_list(file))
    deployment_zone_region.orientation = float4(file)
    deployment_zone_region.snap_facing = bool1(file)
    deployment_zone_region.id = int4(file)

    return deployment_zone_region
コード例 #14
0
ファイル: prop_list.py プロジェクト: SeregaMamonT/wh-to-ue4
def read_prop_list(file: BinaryIO):
    assert_version('PROP_LIST', 2, int2(file))
    keys = read_list(file, read_prop_key_instance)
    props = read_list(file, read_prop_instance)
    result = {}
    for key in keys:
        result[key] = []
    for prop in props:
        key = keys[prop.key_index]
        prop.key = key
        result[key].append(prop)

    return result
コード例 #15
0
def read_building_v11(file):
    building = Building()
    building.flags = {}
    building.building_id = string(file)
    building.parent_id = int2(file)
    some_unknown_flag = int2(file)
    building.building_key = string(file)
    print(building.building_key)
    building.position_type = string(file)
    print(building.position_type)
    building.transform = read_transform_n_x_m(file, 4, 3)
    print(building.transform)
    property_version = int2(file)
    building.properties = building_property_versions.get_reader(
        property_version)(file)

    building.height_mode = string(file)
    print(building.height_mode)
    #print(building.__dict__)
    # extra 8 bytes in the end of building
    file.read(8)
    return building
コード例 #16
0
def read_prefab(file: BinaryIO, global_context):
    global context
    context = global_context

    file.read(8)  # FASTBIN0
    root_version = int2(file)
    if root_version not in context:
        context.append(root_version)
    if root_version == 23 or root_version == 24:
        prefab = Prefab()
        prefab.buildings = read_building_list(file)
        read_building_list_far(file)
        prefab.capture_locations = read_capture_location_set(file)
        read_ef_line_list(file)
        prefab.go_outlines = read_go_outlines(file)
        prefab.non_terrain_outlines = read_non_terrain_outlines(file)
        prefab.zones_templates = read_zones_template_list(file)
        prefab.prefab_instances = read_prefab_instance_list(file)
        read_bmd_outline_list(file)
        read_terrain_outlines(file)
        read_lite_building_outlines(file)
        read_camera_zones(file)
        read_civilian_deployment_list(file)
        read_civilian_shelter_list(file)
        prefab.props = read_prop_list(file)
        prefab.particles = read_particle_list(file)
        prefab.ai_hints = read_ai_hints(file)
        prefab.light_probes = read_light_probe_list(file)
        prefab.terrain_stencil_triangle = read_terrain_stencil_triangle_list(file)
        prefab.point_lights = read_point_light_list(file)
        prefab.building_projectile_emitters = read_building_projectile_emitter_list(file)
        prefab.playable_area = read_playable_area(file)
        #print(print_prefab_stats(prefab))

        return prefab
    if root_version == 26:
        print(root_version, 'in progress')
        prefab = Prefab()
        prefab.buildings = read_building_list(file)
        read_building_list_far(file)
        prefab.capture_locations = read_capture_location_set(file)
        read_ef_line_list(file)
        prefab.go_outlines = read_go_outlines(file)
        prefab.non_terrain_outlines = read_non_terrain_outlines(file)
        prefab.zones_templates = read_zones_template_list(file)
        prefab.prefab_instances = read_prefab_instance_list(file)
        #print(print_prefab_stats(prefab))


    else:
        raise Exception('Only versions 23, 24 of root are supported')
コード例 #17
0
def read_playable_area_v3(file):
    playable_area = PlayableArea()
    playable_area.min_x = float4(file)
    playable_area.min_y = float4(file)
    playable_area.max_x = float4(file)
    playable_area.max_y = float4(file)
    playable_area.has_been_set = bool1(file)
    valid_location_flags_version = int2(file)
    playable_area.flags = {}
    playable_area.flags["valid_north"] = bool1(file)
    playable_area.flags["valid_south"] = bool1(file)
    playable_area.flags["valid_east"] = bool1(file)
    playable_area.flags["valid_west"] = bool1(file)

    return playable_area
コード例 #18
0
def read_custom_material_mesh_v2(file):
    custom_material_mesh = CustomMaterialMesh()
    vertices_amount = int4(file)
    custom_material_mesh.vertices = []
    for i in range(vertices_amount):
        vertex = Point3D(float4(file), float4(file), float4(file))
        custom_material_mesh.vertices.append(vertex)
    indices_amount = int4(file)
    custom_material_mesh.indices = []
    for i in range(indices_amount):
        custom_material_mesh.indices.append(int2(file))
    custom_material_mesh.material = string(file)
    custom_material_mesh.height_mode = string(file)

    return custom_material_mesh
コード例 #19
0
def read_map(file: BinaryIO, global_context):
    global context
    context = global_context

    file.read(8)  # FASTBIN0
    root_version = int2(file)
    if root_version not in context:
        context.append(root_version)
    if root_version == 23 or root_version == 24:
        map = MapData()
        map.buildings = read_building_list(file)
        read_building_list_far(file)
        map.capture_locations = read_capture_location_set(file)
        read_ef_line_list(file)
        map.go_outlines = read_go_outlines(file)
        map.non_terrain_outlines = read_non_terrain_outlines(file)
        map.zones_templates = read_zones_template_list(file)
        map.prefab_instances = read_prefab_instance_list(file)
        read_bmd_outline_list(file)
        read_terrain_outlines(file)
        read_lite_building_outlines(file)
        read_camera_zones(file)
        read_civilian_deployment_list(file)
        read_civilian_shelter_list(file)
        map.props = read_prop_list(file)
        map.particles = read_particle_list(file)
        map.ai_hints = read_ai_hints(file)
        map.light_probes = read_light_probe_list(file)
        map.terrain_stencil_triangle = read_terrain_stencil_triangle_list(file)
        map.point_lights = read_point_light_list(file)
        map.building_projectile_emitters = read_building_projectile_emitter_list(file)
        map.playable_area = read_playable_area(file)

        # only for map
        map.custom_material_meshes = read_custom_material_mesh_list(file)
        read_terrain_stencil_blend_triangle_list(file)
        map.spot_lights = read_spot_light_list(file)
        map.sound_shapes = read_sound_shape_list(file)
        map.composite_scenes = read_composite_scene_list(file)
        map.deployment = read_deployment_list(file)
        read_bmd_catchment_area_list(file)
        # print('Hooray it did not crash!')

        print_map_stats(map)

        return map
    else:
        raise Exception('Only versions 2, 23, 24 of root are supported')
コード例 #20
0
def read_prefab_instance(file):
    prefab_instance = PrefabInstance()
    prefab_version = int2(file)
    prefab_instance.name = string(file)
    prefab_instance.transformation = read_transform_n_x_m(file, 4, 4)
    # print(prefab_instance.transform)
    property_overrides = int4(file)
    # print('Property overrides: ', property_overrides)
    for j in range(property_overrides):
        file.read(2)
        property_value = string(file)
        # print(property_value)
        file.read(14)
    file.read(7)
    prefab_instance.height_mode = string(file)

    return prefab_instance
コード例 #21
0
ファイル: prop_list.py プロジェクト: SeregaMamonT/wh-to-ue4
def read_prop_instance_common(file):
    prop = Prop()
    prop.key_index = int2(file)
    file.read(2)  # TODO
    prop.transform = read_transform_n_x_m(file, 4, 3)
    prop.decal = bool1(file)
    file.read(7)  # flags from logic_decal to animated
    prop.decal_parallax_scale = float4(file)
    # print('Decal parallax: ', prop.decal_parallax_scale)
    prop.decal_tiling = float4(file)
    # print('Decal tiling: ', prop.decal_tiling)
    decal_override_gbuffer_normal = bool1(file)
    prop.flags = read_flags(file)
    prop.flags["decal_override_gbuffer_normal"] = decal_override_gbuffer_normal
    prop.flags["visible_in_shroud"] = bool1(file)
    prop.flags["decal_apply_to_terrain"] = bool1(file)
    prop.flags["decal_apply_to_gbuffer_objects"] = bool1(file)
    prop.flags["decal_render_above_snow"] = bool1(file)
    prop.height_mode = string(file)

    return prop
コード例 #22
0
def read_ai_hints(file: BinaryIO):
    version = int2(file)  # version
    # print('Version: ', version)
    ai_hints = AiHint()

    ai_hints.separators = []

    # separators
    separators_version = int2(file)
    separators_amount = int4(file)
    for i in range(separators_amount):
        ai_hints.separators.append(read_polyline(file))

    # directed_points
    directed_points_version = int2(file)
    directed_points_amount = int4(file)

    # polylines
    polylines_version = int2(file)
    polylines_amount = int4(file)

    polylines = []
    ai_hints.polylines = []
    for i in range(polylines_amount):
        ai_hints.polylines.append(read_polyline(file))

    # polylines list

    polylines_list_version = int2(file)
    polylines_list_amount = int4(file)

    ai_hints.polylines_list_list = []
    for i in range(polylines_list_amount):
        poly_lines_list = PolyLineList()

        hint_polylines_version = int2(file)
        poly_lines_list.type = string(file)
        polygons_amount = int4(file)
        poly_lines_list.polygons = []
        for j in range(polygons_amount):
            poly_lines_list.polygons.append(read_polygone(file))

    return ai_hints
コード例 #23
0
def read_custom_material_mesh_list(file: BinaryIO):
    assert_version('CUSTOM_MATERIAL_MESH_LIST', 1, int2(file))
    return read_list(file, read_custom_material_mesh)
コード例 #24
0
def read_custom_material_mesh(file):
    custom_material_mesh_version = int2(file)
    return custom_material_mesh_versions.get_reader(
        custom_material_mesh_version)(file)
コード例 #25
0
def read_building_projectile_emitter(file):
    building_projectile_emitter_version = int2(file)
    return building_projectile_emitter_versions.get_reader(
        building_projectile_emitter_version)(file)
コード例 #26
0
def read_building_projectile_emitter_list(file: BinaryIO):
    assert_version('BUILDING_PROJECTILE_EMITTER_LIST', 1, int2(file))
    return read_list(file, read_building_projectile_emitter)
コード例 #27
0
def read_bmd_outline_list(file: BinaryIO):
    version = int2(file)  # version
    # print(version)
    assert int4(file) == 0, "BMD_OUTLINE_LIST has items"
コード例 #28
0
def read_sound_shape_list(file: BinaryIO):
    version = int2(file)  # version
    return read_list(file, read_sound_shape)
コード例 #29
0
def read_zones_template_list(file: BinaryIO):
    assert_version('ZONES_TEMPLATE_LIST', 1, int2(file))

    return read_list(file, read_zone_template)
コード例 #30
0
def read_sound_shape(file):
    sound_shape_version = int2(file)
    return sound_shape_versions.get_reader(sound_shape_version)(file)