예제 #1
0
    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()
예제 #2
0
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 []
예제 #3
0
def load(data: ScnDataReader) -> List[Civilization]:
    """
    Read all civilizations from here
    """
    data.mark("civilizations")
    num_civs = data.int16(debug='num_civs')
    for i in range(0, num_civs):
        data.uint8(debug='civ_type {}'.format(i))
        data.string_fixed(size=20, debug='civ_name {}'.format(i))
        civ_num_attributes = data.uint16(
            debug='civ_num_attributes {}'.format(i))
        civ_effect = data.int16(debug='civ_effect {}'.format(i))
        # civ_bonus_effect = data.int16(debug='civ_bonus_effect {}'.format(i)) # Might not exist in AOE1 dat.
        civ_attributes = [
            data.float32(debug='civ_attribute {} {}'.format(i, x))
            for x in range(0, civ_num_attributes)
        ]
        civ_icon_set = data.uint8(debug='civ_icon_set {}'.format(i))
        civ_num_units = data.uint16(debug='civ_num_units {}'.format(i))
        civ_unit_available = [
            data.boolean32(debug='civ_unit_available {} {}'.format(i, x))
            for x in range(0, civ_num_units)
        ]
        for j in range(0, civ_num_units):
            if not civ_unit_available[j]:
                continue
            read_unit(data)
    return []
예제 #4
0
 def read(data: ScnDataReader):
     color_table_name = data.string_fixed(30, debug='color_table_name')
     color_table_id = data.uint16(debug='color_table_id')
     drs_res = data.uint16(debug='color_table_drs_res')  # All blanks?
     minimap_color = data.uint8(debug='color_table_minimap_color')  # Possibly a minimap color?
     color_table_type = data.uint8(debug='color_table_type')  # All 1's except the last one, which is 2.
     return ColorTable(color_table_name, color_table_id, drs_res, minimap_color, color_table_type)
예제 #5
0
 def read(data: ScnDataReader):
     required_techs = [
         data.int16(debug='required_tech1'),
         data.int16(debug='required_tech2'),
         data.int16(debug='required_tech3'),
         data.int16(debug='required_tech4')
     ]
     costs = [TechnologyCost.read(data) for _ in range(0, 3)]
     min_required_techs = data.int16(debug='min_required_techs')
     research_location = data.int16(debug='research_location')
     langauge_file_name = data.int16(debug='langauge_file_name')
     language_file_desc = data.int16(debug='language_file_desc')
     research_time = data.int16(debug='research_time')
     effect = data.int16(debug='effect')
     type = data.int16(debug='type')
     icon = data.int16(debug='icon')
     button = data.uint8(debug='button')
     lang_file_help = data.int32(debug='lang_file_help')
     lang_file_tech_tree = data.int32(debug='lang_file_tech_tree')
     hotkey = data.uint32(debug='hotkey')
     tech_name_len = data.uint16(debug='name_len')
     name = data.string_fixed(size=tech_name_len, debug='name')
     return Technology(required_techs, costs, min_required_techs,
                       research_location, langauge_file_name,
                       language_file_desc, research_time, effect, type,
                       icon, button, lang_file_help, lang_file_tech_tree,
                       hotkey, name)
예제 #6
0
 def read(data: ScnDataReader, sprite_id):
     sprite_name = data.string_fixed(21, debug='sprite_name')
     sprite_filename = data.string_fixed(13, debug='sprite_filename')
     sprite_slp_id = data.uint32(debug='sprite_slp_id')
     sprite_is_loaded = data.boolean8(debug='sprite_is_loaded')
     sprite_color_flag = data.boolean8(debug='sprite_color_flag')
     sprite_layer = data.uint8(debug='sprite_layer')
     sprite_color_table = data.int16(debug='sprite_color_table')
     sprite_transparent_selection = data.boolean8(
         debug='sprite_transparent_selection')
     sprite_bounding_box = (
         data.int16(),  # X1
         data.int16(),  # Y1
         data.int16(),  # X2
         data.int16())  # Y2
     sprite_num_deltas = data.uint16(debug='sprite_num_deltas')
     sprite_sound_id = data.int16(debug='sprite_sound_id')
     attack_sounds_used = data.boolean8()
     sprite_num_frames = data.uint16()
     sprite_num_facets = data.uint16()
     sprite_base_speed = data.float32()
     sprite_frame_rate = data.float32()
     sprite_replay_delay = data.float32()
     sprite_sequence_type = data.uint8()
     sprite_other_id = data.uint16(debug='sprite_other_id')
     sprite_mirror_flag = data.uint8()
     # sprite_other_flag = data.uint8() # Reading 1 byte too far here, one of these must not be in the AOE1 file.
     sprite_deltas = [
         SpriteDelta.read(data) for _ in range(0, sprite_num_deltas)
     ]
     facets = [SpriteFacet.read(data) for _ in range(0, sprite_num_facets)
               ] if attack_sounds_used else []
     return Sprite(sprite_id, sprite_name, sprite_filename, sprite_slp_id,
                   sprite_is_loaded, sprite_color_flag, sprite_layer,
                   sprite_color_table, sprite_transparent_selection,
                   sprite_bounding_box, sprite_sound_id, attack_sounds_used,
                   sprite_num_frames, sprite_num_facets, sprite_base_speed,
                   sprite_frame_rate, sprite_replay_delay,
                   sprite_sequence_type, sprite_other_id,
                   sprite_mirror_flag, sprite_deltas, facets)
예제 #7
0
    def read(data: ScnDataReader):
        # Load header
        file_version = data.string_fixed(size=4)
        file_version_float = float(file_version)
        header_size = data.uint32()
        data.mark(name='SCN header', limit=header_size)  # header size
        header_version = data.uint32(debug='header_version')

        if header_version >= 3:
            # DE scenario a bit different
            timestamp = data.uint32(debug='Timestamp maybe')
            string_marker = data.uint16(debug='string_marker')  # always 2656
            description = data.string16(debug='description')
            # Data sometimes here sometimes not. Need to check remaining bytes in header size to see if we can read it.
            if header_size - data.bytes_read_since_mark >= 8:
                # might not account for all possibilities for these fields
                has_single_player_victory_condition = data.boolean32()
                player_count = data.uint32()
            else:
                has_single_player_victory_condition = False
                player_count = -1
            scenario_header = ScnHeader(file_version=file_version_float,
                                        header_version=header_version,
                                        timestamp=timestamp,
                                        description=description,
                                        has_singleplayer_victory_condition=
                                        has_single_player_victory_condition,
                                        player_count=player_count)
        else:
            timestamp = data.uint32(debug='timestamp')
            scenario_header = ScnHeader(
                file_version=file_version_float,
                header_version=header_version,
                timestamp=timestamp,
                description=data.string32(),
                has_singleplayer_victory_condition=data.boolean32(),
                player_count=data.uint32())
        logging.debug(scenario_header)
        data.unmark()
        data.decompress()

        return scenario_header
예제 #8
0
 def read(data: ScnDataReader):
     """
     Read entire game data file from uncompressed data file
     """
     version = data.string_fixed(8)
     terrain_tables = terrain_table.load(data)
     color_tables = color_table.load(data)
     sounds = sound.load(data)
     sprites = sprite.load(data)
     discard_first_map_stuff(data)
     terrains = terrain.load(data)
     terrain_borders = terrain_border.load(data)
     discard_extra_map_stuff(data)
     random_maps = random_map.load(data)
     effects = effect.load(data)
     civilizations = civilization.load(data)
     technologies = technology.load(data)
     return GameDataFile(version, terrain_tables, color_tables, sounds,
                         sprites, terrains, terrain_borders, random_maps,
                         effects, civilizations, technologies)
예제 #9
0
    def read_classic(data: ScnDataReader):
        base = ScnEngineProperties.read_classic(data)
        version = base.rge_version
        if version <= 1.13:
            for i in range(0, 16):
                # skip past player names
                player_name = data.string_fixed(size=256)
            raise Exception(
                "Not implemented: Don't know how to read player base properties from <1.13 file"
            )
        else:
            player_start_resources = []
            for i in range(0, 16):
                # Ignoring at the moment
                this_player_start_resources = ScnPlayerStartResources.read(
                    data, version)
                player_start_resources.append(this_player_start_resources)

        if version >= 1.02:
            check5 = data.int32()
            if check5 != -99:
                raise Exception(
                    "Check value did not match in scenario data, giving up")

        victory_conquest = data.uint32()
        victory_ruins = data.uint32()
        victory_artifacts = data.uint32()
        victory_discoveries = data.uint32()
        victory_exploration = data.uint32()
        victory_gold = data.uint32()
        victory_all_flag = data.boolean32()

        if version >= 1.13:
            mp_victory_type = data.uint32()
            victory_score = data.uint32()
            victory_time = data.uint32()

        for i in range(0, 16):
            for j in range(0, 16):
                stance = data.uint32()
                logging.debug("Diplomacy from=%d to=%d stance=%d", i, j,
                              stance)

        # 12 victory conditions for each player
        for i in range(0, 16):
            for j in range(0, 12):
                # TODO read these ???
                individual_victory_blob = data.read(60)

        if version >= 1.02:
            check5 = data.int32()
            if check5 != -99:
                raise Exception(
                    "Check value did not match in scenario data, giving up")

        # Allied victory
        for i in range(0, 16):
            allied_victory = data.uint32()

        if version >= 1.24:
            raise Exception(
                "Not implemented: Don't know how to read team information from >=1.24 file"
            )

        if version >= 1.18:
            # Also has disabled units and building, where are they in older versions?
            raise Exception(
                "Not implemented: Don't know how to read tech tree from >=1.18 file"
            )
        elif version > 1.03:
            for i in range(0, 16):
                for j in range(0, 20):
                    disabled_tech_id = data.uint32()
                    logging.debug("Disabled tech player %d, position %d: %d",
                                  i, j, disabled_tech_id)

        if version > 1.04:
            data.uint32()  # No idea

        if version >= 1.12:
            data.uint32()  # No idea
            full_tech_tree = data.boolean32()

        if version > 1.05:
            for i in range(0, 16):
                player_start_age = data.uint32()

        if version >= 1.02:
            check6 = data.int32()
            if check6 != -99:
                raise Exception(
                    "Check value did not match in scenario data, giving up")

        if version >= 1.19:
            # 'view'??
            data.uint32()
            data.uint32()

        if version >= 1.21:
            raise Exception(
                "Not implemented: Don't know how to read map type from >=1.21 file"
            )

        if version >= 1.21:
            raise Exception(
                "Not implemented: Don't know how to read base priorities from >=1.21 file"
            )

        game_properties = ScnGameProperties(base)
        logging.debug(game_properties)
        return game_properties
예제 #10
0
    def read_classic(data: ScnDataReader):
        # TODO actually store this stuff
        version = data.float32(debug='version')
        if version > 1.13:
            for i in range(0, 16):
                # skip past player names
                player_name = data.string_fixed(size=256)

        if version > 1.16:
            raise Exception("Not implemented: player string table not understood")

        if version > 1.13:
            for i in range(0, 16):
                player_base = ScnPlayerBaseProperties.read(data)
                logging.debug(player_base)

        is_conquest = False
        if version > 1.07:
            is_conquest = data.boolean8()

        # Something to do with timelines?
        check1 = data.uint16()
        check2 = data.uint16()
        check3 = data.float32()
        if check1 != 0 or check2 != 0 or check3 < -1 or check3 > 1:
            raise Exception("Unexpected values in scenario data, giving up")

        filename = data.string16(debug='filename')

        if version > 1.16:
            raise Exception("Not implemented: scenario instruction string table not understood")

        if version > 1.22:
            raise Exception("Not implemented: scout string table not understood")

        description = data.string16(debug='description')

        if version >= 1.11:
            hints_message = data.string16(debug='hints_message')
            win_message = data.string16(debug='win_message')
            loss_message = data.string16(debug='loss_message')
            history_message = data.string16(debug='history_message')

        if version > 1.22:
            raise Exception("Not implemented: scout data not understood")

        pregame_cinematic = data.string16(debug='pregame_cinematic')
        victory_cinematic = data.string16(debug='victory_cinematic')
        loss_cinematic = data.string16(debug='loss_cinematic')

        if version >= 1.09:
            mission_bmp = data.string16()
            logging.debug("mission_bmp='%s'", mission_bmp)

        if version >= 1.10:
            mission_image = data.uint32()
            width = data.uint32()
            height = data.uint32()
            orientation = data.uint16()
            if width > 0 or height > 0:
                raise Exception("Mission BMP data not understood")

        for i in range(0, 16):
            player_build_list = data.string16()
            logging.debug("Player %d build list %s", i, player_build_list)

        for i in range(0, 16):
            player_city_plan = data.string16()
            logging.debug("Player %d city plan %s", i, player_city_plan)

        if version >= 1.08:
            for i in range(0, 16):
                player_personality = data.string16()
                logging.debug("Player %d personality %s", i, player_personality)

        for i in range(0, 16):
            """ Embedded files """
            build_list_length = data.uint32()
            city_plan_length = data.uint32()
            ai_rules_length = data.uint32() if version >= 1.08 else 0
            data.read(build_list_length)
            data.read(city_plan_length)
            data.read(ai_rules_length)

        if version >= 1.20:
            raise Exception("Not implemented: AI rules not understood")

        if version >= 1.02:
            check4 = data.int32()
            if check4 != -99:
                raise Exception("Check value did not match in scenario data, giving up")

        rge_scen = ScnEngineProperties(
            version
        )
        logging.debug(rge_scen)
        return rge_scen
예제 #11
0
    def read_de(data: ScnDataReader):
        version = data.float32(debug='version')

        for i in range(0, 16):
            data.uint16(debug='some number here')  # 2656
            data.string16(debug='player tribe name')

        if version >= 3.13:
            # These 16 bytes are not present in some DE scenarios bundled w/ the game, labelled version 3.125.
            for i in range(0, 16):
                # Guessing its a string ref, have not checked
                data.int32(debug="unknown_string_ref for player {}".format(i))

        for i in range(0, 16):
            player_base_props = ScnPlayerBaseProperties.read(data)
            logging.debug(player_base_props)

        data.boolean32(debug='conquest maybe')
        data.float32(debug='probable check field')

        data.uint8(debug='unknown field')

        data.uint16(debug='some number here')  # 2656
        data.string16(debug='scenario_name')

        data.uint16(debug='some number here')  # 2656
        data.string16(debug='scenario_instructions')

        data.uint16(debug='some number here')  # 2656
        data.string16(debug='history_string')

        data.uint16(debug='some number here')  # 2656
        data.string16(debug='victory_string')

        data.uint16(debug='some number here')  # 2656
        data.string16(debug='loss_string')

        data.uint16(debug='some number here')  # 2656
        data.string16(debug='history_string')

        data.int32(debug='instructions_string_reference')
        data.uint16(debug='some_number_here')  # 2656
        data.string16(debug='instructions_vox')

        data.int32(debug='hints_string_reference')
        data.uint16(debug='some_number_here')  # 2656
        data.string16(debug='hints_vox')

        data.int32(debug='victory_string_reference')
        data.uint16(debug='some_number_here')  # 2656
        data.string16(debug='victory_vox')

        data.int32(debug='loss_string_reference')
        data.uint16(debug='some_number_here')  # 2656
        data.string16(debug='loss_vox')

        data.int32(debug='history_string_reference')
        data.uint16(debug='some_number_here')  # 2656
        data.string16(debug='history_vox')

        # Not sure if cinematics or per-player personality, AI, city plans etc

        data.uint16(debug='some_number_here')  # 2656
        data.string16(debug='unidentified_string 1')  # ' <None> '

        data.uint16(debug='some_number_here')  # 2656
        data.string16(debug='unidentified_string 2')  # ' <None> '

        data.uint16(debug='some_number_here')  # 2656
        data.string16(debug='unidentified_string 3')  # ' <None> '

        data.uint16(debug='some_number_here')  # 2656
        data.string16(debug='unidentified_string 4')  # ' <None> '

        data.uint32(debug='unidentified number 1')  # 0
        data.uint32(debug='unidentified number 2')  # 0
        data.uint32(debug='unidentified number 3')  # 0
        data.uint16(debug='unidentified number 4')  # 1

        for i in range(0, 16):
            data.string16(debug="ai player {}".format(i))

        for i in range(0, 16):
            data.string16(debug="city plan player {}".format(i))

        for i in range(0, 16):
            data.string16(debug="personality player {}".format(i))

        for i in range(0, 16):
            some_length1 = data.uint32(debug='some length maybe')
            some_length2 = data.uint32(debug='some length maybe')
            some_length3 = data.uint32(debug='some length maybe')
            data.string_fixed(some_length1, debug='some string 1')
            data.string_fixed(some_length2, debug='some string 2')
            data.string_fixed(some_length3, debug='some string 3')

        check1 = data.int32(debug='check value 1')
        if check1 != -99:
            raise Exception("Check value did not match in scenario data, giving up")

        if version < 3.13:
            data.mark('extra data observed in 3.125 version')
            for i in range(0, 32):
                data.int32(debug='unknown value 1 {}'.format(i))  # 500
            for i in range(0, 32):
                data.int32(debug='unknown value 2 {}'.format(i))  # 0

        check2 = data.int32(debug='check value 2')
        if check2 != -99:
            raise Exception("Check value did not match in scenario data, giving up")

        rge_scen = ScnEngineProperties(
            version
        )
        logging.debug(rge_scen)
        return rge_scen
예제 #12
0
 def read(data: ScnDataReader):
     return SlpHeader(data.string_fixed(4), data.uint32(),
                      data.string_fixed(24))
예제 #13
0
파일: effect.py 프로젝트: mike42/age-tools
 def read(data: ScnDataReader):
     effect_name = data.string_fixed(size=31, debug='effect_name')
     effect_num_commands = data.uint16(debug='effect_num_commands')
     commands = [EffectCommand.read(data) for _ in range(0, effect_num_commands)]
     return Effect(effect_name, commands)
예제 #14
0
 def read(data: ScnDataReader):
     return SoundItem(data.string_fixed(13, debug='sound_filename'),
                      data.uint32(debug='sound_resource_id'),
                      data.uint16(debug='sound_probability'))
예제 #15
0
 def read(data: ScnDataReader):
     return DRSHeader(data.string_fixed(40), data.string_fixed(4),
                      data.string_fixed(12), data.uint32(), data.uint32())
예제 #16
0
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