def rawtext_ref(name, f_type=StrRawLatin1, max_size=None, widget=TextFrame, **kwargs): '''This function serves to macro the creation of a rawdata reference''' ref_struct = rawdata_ref_struct replacements = [] ref_struct_kwargs = {} for keyword in (COMMENT, TOOLTIP): if keyword in kwargs: ref_struct_kwargs[keyword] = kwargs.pop(keyword) if max_size is not None: ref_struct_kwargs[MAX] = max_size ref_struct = desc_variant(ref_struct, ("size", SInt32( "size", GUI_NAME="", SIDETIP="bytes", EDITABLE=False, MAX=max_size, VISIBLE=VISIBILITY_METADATA, ))) return RawdataRef(name, INCLUDE=ref_struct, ORIENT="v", STEPTREE=f_type("data", SIZE=".size", GUI_NAME=name.replace('_', ' '), WIDGET=widget, **kwargs), **ref_struct_kwargs)
def rawdata_ref(name, f_type=BytearrayRaw, max_size=None, widget=HaloRawdataFrame, **kwargs): '''This function serves to macro the creation of a rawdata reference''' ref_struct = rawdata_ref_struct replacements = [] ref_struct_kwargs = {} for keyword in (COMMENT, TOOLTIP): if keyword in kwargs: ref_struct_kwargs[keyword] = kwargs.pop(keyword) if max_size is not None: ref_struct_kwargs[MAX] = max_size ref_struct = desc_variant(ref_struct, ("size", SInt32( "size", GUI_NAME="", SIDETIP="bytes", EDITABLE=False, MAX=max_size, ))) if widget is not None: kwargs[WIDGET] = widget return RawdataRef(name, INCLUDE=ref_struct, STEPTREE=f_type("data", GUI_NAME="", SIZE=".size", **kwargs), **ref_struct_kwargs)
def blam_header_os(tagid, version=1): '''This function serves to macro the creation of a tag header''' return desc_variant( tag_header_os, ("tag_class", UEnum32("tag_class", GUI_NAME="tag_class", INCLUDE=valid_tags_os, EDITABLE=False, DEFAULT=tagid)), ("version", UInt16("version", DEFAULT=version, EDITABLE=False)), )
# For authors and copyright check AUTHORS.TXT # # Reclaimer is free software under the GNU General Public License v3.0. # See LICENSE for more information. # from .obje import * from .devi import * from .objs.ctrl import CtrlTag from supyr_struct.defs.tag_def import TagDef from supyr_struct.util import desc_variant # replace the object_type enum one that uses # the correct default value for this object obje_attrs = desc_variant(obje_attrs, ("object_type", object_type(8)) ) ctrl_attrs = Struct("ctrl_attrs", SEnum16('type', 'toggle_switch', 'on_button', 'off_button', 'call_button' ), SEnum16('triggers_when', 'touched_by_player', 'destroyed' ), float_zero_to_one('call_value'),
"map type", "sp", "mp", "ui", ), Pad(2), UInt32("crc32"), Pad(8), yelo_header, UEnum32('foot', ('foot', 'foot'), DEFAULT='foot', OFFSET=2044), SIZE=2048) map_header_vap = desc_variant( map_header, ("yelo_header", Struct("vap_header", INCLUDE=vap_header, OFFSET=128)), ) tag_header = Struct( "tag header", UEnum32("class 1", GUI_NAME="primary tag class", INCLUDE=valid_tags_os), UEnum32("class 2", GUI_NAME="secondary tag class", INCLUDE=valid_tags_os), UEnum32("class 3", GUI_NAME="tertiary tag class", INCLUDE=valid_tags_os), UInt32("id"), UInt32("path offset"), UInt32("meta offset"), UInt8("indexed"), Pad(3), # if indexed is non-zero, the meta_offset is the literal index in # the bitmaps, sounds, or loc cache that the meta data is located in. # NOTE: indexed is NOT a bitfield, if it is non-zero it is True
dyn_senum16( "region", DYN_NAME_PATH=".....regions.regions_array[DYN_I].name"), dyn_senum16("parent_node", DYN_NAME_PATH="..[DYN_I].name"), dyn_senum16("next_sibling_node", DYN_NAME_PATH="..[DYN_I].name"), dyn_senum16("first_child_node", DYN_NAME_PATH="..[DYN_I].name"), Pad(8), FlSInt16("unknown0", VISIBLE=False), FlSInt16("unknown1", VISIBLE=False), reflexive("bsps", fast_permutation_bsp, 32), SIZE=64) fast_coll_body = desc_variant( coll_body, ("nodes", reflexive("nodes", fast_node, 64, DYN_NAME_PATH='.name')), ) def get(): return coll_def coll_def = TagDef( "coll", blam_header("coll", 10), coll_body, ext=".model_collision_geometry", endian=">", tag_cls=CollTag, )
# This file is part of Reclaimer. # # For authors and copyright check AUTHORS.TXT # # Reclaimer is free software under the GNU General Public License v3.0. # See LICENSE for more information. # from supyr_struct.util import desc_variant from ...hek.defs.actv import * # Create opensauce variant of grenade descriptor. os_actv_grenades = desc_variant( actv_grenades, ("grenade_type", SEnum16("grenade_type", *grenade_types_os)), ) # Create os variant of actv descriptor using the new grenade descriptor. actv_body = desc_variant( actv_body, ("grenades", os_actv_grenades), ) def get(): return actv_def actv_def = TagDef("actv",
# # This file is part of Reclaimer. # # For authors and copyright check AUTHORS.TXT # # Reclaimer is free software under the GNU General Public License v3.0. # See LICENSE for more information. # from ...hek.defs.antr import * from supyr_struct.util import desc_variant antr_body = desc_variant( antr_body, ("animations", reflexive("animations", animation_desc, 2048, DYN_NAME_PATH=".name"))) def get(): return antr_def antr_def = TagDef("antr", blam_header('antr', 4), antr_body, ext=".model_animations", endian=">", tag_cls=AntrTag)
SIZE=40 ) # copy the scnr_body and replace the descriptors for certain # fields with ones that are tweaked for use with open sauce scnr_body = desc_variant( scnr_body, ("DONT_USE", dependency_os("project_yellow_definitions", 'yelo')), ("player_starting_profiles", reflexive("player_starting_profiles", player_starting_profile, 256, DYN_NAME_PATH='.name') ), ("ai_animation_references", reflexive("ai_animation_references", ai_anim_reference, 128, DYN_NAME_PATH='.animation_name') ), ("script_syntax_data", rawdata_ref("script_syntax_data", max_size=570076, IGNORE_SAFE_MODE=True)), ("script_string_data", rawdata_ref("script_string_data", max_size=393216, IGNORE_SAFE_MODE=True)), ("references", reflexive("references", reference, 256, DYN_NAME_PATH='.reference.filepath') ), ("structure_bsps", reflexive("structure_bsps", structure_bsp, 32, DYN_NAME_PATH='.structure_bsp.filepath') ) ) def get(): return scnr_def scnr_def = TagDef("scnr",
reflexive("runtime_decals", runtime_decal, 6144, VISIBLE=False), Pad(12), reflexive("leaf_map_leaves", leaf_map_leaf, 65536, VISIBLE=False), reflexive("leaf_map_portals", leaf_map_portal, 524288, VISIBLE=False), SIZE=648, ) fast_sbsp_body = desc_variant( sbsp_body, ("collision_bsp", reflexive("collision_bsp", fast_collision_bsp, 1)), ("nodes", raw_reflexive("nodes", node, 131072)), ("leaves", raw_reflexive("leaves", leaf, 65535)), ("leaf_surfaces", raw_reflexive("leaf_surfaces", leaf_surface, 262144)), ("surfaces", raw_reflexive("surface", surface, 131072)), ("lens_flare_markers", raw_reflexive("lens_flare_markers", lens_flare_marker, 65535)), ("breakable_surfaces", raw_reflexive("breakable_surfaces", breakable_surface, 256)), ("pathfinding_surfaces", raw_reflexive("pathfinding_surfaces", pathfinding_surface, 131072)), ("pathfinding_edges", raw_reflexive("pathfinding_edges", pathfinding_edge, 262144)), ("markers", raw_reflexive("markers", marker, 1024, DYN_NAME_PATH='.name')), ) sbsp_meta_header_def = BlockDef( "sbsp_meta_header", # to convert these pointers to offsets, do: pointer - bsp_magic UInt32("meta_pointer"), UInt32("uncompressed_lightmap_materials_count"), UInt32("uncompressed_lightmap_materials_pointer"), # name is a guess
("uncompressed", 4), ("compressed", 5), ), Pad(2), UInt32("vertex_count"), Pad(4), # always 0? UInt32("vertices_offset"), UInt32("vertices_reflexive_offset"), VISIBLE=False, SIZE=36), SIZE=104) fast_part = desc_variant( part, ("uncompressed_vertices", raw_reflexive("uncompressed_vertices", fast_uncompressed_vertex, 65535)), ("compressed_vertices", raw_reflexive("compressed_vertices", fast_compressed_vertex, 65535)), ("triangles", raw_reflexive("triangles", triangle, 65535)), ) region = Struct('region', ascii_str32("name"), Pad(32), reflexive("permutations", permutation, 32, DYN_NAME_PATH=".name"), SIZE=76) geometry = Struct('geometry', Pad(36), reflexive("parts", part, 32), SIZE=48)
Float("gain"), Float("pitch"), ), Pad(12), SEnum16("encoding", 'mono', 'stereo'), compression, dependency("promotion_sound", "snd!"), SInt16("promotion_count"), SInt16("unknown1", VISIBLE=False), Struct("unknown2", INCLUDE=rawdata_ref_struct, VISIBLE=False), reflexive("pitch_ranges", pitch_range, 8, DYN_NAME_PATH='.name'), SIZE=164, ) def get(): return snd__def snd__def = TagDef( "snd!", blam_header('snd!', 4), snd__body, ext=".sound", endian=">", tag_cls=Snd_Tag, ) snd__meta_stub = desc_variant(snd__body, ("pitch_ranges", Pad(12))) snd__meta_stub_blockdef = BlockDef(snd__meta_stub)
QStruct("position", INCLUDE=xyz_float), float_rad("facing"), # radians SInt16("team_index"), dyn_senum16("bsp_index", DYN_NAME_PATH= ".....structure_bsps.STEPTREE[DYN_I].structure_bsp.filepath"), SEnum16("type_0", *location_types), SEnum16("type_1", *location_types), SEnum16("type_2", *location_types), SEnum16("type_3", *location_types), SIZE=52) player_starting_location2 = desc_variant( player_starting_location, ("bsp_index", dyn_senum16( "bsp_index", DYN_NAME_PATH= "........structure_bsps.STEPTREE[DYN_I].structure_bsp.filepath"))) trigger_volume = Struct( "trigger_volume", # if this unknown != 1, the trigger volume is disabled FlUInt16("unknown0", DEFAULT=1, EDITABLE=False, VISIBLE=False), Pad(2), ascii_str32("name"), BytesRaw("unknown1", SIZE=12, VISIBLE=False), QStruct("binormal", INCLUDE=ijk_float), QStruct("normal", INCLUDE=ijk_float), QStruct("position", INCLUDE=xyz_float,