def read(data: ScnDataReader): data.boolean8(debug="border_enabled") data.boolean8(debug="border_random") data.string_fixed(size=13, debug='border_name') data.string_fixed(size=13, debug='border_texture_name') # Maybe read as int and test agains -1? data.int32(debug='border_slp_id') data.int32(debug='border_slp_pointer') data.int32(debug='border_sound_id') data.uint8(debug='border_minimap_color_high') data.uint8(debug='border_minimap_color_medium') data.uint8(debug='border_minimap_color_low') # Same as terrain animation data.boolean8(debug='border_manimation_enabled') data.int16(debug='border_anim_num_frames') data.int16(debug='border_anim_num_pause_frames') data.float32(debug='border_anim_frame_interval') data.float32(debug='border_anim_replay_delay') data.int16(debug='border_anim_frame') data.int16(debug='border_anim_draw_frame') data.float32(debug='border_anim_animate_last') data.boolean8(debug='border_anim_frame_changed') data.boolean8(debug='border_anim_drawn') for j in range(0, 19): for k in range(0, 12): data.uint16(debug="border_elevation_sprite_frames {} {}".format(j, k)) # frames data.uint16(debug="border_elevation_sprite_facets {} {}".format(j, k)) # facets data.uint16(debug="border_elevation_sprite_rame_id {} {}".format(j, k)) # frame_id data.int8(debug='border_draw_tile') data.uint8(debug='padding') data.int16(debug='border_underlay_terrain') data.int16(debug='border_style') return TerrainBorder()
def read(data: ScnDataReader): id = data.uint32(debug='random_map_id') terrain_type = data.uint8(debug='random_map_terrain_type') _padding1 = data.uint16(debug='random_map_padding1') _padding2 = data.uint8(debug='random_map_padding2') spacing = data.int32(debug='random_map_spacing') base_square_radius = data.int32(debug='random_map_base_square_radius') zone = data.int8(debug='random_map_zone') placement_type = data.int8(debug='random_map_placement_type') _padding3 = data.uint16(debug='random_map_padding3') land_x = data.int32(debug='random_map_land_x') land_y = data.int32(debug='random_map_land_y') amount_of_land_used_percent = data.int8(debug='random_map_amount_of_land_used_percent') land_by_player_flag = data.int8(debug='random_map_land_by_player_flag') _padding4 = data.uint16(debug='random_map_padding4') radius = data.int32(debug='random_map_radius') fade = data.int32(debug='random_map_fade') clumpiness_factor = data.int32(debug='random_map_clumpiness_factor') return RandomMapLand( id, terrain_type, spacing, base_square_radius, zone, placement_type, land_x, land_y, amount_of_land_used_percent, land_by_player_flag, radius, fade, clumpiness_factor )
def read_missile_unit(data: ScnDataReader): base_props = read_base_unit_props(data) animated_props = read_animated_unit_props(data) moving_unit_props = read_moving_unit_props(data) action_unit_props = read_action_unit_props(data) base_combat_unit_props = read_base_combat_unit_props(data) data.int8(debug='unknown') data.int32(debug='unknown') data.float32(debug='unknown')
def read(data: ScnDataReader): unit_type = data.uint32() terrain_type = data.int32() group_flag = data.int8() scale_flag = data.int8() _padding5 = data.uint16() group_size = data.int32() group_size_variance = data.int32() group_count = data.int32() group_area = data.int32() player_id = data.int32() land_id = data.int32() min_distance_to_players = data.int32() max_distance_to_players = data.int32() return RandomMapObject( unit_type, terrain_type, group_flag, scale_flag, group_size, group_size_variance, group_count, group_area, player_id, land_id, min_distance_to_players, max_distance_to_players )
def load(data: ScnDataReader): # Terrain data.mark(name='terrain') # num_terrains_override = num_terrains num_terrains_override = 32 for i in range(0, num_terrains_override): data.boolean8(debug='terrain_enabled {}'.format(i)) data.uint8(debug='terrain_random {}'.format(i)) # always 0? data.string_fixed(size=13, debug='terrain_name {}'.format(i)) data.string_fixed(size=13, debug='terrain_texture_name {}'.format( i)) # Maybe read as int and test agains -1? data.int32(debug='terrain_slp_id {}'.format(i)) data.int32(debug='terrain_slp_pointer {}'.format(i)) data.int32(debug='terrain_sound_id {}'.format(i)) data.uint8(debug='terrain_minimap_color_high {}'.format( i)) # These colors are off-by-one compared with AGE. data.uint8(debug='terrain_minimap_color_medium {}'.format(i)) data.uint8(debug='terrain_minimap_color_low {}'.format(i)) data.uint8(debug='terrain_minimap_color_cliff_lt {}'.format(i)) data.uint8(debug='terrain_minimap_color_cliff_rt {}'.format(i)) data.int8(debug='terrain_passable_id {}'.format(i)) data.int8(debug='terrain_impassable_id {}'.format(i)) # Animation data.boolean8(debug='terrain_animation_enabled {}'.format(i)) data.int16(debug='terrain_anim_num_frames {}'.format(i)) data.int16(debug='terrain_anim_num_pause_frames {}'.format(i)) data.float32(debug='terrain_anim_frame_interval {}'.format(i)) data.float32(debug='terrain_anim_replay_delay {}'.format(i)) data.int16(debug='terrain_anim_frame {}'.format(i)) data.int16(debug='terrain_anim_draw_frame {}'.format(i)) data.float32(debug='terrain_anim_animate_last {}'.format(i)) data.boolean8(debug='terrain_anim_frame_changed {}'.format(i)) data.boolean8(debug='terrain_anim_drawn {}'.format(i)) # Elevation sprites for j in range(0, 19): data.uint16(debug="terrain_elevation_sprite_frames {} {}".format( i, j)) # frames data.uint16(debug="terrain_elevation_sprite_facets {} {}".format( i, j)) # facets data.uint16(debug="terrain_elevation_sprite_frame_id {} {}".format( i, j)) # frame_id data.int16(debug="terrain_to_draw {}".format(i)) data.uint16(debug="terrain_rows {}".format(i)) data.uint16(debug="terrain_cols {}".format(i)) # Borders for j in range(0, num_terrains_override): data.uint16(debug="terrain_border {} {}".format(i, j)) # Objects for j in range(0, 30): data.uint16(debug="terrain_object_id {} {}".format(i, j)) for j in range(0, 30): data.int16(debug="terrain_density {} {}".format(i, j)) for j in range(0, 30): data.int8(debug="terrain_placement_flag {} {}".format( i, j)) # 0 for random, 1 for central data.uint16(debug="terrain_object_count {}".format(i)) data.uint16(debug="padding {}".format(i)) return []
def read_base_unit_props(data: ScnDataReader): data.mark("base unit") unit_name_len = data.uint16(debug='unit_name_len') unit_id = data.int16(debug='unit_id') unit_name_string_id = data.int16(debug='unit_name_string_id') unit_creation_string_id = data.int16(debug='unit_creation_string_id') unit_class = data.int16(debug='unit_class') standing_sprite = data.int16( debug='standing_sprite') # no standing sprite #2 here.. ? dying_sprite = data.int16(debug='dying_sprite') undead_sprite = data.int16(debug='undead_sprite') undead_flag = data.int8(debug='undead_flag') hp = data.uint16(debug='hp') los = data.float32(debug='los') garrison_capacity = data.uint8(debug='garrison_capacity') collision_radius = (data.float32(debug='collision_radius1'), data.float32(debug='collision_radius2'), data.float32(debug='collision_radius3')) unit_train_sound = data.int16(debug='train_sound') # unit_damage_sound = data.int16(debug='damage_sound') unit_death_spawn = data.int16( debug='unit_death_spawn') # no unit_damage_sound here ?? unit_sort_number = data.uint8(debug='unit_sort_number') unit_can_be_built_on = data.uint8(debug='unit_can_be_built_on') unit_button_picture = data.int16(debug='unit_button_picture') unit_hide_in_scenario_editor = data.boolean8( debug='unit_hide_in_scenario_editor') unit_portrait_picture = data.int16(debug='unit_portrait_picture') unit_enabled = data.boolean8( debug='unit_enabled') # no unit_disabled here ?? unit_tile_req = (data.int16(debug='unit_tile_req1'), data.int16(debug='unit_tile_req2') ) # "Placement side terrains" unit_center_tile_req = (data.int16(debug='unit_center_tile_req1'), data.int16(debug='unit_center_tile_req1')) unit_construction_radius = (data.float32( debug='unit_construction_radius1'), data.float32( debug='unit_construction_radius2')) unit_elevation_flag = data.boolean8(debug='unit_elevation_flag') unit_fog_flag = data.boolean8(debug='unit_fog_flag') unit_terrain_restriction_id = data.uint16( debug='unit_terrain_restriction_id') # "terrain tables" unit_movement_type = data.uint8(debug='unit_movement_type') unit_attribute_max_amount = data.uint16( debug='unit_attribute_max_amount') # resource capacity unit_attribute_rot = data.float32(debug='unit_attribute_rot') # decay unit_area_effect_level = data.uint8(debug='unit_area_effect_level') unit_combat_level = data.uint8(debug='unit_combat_level') unit_select_level = data.uint8(debug='unit_select_level') unit_map_draw_level = data.uint8(debug='unit_map_draw_level') unit_level = data.uint8(debug='unit_level') unit_multiple_attribute_mod = data.float32( debug='unit_multiple_attribute_mod') unit_map_color = data.uint8(debug='unit_map_color') unit_help_string_id = data.uint32('unit_help_string_id') unit_help_page_id = data.uint32(debug='unit_help_page_id') unit_hotkey_id = data.uint32(debug='unit_hotkey_id') unit_recyclable = data.boolean8(debug='unit_recyclable') unit_track_as_resource = data.boolean8(debug='unit_track_as_resource') unit_create_doppleganger = data.boolean8(debug='unit_create_doppleganger') unit_resource_group = data.uint8( debug='unit_resource_group') # tree/stone/gold etc unit_occlusion_mask = data.uint8( debug='unit_occlusion_mask') # "hill mode" in AGE unit_obstruction_type = data.uint8( debug='unit_obstruction_type' ) # dropped unit_selection_shape, unit_civilization, unit_attribute_piece # # object flags go here in later versions selection_outline_radius = ( data.float32(debug='selection_outline_radius1'), data.float32(debug='selection_outline_radius2'), data.float32(debug='selection_outline_radius3')) for i in range(0, 3): attribute_res = data.int16(debug='attribute_res {}'.format(i)) attribute_amount = data.float32(debug='attribute_amount {}'.format(i)) attribute_store_mode = data.int8( debug='attribute_store_mode {}'.format(i)) num_damage_sprites = data.uint8(debug='num_damage_sprites') for i in range(0, num_damage_sprites): damage_sprite = data.uint16(debug='damage_sprite {}'.format(i)) damage_percent = data.uint8(debug='damage_percent {}'.format(i)) damage_apply_mode = data.uint8(debug='damage_apply_mode {}'.format(i)) damage_unused = data.uint8(debug='damage_unused {}'.format(i)) unit_selected_sound = data.int16(debug='unit_selected_sound') unit_death_sound = data.int16(debug='unit_death_sound') unit_attack_reaction = data.uint8(debug='unit_attack_reaction') unit_convert_terrain_flag = data.uint8(debug='unit_convert_terrain_flag') unit_name = data.string_fixed(size=unit_name_len, debug='unit_name') data.uint16(debug='unit_copy_id') # dropped unit_copy_id, unit_group return unit_name