SHARE
TWEET

halo_constants.h

liquidspark May 18th, 2019 5 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. //  halo_constants.h
  3. //  hfp
  4. //
  5. //  Created by silent on 7/31/18.
  6. //  Copyright © 2018 haloserver. All rights reserved.
  7. //
  8.  
  9. #ifndef halo_constants_h
  10. #define halo_constants_h
  11.  
  12. #include <stdlib.h>
  13. #include <stdbool.h>
  14. #include "halo_enums.h"
  15.  
  16. static const double HALO_PI = 3.1415926535897932384626433832795;
  17.  
  18. // used to store fixed tag data
  19. struct halo_tag_info
  20. {
  21.     const int8_t version;   // in the tag header data, this is stored as an int16_t
  22.     int32_t fcl_tuple_super;    // listed for convenience because it is fixed anyway
  23.     int32_t fcl_duple_super;
  24.     int32_t fcl;//const char fcl[4];    // four-character literal, or four-character constant
  25.     const char* extension;
  26.     const size_t filesize_minimum;  // including the 64-byte header
  27.     const size_t filesize_maximum;  // including the 64-byte header
  28. };
  29.  
  30. // array index must match enum halo_tag_classes and enum halo_file_type
  31. // Guerilla does not properly interpret its documents of tag superclasses. When I noticed that the obje superclass was excluded from the devi superclass data contrary to its objedevi definition in guerilla.exe, which coincides with related tag class triplets in a map's tags index, and remembered that this was a similar situation with other tag superclasses, I decided to handle the files based upon a correct interpretation of the tag class definitions in Guerilla, but that means my tag superclass documents are not Guerilla's tag superclass documents. The tag superclasses as documents are therefore in general fully incompatible with Guerilla. The tag superclasses are not intended to be used as tag document classes by Halo anyway.
  32. static const struct halo_tag_info HALO_TAG_CLASS_INFO[] =
  33. {
  34.     { 2, -1, -1, 'actr', "actor", 1336, 2101 },
  35.     { 1, -1, -1, 'actv', "actor_variant", 632, 2035 },
  36.     { 1, -1, -1, 'ant!', "antenna", 272, 3342 },
  37.     { 4, -1, -1, 'antr', "model_animations", 192, 282116096 },
  38.     { 3, 'obje', 'unit', 'bipd', "biped", 1332, 53045 },
  39.     { 7, -1, -1, 'bitm', "bitmap", 172, 34193580 },
  40.     { 1, -1, -1, 'boom', "spheroid", 68, 68 },
  41.     { 1, -1, -1, 'cdmg', "continuous_damage_effect", 576, 576 },
  42.     { 10, -1, -1, 'coll', "model_collision_geometry", 728, 31675560552 },   //64-bit hypothetical max
  43.     { 1, -1, -1, 'colo', "color_table", 76, 24652 },
  44.     { 3, -1, -1, 'cont', "contrail", 388, 6642 },
  45.     { 1, 'obje', 'devi', 'ctrl', "device_control", 856, 19404 },
  46.     { 1, -1, -1, 'deca', "decal", 332, 842 },
  47.     { 1, -1, -1, 'DeLa', "ui_widget_definition", 1068, 46054 },
  48.     { 1, -1, -1, 'devc', "input_device_defaults", 108, 8312 },
  49.     { 1, -1, 'obje', 'devi', "device", 720, 18503 },
  50.     { 1, -1, -1, 'dobc', "detail_object_collection", 192, 1983 },
  51.     { 4, -1, -1, 'effe', "effect", 128, 869632 },
  52.     { 1, -1, -1, 'elec', "lightning", 328, 4411 },
  53.     { 2, 'obje', 'item', 'eqip', "equipment", 1008, 18281 },
  54.     { 1, -1, -1, 'flag', "flag", 160, 1185 },
  55.     { 1, -1, -1, 'fog ', "fog", 460, 1225 },
  56.     { 1, -1, -1, 'font', "font", 220, 9163992 },
  57.     { 1, -1, -1, 'foot', "material_effects", 204, 239950 },
  58.     { 1, 'obje', 'item', 'garb', "garbage", 1008, 236816 },
  59.     { 1, -1, -1, 'glw!', "glow", 404, 659 },
  60.     { 1, -1, -1, 'grhi', "grenade_hud_interface", 568, 477941 },
  61.     { 1, -1, -1, 'hmt ', "hud_message_text", 192, 147648 }, //calculated min is 192, but guerilla sets default file as min 193 bytes, due to provided minimum data size string entry of 1 null byte
  62.     { 1, -1, -1, 'hudg', "hud_globals", 1168, 5925 },
  63.     { 1, -1, -1, 'hud#', "hud_number", 164, 419 },
  64.     { 2, -1, 'obje', 'item', "item", 840, 17858 },
  65.     { 0, -1, -1, 'itmc', "item_collection", 156, 11004 },
  66.     { 6, -1, -1, 'jpt!', "damage_effect", 736, 991 },
  67.     { 2, -1, -1, 'lens', "lens_flare", 304, 4655 },
  68.     { 1, 'obje', 'devi', 'lifi', "device_light_fixture", 784, 18567 },
  69.     { 3, -1, -1, 'ligh', "light", 416, 1181 },
  70.     { 3, -1, -1, 'lsnd', "sound_looping", 148, 17631 },
  71.     { 1, 'obje', 'devi', 'mach', "device_machine", 868, 18651 },
  72.     { 3, -1, -1, 'matg', "globals", 492, 210066 },
  73.     { 1, -1, -1, 'metr', "meter", 236, 66282 },
  74.     { 1, -1, -1, 'mgs2', "light_volume", 396, 1003 },
  75.     { 5, -1, -1, 'mod2', "gbxmodel", 296, 56914175368 },    //64-bit hypothetical max
  76.     { 4, -1, -1, 'mode', "model", 296, 56913945992 },   //64-bit hypothetical max
  77.     { 1, -1, -1, 'mply', "multiplayer_scenario_description", 76, 18572 },
  78.     { 2, -1, -1, 'ngpr', "preferences_network_game", 960, 1470 },
  79.     { 1, -1, -1, 'obje', "object", 444, 16442 },
  80.     { 2, -1, -1, 'part', "particle", 420, 1950 },
  81.     { 4, -1, -1, 'pctl', "particle_system", 168, 48007 },
  82.     { 4, -1, -1, 'phys', "physics", 192, 8456 },    // calculated min is 192, but guerilla gives new documents 2 inertial matrix blocks by default, resulting in typical min of 264
  83.     { 2, -1, 'obje', 'plac', "placeholder", 572, 16570 },
  84.     { 1, -1, -1, 'pphy', "point_physics", 128, 128 },
  85.     { 5, -1, 'obje', 'proj', "projectile", 652, 48705 },
  86.     { 1, -1, -1, 'rain', "weather_particle_system", 112, 11064 },
  87.     { 5, -1, -1, 'sbsp', "scenario_structure_bsp", 712, 1976078685555 },    //64-bit hypothetical max
  88.     { 1, -1, 'obje', 'scen', "scenery", 572, 16570 },
  89.     { 1, -1, 'shdr', 'scex', "shader_transparent_chicago_extended", 184, 5323 },
  90.     { 1, -1, 'shdr', 'schi', "shader_transparent_chicago", 172, 3411 },
  91.     { 2, -1, -1, 'scnr', "scenario", 1520, 2211856522 },    //unsigned 32-bit (hypothetical?) max
  92.     { 2, -1, 'shdr', 'senv', "shader_environment", 900, 2940 },
  93.     { 1, -1, 'shdr', 'sgla', "shader_transparent_glass", 544, 2329 },
  94.     { 1, -1, -1, 'shdr', "shader", 104, 104 },
  95.     { 1, -1, -1, 'sky ', "sky", 272, 4581 },
  96.     { 1, -1, 'shdr', 'smet', "shader_transparent_meter", 324, 579 },
  97.     { 4, -1, -1, 'snd!', "sound", 228, 8608015395 },    //64-bit hypothetical max
  98.     { 1, -1, -1, 'snde', "sound_environment", 136, 136 },
  99.     { 2, -1, 'shdr', 'soso', "shader_model", 504, 1524 },
  100.     { 1, -1, 'shdr', 'sotr', "shader_transparent_generic", 172, 3715 },
  101.     { 1, -1, -1, 'Soul', "ui_widget_collection", 76, 8748 },
  102.     { 1, -1, 'shdr', 'spla', "shader_transparent_plasma", 396, 906 },
  103.     { 1, -1, 'obje', 'ssce', "sound_scenery", 572, 16570 },
  104.     { 1, -1, -1, 'str#', "string_list", 76, 3292876 },
  105.     { 2, -1, 'shdr', 'swat', "shader_transparent_water", 384, 1453 },
  106.     { 1, -1, -1, 'tagc', "tag_collection", 76, 54276 },
  107.     { 2, -1, -1, 'trak', "camera_track", 112, 1072 },
  108.     { 1, -1, -1, 'udlg', "dialogue", 4176, 46506 },
  109.     { 1, -1, -1, 'unhi', "unit_hud_interface", 1452, 8734455 },
  110.     { 2, -1, 'obje', 'unit', "unit", 816, 51891 },
  111.     { 1, -1, -1, 'ustr', "unicode_string_list", 76, 26230476 },
  112.     { 2, -1, -1, 'vcky', "virtual_keyboard", 124, 49289 },
  113.     { 1, 'obje', 'unit', 'vehi', "vehicle", 1072, 53167 },
  114.     { 2, 'obje', 'item', 'weap', "weapon", 1352, 60672 },   // includes corrected block size
  115.     { 1, -1, -1, 'wind', "wind", 128, 128 },
  116.     { 2, -1, -1, 'wphi', "weapon_hud_interface", 444, 3863686 }
  117. };
  118.  
  119. // used to store fixed string type information
  120. struct halo_string_info
  121. {
  122.     const bool is_multibyte;    // if it should use uint8_t or uint16_t for interpretation, to mimic ASCII signed char or UTF-16 unichar (unsigned short) or wide char
  123.     const bool is_fixed;    // if it must contain a fixed quantity of bytes
  124.     const bool terminated;  // if it acts like a C string with a 0-byte terminator
  125.     const uint32_t min_bytes;   // minimum quantity of acceptable bytes, including any terminator
  126.     const uint32_t max_bytes;   // maximum quantity of acceptable bytes, including any terminator
  127.     const uint32_t min_characters;  // minimum quantity of interpreted characters, excluding any terminator
  128.     const uint32_t max_characters;  // maximum quantity of interpreted characters, excluding any terminator
  129. };
  130.  
  131. // array index must match enum halo_string_types
  132. static const struct halo_string_info HALO_STRING_TYPE_INFO[] =
  133. {
  134.     { false, true, false, 4, 4, 4, 4 },
  135.     { false, true, false, 4, 4, 4, 4 },
  136.     { true, true, true, 24, 24, 1, 11 },
  137.     { true, true, true, 48, 48, 1, 23 },
  138.     { false, true, true, 32, 32, 0, 31 },
  139.     { false, false, true, 0, 255, 0, 254 },
  140.     { false, false, true, 0, 4096, 0, 4095 },
  141.     { true, false, true, 0, 32768, 0, 16383 },
  142.     { false, false, true, 0, 16384, 0, 16383 },
  143.     { false, false, true, 0, 262144, 0, 262143 }
  144. };
  145.  
  146. #endif /* halo_constants_h */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top