aLTis

Halo

Feb 25th, 2017
1,193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 126.26 KB | None | 0 0
  1. -- Addresses and Offsets
  2. -- Created by Wizard, edited by aLTis
  3.  
  4. --  The reason why I'm editing this is because Wizard's thing has a lot of wrong offsets and missing information
  5. --  I'll try to fill in what I find and write my name where I change stuff
  6. --  You can ctrl+f my name to see what I've changed
  7. --  I've also changed reading functions to use sapp's API
  8.  
  9. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  10. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  11. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  12. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  13. --DO NOT DOWNLOAD THIS SCRIPT. YOU SHOULD BE VISITING THIS PAGE WHENEVER YOU NEED AN OFFSET.
  14. --THIS PAGE IS UPDATED FREQUENTLY, SO IF YOU DOWNLOAD THIS YOU WILL HAVE  AN  OUTDATED COPY.
  15. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  16. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  17. -->>>>>>>>!!!!>>>>>>>>WARNING>>>>>>>>>>>>>>WARNING<<<<<<<<<<<<<<WARNING<<<<<<<<!!!!<<<<<<<<
  18.  
  19. function OnScriptLoad(process, Game, persistent)
  20.  
  21.     --For Chimera:
  22.     local map_name_address = read_string(0x00643064) -- maybe wrong?
  23.     local server_ip_address = read_string(0x0063EE28)
  24.     local reticle_is_red = read_dword(0x400008CC) -- 1 when reticle is red
  25.    
  26.     -- node information is stored here:
  27.     read_float(object + 0x550) -- Biped
  28.     read_float(object + 0x5C0) -- Vehicle
  29.     read_float(object + 0x340) -- Weapon
  30.     read_float(object + 0x294) -- Equipment
  31.     read_float(object + 0x244) -- Grenade
  32.     read_float(object + 0x2B0) -- Projectile
  33.     read_float(object + 0x1F8) -- Scenery
  34.     read_float(object + 0x228) -- Machine
  35.     read_float(object + 0x21C)  -- Machine Control
  36.    
  37.    
  38.     --Other stuff
  39.     local camera_address = 0x647498 -- from giraffe. 22192-scripted, 30400-first person, 30704-devcam, 31952-vehicle, 23776-dead camera
  40.     local camera_vehicle_enter_scale = read_float(camera_address - 4) -- only changes when entering or leaving a vehicle (from aLTis)
  41.     --unknown = read_word(camera_address + 2) -- always 68. maybe related to camera_address itself? (from aLTis)
  42.     local camera_object_id = read_dword(camera_address + 12) -- the object camera is tracking when vehicle camera is active (from aLTis)
  43.     local vehicle_seat = read_word(camera_address + 16) -- vehicle seat when vehicle camera is active (from aLTis)
  44.    
  45.     local devcam_x = read_float(camera_address + 4) -- (from aLTis)
  46.     local devcam_x = read_float(camera_address + 8) -- (from aLTis)
  47.     local devcam_x = read_float(camera_address + 12) -- (from aLTis)
  48.     local devcam_yaw = read_float(camera_address + 16) -- (from aLTis)
  49.     local devcam_pitch = read_float(camera_address + 20) -- (from aLTis)
  50.     local devcam_roll = read_float(camera_address + 24) -- (from aLTis)
  51.    
  52.     local camera_track_scale = read_float(camera_address + 28) -- 0 means camera track is ignored, 1 means default camera track amount (from aLTis)
  53.     local death_camera_distance = read_float(camera_address + 32) -- has something to do with how far away the death camera is from the biped (from aLTis)
  54.  
  55.     GetGameAddresses(Game) -- declare addresses and confirm the game (pc or ce)
  56.     game = Game
  57.     -- gametype info
  58.  
  59.     local gametype_name = readwidestring(gametype_base, 0x2C) -- Confirmed. Real name of gametype.
  60.     local gametype_game = read_byte(gametype_base + 0x30) -- Confirmed. (CTF = 1) (Slayer = 2) (Oddball = 3) (KOTH = 4) (Race = 5)
  61.     local gametype_team_play = read_byte(gametype_base + 0x34) -- Confirmed. (Off = 0) (On = 1)
  62.     --  gametype parameters
  63.         local gametype_other_players_on_radar = read_bit(gametype_base + 0x38, 0) -- Confirmed. (On = True, Off = False)
  64.         local gametype_friends_indicator = read_bit(gametype_base + 0x38, 1) -- Confirmed. (On = True, Off = False)
  65.         local gametype_infinite_grenades = read_bit(gametype_base + 0x38, 2) -- Confirmed. (On = True, Off = False)
  66.         local gametype_shields = read_bit(gametype_base + 0x38, 3) -- Confirmed. (Off = True, On = False)
  67.         local gametype_invisible_players = read_bit(gametype_base + 0x38, 4) -- Confirmed. (On = True, Off = False)
  68.         local gametype_starting_equipment = read_bit(gametype_base + 0x38, 5) -- Confirmed. (Generic = True, Custom = False)
  69.         local gametype_only_friends_on_radar = read_bit(gametype_base + 0x38, 6) -- Confirmed.
  70.     --  unkBit[7] 0. - always 0?
  71.     local gametype_indicator = read_byte(gametype_base + 0x3C) -- Confirmed. (Motion Tracker = 0) (Nav Points = 1) (None = 2)
  72.     local gametype_odd_man_out = read_byte(gametype_base + 0x40) -- Confirmed. (No = 0) (Yes = 1)
  73.     local gametype_respawn_time_growth = read_dword(gametype_base + 0x44) -- Confirmed. (1 sec = 30 ticks)
  74.     local gametype_respawn_time = read_dword(gametype_base + 0x48) -- Confirmed. (1 sec = 30 ticks)
  75.     local gametype_suicide_penalty = read_dword(gametype_base + 0x4C) -- Confirmed. (1 sec = 30 ticks)
  76.     local gametype_lives = read_byte(gametype_base + 0x50) -- Confirmed. (Unlimited = 0)
  77.     local gametype_maximum_health = read_float(gametype_base + 0x54) -- Confirmed.
  78.     local gametype_score_limit = read_byte(gametype_base + 0x58) -- Confirmed.
  79.     local gametype_weapons = read_byte(gametype_base + 0x5C) -- Confirmed. (Normal = 0) (Pistols = 1) (Rifles = 2) (Plasma Weapons = 3) (Sniper = 4) (No Sniping = 5) (Rocket Launchers = 6) (Shotguns = 7) (Short Range = 8) (Human = 9) (Convenant = 10) (Classic = 11) (Heavy Weapons = 12)
  80.     local gametype_red_vehicles = read_dword(gametype_base + 0x60) -- (???) Binary?
  81.     local gametype_blue_vehicles = read_dword(gametype_base + 0x64) -- (???) Binary?
  82.     local gametype_vehicle_respawn_time = read_dword(gametype_base + 0x68) -- Confirmed. (1 sec = 30 ticks)
  83.     local gametype_friendly_fire = read_byte(gametype_base + 0x6C) -- Confirmed. (Off = 0) (On = 1)
  84.     local gametype_friendly_fire_penalty = read_dword(gametype_base + 0x70) -- Confirmed. (1 sec = 30 ticks)
  85.     local gametype_auto_team_balance = read_byte(gametype_base + 0x74) -- Confirmed. (Off = 0) (On = 1)
  86.     local gametype_time_limit = read_dword(gametype_base + 0x78) -- Confirmed. (1 sec = 30 ticks)
  87.     local gametype_ctf_assault = read_byte(gametype_base + 0x7C) -- Confirmed. (No = 0) (Yes = 1)
  88.         local gametype_koth_moving_hill = read_byte(gametype_base + 0x7C) -- Confirmed. (No = 0) (Yes = 1)
  89.         local gametype_oddball_random_start = read_byte(gametype_base + 0x7C) -- Confirmed. (No = 0) (Yes = 1)
  90.         local gametype_race_type = read_byte(gametype_base + 0x7C) -- Confirmed. (Normal = 0) (Any Order = 1) (Rally = 2)
  91.         local gametype_slayer_death_bonus = read_byte(gametype_base + 0x7c) -- Confirmed. (Yes = 0) (No = 1)
  92.     local gametype_slayer_kill_penalty = read_byte(gametype_base + 0x7D) -- Confirmed. (Yes = 0) (No = 1)
  93.     local gametype_ctf_flag_must_reset = read_byte(gametype_base + 0x7E) -- Confirmed. (No = 0) (Yes = 1)
  94.         local gametype_slayer_kill_in_order = read_byte(gametype_base + 0x7E) -- Confirmed. (No = 0) (Yes = 1)
  95.     local gametype_ctf_flag_at_home_to_score = read_byte(gametype_base + 0x7F) -- Confirmed. (No = 0) (Yes = 1)
  96.     local gametype_ctf_single_flag_time = read_dword(gametype_base + 0x80) -- Confirmed. (1 sec = 30 ticks)
  97.         local gametype_oddball_speed_with_ball = read_byte(gametype_base + 0x80) -- Confirmed. (Slow = 0) (Normal = 1) (Fast = 2)
  98.         local gametype_race_team_scoring = read_byte(gametype_base + 0x80) -- Confirmed. (Minimum = 0) (Maximum = 1) (Sum = 2)
  99.     local gametype_oddball_trait_with_ball = read_byte(gametype_base + 0x84) -- Confirmed. (None = 0) (Invisible = 1) (Extra Damage = 2) (Damage Resistant = 3)
  100.     local gametype_oddball_trait_without_ball = read_byte(gametype_base + 0x88) -- Confirmed. (None = 0) (Invisible = 1) (Extra Damage = 2) (Damage Resistant = 3)
  101.     local gametype_oddball_ball_type = read_byte(gametype_base + 0x8C) -- Confirmed. (Normal = 0) (Reverse Tag = 1) (Juggernaut = 2)
  102.     local gametype_oddball_ball_spawn_count = read_byte(gametype_base + 0x90) -- Confirmed.
  103.     local gametype_koth_moving_hill = read_byte(gametype_base + 0x9C) -- Confirmed. (No = 0) (Yes = 1) (from aLTis) means assault too apparently
  104.    
  105.     --mapcycle header
  106.     mapcycle_pointer = read_dword(mapcycle_header) -- (???) index * 0xA4 + 0xC + this = something.
  107.     mapcycle_total_indicies = read_dword(mapcycle_header + 0x4) -- From DZS. Number of options in the mapcycle.
  108.     mapcycle_total_indicies_allocated = read_dword(mapcycle_header + 0x8) -- From Phasor.
  109.     mapcycle_current_index = read_dword(mapcycle_header + 0xC) -- Confirmed. Current mapcycle index.
  110.    
  111.     --mapcycle struct
  112.     mapcycle_something = readwidestring(mapcycle_pointer + mapcycle_current_index * 0xE4 + 0xC) -- (???) LOTS OF BAADF00D!
  113.     mapcycle_current_map_name = read_string(read_dword(mapcycle_pointer)) -- Confirmed. Real name of the map.
  114.     mapcycle_current_gametype_name = read_string(read_dword(mapcycle_pointer + 0x4)) -- Confirmed. Real name of the gametype. Case-sensitive.
  115.     mapcycle_current_gametype_name2 = readwidestring(mapcycle_pointer + 0xC) -- Confirmed. Real name of gametype. Case-sensitive.
  116.    
  117.     --Server globals
  118.     server_initialized = read_bit(network_server_globals, 0) -- Tested.
  119.     server_last_display_time = read_dword(network_server_globals + 0x4) -- From OS.
  120.     server_password = read_string(network_server_globals + 0x8, 8) -- Confirmed.
  121.     server_single_flag_force_reset = read_bit(network_server_globals + 0x10, 0) -- Confirmed.
  122.     server_banlist_path = read_string(network_server_globals + 0x1C) -- Confirmed. Path to the banlist file.
  123.     server_friendly_fire_type = read_word(network_server_globals + 0x120) -- Tested. Something to do with the friendly fire.
  124.     server_rcon_password = read_string(network_server_globals + 0x128) -- Confirmed.
  125.     if game == "CE" then
  126.         server_motd_filename = read_string(network_server_globals + 0x13C, 0x100) -- From OS.
  127.         server_motd_contents = read_string(network_server_globals + 0x23C, 0x100) -- From OS.
  128.     end
  129.  
  130.     --gameinfo header
  131.     gameinfo_base = read_dword(gameinfo_header)
  132.     --unkLong[1] 0x4 (???) Always 0?
  133.     --unkFloat[2] 0x8 (???)
  134.     --unkLong[9] 0x10 (???)
  135.     --unkFloat[2] 0x34 (???)
  136.    
  137.     --gameinfo struct (someone should really help me with names lol)
  138.     gameinfo_initialized = read_bit(gameinfo_base, 0) -- Confirmed. If the game is started or in standby. (1 if started, 0 if not)
  139.     gameinfo_active = read_bit(gameinfo_base, 1) -- Confirmed. If the game is currently running (Active = True, Not Active = False)
  140.     gameinfo_paused = read_bit(gameinfo_base, 2) -- From OS.
  141.     --Padding[2]
  142.     --unkWord[3] (???)
  143.     gameinfo_time_passed = read_dword(gameinfo_base + 0xC) -- Confirmed (1 second = 30 ticks)
  144.     gameinfo_elapsed_time = read_dword(gameinfo_base + 0x10) -- From OS.
  145.     gameinfo_server_time = read_dword(gameinfo_base + 0x14) -- Confirmed. Same as gameinfo_time_passed, except it lags behind.
  146.     gameinfo_server_speed = read_dword(gameinfo_base + 0x18) -- Confirmed. Changing this would be the same as cheatengining the server and messing with speedhack control.
  147.     gameinfo_leftover_time = read_dword(gameinfo_base + 0x1C) -- From OS. Not sure what this is. Changes frequently.
  148.     --unkLong[39] 0x20 don't care enough to continue.
  149.    
  150.     --banlist header
  151.     banlist_size = read_dword(banlist_header)
  152.     banlist_base = read_dword(banlist_header + 0x4)
  153.    
  154.     --banlist struct
  155.     banlist_struct_size = 0x44
  156.     for j = 1,banlist_size do
  157.         ban_name = readwidestring(banlist_base + j * 0x44, 13) -- Confirmed. Name of banned player.
  158.         ban_hash = read_string(banlist_base + j * 0x44 + 0x1A, 32) -- Confirmed. Hash of banned player.
  159.         ban_some_bool = read_bit(banlist_base + j * 0x44 + 0x3A, 0) -- (???)
  160.         ban_count = read_word(banlist_base + j * 0x44 + 0x3C) -- Confirmed. How many times the specified player has been banned.
  161.         ban_indefinitely = read_bit(banlist_base + j * 0x44 + 0x3E, 0) -- Confirmed. 1 if permanently banned, 0 if not.
  162.         ban_time = read_dword(banlist_base + j * 0x44 + 0x40) -- Confirmed. Ban end date.
  163.     end
  164.    
  165.     --String/data addresses that aren't in a struct/header (to my knowledge).
  166.     server_broadcast_version = read_string(broadcast_version_address) -- Confirmed. Version that the server is broadcasting on.
  167.     version_info = read_string(version_info_address, 0x2A) -- Confirmed. Some version info for halo
  168.     halo_broadcast_game = read_string(broadcast_game_address, 5) -- Confirmed. Basically determines whether the server will broadcast on PC/CE/Trial ("halor" = PC, "halom" = CE, "halo?" = Trial).
  169.     server_port = read_dword(server_port_address) -- Confirmed. Port that the server is broadcasting on.
  170.     server_path = read_string(server_path_address) -- Confirmed. Path to the server's haloded.exe
  171.     server_computer_name = read_string(computer_name_address) -- Confirmed. Server Computer (domain) name.
  172.     profile_path = read_string(profile_path_address) -- Confirmed. Path to the profile path.
  173.     map_name = readwidestring(map_name_address) -- Confirmed. Halo's map name (e.g. Blood Gulch)
  174.     computer_specs = read_string(computer_specs_address) -- Confirmed. Some address I found that stores information about the server (processor speed, brand)
  175.     map_name2 = read_string(map_name_address2) -- Confirmed. Map file name. (e.g. bloodgulch)
  176.     server_password = read_string(server_password_address, 8) -- Confirmed. Current server password for the server (will be nullstring if there is no password)
  177.     banlist_path = read_string(banlist_path_address) -- Confirmed. Path to the banlist file.
  178.     rcon_password = read_string(rcon_password_address, 8) -- Confirmed. Current rcon password for the server.
  179.    
  180.     -- random unuseful crap (string stuff) don't care enough to do CE
  181.     -- don't know why I even cared enough to write these down.
  182.     if game == "PC" then
  183.         halo_profilepath_cmdline = read_string(0x5D45B0, 5) -- Confirmed. The -path cmdline string.
  184.         halo_cpu_cmdline = read_string(0x5E4760, 4) -- Confirmed. The -cpu cmdline string.
  185.         halo_broadcast_game = read_string(0x5E4768, 5) -- Confirmed. Basically determines whether the server will broadcast on PC/CE/Trial ("halor" = PC, "halom" = CE, "halo?" = Trial).
  186.         halo_ip_cmdline = read_string(0x5E4770, 3) -- Confirmed. The -ip cmdline string.
  187.         halo_port_cmdline = read_string(0x5E4774, 5) -- Confirmed. The -port cmdline string.
  188.         halo_checkfpu_cmdline = read_string(0x5E477C, 9) -- Confirmed. The -checkfpu cmdline string.
  189.         halo_windowname = read_string(0x5E4788, 4) -- "The console windowname and classname (basically windowtitle, always 'Halo Console (#)').
  190.         --0x5E4790 - 0x5E473C is registry key stuff
  191.         halo_dw15_exe_path = read_string(0x5E4940, 26) --Confirmed. Path to dw15.exe (.\Watson\dw15.exe -x -s %u) probably from client code.
  192.         --other random crap/strings here
  193.     end
  194.  
  195. end
  196.  
  197. -- All of these are confirmed, unless said otherwise.
  198. function GetGameAddresses(game)
  199.  
  200.     if game == "PC" then
  201.         -- Structs/Headers.
  202.         stats_header = 0x639720
  203.         stats_globals = 0x639898
  204.         ctf_globals = 0x639B98
  205.         slayer_globals = 0x63A0E8
  206.         oddball_globals = 0x639E58
  207.         koth_globals = 0x639BD0
  208.         race_globals = 0x639FA0
  209.         race_locs = 0x670F40
  210.         map_pointer = 0x63525C
  211.         gametype_base = 0x671340
  212.         network_struct = 0x745BA0
  213.         camera_base = 0x69C2F8
  214.         player_header_pointer = 0x75ECE4
  215.         obj_header_pointer = 0x744C18
  216.         collideable_objects_pointer = 0x744C34
  217.         map_header_base = 0x630E74
  218.         banlist_header = 0x641280
  219.         game_globals = "???" -- (???) Why do I not have this for PC?
  220.         gameinfo_header = 0x671420
  221.         mapcycle_header = 0x614B4C
  222.         network_server_globals = 0x69B934
  223.         flags_pointer = 0x6A590C
  224.         hash_table_base = 0x6A2AE4
  225.        
  226.         -- String/Data Addresses.
  227.         broadcast_version_address = 0x5DF840
  228.         version_info_address = 0x5E02C0
  229.         broadcast_game_address = 0x5E4768
  230.         server_port_address = 0x625230
  231.         server_path_address = 0x62C390
  232.         computer_name_address = 0x62CD60
  233.         profile_path_address = 0x635610
  234.         map_name_address = 0x63BC78
  235.         computer_specs_address = 0x662D04
  236.         map_name_address2 = 0x698F21
  237.         server_password_address = 0x69B93C
  238.         banlist_path_address = 0x69B950
  239.         rcon_password_address = 0x69BA5C
  240.  
  241.         --Patches
  242.         gametype_patch = 0x481F3C -- I 'thought' this worked but haven't tested in ages.
  243.         hashcheck_patch = 0x59c280
  244.         servername_patch = 0x517D6B
  245.         versioncheck_patch = 0x5152E7
  246.     else
  247.         -- Structs/headers.
  248.         stats_header = 0x5BD740
  249.         stats_globals = 0x5BD8B8
  250.         ctf_globals = 0x5BDBB8 -- tested value = 0x5BDB98
  251.         slayer_globals = 0x5BE108
  252.         oddball_globals = 0x5BDE78
  253.         koth_globals = 0x5BDBF0 -- tested value = 0x5BDBD0
  254.         race_globals = 0x5BDFC0
  255.         race_locs = 0x5F5098
  256.         map_pointer = 0x5B927C
  257.         gametype_base = 0x5F5498 -- is it 0x5F5478 ??
  258.         network_struct = 0x6C7980
  259.         camera_base = 0x62075C
  260.         player_globals = 0x6E1478 -- From OS.
  261.         player_header_pointer = 0x6E1480
  262.         obj_header_pointer = 0x6C69F0
  263.         collideable_objects_pointer = 0x6C6A14
  264.         map_header_base = 0x6E2CA4
  265.         banlist_header = 0x5C52A0
  266.         game_globals = 0x61CFE0 -- (???)
  267.         gameinfo_header = 0x5F55BC
  268.         mapcycle_header = 0x598A8C
  269.         network_server_globals = 0x61FB64
  270.         hash_table_base = 0x5AFB34
  271.        
  272.         -- String/Data Addresses.
  273.         broadcast_version_address = 0x564B34
  274.         version_info_address = 0x565104
  275.         broadcast_game_address = 0x569EAC
  276.         server_port_address = 0x5A91A0
  277.         server_path_address = 0x5B0670
  278.         computer_name_address = 0x5B0D40
  279.         profile_path_address = 0x5B9630
  280.         map_name_address = 0x5BFC98
  281.         computer_specs_address = 0x5E6E5C
  282.         map_name_address2 = 0x61D151
  283.         server_password_address = 0x61FB6C
  284.         banlist_path_address = 0x61FB80
  285.         rcon_password_address = 0x61FC8C
  286.        
  287.  
  288.         --Patches
  289.         hashcheck_patch = 0x530130
  290.         servername_patch = 0x4CE0CD
  291.         versioncheck_patch = 0x4CB587
  292.     end
  293. end
  294.  
  295. function OnClientUpdate(player, objectId)
  296.  
  297.     local thisHash = gethash(player)
  298.     local team = getteam(player)
  299.  
  300.     if thisHash ~= nil then
  301.  
  302.         -- Confirmed/tested addresses and offsets
  303.         -- teams: red = 0, blue = 1
  304.        
  305.         --stats header (size = 0x178 = 376 bytes)
  306.         --This header is seriously unfinished.
  307.         stats_header_recorded_animations_data = read_dword(stats_header + 0x0) -- Confirmed. Pointer to Recorded Animations data table.
  308.         --unkByte[4] 0x4-0x8 (Zero's)
  309.         stats_header_last_decal_location_x = read_float(stats_header + 0x8) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  310.         stats_header_last_decal_location_y = read_float(stats_header + 0xC) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  311.         stats_header_last_decal_location_x2 = read_float(stats_header + 0x10) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  312.         stats_header_last_decal_location_y2 = read_float(stats_header + 0x14) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  313.         stats_header_last_decal_location_x3 = read_float(stats_header + 0x18) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  314.         stats_header_last_decal_location_y3 = read_float(stats_header + 0x1C) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  315.         stats_header_last_decal_location_x4 = read_float(stats_header + 0x20) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  316.         stats_header_last_decal_location_y4 = read_float(stats_header + 0x24) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  317.         stats_header_last_decal_location_x5 = read_float(stats_header + 0x28) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  318.         stats_header_last_decal_location_y5 = read_float(stats_header + 0x2C) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  319.         stats_header_last_decal_location_x6 = read_float(stats_header + 0x30) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  320.         stats_header_last_decal_location_y6 = read_float(stats_header + 0x34) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  321.         --unkByte[48] 0x38-0x68 (Zero's)
  322.         stats_header_last_decal_location2_x = read_float(stats_header + 0x68) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  323.         stats_header_last_decal_location2_y = read_float(stats_header + 0x6C) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  324.         stats_header_last_decal_location2_x2 = read_float(stats_header + 0x70) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  325.         stats_header_last_decal_location2_y2 = read_float(stats_header + 0x74) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  326.         stats_header_last_decal_location2_x3 = read_float(stats_header + 0x78) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  327.         stats_header_last_decal_location2_y3 = read_float(stats_header + 0x7C) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  328.         stats_header_last_decal_location2_x4 = read_float(stats_header + 0x80) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  329.         stats_header_last_decal_location2_y4 = read_float(stats_header + 0x84) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  330.         stats_header_last_decal_location2_x5 = read_float(stats_header + 0x88) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  331.         stats_header_last_decal_location2_y5 = read_float(stats_header + 0x8C) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  332.         stats_header_last_decal_location2_x6 = read_float(stats_header + 0x90) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  333.         stats_header_last_decal_location2_y6 = read_float(stats_header + 0x94) -- From Silentk. World coordinates of the last bullet/nade hit anywhere on map x,y, applies to BSP only, not objects
  334.         --unkFloat[2] 0x98-0xA0 (???)
  335.         --unkByte[40] 0xA0-0xC8 (Zero's)
  336.         stats_header_decalID_table = read_dword(stats_header + 0xC8) -- From Silentk. Pointer to an array of Decal ID's (correlates with LastDecalLocation)
  337.         --unkPointer[1] 0xCC-0xD0 (???)
  338.         --unkByte[20] 0xD0-0xE4 (???)
  339.         stats_header_locationID = read_dword(stats_header + 0xE4) -- From Silentk
  340.         stats_header_locationID2 = read_dword(stats_header + 0xE8) -- From Silentk
  341.         --unkLong[1] 0xEC-0xF0 (???)
  342.         --unkByte[130] 0xF0-0x172 (Zero's)
  343.         --unkPointer[2] 0x172-0x17A
  344.        
  345.         --stats struct (size = 0x30 = 48 bytes)
  346.         stats_base = stats_globals + player*0x30
  347.         stats_player_ingame = read_byte(stats_base + 0x0) -- From Silentk (1 = Ingame, 0 if not)
  348.         --unkByte[3] 0x1-0x4 (???)
  349.         stats_player_id = readident(stats_base, 0x4) --Confirmed. Full DWORD ID of player.
  350.         stats_player_kills = read_word(stats_base + 0x8) -- Confirmed.
  351.         --unkByte[6] 0xA-0x10 (???)
  352.         stats_player_assists = read_word(stats_base + 0x10) -- From Silentk
  353.         --unkByte[6] 0x12-0x18 (???)
  354.         stats_player_betrays = read_word(stats_base + 0x18) -- From Silentk. Actually betrays + suicides.
  355.         stats_player_deaths = read_word(stats_base + 0x1A) -- From Silentk Everytime you die, no matter what..
  356.         stats_player_suicides = read_word(stats_base + 0x1C) -- Confirmed.
  357.         stats_player_flag_steals = read_word(stats_base + 0x1E) -- From Silentk. Flag steals for CTF.
  358.             stats_player_hill_time = read_word(stats_base + 0x1E) -- Confirmed. Time for KOTH. (1 sec = 30 ticks)
  359.             stats_player_race_time = read_word(stats_base + 0x1E) -- Guess. Time for Race. (1 sec = 30 ticks)
  360.         stats_player_flag_returns = read_word(stats_base + 0x20) -- From Silentk. Flag returns for CTF.
  361.             stats_player_oddball_target_kills = read_word(stats_base + 0x20) -- Guess. Number of times you killed the Juggernaut or It.
  362.             stats_player_race_laps = read_word(stats_base + 0x20) -- Guess. Laps for Race.
  363.         stats_player_flag_scores = read_word(stats_base + 0x22) -- From Silentk. Flag scores for CTF.
  364.             stats_player_oddball_kills = read_word(stats_base + 0x22) -- Guess. Number of kills you have as Juggernaut or It.
  365.             stats_player_race_best_time = read_word(stats_base + 0x22) -- Guess. Best time for Race. (1 sec = 30 ticks)
  366.         --unkByte[12] 0x24-0x30 (???)
  367.  
  368.         -- ctf globals (size = 0x34 = 52 bytes)
  369.         ctf_flag_coords_pointer = read_dword(ctf_globals + team*4) -- Confirmed. Pointer to the coords where the flag respawns.
  370.             ctf_flag_x_coord = read_float(ctf_flag_coords_pointer) -- Confirmed.
  371.             ctf_flag_y_coord = read_float(ctf_flag_coords_pointer + 0x4) -- Confirmed.
  372.             ctf_flag_z_coord = read_float(ctf_flag_coords_pointer + 0x8) -- Confirmed.
  373.         ctf_flag_object_id = readident(ctf_globals + team*4 + 0x8) -- Confirmed.
  374.         ctf_team_score = read_dword(ctf_globals + team*4 + 0x10) -- Confirmed.
  375.         ctf_score_limit = read_dword(ctf_globals + 0x18) -- Confirmed.
  376.         ctf_team_missing_flag_bool = read_bit(ctf_globals + 0x1C+team, 0) -- Confirmed. (True if team doesn't have flag, False if their flag is at home)
  377.         ctf_flag_istaken_red_soundtimer = read_dword(ctf_globals + 0x20) -- Confirmed. (Announcer repeats 'Red team, has the flag' after this number gets to 600 ticks = 20 seconds)
  378.         ctf_flag_istaken_blue_soundtimer = read_dword(ctf_globals + 0x24) -- Confirmed. (Announcer repeats 'Blue team, has the flag' after this number gets to 600 ticks = 20 seconds)
  379.         ctf_flag_swap_timer = read_dword(ctf_globals + 0x28) -- Confirmed. Single flag only. Counts down until 0, then offense team swaps with defense team. (1 second = 30 ticks)
  380.         ctf_failure_timer = read_dword(ctf_globals + 0x2C)-- From OS. Sound timer for failure. Counts down until 0. (1 second = 30 ticks)
  381.         ctf_team_on_defense = read_byte(ctf_globals + 0x30) -- Confirmed. Team on defense (single flag gametypes) (Red = 0, Blue = 1)
  382.  
  383.         --koth globals (size = 0x200 = 512 bytes)
  384.         --Reminder: There are 16 teams in FFA, one for each person.
  385.         koth_team_score = read_dword(koth_globals + team*4) -- Confirmed. (1 second = 30 ticks)
  386.         koth_team_last_time_in_hill = read_dword(koth_globals + player*4 + 0x40) -- Confirmed. gameinfo_current_time - this = time since team was last in the hill. (1 sec = 30 ticks)
  387.         koth_player_in_hill = read_byte(koth_globals + player + 0x80) -- Confirmed. (1 if in hill, 0 if not)
  388.         koth_hill_marker_count = read_dword(koth_globals + 0x90) -- Confirmed. Number of hill markers.
  389.         --These are coordinates for each hill marker
  390.         for i = 0,koth_hill_marker_count-1 do
  391.             koth_hill_marker_x_coord = read_float(koth_globals + i*12 + 0x94) -- X coordinate for hill marker (from aLTis: math here was wrong)
  392.             koth_hill_marker_y_coord = read_float(koth_globals + i*12 + 0x98) -- Y coordinate for hill marker
  393.             koth_hill_marker_z_coord = read_float(koth_globals + i*12 + 0x9C) -- Z coordinate for hill marker
  394.         end
  395.         --wth... these are coordinates but they're 2 dimensional, no z axis. Probably just the area that determines if you are in a hill
  396.         for i = 0,koth_hill_marker_count-1 do
  397.             koth_hill_marker_x_coord2 = read_float(koth_globals + i*8 + 0x124) -- Tested. X coordinate for 2d hill. (from aLTis: math here was wrong
  398.             koth_hill_marker_y_coord2 = read_float(koth_globals + i*8 + 0x128) -- Tested. Y coordinate for 2d hill.
  399.         end
  400.         koth_center_of_hill_x_coord = read_float(koth_globals + 0x184) -- Confirmed. Center of hill X.
  401.         koth_center_of_hill_y_coord = read_float(koth_globals + 0x188) -- Confirmed. Center of hill Y.
  402.         koth_center_of_hill_z_coord = read_float(koth_globals + 0x18C) -- Confirmed. Center of hill Z.
  403.         koth_occupied = read_dword(koth_globals + 0x190) -- from aLTis
  404.         koth_occupied_time = read_dword(koth_globals + 0x194) -- from aLTis
  405.         koth_occupied_object_id = read_dword(koth_globals + 0x198) -- from aLTis (unconfirmed)
  406.         koth_move_timer_real = read_dword(koth_globals + 0x1A8) -- from aLTis (actually works)
  407.         koth_move_timer = read_dword(koth_globals + 0x200) -- Confirmed. (1 second = 30 ticks)
  408.  
  409.         -- oddball globals
  410.         oddball_score_to_win = read_dword(oddball_globals) -- Confirmed.
  411.         oddball_team_score = read_dword(oddball_globals + team*4 + 0x4) -- Confirmed. There's actually 16 teams if the gametype is FFA.
  412.         oddball_player_score = read_dword(oddball_globals + player*4 + 0x44) -- Confirmed.
  413.         --oddball_something = read_dword(oddball_globals + player*4 + 0x64) -- (???)
  414.         oddball_ball_indexes = read_dword(oddball_globals + 0x84) -- Tested. Idk what this is for but it holds oddball indexes that are differentiated by 0x1C2.
  415.             oddball_it_people = read_dword(oddball_globals + 0x84) -- Tested. It's filled with stuff depending on the amount of 'it' people in jugg/tag
  416.         oddball_player_holding_ball = readident(oddball_globals + player*4 + 0xC4) -- Confirmed.
  417.         oddball_player_time_with_ball = read_dword(oddball_globals + player*4 + 0x104) -- Confirmed. (1 second = 30 ticks)
  418.  
  419.         --race globals
  420.         race_checkpoint_count = read_dword(race_globals) -- Confirmed. Total number of checkpoints required for a lap. Stored very awkwardly. (0x1 = 1, 0x3 = 2, 0x7 = 3, 0xF = 4, 0x1F = 5 etc)
  421.         race_player_current_checkpoint = read_dword(race_globals + player*4 + 0x44) -- Confirmed. Current checkpoint the player needs to go to. Stored very awkwardly. (0x1 = first checkpoint, 0x3 = second checkpoint, 0x7 = 3rd checkpoint, 0xF = 4th checkpoint, 0x1F = 5th checkpoint etc)
  422.         race_team_score = read_dword(race_globals + team*4 + 0x88) -- Confirmed.
  423.  
  424.         --race checkpoint locations
  425.         for i = 0,race_checkpoint_count do
  426.             race_checkpoint_x_coord = read_float(race_locs + i*0x20) -- Confirmed.
  427.             race_checkpoint_y_coord = read_float(race_locs + i*0x20 + 0x4) -- Confirmed.
  428.             race_checkpoint_z_coord = read_float(race_locs + i*0x20 + 0x8) -- Confirmed.
  429.         end
  430.  
  431.         --slayer globals
  432.         slayer_team_score = read_dword(slayer_globals + team*4) -- Confirmed.
  433.         slayer_player_score = read_dword(slayer_globals + player*4 + 0x40) -- Confirmed.
  434.         slayer_game = read_byte(slayer_globals + 0x20) -- Tested. I think its always 1. I guess 1 if slayer, 0 if not? Something like that.
  435.  
  436.         -- camera struct
  437.         camera_size = 0x30
  438.         camera_xy = read_float(camera_base + player*camera_size)
  439.         camera_z = read_float(camera_base + player*camera_size + 0x4)
  440.         camera_x_aim = read_float(camera_base + player*camera_size + 0x1C)
  441.         camera_y_aim = read_float(camera_base + player*camera_size + 0x20)
  442.         camera_z_aim = read_float(camera_base + player*camera_size + 0x24)
  443.  
  444.         -- mp flags table (race checkpoints, hill markers, vehicle spawns, etc)
  445.         -- REM figure out wth this is since I now know where flags really are...
  446.         flags_table_base = read_dword(flags_pointer) -- Tested.
  447.         flags_count = read_dword(flags_table_base + 0x378) -- Tested.
  448.         flags_table_address = read_dword(flags_table_base + 0x37C) -- Tested.
  449.         for i = 0,flags_count do -- i is each individual flag index
  450.             flag_address = flags_table_address + i * 148
  451.             flag_x_coord = read_float(flag_address) -- Confirmed.
  452.             flag_y_coord = read_float(flag_address + 0x4) -- Confirmed.
  453.             flag_z_coord = read_float(flag_address + 0x8) -- Confirmed.
  454.             flag_type = read_word(flag_address + 0x10) -- Tested. (3 if race checkpoint, 6 if spawnpoint, sometimes 0 meaning something else)
  455.             --flag_something = read_word(flag_address + 0x12) -- (???) Always 1?
  456.             flag_tagtype = read_string(flag_address + 0x14, 4) -- Tested. It's usually ITMC or WPCL, which makes no sense...
  457.         end
  458.  
  459.         -- player struct setup
  460.         m_player = getplayer(player)
  461.  
  462.         -- player struct
  463.         player_id = read_word(m_player, 0x0) -- Confirmed. WORD ID of this player. (0xEC70 etc)
  464.         player_host = read_word(m_player + 0x2) -- Confirmed. (Host = 0) (Not host = 0xFFFFFFFF)
  465.         player_name = readwidestring(m_player + 0x4, 12) -- Confirmed.
  466.         --unkIdent[1] 0x1C-0x20 (???)
  467.         player_team = read_byte(m_player + 0x20) -- Confirmed. (Red = 0) (Blue = 1)
  468.         --Padding[3] 0x21-0x24
  469.         player_interaction_obj_id = readident(m_player + 0x24) -- Confirmed. Returns vehi/weap id on interaction. (does not apply to weapons you're already holding)
  470.         player_interaction_object_type = read_word(m_player + 0x28) -- Confirmed. (Vehicle = 8, Weapon = 7)
  471.         player_interaction_vehi_seat = read_word(m_player + 0x2A) -- Confirmed. Takes seat number from vehi tag starting with 0. Warthog Seats: (0 = Driver, 1 = Gunner, 2 = Passenger)
  472.         player_respawn_time = read_dword(m_player + 0x2C) -- Confirmed. Counts down when dead. When 0 you respawn. (1 sec = 30 ticks)
  473.         player_respawn_time_growth = read_dword(m_player + 0x30) -- Confirmed. Current respawn time growth for player. (1 second = 30 ticks)
  474.         player_obj_id = readident(m_player + 0x34) -- Confirmed.
  475.         player_last_obj_id = readident(m_player + 0x38) -- Confirmed. 0xFFFFFFFF if player hasn't died/hasn't had their object destroyed yet. sv_kill or kill(player) DOES NOT AFFECT THIS AT ALL.
  476.         player_cluster_index = read_word(m_player + 0x3C) -- Tested. Not sure what this is, but it's definitely something.
  477.         --  bitmask16:
  478.             player_weapon_pickup = read_bit(m_player + 0x3E, 0) -- Confirmed. (True if picking up weapon, False if not.)
  479.         --  bitPadding[15] 1-15
  480.         --player_auto_aim_target_objId = readident(m_player + 0x40) -- (???) Always 0xFFFFFFFF
  481.         player_last_bullet_time = read_dword(m_player + 0x44) -- Confirmed. gameinfo_current_time - this = time since last shot fired. (1 second = 30 ticks). Auto_aim_update_time in OS.
  482.        
  483.         --This stuff comes directly from the client struct:
  484.         player_name2 = readwidestring(m_player + 0x48, 12) -- Confirmed.
  485.         player_color = read_word(m_player + 0x60) -- Confirmed. Color of the player (FFA Gametypes Only.) (0 = white) (1 = black) (2 = red) (3 = blue) (4 = gray) (5 = yellow) (6 = green) (7 = pink) (8 = purple) (9 = cyan) (10 = cobalt) (11 = orange) (12 = teal) (13 = sage) (14 = brown) (15 = tan) (16 = maroon) (17 = salmon)
  486.         --player_icon_index = read_word(m_player + 0x62) -- (???) Always 0xFFFF?
  487.         player_machine_index = read_byte(m_player + 0x64) -- Confirmed with resolveplayer(player). Player Machine Index (rconId - 1).
  488.         --player_controller_index = read_byte(m_player + 0x65) -- (???) Always 0?
  489.         player_team2 = read_byte(m_player + 0x66) -- Confirmed. (Red = 0) (Blue = 1)
  490.         player_index = read_byte(m_player + 0x67) -- Confirmed. Player memory id/index (0 - 15) (To clarify: this IS the 'player' argument passed to phasor functions)
  491.         --End of client struct stuff.
  492.        
  493.         player_invis_time = read_word(m_player + 0x68) -- Confirmed. Time until player is no longer camouflaged. (1 sec = 30 ticks)
  494.         --unkWord[1] 0x6A-0x6C (???) Has something to do with player_invis_time.
  495.         player_speed = read_float(m_player + 0x6C) -- Confirmed.
  496.         player_teleporter_flag_id = readident(m_player + 0x70) -- Tested. Index to a netgame flag in the scenario, or -1 (Always 0xFFFFFFFF?)
  497.         player_objective_mode = read_dword(m_player + 0x74) -- From Smiley. (Hill = 0x22 = 34) (Juggernaut = It = 0x23 = 35) (Race = 0x16 = 22) (Ball = 0x29 = 41) (Others = -1)
  498.         player_objective_player_id = readident(m_player + 0x78) -- Confirmed. Becomes the full DWORD ID of this player once they interact with the objective. (DOES NOT APPLY TO CTF) (0xFFFFFFFF / -1 if not interacting)
  499.         player_target_player = read_dword(m_player + 0x7C) -- From OS. Values (this and below) used for rendering a target player's name. (Always 0xFFFFFFFF?)
  500.         player_target_time = read_dword(m_player + 0x80) -- From OS. Timer used to fade in the target player name.
  501.         player_last_death_time = read_dword(m_player + 0x84) -- Confirmed. gameinfo_current_time - this = time since last death time. (1 sec = 30 ticks)
  502.         player_slayer_target = readident(m_player + 0x88) -- Confirmed. Slayer Target Player
  503.         --  bitmask32:
  504.             player_oddman_out = read_bit(m_player + 0x8C, 0) -- Confirmed. (1 if oddman out, 0 if not)
  505.         --  bitPadding[31]
  506.         --Padding[6] 0x90-0x96
  507.         player_killstreak = read_word(m_player + 0x96) -- Confirmed. How many kills the player has gotten in their lifetime.
  508.         player_multikill = read_word(m_player + 0x98) -- (???) 0 on spawn, 1 when player gets a kill, then stays 1 until death.
  509.         player_last_kill_time = read_word(m_player + 0x9A) -- Confirmed. gameinfo_current_time - this = time since last kill time. (1 sec = 30 ticks)
  510.         player_kills = read_word(m_player + 0x9C) -- Confirmed.
  511.         --unkByte[6] 0x9E-0xA4 (Padding Maybe?)
  512.         player_assists = read_word(m_player + 0xA4) -- Confirmed.
  513.         --unkByte[6] 0xA6-0xAC (Padding Maybe?)
  514.         player_betrays = read_word(m_player + 0xAC) -- Confirmed. Actually betrays + suicides.
  515.         player_deaths = read_word(m_player + 0xAE) -- Confirmed.
  516.         player_suicides = read_word(m_player + 0xB0) -- Confirmed.
  517.         --Padding[14] 0xB2-0xC0
  518.         player_teamkills = read_word(m_player + 0xC0) -- From OS.
  519.         --Padding[2] 0xC2-0xC4
  520.        
  521.         --This is all copied from the stat struct
  522.         player_flag_steals = read_word(m_player + 0xC4) -- Confirmed. Flag steals for CTF.
  523.             player_hill_time = read_word(m_player + 0xC4) -- Confirmed. Time for KOTH. (1 sec = 30 ticks)
  524.             player_race_time = read_word(m_player + 0xC4) -- Confirmed. Time for Race. (1 sec = 30 ticks)
  525.         player_flag_returns = read_word(m_player + 0xC6) -- Confirmed. Flag returns for CTF.
  526.             player_oddball_target_kills = read_word(m_player + 0xC6) -- Confirmed. Number of times you killed the Juggernaut or It.
  527.             player_race_laps = read_word(m_player + 0xC6) -- Confirmed. Laps for Race.
  528.         player_flag_scores = read_word(m_player + 0xC8) -- Confirmed. Flag scores for CTF.
  529.             player_oddball_kills = read_word(m_player + 0xC8) -- Confirmed. Number of kills you have as Juggernaut or It.
  530.             player_race_best_time = read_word(m_player + 0xC8) -- Confirmed. Best time for Race. (1 sec = 30 ticks)
  531.        
  532.         --unkByte[2] 0xCA-0xCC (Padding Maybe?)
  533.         player_telefrag_timer = read_dword(m_player + 0xCC) -- Confirmed. Time spent blocking a tele. Counts down after other player stops trying to teleport. (1 sec = 30 ticks)
  534.         player_quit_time = read_dword(m_player + 0xD0) -- Confirmed. gameinfo_current_time - this = time since player quit. 0xFFFFFFFF if player not quitting. (1 sec = 30 ticks)
  535.         --  bitmask16:
  536.         --  player_telefrag_enabled = read_bit(m_player + 0xD4, 0) -- (???) Always False?
  537.         --  bitPadding[7] 1-7
  538.         --  player_quit = read_bit(m_player + 0xD4, 8) -- (???) Always False?
  539.         --  bitPadding[7] 9-15
  540.         --Padding[6] 0xD6-0xDC
  541.         player_ping = read_dword(m_player + 0xDC) -- Confirmed.
  542.         player_teamkill_number = read_dword(m_player + 0xE0) -- Confirmed.
  543.         player_teamkill_timer = read_dword(m_player + 0xE4) -- Confirmed. Time since last betrayal. (1 sec = 30 ticks)
  544.         player_some_timer = read_word(m_player + 0xE8) -- Tested. It increases once every half second until it hits 36, then repeats.
  545.         --unkByte[14] 0xEA-0xF8 (???)
  546.         player_x_coord = read_float(m_player + 0xF8) -- Confirmed.
  547.         player_y_coord = read_float(m_player + 0xFC) -- Confirmed.
  548.         player_z_coord = read_float(m_player + 0x100) -- Confirmed.
  549.         --unkIdent[1] 0x104-0x108 (???)
  550.        
  551.        
  552.         --unkByte[8] 0x108-0x110 (???)
  553.         --unkLong[1] 0x110-0x114 (Some timer)
  554.         --unkByte[8] 0x114-0x11C (???)
  555.         --  Player Action Keypresses.
  556.             player_melee_key = read_bit(m_player + 0x11C, 0) -- Confirmed.
  557.             player_action_key = read_bit(m_player + 0x11C, 1) -- Confirmed.
  558.         --  unkBit[1] 2
  559.             player_flashlight_key = read_bit(m_player + 0x11C, 3) -- Confirmed.
  560.         --  unkBit[9] 4-12
  561.             player_reload_key = read_bit(m_player + 0x11C, 13) -- Confirmed.
  562.         --  unkBit[2] 14-15
  563.        
  564.         --unkByte[30] 0x11E-0x134 (???)
  565.         player_xy_aim = read_float(m_player + 0x138) -- Confirmed. Lags. (0 to 2pi) In radians.
  566.         player_z_aim = read_float(m_player + 0x13C) -- Confirmed. Lags. (-pi/2 to pi/2) In radians.
  567.         player_forward = read_float(m_player + 0x140) -- Confirmed. Negative means backward. Lags. (-1, -sqrt(2)/2, 0, sqrt(2)/2, 1)
  568.         player_left = read_float(m_player + 0x144) -- Confirmed. Negative means right. Lags. (-1, -sqrt(2)/2, 0, sqrt(2)/2, 1)
  569.         player_rateoffire_speed = read_float(m_player + 0x148) -- Confirmed. As player is shooting, this will gradually increase until it hits the max (0 to 1 only)
  570.         player_weap_type = read_word(m_player + 0x14C) -- Confirmed. Lags. (Primary = 0) (Secondary = 1) (Tertiary = 2) (Quaternary = 3)
  571.         player_nade_type = read_word(m_player + 0x14E) -- Confirmed. Lags. (Frag = 0) (Plasma = 1)
  572.         --unkByte[4] 0x150-0x154 (Padding Maybe?)
  573.         player_x_aim2 = read_float(m_player + 0x154) -- Confirmed. Lags.
  574.         player_y_aim2 = read_float(m_player + 0x158) -- Confirmed. Lags.
  575.         player_z_aim2 = read_float(m_player + 0x15C) -- Confirmed. Lags.
  576.         --unkByte[16] 0x160-0x170 (Padding Maybe?)
  577.         player_x_coord2 = read_float(m_player + 0x170) -- Confirmed. Lags. (Possibly what the client reports is _its_ world coord?)
  578.         player_y_coord2 = read_float(m_player + 0x174) -- Confirmed. Lags. (Possibly what the client reports is _its_ world coord?)
  579.         player_z_coord2 = read_float(m_player + 0x178) -- Confirmed. Lags. (Possibly what the client reports is _its_ world coord?)
  580.         --unkByte[132] 0x17C-0x200
  581.  
  582.         -- obj/weap struct setup
  583.         object = getobject(player_obj_id) -- obj struct setup
  584.         m_vehicle = getobject(read_dword(object + 0x11C)) -- vehi check setup
  585.  
  586.         -- vehi check
  587.         if m_vehicle then
  588.             object = m_vehicle
  589.         end
  590.  
  591.         --***************************************** OBJECTS **************************************************************
  592.        
  593.         -- obj struct. This struct applies to ALL OBJECTS. 0x0 - 0x1F4
  594.         obj_tag_id = read_dword(object) -- Confirmed with HMT. Tag Meta ID / MapID / TagID.
  595.         --obj_object_role = read_dword(object + 0x4) -- From OS. (0 = Master, 1 = Puppet, 2 = Puppet controlled by local player, 3 = ???) Always 0?
  596.         --  bitmask32:
  597.             obj_is_not_moving = read_bit(object + 0x8, 0) -- Tested. Is true when object is not moving (from aLTis)
  598.         --  unkBits[8] 1-7 (???)
  599.             obj_should_force_baseline_update = read_bit(object + 0x8, 8) -- From OS.
  600.         --  unkBits[23] 9-32 (???)
  601.         obj_existance_time = read_dword(object + 0xC) -- Confirmed. (1 second = 30 ticks)
  602.        
  603.        
  604.         --  Physics bitmask32:
  605.             obj_ghost_mode = read_bit(object + 0x10, 0) -- (Ghost mode = True)
  606.             obj_is_on_ground = read_bit(object + 0x10, 1) -- (Object is on the ground = True, otherwise False)
  607.             obj_ignoreGravity = read_bit(object + 0x10, 2) -- From Phasor
  608.             obj_is_in_water = read_bit(object + 0x10, 3) -- For vehicles only? (from aLTis)
  609.         --  unkBits[1] 0x10 4 seems to be water related too (vehicle only?)
  610.             obj_stationary = read_bit(object + 0x10, 5) -- This bit is set (true) when the object is stationary.
  611.         --  unkBits[1] 0x10 6
  612.             obj_noCollision2 = read_bit(object + 0x10, 7) -- From Phasor. When player enters/exits vehicles, its animations are weird
  613.             obj_dynamic_lights = read_bit(object + 0x10, 8) -- Setting this to false makes lights derender if you move the object away from where it was (from aLTis)
  614.         --  unkBits[3] 0x10 9-10
  615.             obj_connected_to_map = read_bit(object + 0x10, 11) -- Setting this to false will make the sounds attached to this stay in place if object moves (probably has more changes than just that) (from aLTis)
  616.             obj_node_rotation_thingy = read_bit(object + 0x10, 12) -- Setting this to true messes up rotations of the nodes. Not 100% sure what this is (from aLTis)
  617.             obj_dynamic_lights2 = read_bit(object + 0x10, 13) -- similar to the first one but more harsh? (from aLTis)
  618.             obj_dynamic_shading = read_bit(object + 0x10, 14) -- Setting this to false will prevent shading and shadows from changing when object moves to darker/lighter areas (from aLTis)
  619.             obj_dynamic_shading2 = read_bit(object + 0x10, 15) -- Also shading related but can't quite tell what it does (from aLTis)
  620.             obj_garbage_bit = read_bit(object + 0x10, 16) -- From OS.
  621.         --  unkBits[1] 0x10 17
  622.             obj_does_not_cast_shadow = read_bit(object + 0x10, 18) -- From OS.
  623.         --  unkBits[2] 0x10 19
  624.             obj_frozen = read_bit(object + 0x10, 20) -- Center of object's radius stays where the object was spawned, moving the object away from it usually derenders it. Object cannot be removed too when when it's true so it might mean something else (from aLTis)
  625.             obj_is_outside_of_map = read_bit(object + 0x10, 21) -- True if outside of map, False if not
  626.         --  obj_beautify_bit = read_bit(object + 0x10, 22) -- (???) Always False?
  627.             obj_only_aim_when_moving = read_bit(object + 0x10, 23) -- When true vehicle will not aim unless it's moving. If set on biped then the biped's model will stay still while the invisible biped moves (from aLTis)
  628.             obj_is_collideable = read_bit(object + 0x10, 24) -- Set this to true to allow other objects to pass through you. (doesn't apply to bipeds and vehicle on vehicle collision).
  629.         --  unkBits[7] 0x10 25-31
  630.        
  631.        
  632.         obj_marker_id = read_dword(object + 0x14) -- Tested. Continually counts up from like 89000...
  633.         --Padding[0x38] 0x18-0x50
  634.         --obj_owner_player_id = readident(object + 0x50) -- (???) Always 0?
  635.         --obj_owner_id = readident(object + 0x54) -- (???) Always 0?
  636.         --obj_timestamp = read_dword(object + 0x58) -- (???) Always 0?
  637.        
  638.         obj_x_coord = read_float(object + 0x5C) -- Confirmed.
  639.         obj_y_coord = read_float(object + 0x60) -- Confirmed.
  640.         obj_z_coord = read_float(object + 0x64) -- Confirmed.
  641.         obj_x_vel = read_float(object + 0x68) -- Confirmed.
  642.         obj_y_vel = read_float(object + 0x6C) -- Confirmed.
  643.         obj_z_vel = read_float(object + 0x70) -- Confirmed.
  644.         obj_rot1 = read_float(object + 0x74) -- Confirmed. First rotation vector (from aLTis)
  645.         obj_rot2 = read_float(object + 0x78) -- Confirmed. First rotation vector (from aLTis)
  646.         obj_rot3 = read_float(object + 0x7C) -- Confirmed. First rotation vector (from aLTis)
  647.         obj_rot4 = read_float(object + 0x80) -- Confirmed. Second rotation vector (from aLTis)
  648.         obj_rot5 = read_float(object + 0x84) -- Confirmed. Second rotation vector (from aLTis)
  649.         obj_rot6 = read_float(object + 0x88) -- Confirmed. Second rotation vector (from aLTis)
  650.         obj_pitch_vel = read_float(object + 0x8C) -- Confirmed for vehicles. Current velocity for pitch.
  651.         obj_yaw_vel = read_float(object + 0x90) -- Confirmed for vehicles. Current velocity for yaw.
  652.         obj_roll_vel = read_float(object + 0x94) -- Confirmed for vehicles. Current velocity for roll.
  653.        
  654.         obj_locId = read_dword(object + 0x98) -- Confirmed. Each map has dozens of location IDs, used for general location checking.
  655.         --unkLong[1] 0x9C (Padding Maybe?) -- when not in vehicle it points to some object, weird values that make no sense otherwise 0x40080000
  656.         -- Apparently these are coordinates, used for the game code's trigger volume point testing
  657.         obj_center_x_coord = read_float(object + 0xA0) -- Tested. Coordinate + origin offset
  658.         obj_center_y_coord = read_float(object + 0xA4) -- Tested. Coordinate + origin offset
  659.         obj_center_z_coord = read_float(object + 0xA8) -- Tested. Coordinate + origin offset
  660.         obj_bounding_radius = read_float(object + 0xAC) -- Confirmed. Radius of object. In Radians. (-1 to 1)
  661.         obj_scale = read_float(object + 0xB0) -- Tested. Seems to be some random float for all objects (all same objects have same value)
  662.         obj_type = read_word(object + 0xB4) -- Confirmed. (0 = Biped) (1 = Vehicle) (2 = Weapon) (3 = Equipment) (4 = Garbage) (5 = Projectile) (6 = Scenery) (7 = Machine) (8 = Control) (9 = Light Fixture) (10 = Placeholder) (11 = Sound Scenery)
  663.         --Padding[2] 0xB6-0xB8
  664.         obj_team = read_word(object + 0xB8) -- Confirmed. If objective then this >= 0, -1 = is NOT game object. Otherwise: (Red = 0) (Blue = 1) also means object team
  665.         obj_namelist_index = read_word(object + 0xBA) -- From OS. Index of the object name in the scenario tag. (from aLTis)
  666.         --obj_moving_time = read_word(object + 0xBC) -- (???) Always 0?
  667.         --obj_region_permutation_variant_id = read_word(object + 0xBE) -- (???) Always 0?
  668.         obj_player_id = readident(object + 0xC0) -- Confirmed. Full DWORD ID of player.
  669.         obj_owner_obj_id = readident(object + 0xC4) -- Confirmed. Parent object ID of this object (DOES NOT APPLY TO BIPEDS/PLAYER OBJECTS)
  670.         --Padding[4] 0xC8-0xCC
  671.        
  672.        
  673.         obj_antr_meta_id = readident(object + 0xCC) -- From DZS. Animation tag (from aLTis)
  674.         obj_base_animation = read_word(object + 0xD0) -- Tested. The base animation that is currently playing. (by aLTis)
  675.         obj_base_animation_frame = read_word(object + 0xD2) -- Tested. Current frame of the base animation (by aLTis)
  676.         obj_animation_scale = read_word(object + 0xD4) -- Tested. Has to do with transitions between base animations (from aLTis)
  677.        
  678.         obj_max_health = read_float(object + 0xD8) -- Confirmed. Takes value from coll tag.
  679.         obj_max_shields = read_float(object + 0xDC) -- Confirmed. Takes value from coll tag.
  680.         obj_health = read_float(object + 0xE0) -- Confirmed. (0 to 1)
  681.         obj_shields = read_float(object + 0xE4) -- Confirmed. (0 to 3) (Normal = 1) (Full overshield = 3)
  682.         obj_current_shield_damage = read_float(object + 0xE8) -- Confirmed. CURRENT INSTANTANEOUS amount of shield being damaged.
  683.         obj_current_body_damage = read_float(object + 0xEC) -- Confirmed. CURRENT INSTANTANEOUS amount of health being damaged.
  684.         --obj_some_obj_id = readident(object + 0xF0) -- (???) Always 0xFFFFFFFF?
  685.         obj_last_shield_damage_amount = read_float(object + 0xF4) -- Tested. Total shield damage taken (counts back down to 0 after 2 seconds)
  686.         obj_last_body_damage_amount = read_float(object + 0xF8) -- Tested. Total health damage taken (counts back down to 0 after 2 seconds)
  687.         obj_last_shield_damage_time = read_dword(object + 0xFC) -- Tested. Counts up to 75 after shield is damaged, then becomes 0xFFFFFFFF.
  688.         obj_last_body_damage_time = read_dword(object + 0x100) -- Tested. Counts up to 75 after health is damaged, then becomes 0xFFFFFFFF.
  689.         obj_shields_recharge_time = read_word(object + 0x104) -- Tested. Counts down when shield is damaged. When 0 your shields recharge. (1 sec = 30 ticks). based on ftol(s_shield_damage_resistance->stun_time * 30f)
  690.         -- damageFlags bitmask16
  691.             --obj_body_damage_effect_applied = read_bit(object + 0x106, 0) -- (???) Always False?
  692.             --obj_shield_damage_effect_applied = read_bit(object + 0x106, 1) -- (???) Always False?
  693.             obj_body_health_empty = read_bit(object + 0x106, 2) -- Tested. True when health is empty. Set to true to make player "die" without actually dying (from aLTis)
  694.             obj_shield_empty = read_bit(object + 0x106, 3) -- Tested. True when shield is empty (from aLTis)
  695.             obj_overshield = read_bit(object + 0x106, 4) -- Tested. True when overshield is full (from aLTis)
  696.             obj_silent_kill_bit = read_bit(object + 0x106, 5) -- Tested. True when player dies. (from aLTis)
  697.             obj_damage_berserk = read_bit(object + 0x106, 6) -- Tested. Same as above? (from aLTis)
  698.         --  unkBits[4] 0x106 7-9
  699.             obj_cannot_use_weapons = read_bit(object + 0x106, 10) -- Tested. I assume this is when you shoot off left hand from flood. Drops weapon when true (from aLTis)
  700.             obj_cannot_take_damage = read_bit(object + 0x106, 11) -- Confirmed. Set this to true to make object undamageable (even from backtaps!)
  701.             obj_shield_recharging = read_bit(object + 0x106, 12) -- Confirmed. (True = shield recharging, False = not recharging)
  702.             obj_killed_no_statistics = read_bit(object + 0x106, 13) -- Tested. True when commiting suicide (set to commit suicide) (from aLTis)
  703.         --  unkBits[2] 0x106 14-15
  704.         --Padding[4] 0x108
  705.         obj_cluster_partition_index = readident(object + 0x10C) -- Tested. This number continually counts up, and resumes even after object is destroyed and recreated (killed)
  706.         --obj_some_obj_id2 = readident(object + 0x110) -- object_index, garbage collection related
  707.         --obj_next_obj_id = readident(object + 0x114) -- (???) I wonder what this is. If you set this to your weapon id then you will see your weapon's third person model (from aLTis)
  708.        
  709.         obj_weap_obj_id = readident(object + 0x118) -- Confirmed. Current weapon  id.
  710.         obj_vehi_obj_id = readident(object + 0x11C) -- Confirmed. Current vehicle id. (Could also be known as the object's parent ID.)
  711.         obj_vehi_seat = read_word(object + 0x120) -- Confirmed. Current seat index (actually same as player_interaction_vehi_seat once inside a vehicle)
  712.         --  bitmask8:
  713.             obj_force_shield_update = read_bit(object + 0x122, 0) -- From OS.
  714.         --  unkBits[15] 1-15 (???)
  715.        
  716.         --Functions.
  717.         obj_shields_hit = read_float(object + 0x124) -- Tested. Counts down from 1 after shields are hit (0 to 1)
  718.         obj_shields_target = read_float(object + 0x128) -- Tested. When you have an overshield it stays at 1 which is why I think the overshield drains. (0 to 1) [2nd function]
  719.         obj_flashlight_scale = read_float(object + 0x12C) -- Confirmed. Intensity of flashlight as it turns on and off. (0 to 1) (On > 0) (Off = 0) [3rd function]
  720.         obj_assaultrifle_function = read_float(object + 0x130) -- The Assault rifle is the only one that uses this function.
  721.         obj_export_function1 = read_float(object + 0x134) -- Tested. (Assault rifle = 1)
  722.         obj_flashlight_scale2 = read_float(object + 0x138) -- Confirmed. Intensity of flashlight as it turns on and off. (0 to 1) (On > 0) (Off = 0) [2nd function]
  723.         obj_shields_hit2 = read_float(object + 0x13C) -- Tested. Something to do with shields getting hit. [3rd function]
  724.         obj_export_function4 = read_float(object + 0x140) -- Tested. (1 = Assault Rifle)
  725.         --End of functions.
  726.        
  727.         --Regions/Attachments.
  728.         obj_attachment_type = read_byte(object + 0x144) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  729.         obj_attachment_type2 = read_byte(object + 0x145) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  730.         obj_attachment_type3 = read_byte(object + 0x146) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  731.         obj_attachment_type4 = read_byte(object + 0x147) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  732.         obj_attachment_type5 = read_byte(object + 0x148) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  733.         obj_attachment_type6 = read_byte(object + 0x149) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  734.         obj_attachment_type7 = read_byte(object + 0x14A) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  735.         obj_attachment_type8 = read_byte(object + 0x14B) -- From OS. (0 = light, 1 = looping sound, 2 = effect, 3 = contrail, 4 = particle, 5 = ???, 0xFF = invalid)
  736.        
  737.         -- game state identity
  738.         -- ie, if Attachments[x]'s definition (object_attachment_block[x]) says it is a 'cont'
  739.         -- then the identity is a contrail_data handle
  740.         obj_attachment_id = readident(object + 0x14C) -- From OS.
  741.         obj_attachment2_id = readident(object + 0x150) -- From OS.
  742.         obj_attachment3_id = readident(object + 0x154) -- From OS.
  743.         obj_attachment4_id = readident(object + 0x158) -- From OS.
  744.         obj_attachment5_id = readident(object + 0x15C) -- From OS.
  745.         obj_attachment6_id = readident(object + 0x160) -- From OS.
  746.         obj_attachment7_id = readident(object + 0x164) -- From OS.
  747.         obj_attachment8_id = readident(object + 0x168) -- From OS.
  748.         obj_first_widget_id = readident(object + 0x16C) -- (???) Always 0xFFFFFFFF?
  749.         obj_cached_render_state_index = readident(object + 0x170) -- (???) Always 0xFFFFFFFF?
  750.         --unkByte[2] 0x174-0x176 (Padding Maybe?)
  751.         obj_shader_permutation = read_word(object + 0x176) -- From OS. shader's bitmap block index
  752.         obj_health_region = read_byte(object + 0x178) -- From OS.
  753.         obj_health_region2 = read_byte(object + 0x179) -- From OS.
  754.         obj_health_region3 = read_byte(object + 0x17A) -- From OS.
  755.         obj_health_region4 = read_byte(object + 0x17B) -- From OS.
  756.         obj_health_region5 = read_byte(object + 0x17C) -- From OS.
  757.         obj_health_region6 = read_byte(object + 0x17D) -- From OS.
  758.         obj_health_region7 = read_byte(object + 0x17E) -- From OS.
  759.         obj_health_region8 = read_byte(object + 0x17F) -- From OS.
  760.         obj_region_permutation_index = readchar(object + 0x180) -- From OS.
  761.         obj_region_permutation2_index = readchar(object + 0x181) -- From OS.
  762.         obj_region_permutation3_index = readchar(object + 0x182) -- From OS.
  763.         obj_region_permutation4_index = readchar(object + 0x183) -- From OS.
  764.         obj_region_permutation5_index = readchar(object + 0x184) -- From OS.
  765.         obj_region_permutation6_index = readchar(object + 0x185) -- From OS.
  766.         obj_region_permutation7_index = readchar(object + 0x186) -- From OS.
  767.         obj_region_permutation8_index = readchar(object + 0x187) -- From OS.
  768.         --End of regions/attachments
  769.        
  770.         obj_color_change_red = read_float(object + 0x188) -- From OS.
  771.         obj_color_change_green = read_float(object + 0x18C) -- From OS.
  772.         obj_color_change_blue = read_float(object + 0x190) -- From OS.
  773.         obj_color_change2_red = read_float(object + 0x194) -- From OS.
  774.         obj_color_change2_green = read_float(object + 0x198) -- From OS.
  775.         obj_color_change2_blue = read_float(object + 0x19C) -- From OS.
  776.         obj_color_change3_red = read_float(object + 0x1A0) -- From OS.
  777.         obj_color_change3_green = read_float(object + 0x1A4) -- From OS.
  778.         obj_color_change3_blue = read_float(object + 0x1A8) -- From OS.
  779.         obj_color_change4_red = read_float(object + 0x1AC) -- From OS.
  780.         obj_color_change4_green = read_float(object + 0x1B0) -- From OS.
  781.         obj_color_change4_blue = read_float(object + 0x1B4) -- From OS.
  782.         obj_color2_change_red = read_float(object + 0x1B8) -- From OS.
  783.         obj_color2_change_green = read_float(object + 0x1BC) -- From OS.
  784.         obj_color2_change_blue = read_float(object + 0x1C0) -- From OS.
  785.         obj_color2_change2_red = read_float(object + 0x1C4) -- From OS.
  786.         obj_color2_change2_green = read_float(object + 0x1C8) -- From OS.
  787.         obj_color2_change2_blue = read_float(object + 0x1CC) -- From OS.
  788.         obj_color2_change3_red = read_float(object + 0x1D0) -- From OS.
  789.         obj_color2_change3_green = read_float(object + 0x1D4) -- From OS.
  790.         obj_color2_change3_blue = read_float(object + 0x1D8) -- From OS.
  791.         obj_color2_change4_red = read_float(object + 0x1DC) -- From OS.
  792.         obj_color2_change4_green = read_float(object + 0x1E0) -- From OS.
  793.         obj_color2_change4_blue = read_float(object + 0x1E4) -- From OS.
  794.        
  795.         --one of these are for interpolating:
  796.         obj_header_block_ref_node_orientation_size = read_word(object + 0x1E8) -- From OS.
  797.         obj_header_block_ref_node_orientation_offset = read_word(object + 0x1EA) -- From OS.
  798.         obj_header_block_ref_node_orientation2_size = read_word(object + 0x1EC) -- From OS.
  799.         obj_header_block_ref_node_orientation2_offset = read_word(object + 0x1EE) -- From OS.
  800.         obj_header_block_ref_node_matrix_block_size = read_word(object + 0x1F0) -- From OS.
  801.         obj_header_block_ref_node_matrix_block_offset = read_word(object + 0x1F2) -- From OS.
  802.        
  803.         --unkLong[2] 0x1E8-0x1F0 (???) Some sort of ID? Points to some random tag
  804.         --obj_node_matrix_block = read_dword(object + 0x1F0) -- From OS. (???)
  805.        
  806.         if obj_type == 0 or obj_type == 1 then -- check if object is biped or vehicle
  807.            
  808.             --unit struct (applies to bipeds (players and AI) and vehicles)
  809.             m_unit = object
  810.            
  811.             unit_actor_index = readident(m_unit + 0x1F4) -- From OS.
  812.             unit_swarm_actor_index = readident(m_unit + 0x1F8) -- From OS.
  813.             unit_swarm_next_actor_index = readident(m_unit + 0x1FC) -- Guess.
  814.             unit_swarm_prev_obj_id = readident(m_unit + 0x200) -- From OS.
  815.            
  816.             --  Client Non-Instantaneous bitmask32
  817.             --  unkBit[4] 0-3 (???)
  818.                 unit_is_invisible = read_bit(m_unit + 0x204, 4) -- Confirmed. (True if currently invisible, False if not)
  819.                 unit_powerup_additional = read_bit(m_unit + 0x204, 5) -- From OS. Guessing this is set if you have multiple powerups at the same time.
  820.                 unit_is_currently_controllable_bit = read_bit(m_unit + 0x204, 6) -- From OS. I'm just going to assume this works.
  821.             --  unkBit[9] 7-15 (???)
  822.             --  unit_doesNotAllowPlayerEntry = read_bit(m_unit + 0x204, 16) -- From DZS. For vehicles. (True if vehicle is allowing players to enter, False if not)
  823.             --  unkBit[2] 17-18 (???)
  824.                 unit_flashlight = read_bit(m_unit + 0x204, 19) -- Confirmed. (True = flashlight on, False = flashlight off)
  825.                 unit_doesnt_drop_items = read_bit(m_unit + 0x204, 20) -- Confirmed. (True if object doesn't drop items on death, otherwise False). (Clients will see player drop items, then immediately despawn)
  826.             --  unkBit[1] 21 (???)
  827.             --  unit_can_blink = read_bit(m_unit + 0x204, 22) -- (???) Always False?
  828.             --  unkBit[1] 23 (???)
  829.                 unit_is_suspended = read_bit(m_unit + 0x204, 24) -- Confirmed. (True if frozen/suspended, False if not)
  830.                 unit_is_moving_randomly = read_bit(m_unit + 0x204, 25) -- Tested. If you set this to true the unit will move around randomly lol (from aLTis)
  831.             --  unkBit[2] 26 (???)
  832.             --  unit_is_possessed = read_bit(m_unit + 0x204, 27) -- (???) Always False?
  833.                 unit_flashlight_currently_on = read_bit(m_unit + 0x204, 28) -- Forces the unit to enable flashlight when true (from aLTis)
  834.                 unit_flashlight_currently_off = read_bit(m_unit + 0x204, 29) -- Forces the unit to disable flashlight when true (from aLTis)
  835.             --  unkBit[2] 30-31 (???)
  836.  
  837.             --  Client Action Keypress bitmask32 (Instantaneous actions).
  838.                 unit_crouch_presshold = read_bit(m_unit + 0x208, 0) -- Confirmed. (True when holding crouch, False when not)
  839.                 unit_jump_presshold = read_bit(m_unit + 0x208, 1)   -- Confirmed. (True when holding jump key, False when not)
  840.             --  unit_user1 = read_bit(m_unit + 0x208, 3) -- (???) Always False?
  841.             --  unit_user2 = read_bit(m_unit + 0x208, 4) -- (???) Always False?
  842.                 unit_flashlightkey = read_bit(m_unit + 0x208, 4)-- Confirmed. (True when pressing flashlight key, False when not)
  843.             --  unit_exact_facing = read_bit(m_unit + 0x208, 5) -- (???) Always False?
  844.                 unit_actionkey = read_bit(m_unit + 0x208, 6)    -- Confirmed. (True when pressing action key, False when not)
  845.                 unit_meleekey = read_bit(m_unit + 0x208, 7)     -- Confirmed. (True when pressing melee key, False when not)
  846.             --  unit_look_without_turn = read_bit(m_unit + 0x208, 8) -- (???) Always False?
  847.             --  unit_force_alert = read_bit(m_unit + 0x208, 9) -- (???) Always False?
  848.                 unit_reload_key = read_bit(m_unit + 0x208, 10)  -- Confirmed. (True when pressing action/reload key, False when not)
  849.                 unit_primaryWeaponFire_presshold = read_bit(m_unit + 0x208, 11)     -- Confirmed. (True when holding left click, False when not)
  850.                 unit_secondaryWeaponFire_presshold = read_bit(m_unit + 0x208, 12)   -- Confirmed. (True when holding right click, False when not)
  851.                 unit_grenade_presshold = read_bit(m_unit + 0x208, 13)   -- Confirmed. (True when holding right click, False when not)
  852.                 unit_actionkey_presshold = read_bit(m_unit + 0x208, 14) -- Confirmed. (True when holding action key,  False when not)
  853.             --  emptyBit[1] 15
  854.            
  855.             --unkWord[2] 0x20A-0x20E related to first two words in unit_global_data
  856.             --unit_shield_sapping = readchar(m_unit + 0x20E) -- (???) Always 0?
  857.             unit_base_seat_index = readchar(m_unit + 0x20F) -- From OS.
  858.             --unit_time_remaining = read_dword(m_unit + 0x210) -- (???) Always 0?
  859.             unit_flags = read_dword(m_unit + 0x214) -- From OS. Bitmask32 (breakdown of this coming soon)
  860.             unit_player_id = readident(m_unit + 0x218) -- Confirmed. Full DWORD ID of the Player.
  861.             unit_ai_effect_type = read_word(m_unit + 0x21C) -- From OS. ai_unit_effect
  862.             unit_emotion_animation_index = read_word(m_unit + 0x21E) -- From OS.
  863.             unit_last_bullet_time = read_dword(m_unit + 0x220) -- Confirmed. gameinfo_current_time - this = time since last shot fired. (1 second = 30 ticks) Related to unit_ai_effect_type. Lags immensely behind player_last_bullet_time.
  864.             unit_x_facing = read_float(m_unit + 0x224) -- Confirmed. Same as unit_x_aim.
  865.             unit_y_facing = read_float(m_unit + 0x228) -- Confirmed. Same as unit_y_aim.
  866.             unit_z_facing = read_float(m_unit + 0x22C) -- Confirmed. Same as unit_z_aim.
  867.             unit_desired_x_aim = read_float(m_unit + 0x230) -- Confirmed. This is where the unit WANTS to aim.
  868.             unit_desired_y_aim = read_float(m_unit + 0x234) -- Confirmed. This is where the unit WANTS to aim.
  869.             unit_desired_z_aim = read_float(m_unit + 0x238) -- Confirmed. This is where the unit WANTS to aim.
  870.             unit_x_aim = read_float(m_unit + 0x23C) -- Confirmed.
  871.             unit_y_aim = read_float(m_unit + 0x240) -- Confirmed.
  872.             unit_z_aim = read_float(m_unit + 0x244) -- Confirmed.
  873.             unit_x_aim_vel = read_float(m_unit + 0x248) -- Confirmed. Does not apply to multiplayer bipeds
  874.             unit_y_aim_vel = read_float(m_unit + 0x24C) -- Confirmed. Does not apply to multiplayer bipeds
  875.             unit_z_aim_vel = read_float(m_unit + 0x250) -- Confirmed. Does not apply to multiplayer bipeds
  876.             unit_x_aim2 = read_float(m_unit + 0x254) -- Confirmed.
  877.             unit_y_aim2 = read_float(m_unit + 0x258) -- Confirmed.
  878.             unit_z_aim2 = read_float(m_unit + 0x25C) -- Confirmed.
  879.             unit_x_aim3 = read_float(m_unit + 0x260) -- Confirmed.
  880.             unit_y_aim3 = read_float(m_unit + 0x264) -- Confirmed.
  881.             unit_z_aim3 = read_float(m_unit + 0x268) -- Confirmed.
  882.             --unit_x_aim_vel2 = read_float(m_unit + 0x26C) -- (???) Always 0?
  883.             --unit_y_aim_vel2 = read_float(m_unit + 0x26C) -- (???) Always 0?
  884.             --unit_z_aim_vel2 = read_float(m_unit + 0x26C) -- (???) Always 0?
  885.  
  886.             unit_forward = read_float(m_unit + 0x278) -- Confirmed. Negative means backward. (-1, -sqrt(2)/2, 0, sqrt(2)/2, 1)
  887.             unit_left = read_float(m_unit + 0x27C) -- Confirmed. Negative means right. (-1, -sqrt(2)/2, 0, sqrt(2)/2, 1)
  888.             unit_up = read_float(m_unit + 0x280) -- Confirmed. Negative means down. (-1, -sqrt(2)/2, 0, sqrt(2)/2, 1) (JUMPING/FALLING DOESNT COUNT)
  889.             unit_shooting = read_float(m_unit + 0x284) -- Confirmed. (Shooting = 1, Not Shooting = 0)
  890.             --unkByte[2] 0x288-0x28A melee related (state enum and counter?)
  891.             unit_time_until_flaming_death = readchar(m_unit + 0x28A) -- From OS (1 second = 30 ticks)
  892.             --unkByte[2] 0x28B-0x28D looks like the amount of frames left for the ping animation. Also set to the same PersistentControlTicks value when an actor dies and they fire-wildly
  893.             unit_throwing_grenade_state = read_byte(m_unit + 0x28D) -- Confirmed. (0 = not throwing) (1 = Arm leaning back) (2 = Grenade leaving hand) (3 = Grenade Thrown, going back to normal state)
  894.             --unkWord[2] 0x28E-0x292 grenade throw animation related (from aLTis)
  895.             --Padding[2] 0x292-0x294
  896.             unit_thrown_grenade_obj_id = readident(m_unit + 0x294) -- Confirmed. 0xFFFFFFFF when grenade leaves hand.
  897.            
  898.             -- ANIMATION STUFF
  899.             --unkBit[16] 0x298 Something to do with states/animations. First bit is 1 when unit is in impulse state. (from aLTis)
  900.             unit_aim_animation_index = read_word(m_unit + 0x29A) -- Tested. Aim-still or aim-move animation that is playing (from aLTis)
  901.             unit_look_animation_index = read_word(m_unit + 0x29C) -- Tested. Look animation that is playing (stand look) (from aLTis)
  902.             --unkWord[1] 0x29E-0x2A0 appears unused except for getting initialized
  903.             unit_state = read_byte(m_unit + 0x2A0) -- Confirmed. Unit from animation tag. (Standing = 4) (Crouching = 3) (W-driver = 0) (W-gunner = 1) (from aLTis)
  904.             unit_weap_slot = read_byte(m_unit + 0x2A1) -- Confirmed. index of "weapons" slot in the unit of animation tag
  905.             unit_weap_index_type = read_byte(m_unit + 0x2A2) -- Tested. (0 = Rocket Launcher) (1 = Plasma Pistol) (2 = Shotgun) (3 = Plasma Rifle) don't care to continue
  906.             unit_animation_state = read_byte(m_unit + 0x2A3) -- Confirmed. (0 = Idle, 1 = Gesture, Turn Left = 2, Turn Right = 3, Move Front = 4, Move Back = 5, Move Left = 6, Move Right = 7, Stunned Front = 8, Stunned Back = 9, Stunned Left = 10, Stunned Right = 11, Slide Front = 12, Slide Back = 13, Slide Left = 14, Slide Right = 15, Ready = 16, Put Away = 17, Aim Still = 18, Aim Move = 19, Airborne = 20, Land Soft = 21, Land Hard = 22, ??? = 23, Airborne Dead = 24, Landing Dead = 25, Seat Enter = 26, Seat Exit = 27, Custom Animation = 28, Impulse = 29, Melee = 30, Melee Airborne = 31, Melee Continuous = 32, Grenade Toss = 33, Resurrect Front = 34, Ressurect Back = 35, Feeding = 36, Surprise Front = 37, Surprise Back = 38, Leap Start = 39, Leap Airborne = 40, Leap Melee = 41, Unused AFAICT = 42, Berserk = 43)
  907.             unit_reloadmelee = read_byte(m_unit + 0x2A4) -- Confirmed. (Reloading = 5) (Meleeing = 7)
  908.             unit_shooting2 = read_byte(m_unit + 0x2A5) -- Confirmed. (Shooting = 1) (No = 0)
  909.             unit_animation_state2 = read_byte(m_unit + 0x2A6) -- Confirmed. Some kind of unit states (5 - default, 3 - berserk), could also be shield states? (from aLTis)
  910.             unit_crouch2 = read_byte(m_unit + 0x2A7) -- Confirmed. (Standing = 2) (Crouching = 3) (Flaming? = 5)
  911.             --unkByte[2] 0x2A8-0x2AA (???)
  912.             unit_replacement_animation_index = read_word(m_unit + 0x2AA) -- Tested. Replacement animation index from animations tag that is currently playing. (from aLTis)
  913.             unit_replacement_animation_frame_index = read_word(m_unit + 0x2AC) -- Tested. Current frame of the replacement animation. (from aLTis)
  914.             unit_recoil_animation_index = read_word(m_unit + 0x2AE) -- Tested. Firing overlay animation that is playing (from aLTis)
  915.             unit_recoil_frame_index = read_word(m_unit + 0x2B0) -- From OS. Recoil amount for the animation. when firing = 0, counts up to 5 when not (from aLTis)
  916.             unit_ping_animation_index = read_word(m_unit + 0x2B2) -- From OS. Unit ping animation that is playing, different depending on where the unit is hit (from aLTis)
  917.             unit_ping_frame_index = read_word(m_unit + 0x2B4) -- From OS. Frame index of the ping animation (from aLTis)
  918.             unit_able_to_fire = read_byte(biped_object + 0x2B6) --  Tested. 1 when unit can fire, 0 otherwise (from aLTis)
  919.             unit_able_to_fire2 = read_byte(biped_object + 0x2B7) -- Tested. same as above (from aLTis)
  920.            
  921.             unit_aim_rectangle_top_x = read_float(m_unit + 0x2B8) -- Confirmed. Top-most aim possible.
  922.             unit_aim_rectangle_bottom_x = read_float(m_unit + 0x2BC) -- Confirmed. Bottom-most aim possible.
  923.             unit_aim_rectangle_left_y = read_float(m_unit + 0x2C0) -- Confirmed. Left-most aim possible.
  924.             unit_aim_rectangle_right_y = read_float(m_unit + 0x2C4) -- Confirmed. Right-most aim possible.
  925.             unit_look_rectangle_top_x = read_float(m_unit + 0x2C8) -- Confirmed. Top-most aim possible. Same as unit_aim_rectangle_top_x.
  926.             unit_look_rectangle_bottom_x = read_float(m_unit + 0x2CC) -- Confirmed. Bottom-most aim possible. Same as unit_aim_rectangle_bottom_x.
  927.             unit_look_rectangle_left_y = read_float(m_unit + 0x2D0) -- Confirmed. Left-most aim possible. Same as unit_aim_rectangle_left_y.
  928.             unit_look_rectangle_right_y = read_float(m_unit + 0x2D4) -- Confirmed. Right-most aim possible. Same as unit_aim_rectangle_right_y.
  929.             --Padding[8] 0x2D8-0x2E0
  930.             unit_ambient = read_float(m_unit + 0x2E0) -- Tested. Being in a bright place increases this value and shooting the weapon sets it to 1. I think AI can't see you on low values. (from aLTis)
  931.             unit_illumination = read_float(m_unit + 0x2E4) -- Tested. Firing the weapon or throwing a grenade increases this value. Might be AI related as well.
  932.             unit_mouth_aperture = read_float(m_unit + 0x2E8) -- From OS.
  933.             --Padding[4] 0x2EC-0x2F0
  934.             unit_vehi_seat = read_word(m_unit + 0x2F0) -- Confirmed. (Warthog seats: Driver = 0, Passenger = 1, Gunner = 2 Not in vehicle = 0xFFFF)
  935.             unit_weap_slot2 = read_word(m_unit + 0x2F2) -- Confirmed. Current weapon slot. (Primary = 0) (Secondary = 1) (Ternary = 2) (Quaternary = 3)
  936.             unit_next_weap_slot = read_word(m_unit + 0x2F4) -- Confirmed. Weapon slot the player is trying to change to. (Primary = 0) (Secondary = 1) (Ternary = 2) (Quaternary = 3)
  937.             --unkByte[2] 0x2F6-0x2F8 (Padding Maybe?)
  938.             unit_next_weap_obj_id = readident(m_unit + 0x2F8 + unit_next_weap_slot*4) -- Confirmed. Object ID of the weapon that the player is trying to change to.
  939.             unit_primary_weap_obj_id = readident(m_unit + 0x2F8) -- Confirmed.
  940.             unit_secondary_weap_obj_id = readident(m_unit + 0x2FC) -- Confirmed.
  941.             unit_tertiary_weap_obj_id = readident(m_unit + 0x300) -- Confirmed.
  942.             unit_quaternary_weap_obj_id = readident(m_unit + 0x304) -- Confirmed.
  943.             unit_primaryWeaponLastUse = read_dword(m_unit + 0x308) -- From DZS. gameinfo_current_time - this = time since this weapon was last swapped to/picked up. (1 second = 30 ticks)
  944.             unit_secondaryWeaponLastUse = read_dword(m_unit + 0x30C) -- From DZS. gameinfo_current_time - this = time since this weapon was last swapped to/picked up. (1 second = 30 ticks)
  945.             unit_tertiaryWeaponLastUse = read_dword(m_unit + 0x310) -- From DZS. gameinfo_current_time - this = time since this weapon was last swapped to/picked up. (1 second = 30 ticks)
  946.             unit_quaternaryWeaponLastUse = read_dword(m_unit + 0x314) -- From DZS. gameinfo_current_time - this = time since this weapon was last swapped to/picked up. (1 second = 30 ticks)
  947.             unit_objective = read_dword(m_unit + 0x318) -- Tested. Increases every time you interact with the objective.
  948.             unit_current_nade_type = readchar(m_unit + 0x31C) -- Confirmed. (Frag = 0) (Plasma = 1)
  949.             unit_next_nade_type = read_byte(m_unit + 0x31D) -- Confirmed. Grenade type the player is trying to change to. (Frag = 0) (Plasma = 1)
  950.             unit_primary_nades = read_byte(m_unit + 0x31E) -- Confirmed. Amount of frag grenades you have.
  951.             unit_secondary_nades = read_byte(m_unit + 0x31F) -- Confirmed. Amount of plasma grenades you have.
  952.             unit_zoom_level = read_byte(m_unit + 0x320) -- Confirmed. The level of zoom the player is at. (0xFF = not zoomed, 0 = first zoom lvl, 1 = second zoom lvl, etc...)
  953.             unit_desired_zoom_level = read_byte(m_unit + 0x321) -- Confirmed. Where the player wants to zoom. (0xFF = not zoomed, 0 = first zoom lvl, 1 = second zoom lvl, etc...)
  954.             unit_vehicle_speech_timer = readchar(m_unit + 0x322) -- Tested. Counts up from 0 after reloading, shooting, or throwing nade.
  955.             unit_aiming_change = read_byte(m_unit + 0x323) -- Tested. This is 'confirmed' except I don't know what units. Does not apply to multiplayer bipeds.
  956.             unit_master_obj_id = readident(m_unit + 0x324) -- Confirmed. Object ID controlling this unit (driver)
  957.             unit_masterofweapons_obj_id = readident(m_unit + 0x328) -- Confirmed. Object ID controlling the weapons of this unit (gunner)
  958.             unit_passenger_obj_id = readident(m_unit + 0x32C) -- Confirmed for vehicles. 0xFFFFFFFF for bipeds
  959.             unit_time_abandoned_parent = read_dword(m_unit + 0x330) -- Confirmed. gameinfo_current_time - this = time since player ejected from vehicle.
  960.             unit_some_obj_id = readident(m_unit + 0x334) -- From OS.
  961.             unit_vehicleentry_scale = read_float(m_unit + 0x338) -- Tested. Intensity of vehicle entry as you enter a vehicle (0 to 1)
  962.             --unit_power_of_masterofweapons = read_float(m_unit + 0x33C) -- (???) Always 0?
  963.             unit_flashlight_scale = read_float(m_unit + 0x340) -- Confirmed. Intensity of flashlight as it turns on and off. (0 to 1) (On > 0) (Off = 0)
  964.             unit_flashlight_energy = read_float(m_unit + 0x344) -- Confirmed. Amount of flashlight energy left. (0 to ~1)
  965.             unit_nightvision_scale = read_float(m_unit + 0x348) -- Confirmed. Intensity of nightvision as it turns on and off. (0 to 1) (On = 1) (Off = 0)
  966.             unit_vehicle_position_x = read_float(m_unit + 0x348) -- Confirmed. Position of the vehicle that unit is riding (from aLTis)
  967.             unit_vehicle_position_y = read_float(m_unit + 0x34C) -- Confirmed. Position of the vehicle that unit is riding (from aLTis)
  968.             unit_vehicle_position_z = read_float(m_unit + 0x350) -- Confirmed. Position of the vehicle that unit is riding (from aLTis)
  969.             unit_invis_scale = read_float(m_unit + 0x37C) -- Confirmed. How invisible you are. (0 to 1) (Completely = 1) (None = 0)
  970.             --unit_fullspectrumvision_scale = read_float(m_unit + 0x380) -- (???) Always 0, even when picking up a fullspectrum vision.
  971.             unit_dialogue_definition = readident(m_unit + 0x384) -- Confirmed. Dialog tag for this unit.
  972.            
  973.             -->>SPEECH<<--
  974.             --AI Current Speech:
  975.             unit_speech_priority = read_word(m_unit + 0x388) -- From OS. (0 = None) (1 = Idle) (2 = Pain) (3 = Talk) (4 = Communicate) (5 = Shout) (6 = Script) (7 = Involuntary) (8 = Exclaim) (9 = Scream) (10 = Death)
  976.             unit_speech_scream_type = read_word(m_unit + 0x38A) -- From OS. (0 = Fear) (1 = Enemy Grenade) (2 = Pain) (3 = Maimed Limb) (4 = Maimed Head) (5 = Resurrection)
  977.             unit_sound_definition = readident(m_unit + 0x38C) -- From OS.
  978.             --unkWord[1] 0x390-0x392 time-related.
  979.             --Padding[2] 0x392-0x394
  980.             --unkLong[2] 0x394-0x39C (???)
  981.             --unkWord[1] 0x39C-0x39E (???)
  982.             unit_ai_current_communication_type = read_word(m_unit + 0x39E) -- From OS. (0 = Death) (1 = Killing Spree) (2 = Hurt) (3 = Damage) (4 = Sighted Enemy) (5 = Found Enemy) (6 = Unexpected Enemy) (7 = Found dead friend) (8 = Allegiance Changed) (9 = Grenade Throwing) (10 = Grenade Startle) (11 = Grenade Sighted) (12 = Grenade Danger) (13 = Lost Contact) (14 = Blocked) (15 = Alert Noncombat) (16 = Search Start) (17 = Search Query) (18 = Search Report) (19 = Search Abandon) (20 = Search Group Abandon) (21 = Uncover Start) (22 = Advance) (23 = Retreat) (24 = Cover) (25 = Sighted Friend Player) (26 = Shooting) (27 = Shooting Vehicle) (28 = Shooting Berserk) (29 = Shooting Group) (30 = Shooting Traitor) (31 = Flee) (32 = Flee Leader Died) (33 = Flee Idle) (34 = Attempted Flee) (35 = Hiding Finished) (36 = Vehicle Entry) (37 = Vehicle Exit) (38 = Vehicle Woohoo) (39 = Vehicle Scared) (40 = Vehicle Falling) (41 = Surprise) (42 = Berserk) (43 = Melee) (44 = Dive) (45 = Uncover Exclamation) (46 = Falling) (47 = Leap) (48 = Postcombat Alone) (49 = Postcombat Unscathed) (50 = Postcombat Wounded) (51 = Postcombat Massacre) (52 = Postcombat Triumph) (53 = Postcombat Check Enemy) (54 = Postcombat Check Friend) (55 = Postcombat Shoot Corpse) (56 = Postcombat Celebrate)
  983.             --unkWord[1] 0x3A0-0x3A2 (???)
  984.             --Padding[2] 0x3A2-0x3A4
  985.             --unkWord[1] 0x3A4-0x3A6 (???)
  986.             --Padding[6] 0x3A6-0x3AC
  987.             --unkWord[1] 0x3AC-0x3AE (???)
  988.             --Padding[2] 0x3AE-0x3B0
  989.             --unkWord[2] 0x3B0-0x3B4 (???)
  990.             --  bitmask8
  991.                 unit_ai_current_communication_broken = read_bit(m_unit + 0x3B4, 0) -- From OS. 1C false = reformed
  992.             --  unkBit[7] 1-7 (???)
  993.             --Padding[3] 0x3B5-0x3B8
  994.            
  995.             --AI Next Speech (I think):
  996.             unit_speech_priority2 = read_word(m_unit + 0x3B8) -- From OS. (0 = None) (1 = Idle) (2 = Pain) (3 = Talk) (4 = Communicate) (5 = Shout) (6 = Script) (7 = Involuntary) (8 = Exclaim) (9 = Scream) (10 = Death)
  997.             unit_speech_scream_type2 = read_word(m_unit + 0x3BA) -- From OS. (0 = Fear) (1 = Enemy Grenade) (2 = Pain) (3 = Maimed Limb) (4 = Maimed Head) (5 = Resurrection)
  998.             unit_sound_definition2 = readident(m_unit + 0x3BC) -- From OS.
  999.             --unkWord[1] 0x3C0-0x3C2 time-related.
  1000.             --Padding[2] 0x3C2-0x3C4
  1001.             --unkLong[2] 0x3C4-0x3CC (???)
  1002.             --unkWord[1] 0x3CC-0x3CE (???)
  1003.             --unit_ai_current_communication_type2 = read_word(m_unit + 0x3CE) -- always 0?
  1004.             --unkWord[1] 0x3D0-0x3D2 (???)
  1005.             --Padding[2] 0x3D2-0x3D4
  1006.             --unkWord[1] 0x3D4-0x3D6 (???)
  1007.             --Padding[6] 0x3D6-0x3DC
  1008.             --unkWord[1] 0x3DC-0x3DE (???)
  1009.             --Padding[2] 0x3DE-0x3E0
  1010.             --unkWord[2] 0x3E0-0x3E4 (???)
  1011.             --  bitmask8
  1012.                 unit_ai_current_communication_broken2 = read_bit(m_unit + 0x3E4, 0) -- From OS. 1C false = reformed
  1013.             --  unkBit[7] 1-7 (???)
  1014.             --Padding[3] 0x3E5-0x3E8
  1015.            
  1016.             --unkWord[4] 0x3E8-0x3F0
  1017.             --unkLong[1] 0x3F0 time related
  1018.             --unkBit[32] 0x3F4-0x3F8 0-31 (???)
  1019.             --unkWord[4] 0x3F8-0x400 (???)
  1020.             --unkLong[1] 0x400-0x404 (???)
  1021.             -->>END OF SPEECH<<--
  1022.            
  1023.                 -- Unit damage bitmask:
  1024.                 unit_aoe_damage_recieved = read_bit(m_unit + 0x404, 0) -- Tested. True when getting AOE damage (from aLTis)
  1025.                 unit_any_damage_recieved = read_bit(m_unit + 0x404, 1) -- Tested. True when getting any damage (from aLTis)
  1026.                 --unkBit 2
  1027.                 unit_plasma_damage_recieved = read_bit(m_unit + 0x404, 3) -- Tested. True when getting damaged by plasma weapons (from aLTis)
  1028.                 --unkBit 4-15
  1029.            
  1030.             unit_damage2 = read_word(m_unit + 0x406) -- Tested. Changes to 45 when damaged and counts down (from aLTis)
  1031.             --unit_damage3 = read_float(m_unit + 0x408) -- Tested. Changes when damaged. Changes back.
  1032.             unit_causing_objId = readident(m_unit + 0x40C) -- Confirmed. ObjId causing damage to this object.
  1033.             --unit_flamer_causer_objId = readident(m_unit + 0x410) -- (???) Always 0xFFFFFFFF?
  1034.             --Padding[8] 0x414-0x41C
  1035.             --unit_death_time = read_dword(m_unit + 0x41C) -- (???) Always 0xFFFFFFFF?
  1036.             --unit_feign_death_timer = read_word(m_unit + 0x420) -- (???) Always 0xFFFFFFFF?
  1037.             unit_camo_regrowth = read_word(m_unit + 0x422) -- Confirmed. (1 = Camo Failing due to damage/shooting)
  1038.             unit_stun_amount = read_float(m_unit + 0x424) -- Tested. Changes to almost 1 when getting hit by plasma weapons
  1039.             unit_stun_timer = read_word(m_unit + 0x428) -- Tested. Counts down to 0 after getting hit by plasma weapons
  1040.             unit_killstreak = read_word(m_unit + 0x42A) -- Tested. Same as player_killstreak.
  1041.             unit_last_kill_time = read_dword(m_unit + 0x42C) -- Confirmed. gameinfo_current_time - this = time since last kill time. (1 sec = 30 ticks)
  1042.            
  1043.             --I realize the below are confusing, and if you really don't understand them after looking at it, I will explain it if you contact me about them:
  1044.             --I have no idea why halo stores these, only thing I can think of is because of betrayals or something.. but still..
  1045.             unit_last_damage_time_by_mostrecent_objId = read_dword(m_unit + 0x430) -- Confirmed. gameinfo_current_time - this = Time since last taken damage by MOST RECENT object. (1 second = 30 ticks)
  1046.             unit_total_damage_by_mostrecent_objId = read_float(m_unit + 0x434) -- Confirmed. Total damage done by the MOST RECENT PLAYER (NOT TOTAL DAMAGE TO EVERYONE)
  1047.             unit_damage_mostrecent_causer_objId = readident(m_unit + 0x438) -- Confirmed. the MOST RECENT object ID to do damage to this object (or 0xFFFFFFFF)
  1048.             unit_damage_mostrecent_causer_playerId = readident(m_unit + 0x43C) -- Confirmed. Full DWORD ID of the MOST RECENT PLAYER to do damage to this object.. (AI = 0xFFFFFFFF)
  1049.             unit_last_damage_time_by_secondtomostrecent_obj = read_dword(m_unit + 0x440) -- Confirmed. gameinfo_current_time - this = Time since last taken damage by the SECOND TO MOST RECENT object. (1 second = 30 ticks)
  1050.             unit_total_damage_by_secondtomostrecent_obj = read_float(m_unit + 0x444) -- Confirmed. Total damage done by the SECOND TO MOST RECENT PLAYER (NOT TOTAL DAMAGE TO EVERYONE)
  1051.             unit_damage_secondtomostrecent_causing_objId = readident(m_unit + 0x448) -- Confirmed. the SECOND TO MOST RECENT object ID to do damage to this object (or 0xFFFFFFFF)
  1052.             unit_damage_secondtomostrecent_causing_playerId = readident(m_unit + 0x44C) -- Confirmed. Full DWORD ID of the SECOND TO MOST RECENT PLAYER to do damage to this object.. (AI = 0xFFFFFFFF)
  1053.             unit_last_damage_time_by_thirdtomostrecent_obj = read_dword(m_unit + 0x450) -- Confirmed. gameinfo_current_time - this = Time since last taken damage by the THIRD TO MOST RECENT object. (1 second = 30 ticks)
  1054.             unit_total_damage_by_thirdtomostrecent_obj = read_float(m_unit + 0x454) -- Confirmed. Total damage done by the THIRD TO MOST RECENT PLAYER (NOT TOTAL DAMAGE TO EVERYONE)
  1055.             unit_damage_thirdtomostrecent_causing_objId = readident(m_unit + 0x458) -- Confirmed. the THIRD TO MOST RECENT object ID to do damage to this object (or 0xFFFFFFFF)
  1056.             unit_damage_thirdtomostrecent_causing_playerId = readident(m_unit + 0x45C) -- Confirmed. Full DWORD ID of the THIRD TO MOST RECENT PLAYER to do damage to this object.. (AI = 0xFFFFFFFF)
  1057.             unit_last_damage_time_by_fourthtomostrecent_obj = read_dword(m_unit + 0x460) -- Confirmed. gameinfo_current_time - this = Time since last taken damage by the FOURTH TO MOST RECENT object. (1 second = 30 ticks)
  1058.             unit_total_damage_by_fourthtomostrecent_obj = read_float(m_unit + 0x464) -- Confirmed. Total damage done by the FOURTH TO MOST RECENT PLAYER (NOT TOTAL DAMAGE TO EVERYONE)
  1059.             unit_damage_fourthtomostrecent_causing_objId = readident(m_unit + 0x468) -- Confirmed. the FOURTH TO MOST RECENT object ID to do damage to this object (or 0xFFFFFFFF)
  1060.             unit_damage_fourthtomostrecent_causing_playerId = readident(m_unit + 0x46C) -- Confirmed. Full DWORD ID of the FOURTH TO MOST RECENT PLAYER to do damage to this object.. (AI = 0xFFFFFFFF)
  1061.             --Padding[4] 0x470-0x474
  1062.             unit_shooting3 = read_byte(m_unit + 0x474) -- Confirmed. (Shooting = 1) (No = 0) 'unused'
  1063.             --unkByte[1] 0x475-0x476 (???) 'unused'
  1064.             --Padding[2] 0x476-0x478
  1065.             unit_animation_state3 = read_byte(m_unit + 0x478) -- Same as 2 - 5 by default and 3 when berserk (from aLTis)
  1066.             --unit_aiming_speed2 = read_byte(m_unit + 0x479) -- (???) Always 0?
  1067.             --  Client Action Keypress bitmask32 (Instantaneous actions).
  1068.                 unit_crouch2_presshold = read_bit(m_unit + 0x47A, 0) -- Confirmed. (True when holding crouch, False when not)
  1069.                 unit_jump2_presshold = read_bit(m_unit + 0x47A, 1)  -- Confirmed. (True when holding jump key, False when not)
  1070.             --  unit_user1_2 = read_bit(m_unit + 0x47A, 3) -- (???) Always false?
  1071.             --  unit_user2_2 = read_bit(m_unit + 0x47A, 4) -- (???) Always false?
  1072.                 unit_flashlightkey2 = read_bit(m_unit + 0x47A, 4)-- Confirmed. (True when pressing flashlight key, False when not)
  1073.                 unit_exact_facing2 = read_bit(m_unit + 0x47A, 5) -- True when AI is walking forward (from aLTis)
  1074.                 unit_actionkey2 = read_bit(m_unit + 0x47A, 6)   -- Confirmed. (True when pressing action key, False when not)
  1075.                 unit_meleekey2 = read_bit(m_unit + 0x47A, 7)        -- Confirmed. (True when pressing melee key, False when not)
  1076.             --  unit_look_without_turn2 = read_bit(m_unit + 0x47A, 8) -- (???) Always false?
  1077.             --  unit_force_alert2 = read_bit(m_unit + 0x47A, 9) -- (???) Always false?
  1078.                 unit_reload_key2 = read_bit(m_unit + 0x47A, 10) -- Confirmed. (True when pressing action/reload key, False when not)
  1079.                 unit_primaryWeaponFire_presshold2 = read_bit(m_unit + 0x47A, 11)    -- Confirmed. (True when holding left click, False when not)
  1080.                 unit_secondaryWeaponFire_presshold2 = read_bit(m_unit + 0x47A, 12)  -- Confirmed. (True when holding right click, False when not)
  1081.                 unit_grenade_presshold2 = read_bit(m_unit + 0x47A, 13)  -- Confirmed. (True when holding right click, False when not)
  1082.                 unit_actionkey_presshold2 = read_bit(m_unit + 0x47A, 14)    -- Confirmed. (True when holding action key,  False when not)
  1083.             --  emptyBit[1] 15
  1084.             unit_weap_slot3 = read_byte(m_unit + 0x47C) -- Confirmed. (Primary = 0) (Secondary = 1) (Ternary = 2) (Quaternary = 3)
  1085.             unit_nade_type = read_byte(m_unit + 0x47E) -- Confirmed. (Frag = 0) (Plasma = 1)
  1086.             unit_zoom_level2 = read_word(m_unit + 0x480) -- Confirmed. The level of zoom the player is at. (0xFFFF = not zoomed, 0 = first zoom lvl, 1 = next zoom lvl, etc...)
  1087.             --Padding[2] 0x482-0x484
  1088.             unit_x_vel2 = read_float(m_unit + 0x484) -- Confirmed. Unit forward
  1089.             unit_y_vel2 = read_float(m_unit + 0x488) -- Confirmed. Unit left
  1090.             unit_z_vel2 = read_float(m_unit + 0x48C) -- Confirmed. Unit up?
  1091.             unit_primary_trigger = read_float(m_unit + 0x490) -- Confirmed. (1 = Holding down primaryFire button) (0 = not firing) Doesn't necessarily mean unit is shooting.
  1092.             unit_x_aim4 = read_float(m_unit + 0x494) -- Confirmed.
  1093.             unit_y_aim4 = read_float(m_unit + 0x498) -- Confirmed.
  1094.             unit_z_aim4 = read_float(m_unit + 0x49C) -- Confirmed.
  1095.             unit_x_aim5 = read_float(m_unit + 0x4A0) -- Confirmed.
  1096.             unit_y_aim5 = read_float(m_unit + 0x4A4) -- Confirmed.
  1097.             unit_z_aim5 = read_float(m_unit + 0x4A8) -- Confirmed.
  1098.             unit_x_aim6 = read_float(m_unit + 0x4AC) -- Confirmed.
  1099.             unit_y_aim6 = read_float(m_unit + 0x4B0) -- Confirmed.
  1100.             unit_z_aim6 = read_float(m_unit + 0x4B4) -- Confirmed.
  1101.             --  bitmask32:
  1102.                 unit_last_completed_client_update_id_valid = read_bit(m_unit + 0x4B8, 0) -- From OS.
  1103.             --  unkBit[31] 1-31 (???)
  1104.             unit_last_completed_client_update_id = read_dword(m_unit + 0x4BC) -- From OS.
  1105.             --Padding[12] 0x4C0-0x4CC unused.
  1106.         end
  1107.        
  1108.         if obj_type == 0 then -- check if object is a biped.
  1109.        
  1110.             -- Biped Struct. Definition is a two legged creature, but applies to ALL AI and all players.
  1111.             m_biped = object
  1112.             --  bitmask32:
  1113.                 bipd_is_airborne = read_bit(m_biped + 0x4CC, 0) -- Confirmed. (Airborne = True, No = False)
  1114.                 bipd_is_slipping = read_bit(m_biped + 0x4CC, 1) -- Tested. True when hit by a grenade. (from aLTis)
  1115.                 bipd_is_flying = read_bit(m_biped + 0x4CC, 2) -- Tested. If true then the biped ignores gravity and flies (from aLTis)
  1116.                 bipd_ignores_collision = read_bit(m_biped + 0x4CC, 3) -- Tested. Basically noclip (from aLTis)
  1117.             --  unkBit[30] 4-31
  1118.            
  1119.             landing_timer = read_byte(m_biped + 0x4D0) --   Counts up when biped lands, value gets higher depending on height (from aLTis)
  1120.             landing_strentgh = read_byte(m_biped + 0x4D1) --    Instantly changes to a value depenging of how hard the fall was (from aLTis)
  1121.             bipd_movement_state = read_byte(m_biped + 0x4D2) -- Confirmed. (Standing = 0) (Walking = 1) (Idle/Turning = 2) (Gesturing?? = 3)
  1122.             --unkByte[5] 0x4D3-0x4D8 (Padding Maybe?)
  1123.             bipd_action = read_word(m_biped + 0x4D8) -- Tested. Some kind of ID of the BSP surface the biped is walking on, 0xFFFF when in air (from aLTis)
  1124.             bipd_action2 = read_byte(m_biped + 0x4DA) -- Tested. Related to the above? 255 if in air and 0 if touching a surface (from aLTis)
  1125.             bipd_action3 = read_byte(m_biped + 0x4DB) -- Tested. Same as above (might be word?) (from aLTis)
  1126.             bipd_x_coord = read_float(m_biped + 0x4E0) -- Confirmed.
  1127.             bipd_y_coord = read_float(m_biped + 0x4E4) -- Confirmed.
  1128.             bipd_z_coord = read_float(m_biped + 0x4E8) -- Confirmed.
  1129.             bipd_walking_counter = read_long(m_biped + 0x4EC) --    Counts up every time biped moves, not sure what's the type of this value though (from aLTis)
  1130.             bipd_bumped_obj_id = readident(m_biped + 0x4FC) -- Confirmed. Object ID of any object you bump into (rocks, weapons, players, vehicles, ANY object)
  1131.             bipd_time_since_last_bump = readchar(m_biped + 0x500) -- Tested. Counts backwards from 0 to -15 when bumped. Glitchy. Don't rely on this.
  1132.             bipd_airborne_time = readchar(m_biped + 0x501) -- Confirmed. (1 sec = 30 ticks)
  1133.             bipd_slipping_time = readchar(m_biped + 0x502) -- Counts up when hit by a grenade (from aLTis)
  1134.             bipd_walking_direction =  read_char(m_biped + 0x503) -- 0 when not walking, 1 when walking forward etc (from aLTis)
  1135.             bipd_jump_time = readchar(m_biped + 0x504) -- Tested. Counts up from 0 after landing from a jump, and returns to 0 after you hit the ground (1 sec = 30 ticks).
  1136.             bipd_melee_timer = read_byte(m_biped + 0x505) -- Time until melee is finished (by aLTis)
  1137.             --Padding[1] 0x507-0x508
  1138.             bipd_landing_thingy = read_byte(m_biped + 0x508) -- turns to 0 when landing, stays 0 when landing hard. 0xFF otherwise. (from aLTis)
  1139.             --Padding[2] 0x50A-0x50C
  1140.             bipd_crouch_scale = read_float(m_biped + 0x50C) -- Confirmed. How crouched you are. (0 to 1) (Crouching = 1) (Standing = 0)
  1141.             --unkFloat[1] 0x510-0x514 (???)
  1142.             bipd_surface_angle_x = read_float(m_biped + 0x514) -- Tested. Not 100% sure but it seems to be the angle of the surface where biped stands (from aLTis)
  1143.             bipd_surface_angle_y = read_float(m_biped + 0x518) -- Tested. Not 100% sure but it seems to be the angle of the surface where biped stands (from aLTis)
  1144.             bipd_surface_angle_z = read_float(m_biped + 0x51C) -- Tested. Not 100% sure but it seems to be the angle of the surface where biped stands (from aLTis)
  1145.             bipd_surface_angle_d = read_float(m_biped + 0x520) -- Tested. Not 100% sure but it seems to be the angle of the surface where biped stands (from aLTis)
  1146.             --unkChar[2] 0x524-0x526 (???)
  1147.             --  bitmask8
  1148.                 bipd_baseline_valid = read_bit(m_biped + 0x526, 0) -- From OS.
  1149.             --  unkBit[7] 1-7 (???)
  1150.             bipd_baseline_index = readchar(m_biped + 0x527) -- From OS.
  1151.             bipd_message_index = readchar(m_biped + 0x528) -- From OS.
  1152.             --Padding[3] 0x529-0x52C
  1153.            
  1154.             --  baseline update
  1155.             bipd_primary_nades = read_byte(m_biped + 0x52C) -- Confirmed. Number of frag grenades.
  1156.             bipd_secondary_nades = read_byte(m_biped + 0x52D) -- Confirmed. Number of plasma grenades.
  1157.             --Padding[2] 0x52E-0x530
  1158.             bipd_health = read_float(m_biped + 0x530) -- Confirmed. (0 to 1). Lags behind obj_health.
  1159.             bipd_shield = read_float(m_biped + 0x534) -- Confirmed. (0 to 1). Lags behind obj_health.
  1160.             --  bitmask8
  1161.                 bipd_shield_stun_time_greater_than_zero = read_bit(m_biped + 0x538, 0) -- From OS.
  1162.             --  unkBit[7] 1-7 (???)
  1163.             --Padding[3] 0x539-0x53C
  1164.             --  bitmask8
  1165.             --  unkBit[8] 0x53C 0-7 (???)
  1166.             --Padding[3] 0x53D-0x540
  1167.            
  1168.             --  delta update
  1169.             --bipd_primary_nades2 = read_byte(m_biped + 0x540) -- (???) Always 0?
  1170.             --bipd_secondary_nades2 = read_byte(m_biped + 0x541) -- (???) Always 0?
  1171.             --Padding[2] 0x542-0x544
  1172.             --bipd_health2 = read_float(m_biped + 0x544) -- (???) Always 0? (0 to 1)
  1173.             --bipd_shield2 = read_float(m_biped + 0x548) -- (???) Always 0? (0 to 1)
  1174.             --  bitmask8
  1175.                 bipd_shield_stun_time_greater_than_zero2 = read_bit(m_biped + 0x54C, 0) -- From OS.
  1176.             --  unkBit[7] 1-7 (???)
  1177.             --Padding[3] 0x54D-0x550
  1178.            
  1179.             --these are all just friggin rediculous...
  1180.             function getBodyPart(address, offset)
  1181.                 address = address + (offset or 0x0)
  1182.                 local bodypart = {}
  1183.                 bodypart.scale = read_float(address + 0x0) -- From 002
  1184.                 bodypart.rotationx0 = read_float(address + 0x4) -- From 002
  1185.                 bodypart.rotationy0 = read_float(address + 0x8) -- From 002
  1186.                 bodypart.rotationz0 = read_float(address + 0xC) -- From 002
  1187.                 bodypart.rotationx1 = read_float(address + 0x10) -- From 002
  1188.                 bodypart.rotationy1 = read_float(address + 0x14) -- From 002
  1189.                 bodypart.rotationz1 = read_float(address + 0x18) -- From 002
  1190.                 bodypart.rotationx2 = read_float(address + 0x1C) -- From 002
  1191.                 bodypart.rotationy2 = read_float(address + 0x20) -- From 002
  1192.                 bodypart.rotationz2 = read_float(address + 0x24) -- From 002
  1193.                 bodypart.x = read_float(address + 0x28) -- Confirmed.
  1194.                 bodypart.y = read_float(address + 0x2C) -- Confirmed.
  1195.                 bodypart.z = read_float(address + 0x30) -- Confirmed.
  1196.                 return bodypart
  1197.             end
  1198.            
  1199.             function getBodyPartLocation(address, offset)
  1200.                 address = address + (offset or 0x0)
  1201.                 --unkFloats[10] (???) Probably rotations.
  1202.                 bipd_bodypart_x = read_float(m_biped + 0x28)
  1203.                 bipd_bodypart_y = read_float(m_biped + 0x2C)
  1204.                 bipd_bodypart_z = read_float(m_biped + 0x30)
  1205.                 return bipd_bodypart_x,bipd_bodypart_y,bipd_bodypart_z
  1206.             end
  1207.  
  1208.             --All of these are from SuperAbyll.
  1209.             --getBodyPart returns a table full of x,y,z coords + unknown floats
  1210.             --getBodyPartLocation returns 3 values (x, y, and z coordinates)
  1211.             bipd_left_thigh = getBodyPart(m_biped + 0x550)
  1212.                 --if you just want the coordinates, you can do this instead for each bodypart:
  1213.                 x,y,z = getBodyPartLocation(m_biped + 0x550) -- XYZ coordinates for the left thigh.
  1214.             bipd_right_thigh = getBodyPart(m_biped + 0x584)
  1215.             bipd_pelvis = getBodyPart(m_biped + 0x5B8)
  1216.             bipd_left_calf = getBodyPart(m_biped + 0x5EC)
  1217.             bipd_right_calf = getBodyPart(m_biped + 0x620)
  1218.             bipd_spine = getBodyPart(m_biped + 0x654)
  1219.             bipd_left_clavicle = getBodyPart(m_biped + 0x688)
  1220.             bipd_left_foot = getBodyPart(m_biped + 0x6BC)
  1221.             bipd_neck = getBodyPart(m_biped + 0x6F0)
  1222.             bipd_right_clavicle = getBodyPart(m_biped + 0x724)
  1223.             bipd_right_foot = getBodyPart(m_biped + 0x758)
  1224.             bipd_head = getBodyPart(m_biped + 0x78C)
  1225.             bipd_left_upper_arm = getBodyPart(m_biped + 0x7C0)
  1226.             bipd_right_upper_arm = getBodyPart(m_biped + 0x7F4)
  1227.             bipd_left_lower_arm = getBodyPart(m_biped + 0x828)
  1228.             bipd_right_lower_arm = getBodyPart(m_biped + 0x85C)
  1229.             bipd_left_hand = getBodyPart(m_biped + 0x890)
  1230.             bipd_right_hand = getBodyPart(m_biped + 0x8C4)
  1231.            
  1232.             --The coordinates from these can be accessed doing the following
  1233.             --let's say I want to tell the whole server the y coordinate of this object's right foot. I would do: say(bipd_right_foot.y)
  1234.             say(bipd_right_foot.y) -- **SERVER**: 52.7130341548629
  1235.        
  1236.         elseif obj_type == 1 then -- check if object is a vehicle
  1237.        
  1238.             -- vehi struct
  1239.             -- Thank you 002 and shaft for figuring out that there's a struct here:
  1240.             --  bitmask16:
  1241.             vehi_tires_blur = read_bit(m_vehicle + 0x4CC, 0) -- Tested. True when warthog's tires switch to blurred permutation (from aLTis)
  1242.             --  unkBit[2] 0x4CC 1
  1243.             vehi_crouch = read_bit(m_vehicle + 0x4CC, 2)
  1244.             vehi_jump = read_bit(m_vehicle + 0x4CC, 3)
  1245.             --  unkBit[4] 0x4CC 4-7
  1246.             vehi_physics_active_timer = read_word(m_vehicle + 0x4CE) -- Tested. 15 when physics are activated by the player (not when moved by other things), counts down to 0 otherwise (from aLTis)
  1247.             vehi_airborne_timer = read_byte(m_vehicle + 0x4D0) -- Tested. Counts up from 0 to 255 when vehicle is in the air. Hovering doesn't count. (from aLTis)
  1248.             vehi_speed = read_float(m_vehicle + 0x4D4)
  1249.             vehi_slide = read_float(m_vehicle + 0x4D8)
  1250.             vehi_turn = read_float(m_vehicle + 0x4DC)
  1251.             vehi_tireposition = read_float(m_vehicle + 0x4E0)
  1252.             vehi_treadpositionleft = read_float(m_vehicle + 0x4E4)
  1253.             vehi_treadpositionright = read_float(m_vehicle + 0x4E8)
  1254.             vehi_hover = read_float(m_vehicle + 0x4EC)
  1255.             vehi_thrust = read_float(m_vehicle + 0x4F0)
  1256.             --unkByte[4] 0x4F4-0x4F8 something to do with suspension states... enum?
  1257.             vehi_hoveringposition_x = read_float(m_vehicle + 0x4FC)
  1258.             vehi_hoveringposition_y = read_float(m_vehicle + 0x500)
  1259.             vehi_hoveringposition_z = read_float(m_vehicle + 0x504)
  1260.             vehi_collision_pushback_x = read_float(m_vehicle + 0x508) -- Tested. When colliding with another vehicle, this is how hard it will be pushed away (from aLTis)
  1261.             vehi_collision_pushback_y = read_float(m_vehicle + 0x50C) -- Tested.
  1262.             vehi_collision_pushback_z = read_float(m_vehicle + 0x510) -- Tested.
  1263.             vehi_collision_pushback_x_rot = read_float(m_vehicle + 0x514) -- Tested.
  1264.             vehi_collision_pushback_y_rot = read_float(m_vehicle + 0x518) -- Tested.
  1265.             vehi_collision_pushback_z_rot = read_float(m_vehicle + 0x51C) -- Tested.
  1266.             --unkLong[7] 0x520-0x524
  1267.             --  bitmask16
  1268.                 vehi_networkTimeValid = read_bit(m_vehicle + 0x524, 0)
  1269.             --  unkBit[7] 1-7
  1270.                 vehi_baselineValid = read_bit(m_vehicle + 0x524, 8)
  1271.             --  unkBit[7] 9-15
  1272.             vehi_baselineIndex = read_byte(m_vehicle + 0x526)
  1273.             vehi_messageIndex = read_byte(m_vehicle + 0x527)
  1274.             --  bitmask32
  1275.                 vehi_at_rest = read_bit(m_vehicle + 0x528, 0)
  1276.             --  unkBit[30] 1-31
  1277.             vehi_x_coord = read_float(m_vehicle + 0x52C)
  1278.             vehi_y_coord = read_float(m_vehicle + 0x530)
  1279.             vehi_z_coord = read_float(m_vehicle + 0x534)
  1280.             vehi_x_vel = read_float(m_vehicle + 0x538)
  1281.             vehi_y_vel = read_float(m_vehicle + 0x53C)
  1282.             vehi_z_vel = read_float(m_vehicle + 0x540)
  1283.             vehi_x_aim_vel = read_float(m_vehicle + 0x544)
  1284.             vehi_y_aim_vel = read_float(m_vehicle + 0x548)
  1285.             vehi_z_aim_vel = read_float(m_vehicle + 0x54C)
  1286.             vehi_pitch = read_float(m_vehicle + 0x550)
  1287.             vehi_yaw = read_float(m_vehicle + 0x554)
  1288.             vehi_roll = read_float(m_vehicle + 0x558)
  1289.             vehi_x_scale = read_float(m_vehicle + 0x55C)
  1290.             vehi_y_scale = read_float(m_vehicle + 0x560)
  1291.             vehi_z_scale = read_float(m_vehicle + 0x564)
  1292.             --Padding[4] 0x568-0x56C
  1293.             vehi_x_coord2 = read_float(m_vehicle + 0x56C)
  1294.             vehi_y_coord2 = read_float(m_vehicle + 0x570)
  1295.             vehi_z_coord2 = read_float(m_vehicle + 0x574)
  1296.             vehi_x_vel2 = read_float(m_vehicle + 0x578)
  1297.             vehi_y_vel2 = read_float(m_vehicle + 0x57C)
  1298.             vehi_z_vel2 = read_float(m_vehicle + 0x580)
  1299.             vehi_x_aim_vel2 = read_float(m_vehicle + 0x584)
  1300.             vehi_y_aim_vel2 = read_float(m_vehicle + 0x588)
  1301.             vehi_z_aim_vel2 = read_float(m_vehicle + 0x58C)
  1302.             vehi_pitch2 = read_float(m_vehicle + 0x590)
  1303.             vehi_yaw2 = read_float(m_vehicle + 0x594)
  1304.             vehi_roll2 = read_float(m_vehicle + 0x598)
  1305.             vehi_x_scale2 = read_float(m_vehicle + 0x59C)
  1306.             vehi_y_scale2 = read_float(m_vehicle + 0x5A0)
  1307.             vehi_z_scale2 = read_float(m_vehicle + 0x5A4)
  1308.             --Padding[4] 0x5A8-0x5AC
  1309.             vehi_some_timer = read_dword(m_vehicle + 0x5AC) -- Tested. Vehicle respawn timer?. Can force vehicle to respawn with this (from aLTis)
  1310.  
  1311.             --block index of the scenario datum used for respawning
  1312.             --For all game engines besides race, this will be a scenario vehicle datum
  1313.             --For race, it's a scenario_netpoint, aka "scenario_netgame_flags_block"
  1314.             vehi_respawn_timer = read_word(m_vehicle + 0x5B0) -- Confirmed. (1 sec = 30 ticks)
  1315.             --Padding[2] 0x5B2-0x5B4
  1316.             vehi_respawn_x_coord = read_float(m_vehicle + 0x5B4) -- Respawn coordinates
  1317.             vehi_respawn_y_coord = read_float(m_vehicle + 0x5B8) -- Respawn coordinates
  1318.             vehi_respawn_z_coord = read_float(m_vehicle + 0x5BC) -- Respawn coordinates
  1319.         end
  1320.  
  1321.     --server network struct
  1322.     network_machine_pointer = read_dword(network_struct) -- Confirmed.
  1323.     network_state = read_word(network_struct + 0x4) -- Confirmed. (Inactive = 0, Game = 1, Results = 2)
  1324.     --unkWord[1] 0x6 (???)
  1325.     network_name = readwidestring(network_struct + 0x8, 0x42) -- Confirmed. Current server name.
  1326.     --unkWord[3] 0x86 (Padding Maybe?)
  1327.     network_current_map = read_string(network_struct + 0x8C, 0x80) -- Confirmed. Current map the server is currently running.
  1328.     network_current_gametype = readwidestring(network_struct + 0x10C, 0x18) -- Confirmed. Current gametype that the server is currently running.
  1329.     --  partial of Gametype need to break them down.
  1330.     --  unkByte[39] (???)
  1331.     --  unkFloat[1] 0x160 (???) Always 1.
  1332.     network_score_limit = read_byte(network_struct + 0x164) -- Confirmed. Current score limit for gametype. (1 second = 30 ticks)
  1333.     --Padding[3] 0x165
  1334.     local ce = 0x0
  1335.     if game == "CE" then
  1336.         --This exists in CE but not PC, therefore making the struct size larger in CE.
  1337.         --unkByte[64] 0x168 (???)
  1338.         ce = 0x40
  1339.     end
  1340.     --unkFloat[1] 0x1A0+ce (???) --0xBAADF00D (lol)
  1341.     network_max_players = read_byte(network_struct + (0x1A5+ce)) -- Confirmed. The maximum amount of players allowed to join the server (sv_maxplayers)
  1342.     network_difficulty_level = read_word(network_struct + (0x1A6+ce)) -- Tested. For SP only. Always 1 for server.
  1343.     network_player_count = read_word(network_struct + (0x1A8+ce)) -- Confirmed. Total number of players currently in the server.
  1344.     --  client network struct
  1345.         client_struct_size = 0x20 -- Confirmed.
  1346.         client_network_struct = network_struct + 0x1AA+ce + player * client_struct_size -- Strange. It starts in the middle of the dword.
  1347.         client_name = readwidestring(client_network_struct, 12) -- Confirmed. Name of player.
  1348.         client_color = read_word(client_network_struct + 0x18) -- Confirmed. Color of the player (ffa gametypes only.) (0 = white) (1 = black) (2 = red) (3 = blue) (4 = gray) (5 = yellow) (6 = green) (7 = pink) (8 = purple) (9 = cyan) (10 = cobalt) (11 = orange) (12 = teal) (13 = sage) (14 = brown) (15 = tan) (16 = maroon) (17 = salmon)
  1349.         client_icon_index = read_word(client_network_struct + 0x1A) -- From OS.
  1350.         client_machine_index = read_byte(client_network_struct + 0x1C) -- Confirmed. Player machine index (or rconId - 1)
  1351.         client_status = read_byte(client_network_struct + 0x1D) -- From Phasor. (1 = Genuine, 2 = Invalid hash (or auth, or w/e))
  1352.         client_team = read_byte(client_network_struct + 0x1E) -- Confirmed. (0 = red) (1 = blue)
  1353.         client_player_id = read_byte(client_network_struct + 0x1F) -- Confirmed. Player memory id/index (0 - 15) (To clarify: this IS the 'player' argument passed to phasor functions)
  1354.     --Padding[2] 0x3AA+ce
  1355.     network_game_random_seed = read_dword(network_struct + (0x3AC+ce)) -- Tested.
  1356.     network_games_played = read_dword(network_struct + (0x3B0+ce)) -- Confirmed. Total number of games played. (First game = 1, Second game = 2, etc..)
  1357.     network_local_data = read_dword(network_struct + (0x3B4+ce)) -- From OS.
  1358.     --  client_machine_info struct
  1359.         client_machineinfo_size = 0x60
  1360.         if game == "CE" then
  1361.             client_machineinfo_size = 0xEC
  1362.         end
  1363.         client_machineinfo_struct = network_struct + 0x3B8+ce + player * client_machineinfo_size
  1364.         client_connectioninfo_pointer = read_dword(client_machineinfo_struct) -- From Phasor.
  1365.     --  Padding[8] 0x4
  1366.         client_machine_index = read_word(client_machineinfo_struct + 0xC) -- Confirmed. Player machine index (or rconId - 1)
  1367.     --  unkWord[1] 0xE (Padding Maybe?)
  1368.         client_machine_unknown = read_word(client_machineinfo_struct + 0x10) -- From DZS. First is 1, then 3, then 7 and back to 0 if not in used (1 is found during the CD Hash Check, 7 if currently playing the game)
  1369.     --  unkWord[1] 0x12 (Padding Maybe?)
  1370.     --  unkLong[2] 0x14 (???)
  1371.     --  unkLong[1] 0x1C (???) most of the time 1, but sometimes changes to 2 for a moment.
  1372.     --  unkLong[1] 0x20 (???)
  1373.     --      action bitmask 16
  1374.             client_crouch = read_bit(client_machineinfo_struct + 0x24, 0) -- From DZS.
  1375.             client_jump = read_bit(client_machineinfo_struct + 0x24, 1) -- From DZS.
  1376.             client_flashlight = read_bit(client_machineinfo_struct + 0x24, 2) -- From DZS.
  1377.     --      unkBit[5] 3-7
  1378.             client_reload = read_bit(client_machineinfo_struct + 0x24, 8) -- From DZS.
  1379.             client_fire = read_bit(client_machineinfo_struct + 0x24, 9) -- From DZS.
  1380.             client_actionkey = read_bit(client_machineinfo_struct + 0x24, 10) -- From DZS.
  1381.             client_grenade = read_bit(client_machineinfo_struct + 0x24, 11) -- From DZS.
  1382.     --      unkBit[4] 12-15
  1383.     --  unkWord[1] 0x26 (Padding Maybe?)
  1384.         client_yaw = read_float(client_machineinfo_struct + 0x28) -- From DZS.
  1385.         client_pitch = read_float(client_machineinfo_struct + 0x2C) -- From DZS.
  1386.         client_roll = read_float(client_machineinfo_struct + 0x30) -- From DZS.
  1387.     --  unkByte[8] 0x34 (???)
  1388.         client_forwardVelocityMultiplier = read_float(client_machineinfo_struct + 0x3C) -- From DZS.
  1389.         client_horizontalVelocityMultiplier = read_float(client_machineinfo_struct + 0x40) -- From DZS.
  1390.         client_ROFVelocityMultiplier = read_float(client_machineinfo_struct + 0x44) -- From DZS.
  1391.         client_weap_type = read_word(client_machineinfo_struct + 0x48) -- Confirmed. (Primary = 0, Secondary = 1, Tertiary = 2, Quaternary = 3)
  1392.         client_nade_type = read_word(client_machineinfo_struct + 0x4A) -- Confirmed. (Frag Grenades = 0, Plasma Grenades = 1)
  1393.         --unkWord[1] 0x4C The index is -1 if no choices are even available.
  1394.         --unkWord[2] 0x4E
  1395.         client_machine_encryption_key = read_string(client_machineinfo_struct + 0x52, 0xA) -- From Phasor. Used for encrypting packets.
  1396.         client_machineNum = read_dword(client_machineinfo_struct + 0x5C) -- From Phasor. 0 - 0xFFFFFFFF Increased for each connection in server's life.
  1397.         if game == "CE" then
  1398.             client_last_player_name = read_string(client_machineinfo_struct + 0x60) -- Confirmed. Changes to the player name when they quit. (Could be useful for BOS if PC had this too :/)
  1399.             client_machine_ip_address = read_string(client_machineinfo_struct + 0x80, 32) -- From Phasor.
  1400.             client_machine_player_cdhash = read_string(client_machineinfo_struct + 0xA0, 32) -- From Phasor.
  1401.             --unkByte[76] 0xC0 (???) Maybe Padding? Nothing here. Possibly was going to be used for something else?
  1402.         end
  1403.        
  1404.     -- machine struct
  1405.     --I've found two methods of getting this struct :D
  1406.     local method = 1
  1407.     if method == 1 then
  1408.         machine_base = read_dword(network_machine_pointer) -- Confirmed.
  1409.         machine_table = machine_base + 0xAA0 -- Confirmed. Player machine table
  1410.         machine_struct = read_dword(machine_table + player_machine_index*4) -- Confirmed. Player machine struct
  1411.     elseif method == 2 then
  1412.         --This is the way most server apps do it (including Phasor) since it's less lines of code.
  1413.         machine_table = read_dword(client_connectioninfo_pointer)
  1414.         machine_struct = read_dword(machine_table)
  1415.         machine_network = read_dword(machine_network)
  1416.     end
  1417.     machine_player_first_ip_byte = read_byte(machine_struct) -- Confirmed. 127 if host.
  1418.     machine_player_second_ip_byte = read_byte(machine_struct + 0x1) -- Confirmed. 0 if host.
  1419.     machine_player_third_ip_byte = read_byte(machine_struct + 0x2) -- Confirmed. 0 if host.
  1420.     machine_player_fourth_ip_byte = read_byte(machine_struct + 0x3) -- Confirmed. 1 if host.
  1421.     machine_player_ip_address = string.format("%i.%i.%i.%i", machine_player_first_ip_byte, machine_player_second_ip_byte, machine_player_third_ip_byte, machine_player_fourth_ip_byte) -- Player's IP Address (127.0.0.1 if host)
  1422.     machine_player_port = read_word(machine_struct + 0x4) -- Confirmed. Usually 2303.
  1423.        
  1424.         -- address/offset checker
  1425.         --hprintf("---")
  1426.  
  1427.         --[[local offset = 0x0
  1428.  
  1429.         while offset < camera_size do
  1430.  
  1431.             if read_byte(camera_base, offset) ~= nil then
  1432.                 hprintf(string.format("%X", offset) .. " - " .. read_byte(camera_base, offset))
  1433.             end
  1434.  
  1435.             offset = offset + 0x1
  1436.  
  1437.         end]]--
  1438.     end
  1439. end
  1440.  
  1441. function OnObjectCreation(objectId)
  1442.     local object = getobject(objectId)
  1443.     if object then
  1444.         local obj_type = read_word(object + 0xB4)
  1445.         if obj_type == 2 or obj_type == 3 or obj_type == 4 then
  1446.             -- item struct
  1447.             -- This applies to equipment, weapons, and garbage only.
  1448.             item_struct = object
  1449.            
  1450.             --  bitmask32:
  1451.                 item_in_inventory = read_bit(item_struct + 0x1F4, 0) -- From OS.
  1452.             --  unkBit[31] 1-31 (Padding Maybe?)
  1453.             item_detonation_countdown = read_word(item_struct + 0x1F8) -- Confirmed. (1 sec = 30 ticks)
  1454.             item_collision_surface_index = read_word(item_struct + 0x1FA) -- From OS.
  1455.             item_structure_bsp_index = read_word(item_struct + 0x1FC) -- From OS.
  1456.             --Padding[2] 0x1FE-0x200
  1457.             item_unknown_obj_id = readident(item_struct + 0x200)
  1458.             item_last_update_time = read_dword(item_struct + 0x204) -- From OS.
  1459.             item_unknown_obj_id2 = readident(item_struct + 0x208)
  1460.             item_unknown_x_coord = read_float(item_struct + 0x20C)
  1461.             item_unknown_y_coord = read_float(item_struct + 0x210)
  1462.             item_unknown_z_coord = read_float(item_struct + 0x214)
  1463.             item_unknown_x_vel = read_float(item_struct + 0x218)
  1464.             item_unknown_y_vel = read_float(item_struct + 0x21C)
  1465.             item_unknown_z_vel = read_float(item_struct + 0x220)
  1466.             item_unknown_xy_angle = read_float(item_struct + 0x224)
  1467.             item_unknown_z_angle = read_float(item_struct + 0x228)
  1468.            
  1469.             if obj_type == 2 then -- weapons
  1470.            
  1471.                 -- weap struct
  1472.                 weap_struct = object
  1473.                
  1474.                 weap_meta_id = read_dword(weap_struct) -- Confirmed with HMT. Tag Meta ID.
  1475.                 weap_fuel = read_float(weap_struct + 0x124) -- Confirmed. Only for Flamethrower. (0 to 1)
  1476.                 weap_charge = read_float(weap_struct + 0x140) -- Confirmed. Only for Plasma Pistol. (0 to 1)
  1477.                 --  weapon flags bitmask32:
  1478.                     weap_overheated = read_bit(weap_struct + 0x22C, 0) -- Tested. True when weapon is overheated (from aLTis)
  1479.                     weap_overheat_over = read_bit(weap_struct + 0x22C, 1) -- Tested. True when overheat animation ends (from aLTis)
  1480.                 --  unkBit[3] 2 (???)
  1481.                     weap_must_be_readied = read_bit(weap_struct + 0x22C, 3) -- From OS. True when reloading
  1482.                 --  unkBit[28] 4-31 (???)
  1483.                
  1484.                 --  ownerObjFlags bitmask16:
  1485.                 --  unkBit[16] 0x230 0 (???)
  1486.                     weapon_primary_trigger_hold = read_bit(weap_struct + 0x230, 1) -- is true when player is trying to fire (from aLTis)
  1487.                     weapon_secondary_trigger_hold = read_bit(weap_struct + 0x230, 2) -- is true when player is trying to throw a grenade (from aLTis)
  1488.                     weapon_reload_press = read_bit(weap_struct + 0x230, 3) -- is true when player is trying to reload (from aLTis)
  1489.                     weapon_melee = read_bit(weap_struct + 0x230, 4) -- is true when melee or grenade throw animation is playing (from aLTis)
  1490.                     --unkBit[16] 0x230 5
  1491.                     weapon_zoom = read_bit(weap_struct + 0x230, 6) -- is true when zoomed in (from aLTis)
  1492.                 --  unkBit[16] 0x230 7-15 (???)
  1493.                 --Padding[2] 0x232-0x234
  1494.                 weap_primary_trigger = read_float(weap_struct + 0x234) -- From OS.
  1495.                 weap_state = read_byte(weap_struct + 0x238) -- From OS. (0 = Idle) (1 = PrimaryFire) (2 = SecondaryFire) (3 = Chamber1) (4 = Chamber2) (5 = Reload1) (6 = Reload2) (7 = Charged1) (8 = Charged2) (9 = Ready) (10 = Put Away)
  1496.                 --Padding[1] 0x239-0x23A
  1497.                 weap_readyWaitTime = read_word(weap_struct + 0x23A) -- From DZS.
  1498.                 weap_heat = read_float(weap_struct + 0x23C) -- Confirmed. (0 to 1)
  1499.                 weap_age = read_float(weap_struct + 0x240) -- Confirmed. Equal to 1 - batteries. (0 to 1)
  1500.                 weap_illumination_fraction = read_float(weap_struct + 0x244) -- From OS.
  1501.                 weap_light_power = read_float(weap_struct + 0x248) -- From OS.
  1502.                 --Padding[4] 0x24C-0x250 Unused.
  1503.                 weap_tracked_objId = readident(weap_struct + 0x250) -- From OS.
  1504.                 --Padding[8] 0x254-0x25C Unused.
  1505.                 weap_alt_shots_loaded = read_word(weap_struct + 0x25C) -- From OS.
  1506.                 --Padding[2] 0x25E-0x260
  1507.        
  1508.                 --Trigger State:
  1509.                 --Padding[1] 0x260-0x261
  1510.                 weap_trigger_state = read_byte(weap_struct + 0x261) -- From OS. 0-idle,1-firing,2-charged fire?,3-charged fire?,7-no battery
  1511.                 weap_trigger_time = read_word(weap_struct + 0x262) -- From OS.
  1512.                 --  trigger_flags bitmask32:
  1513.                 weap_trigger_currently_not_firing = read_bit(weap_struct + 0x264, 0) -- From DZS.
  1514.                 --  unkBit[31] 0x264-0x268 1-31 (???)
  1515.                 weap_trigger_autoReloadCounter = read_dword(weap_struct + 0x268) -- From DZS.
  1516.                 --unkWord[2] 0x26C-0x26E firing effect related. Always 0, if you set it to a higher value it counts down with every shot. No idea what this is
  1517.                 weap_trigger_rounds_since_last_tracer = read_word(weap_struct + 0x26E) -- From OS.
  1518.                 weap_trigger_rate_of_fire = read_float(weap_struct + 0x270) -- From OS.
  1519.                 weap_trigger_ejection_port_recovery_time = read_float(weap_struct + 0x274) -- From OS.
  1520.                 weap_trigger_illumination_recovery_time = read_float(weap_struct + 0x278) -- From OS.
  1521.                 --unkFloat[1] 0x27C-0x280 used in the calculation of projectile error angle
  1522.                 weap_trigger_charging_effect_id = readident(weap_struct + 0x280) -- From OS.
  1523.                 --unkByte[4] 0x284-0x288 (???)
  1524.                 --Padding[1] 0x288-0x289
  1525.                 weap_trigger2_state = read_byte(weap_struct + 0x289) -- From OS. Some counter.
  1526.                 weap_trigger2_time = read_word(weap_struct + 0x28A) -- From OS.
  1527.                 --  trigger_flags bitmask32:
  1528.                     weap_trigger2_currently_not_firing = read_bit(weap_struct + 0x28C, 0) -- From DZS.
  1529.                 --  unkBit[31] 0x28C-0x290 1-31 (???)
  1530.                 weap_trigger2_autoReloadCounter = read_dword(weap_struct + 0x290) -- From DZS.
  1531.                 --unkWord[2] 0x294-0x296 firing effect related.
  1532.                 weap_trigger2_rounds_since_last_tracer = read_word(weap_struct + 0x296) -- From OS.
  1533.                 weap_trigger2_rate_of_fire = read_float(weap_struct + 0x298) -- From OS.
  1534.                 weap_trigger2_ejection_port_recovery_time = read_float(weap_struct + 0x29C) -- From OS.
  1535.                 weap_trigger2_illumination_recovery_time = read_float(weap_struct + 0x2A0) -- From OS.
  1536.                 --unkFloat[1] 0x2A4-0x2A8 used in the calculation of projectile error angle
  1537.                 weap_trigger2_charging_effect_id = readident(weap_struct + 0x2A8) -- From OS.
  1538.                 --unkByte[4] 0x2AC-0x2B0 (???)
  1539.        
  1540.                 --Primary Magazine State:
  1541.                 weap_mag1_state = read_word(weap_struct + 0x2B0) -- From OS. (0 = Idle) (1 = Chambering Start) (2 = Chambering Finish) (3 = Chambering)
  1542.                 weap_mag1_chambering_time = read_word(weap_struct + 0x2B2) -- From OS. Can set to 0 to finish reloading. (1 sec = 30 ticks)
  1543.                 weap_reload_animation_frame_count = read_word(0x2B4) -- Tested. Same as in animation tag (from aLTis)
  1544.                 weap_primary_ammo = read_word(weap_struct + 0x2B6) -- Confirmed. Unloaded ammo for magazine 1.
  1545.                 weap_primary_clip = read_word(weap_struct + 0x2B8) -- Confirmed. Loaded clip for magazine 1.
  1546.                 --unkWord[3] 0x2BA-0x2C0 game tick value,unkWord,possible enum
  1547.        
  1548.                 --Secondary Magazine State:
  1549.                 weap_mag2_state = read_word(weap_struct + 0x2C0) -- From OS. (0 = Idle) (1 = Chambering Start) (2 = Chambering Finish) (3 = Chambering)
  1550.                 weap_mag2_chambering_time = read_word(weap_struct + 0x2C2) -- From OS. Can set to 0 to finish reloading. (1 sec = 30 ticks)
  1551.                 --unkWord[1] 0x2C4-0x2C6 game tick based value (animations?)
  1552.                 weap_secondary_ammo = read_word(weap_struct + 0x2C6) -- Confirmed. Unloaded ammo for magazine 1.
  1553.                 weap_secondary_clip = read_word(weap_struct + 0x2C8) -- Confirmed. Loaded clip for magazine 1.
  1554.                 --unkWord[3] 0x2CA-0x2D0 game tick value,unkWord,possible enum
  1555.                
  1556.                 weap_last_fired_time = read_dword(weap_struct + 0x2D0) -- From DZS. gameinfo_current_time - this = time since this weapon was fired. (1 second = 30 ticks)
  1557.                 weap_mag1_starting_total_rounds = read_word(weap_struct + 0x2D4) -- From OS. The total unloaded primary ammo the weapon has by default.
  1558.                 weap_mag1_starting_loaded_rounds = read_word(weap_struct + 0x2D6) -- From OS. The total loaded primary clip the weapon has by default.
  1559.                 weap_mag2_starting_total_rounds = read_word(weap_struct + 0x2D8) -- From OS. The total unloaded secondary ammo the weapon has by default.
  1560.                 weap_mag2_starting_loaded_rounds = read_word(weap_struct + 0x2DA) -- From OS. The total loaded secondary clip the weapon has by default.
  1561.                 --unkByte[4] 0x2DC-0x2E0 (Padding Maybe?)
  1562.                 weap_baseline_valid = read_byte(weap_struct + 0x2E0) -- From OS.
  1563.                 weap_baseline_index = read_byte(weap_struct + 0x2E1) -- From OS.
  1564.                 weap_message_index = read_byte(weap_struct + 0x2E2) -- From OS.
  1565.                 --Padding[1] 0x2E3-0x2E4
  1566.                 weap_x_coord = read_float(weap_struct + 0x2E4) -- From OS.
  1567.                 weap_y_coord = read_float(weap_struct + 0x2E8) -- From OS.
  1568.                 weap_z_coord = read_float(weap_struct + 0x2EC) -- From OS.
  1569.                 weap_x_vel = read_float(weap_struct + 0x2F0) -- From OS.
  1570.                 weap_y_vel = read_float(weap_struct + 0x2F2) -- From OS.
  1571.                 weap_z_vel = read_float(weap_struct + 0x2F4) -- From OS.
  1572.                 --Padding[12] 0x2F8-0x300
  1573.                 weap_primary_ammo2 = read_word(weap_struct + 0x300) -- From OS. Unloaded ammo for magazine 1.
  1574.                 weap_secondary_ammo2 = read_word(weap_struct + 0x302) -- From OS. Unloaded ammo for magazine 2.
  1575.                 weap_age2 = read_float(weap_struct + 0x304) -- From OS. Equal to 1 - batteries. (0 to 1)
  1576.                 --Duplicates of above below this point, will add later.
  1577.             elseif obj_type == 3 then -- equipment
  1578.                
  1579.                 -- eqip struct
  1580.                 eqip_struct = item_struct
  1581.                
  1582.                 --unkByte[16] 0x22C-0x23C (???) possibly unused?
  1583.                 --unkByte[8] 0x23C-0x244 (???) possibly unused?
  1584.                 --  bitmask8:
  1585.                     eqip_baseline_valid = read_bit(eqip_struct + 0x244, 0) -- From OS.
  1586.                 --  unkBit[7] 1-7 (Padding Maybe?)
  1587.                 eqip_baseline_index = readchar(eqip_struct + 0x245) -- From OS.
  1588.                 eqip_message_index = readchar(eqip_struct + 0x246) -- From OS.
  1589.                 --Padding[1] 0x247-0x248
  1590.                 -- baseline update
  1591.                 eqip_x_coord = read_float(eqip_struct + 0x248) -- From OS.
  1592.                 eqip_y_coord = read_float(eqip_struct + 0x24C) -- From OS.
  1593.                 eqip_z_coord = read_float(eqip_struct + 0x250) -- From OS.
  1594.                 eqip_x_vel = read_float(eqip_struct + 0x254) -- From OS.
  1595.                 eqip_y_vel = read_float(eqip_struct + 0x258) -- From OS.
  1596.                 eqip_z_vel = read_float(eqip_struct + 0x25C) -- From OS.
  1597.                 eqip_pitch_vel = read_float(eqip_struct + 0x260) -- From OS.
  1598.                 eqip_yaw_vel = read_float(eqip_struct + 0x264) -- From OS.
  1599.                 eqip_roll_vel = read_float(eqip_struct + 0x268) -- From OS.
  1600.                
  1601.                 --  delta update
  1602.                 --  bitmask8:
  1603.                     eqip_delta_valid = read_bit(eqip_struct + 0x26C, 0) -- Guess.
  1604.                 --  unkBit[7] 1-7 (Padding Maybe?)
  1605.                 --Padding[3] 0x26D-0x270
  1606.                 eqip_x_coord2 = read_float(eqip_struct + 0x270) -- From OS.
  1607.                 eqip_y_coord2 = read_float(eqip_struct + 0x274) -- From OS.
  1608.                 eqip_z_coord2 = read_float(eqip_struct + 0x278) -- From OS.
  1609.                 eqip_x_vel2 = read_float(eqip_struct + 0x27C) -- From OS.
  1610.                 eqip_y_vel2 = read_float(eqip_struct + 0x280) -- From OS.
  1611.                 eqip_z_vel2 = read_float(eqip_struct + 0x284) -- From OS.
  1612.                 eqip_pitch_vel2 = read_float(eqip_struct + 0x288) -- From OS.
  1613.                 eqip_yaw_vel2 = read_float(eqip_struct + 0x28C) -- From OS.
  1614.                 eqip_roll_vel2 = read_float(eqip_struct + 0x290) -- From OS.
  1615.                
  1616.             elseif obj_type == 4 then -- garbage object
  1617.                
  1618.                 -- garbage struct
  1619.                 garb_struct = item_struct
  1620.                
  1621.                 garb_time_until_garbage = read_word(garb_struct + 0x22C) -- From OS.
  1622.                 --Padding[2] 0x22E-0x230
  1623.                 --Padding[20] 0x230-0x244 unused
  1624.                
  1625.             elseif obj_type == 5 then -- projectile
  1626.                
  1627.                 -- proj struct
  1628.                 proj_struct = object
  1629.                
  1630.                 --It appears Smiley didn't know how to read Open-Sauce very effectively, which explains the previous failure in this projectile structure's documentation:
  1631.                
  1632.                 proj_mapId = readident(proj_struct + 0x0) -- Confirmed.
  1633.                 --INSERT REST OF OBJECT STRUCT FROM 0x4 TO 0x1F4 HERE
  1634.                 --Padding[52] 0x1F4-0x22C -- Item data struct not used in projectile.
  1635.                
  1636.                 --unkBit 0
  1637.                 proj_contrail = read_bit(proj_struct + 0x22C, 1) -- Tested. If true then projectile will have a contrail
  1638.                 --unkBit 2
  1639.                 proj_frozen = read_bit(proj_struct + 0x22C, 3) -- Tested. If true then the projectile will be frozen in time (from aLTis)
  1640.                 proj_at_rest = read_bit(proj_struct + 0x22C, 4) -- Tested. If true then the grenade detonation timer starts (from aLTis)
  1641.                 proj_at_rest2 = read_bit(proj_struct + 0x22C, 5) -- Tested. Same as above?? (from aLTis)
  1642.                 --unkBit 6-31 unused
  1643.                
  1644.                 proj_action = read_word(proj_struct + 0x230) -- From OS. (enum) 0-explodes, 1-disappears, everything higher will make projectile freeze (from aLTis)
  1645.                 proj_material = read_word(proj_struct + 0x232) -- Tested. Material type that the projectile touched (from aLTis)
  1646.                 proj_source_obj_id = readident(proj_struct + 0x234) -- From OS.
  1647.                 proj_target_obj_id = readident(proj_struct + 0x238) -- From OS.
  1648.                 proj_contrail_attachment_index = read_dword(proj_struct + 0x23C) -- From OS. index for the proj's definition's object_attachment_block, index is relative to object.attachments.attachment_indices or -1
  1649.                 proj_time_remaining = read_float(proj_struct + 0x240) -- From OS. Time remaining to target.
  1650.                 proj_detonation_time = read_float(proj_struct + 0x244) -- Tested. Math for this: (1/30/'timer' from projectile tag) (from aLTis)
  1651.                 proj_arming_timer = read_float(proj_struct + 0x248) -- Tested. If 'aiming time' in tag is not 0, then this tells how long the projectile has existed in seconds (from aLTis)
  1652.                 proj_arming_time = read_float(proj_struct + 0x24C) --Tested. Math for this: (1/30/'arming time' from projectile tag) (from aLTis)
  1653.                 proj_range_traveled = read_word(proj_struct + 0x250) -- From OS. If the proj definition's "maximum range" is > 0, divide this value by "maximum range" to get "range remaining".
  1654.                 proj_x_vel = read_float(proj_struct + 0x254) -- From OS.
  1655.                 proj_y_vel = read_float(proj_struct + 0x258) -- From OS.
  1656.                 proj_z_vel = read_float(proj_struct + 0x25C) -- From OS.
  1657.                 proj_water_damage_range = read_float(proj_struct + 0x260) --Tested. set to water_damage_range's maximum.
  1658.                 proj_pitch = read_float(proj_struct + 0x264) -- From OS.
  1659.                 proj_yaw = read_float(proj_struct + 0x268) -- From OS.
  1660.                 proj_roll = read_float(proj_struct + 0x26C) -- From OS.
  1661.                 --unkFloat[2] 0x270-0x278 real_euler_angles2d
  1662.                 --unkBit[8] 0x278-0x279 (???) -- first bit is true for grenades
  1663.                 --  bitmask8:
  1664.                     proj_baseline_valid = read_bit(proj_struct + 0x279, 0) -- From OS.
  1665.                 --  unkBit[7] 1-7
  1666.                 proj_baseline_index = readchar(proj_struct + 0x27A) -- From OS.
  1667.                 proj_message_index = readchar(proj_struct + 0x27B) -- From OS.
  1668.                
  1669.                 --  baseline update
  1670.                 proj_x_coord = read_float(proj_struct + 0x27C) -- From OS.
  1671.                 proj_y_coord = read_float(proj_struct + 0x280) -- From OS.
  1672.                 proj_z_coord = read_float(proj_struct + 0x284) -- From OS.
  1673.                 proj_x_vel2 = read_float(proj_struct + 0x288) -- From OS.
  1674.                 proj_y_vel2 = read_float(proj_struct + 0x28C) -- From OS.
  1675.                 proj_z_vel2 = read_float(proj_struct + 0x290) -- From OS.
  1676.                 --unkBit[8] 0x294-0x295 delta_valid?
  1677.                 --Padding[3] 0x295-0x298
  1678.                
  1679.                 --  delta update
  1680.                 proj_x_coord2 = read_float(proj_struct + 0x298) -- From OS.
  1681.                 proj_y_coord2 = read_float(proj_struct + 0x29C) -- From OS.
  1682.                 proj_z_coord2 = read_float(proj_struct + 0x2A0) -- From OS.
  1683.                 proj_x_vel3 = read_float(proj_struct + 0x2A4) -- From OS.
  1684.                 proj_y_vel3 = read_float(proj_struct + 0x2A8) -- From OS.
  1685.                 proj_z_vel3 = read_float(proj_struct + 0x2AC) -- From OS.
  1686.                
  1687.             elseif obj_type >= 6 and obj_type <= 9 then -- device
  1688.                
  1689.                 -- device struct
  1690.                 device_struct = object
  1691.                
  1692.                 device_position_reversed = read_bit(device_struct + 0x1F4, 0) -- Tested. Same as in the tag (from aLTis)
  1693.                 --  unkBit 1-2 they do something but not sure what
  1694.                 --  unkBit 3-31 unused?
  1695.                
  1696.                 device_power_group_index = read_word(device_struct + 0x1F8) -- From OS.
  1697.                 --Padding[2] 0x1FA-0x1FC
  1698.                 device_power_amount = read_float(device_struct + 0x1FC) -- From OS.
  1699.                 device_power_change = read_float(device_struct + 0x200) -- From OS.
  1700.                 device_position_group_index = read_word(device_struct + 0x204) -- From OS.
  1701.                 --Padding[2] 0x206-0x208
  1702.                 device_position_amount = read_float(device_struct + 0x208) -- From OS.
  1703.                 device_position_change = read_float(device_struct + 0x20C) -- From OS.
  1704.                 --  user interaction bitmask32:
  1705.                     device_one_sided = read_bit(device_struct + 0x210, 0) -- From OS.
  1706.                     device_operates_automatically = read_bit(device_struct + 0x210, 1) -- From OS.
  1707.                 --  unkBit[30] 2-31 (Padding Maybe?)
  1708.                
  1709.                 if obj_type == 7 then -- machine
  1710.                    
  1711.                     -- mach struct
  1712.                     mach_struct = device_struct
  1713.                    
  1714.                     mach_does_not_operate_automatically = read_bit(device_struct + 0x214, 0) -- Tested. Same as in tag (from aLTis)
  1715.                     --unkBit 1-2 maybe flags one sided and never appears locked?
  1716.                     mach_opened_by_melee = read_bit(device_struct + 0x214, 3) -- Tested. Same as in tag (from aLTis)
  1717.                     --unkBit 4-31
  1718.                     mach_door_timer = read_dword(mach_struct + 0x218) -- Tested. looks like a timer used for door-type machines.
  1719.                     mach_elevator_x_coord = read_dword(mach_struct + 0x21C) -- From OS.
  1720.                     mach_elevator_y_coord = read_dword(mach_struct + 0x220) -- From OS.
  1721.                     mach_elevator_z_coord = read_dword(mach_struct + 0x224) -- From OS.
  1722.                    
  1723.                 elseif obj_type == 8 then -- control
  1724.                    
  1725.                     -- ctrl struct
  1726.                     ctrl_struct = device_struct
  1727.                    
  1728.                     ctrl_flags = read_dword(mach_struct + 0x214) -- breakdown coming soon!
  1729.                     ctrl_custom_name_index = read_word(mach_struct + 0x218) -- From OS.
  1730.                     --Padding[2] 0x21A-0x21C
  1731.                
  1732.                 elseif obj_type == 9 then -- lightfixture
  1733.                    
  1734.                     --lightfixture struct
  1735.                     lifi_struct = device_struct
  1736.                    
  1737.                     lifi_red_color = read_float(lifi_struct + 0x214) -- From OS.
  1738.                     lifi_green_color = read_float(lifi_struct + 0x218) -- From OS.
  1739.                     lifi_blue_color = read_float(lifi_struct + 0x21C) -- From OS.
  1740.                     lifi_intensity = read_float(lifi_struct + 0x220) -- From OS.
  1741.                     lifi_falloff_angle = read_float(lifi_struct + 0x224) -- From OS.
  1742.                     lifi_cutoff_angle = read_float(lifi_struct + 0x228) -- From OS.
  1743.                    
  1744.                 end
  1745.             end
  1746.         end
  1747.     end
  1748. end
  1749.  
  1750. function readident(address, offset)
  1751.     address = address + (offset or 0)
  1752.     identity = read_dword(address) -- DWORD ID.
  1753.     --  Thank you WaeV for helping me wrap my head around this.
  1754.         ident_table_index = read_word(address) -- Confirmed. This is what most functions use. (player number, object index, etc)
  1755.         ident_table_flags = read_byte(address + 0x2) -- Tested. From Phasor. 0x44 by default, dunno what they're for.
  1756.         ident_type = read_byte(address + 0x3) -- Confirmed. [Object values: (Weapon = 6) (Vehicle = 8) (Others = -1) (Probably more)]
  1757.     return identity
  1758. end
  1759.  
  1760.  
  1761. function getplayer(player_number)
  1762.     player_number = tonumber(player_number) or raiseerror("bad argument #1 to getplayer (valid player required, got " .. tostring(type(player_number)) .. ")")
  1763.     -- player header setup
  1764.     local player_header = read_dword(player_header_pointer) - 0x8 -- Confirmed. (0x4029CE88)
  1765.     local player_header_size = 0x40 -- Confirmed.
  1766.    
  1767.     -- player header
  1768.     --Padding[8] 0x0-0x8
  1769.     local player_header_name = read_string(player_header + 0x8, 0xE) -- Confirmed. Always "players".
  1770.     --Padding[24] 0x10-0x20
  1771.     local player_header_maxplayers = read_word(player_header + 0x28) -- Confirmed. (0 - 16)
  1772.     local player_struct_size = read_word(player_header + 0x2A) -- Confirmed. (0x200 = 512)
  1773.     local player_header_data = read_string(player_header + 0x30, 0x4) -- Confirmed. Always "@t@d". Translates to data?
  1774.     local player_header_ingame = read_word(player_header + 0x34) -- Tested. Always seems to be 0 though... (In game = 0) (Not in game = 1)
  1775.     local player_header_current_players = read_word(player_header + 0x36) -- Confirmed.
  1776.     local player_header_next_player_id = readident(player_header + 0x38) -- Confirmed. Full DWORD ID of the next player to join.
  1777.     local player_header_first_player_struct = readident(player_header + 0x3C) -- Confirmed with getplayer(0). Player struct of the first player. (0x4029CEC8 for PC/CE)
  1778.  
  1779.     -- player struct setup
  1780.     local player_base = player_header + player_header_size -- Confirmed. (0x4029CEC8)
  1781.     local player_struct = player_base + (player_number * player_struct_size) -- Confirmed with getplayer(player).
  1782.  
  1783.     return player_struct
  1784.  
  1785. end
  1786.  
  1787. function getLowerWord16(x)
  1788.     local highervals = math.floor(x / 2 ^ 16)
  1789.     highervals = highervals * 2 ^ 16
  1790.     local lowervals = x - highervals
  1791.     return lowervals
  1792. end
  1793.  
  1794. function rshift(x, by)
  1795.     return math.floor(x / 2 ^ by)
  1796. end
  1797.  
  1798. function getobject(objectId)
  1799.  
  1800.     -- obj header setup
  1801.     local obj_header = read_dword(obj_header_pointer) -- Confirmed. (0x4005062C)
  1802.     local obj_header_size = 0x38 -- Confirmed.
  1803.  
  1804.     -- obj header
  1805.     local obj_header_name = read_string(obj_header, 0x6) -- Confirmed. Always "object".
  1806.     local obj_header_maxobjs = read_word(obj_header + 0x20) -- Confirmed. (0x800 = 2048 objects)
  1807.     local obj_table_size = read_word(obj_header + 0x22) -- Confirmed. (0xC = 12)
  1808.     local obj_header_data = read_string(obj_header + 0x28, 0x3) -- Confirmed. Always "@t@d". Translates to data?
  1809.     local obj_header_objs = read_word(obj_header + 0x2C) -- Needs to be tested.
  1810.     local obj_header_current_maxobjs = read_word(obj_header + 0x2E) -- Tested.
  1811.     local obj_header_current_objs = read_word(obj_header + 0x30) -- Tested.
  1812.     local obj_header_next_obj_index = read_word(obj_header + 0x32) -- Tested. Corresponds with obj_struct_obj_index.
  1813.     local obj_table_base_pointer = read_dword(obj_header + 0x34) -- Confirmed. (0x40050664)
  1814.     --local obj_header_next_obj_id = readident(obj_header + 0x34) -- Incorrect?
  1815.     --local obj_header_first_obj = readident(obj_header + 0x36) -- Incorrect?
  1816.  
  1817.     -- obj table setup
  1818.     local obj_table_index = getLowerWord16(objectId) -- grab last two bytes of objId
  1819.     local obj_table_flags = rshift(objectId, 4*4) - rshift(objectId, 6*4) * 0x100 -- part of the objId salt
  1820.     local obj_table_type = rshift(objectId, 6*4) -- part of the objId salt
  1821.     local obj_table_base = obj_header + obj_header_size -- Confirmed. (0x40050664)
  1822.     local obj_table_address = obj_table_base + (obj_table_index * obj_table_size) + 0x8 -- Confirmed.
  1823.  
  1824.     -- obj_table (needs testing)
  1825.     local obj_struct = read_dword(obj_table_address + 0x0) -- Confirmed with getobject().
  1826.     local obj_struct_obj_id = read_word(obj_table_address + 0x2) -- (???)
  1827.     local obj_struct_obj_index = read_word(obj_table_address + 0x4) -- Tested. Corresponds with obj_header_next_obj_index.
  1828.     local obj_struct_size = read_word(obj_table_address + 0x6) -- Wrong offset?
  1829.  
  1830.     return obj_struct
  1831.  
  1832. end
  1833.  
  1834. function gettagaddress(tagtype, tagname)
  1835.  
  1836.     -- map header
  1837.     local map_header_size = 0x800 -- Confirmed. (2048 bytes)
  1838.     local map_header_head = read_string(map_header_base, 4, true) -- Confirmed. "head" (head = daeh)
  1839.     local map_header_version = read_byte(map_header_base + 0x4) -- Confirmed. (Xbox = 5) (Trial = 6) (PC = 7) (CE = 0x261 = 609)
  1840.     local map_header_map_size = read_dword(map_header_base + 0x8, 0x3) -- Confirmed. (Bytes)
  1841.     local map_header_index_offset = read_dword(map_header_base + 0x10, 0x2) -- Confirmed. (Hex)
  1842.     local map_header_meta_data_size = read_dword(map_header_base + 0x14, 0x2) -- Confirmed. (Hex)
  1843.     local map_header_map_name = read_string(map_header_base + 0x20, 0x9) -- Confirmed.
  1844.     local map_header_build = read_string(map_header_base + 0x40, 12) -- Confirmed.
  1845.     local map_header_map_type = read_byte(map_header_base + 0x60) -- Confirmed. (SP = 0) (MP = 1) (UI = 2)
  1846.     -- Something from 0x64 to 0x67.
  1847.     local map_header_foot = read_string(map_header_base + 0x7FC, 4, true) -- Confirmed. "foot" (foot = toof)
  1848.  
  1849.     --tag table setup
  1850.     local map_base = read_dword(map_pointer) -- Confirmed. (0x40440000)
  1851.     local tag_table_base_pointer = read_dword(map_base)
  1852.     local tag_table_first_tag_id = read_dword(map_base + 0x4) -- Confirmed. Also known as the scenario tagId.
  1853.     local tag_table_tag_id = read_dword(map_base + 0x8) -- Confirmed. MapId/TagId for specified tag
  1854.     local tag_table_count = read_dword(map_base + 0xC) -- Confirmed. Number of tags in the tag table.
  1855.     local map_verticie_count = read_dword(map_base + 0x10)
  1856.     local map_verticie_offset = read_dword(map_base + 0x14)
  1857.     local map_indicie_count = read_dword(map_base + 0x18)
  1858.     local map_indicie_offset = read_dword(map_base + 0x1C)
  1859.     local map_model_data_size = read_dword(map_base + 0x20)
  1860.     local tag_table_tags = read_string(map_base + 0x24, 4, true) -- Confirmed. "tags" (tags = sgat)
  1861.     local tag_table_base = read_dword(map_base) -- Confirmed. (0x40440028)
  1862.     local tag_table_size = 0x20 -- Confirmed.
  1863.     local tag_allocation_size = 0x01700000 -- From OS.
  1864.     local tag_max_address = map_base + tag_allocation_size -- From OS. (0x41B40000)
  1865.    
  1866.     -- tag table
  1867.     -- the scenario is always the first tag located in the table.
  1868.     local scnr_tag_class1 = read_string(tag_table_base, 4, true) -- Confirmed. "weap", "obje", etc. (weap = paew). Never 0xFFFF.
  1869.     local scnr_tag_class2 = read_string(tag_table_base + 0x4, 4, true) -- Confirmed. "weap", "obje", etc. (weap = paew) 0xFFFF if not existing.
  1870.     local scnr_tag_class3 = read_string(tag_table_base + 0x8, 4, true) -- Confirmed. "weap", "obje", etc. (weap = paew) 0xFFFF if not existing.
  1871.     local scnr_tag_id = readident(tag_table_base + 0xC) -- Confirmed. TagID/MapID/MetaID
  1872.     local scnr_tag_name_address = read_dword(tag_table_base + 0x10) -- Confirmed. Pointer to the tag name.
  1873.         local scnr_tag_name = read_string(scnr_tag_name_address) -- Confirmed. Name of the tag ("weapons\\pistol\\pistol")
  1874.     local scnr_tag_data_address = read_dword(tag_table_base + 0x14) -- Confirmed. This is where map mods made with Eschaton/HMT/HHT are stored.
  1875.     --unkByte[8]
  1876.    
  1877.     local tag_address = 0
  1878.     for i=0,(tag_table_count - 1) do
  1879.    
  1880.         local tag_class = read_string(tag_table_base, (tag_table_size * i), 4)
  1881.         local tag_id = read_dword(tag_table_base + 0xC + (tag_table_size * i))
  1882.         local tag_name_address = read_dword(tag_table_base + 0x10 + tag_table_size * i)
  1883.         local tag_name = read_string(tag_name_address)
  1884.        
  1885.         --this function can accept mapId or tagtype, tagname
  1886.         if tag_id == tagtype or (tag_class == tagtype and tag_name == tagname) then
  1887.             tag_address = todec(read_dword(tag_table_base + 0x14 + (tag_table_size * i)))
  1888.             break
  1889.         end
  1890.        
  1891.     end
  1892.  
  1893.     return tag_address
  1894.  
  1895. end
  1896.  
  1897. function endian(address, offset, length)
  1898.     if offset and not length then
  1899.         length = offset
  1900.         offset = nil
  1901.     end
  1902.     local data_table = {}
  1903.     local data = ""
  1904.  
  1905.     for i=0,length do
  1906.  
  1907.         local hex = string.format("%X", read_byte(address, offset + i))
  1908.  
  1909.         if tonumber(hex, 16) < 16 then
  1910.             hex = 0 .. hex
  1911.         end
  1912.  
  1913.         table.insert(data_table, hex)
  1914.  
  1915.     end
  1916.  
  1917.     for k,v in pairs(data_table) do
  1918.         data = v .. data
  1919.     end
  1920.  
  1921.     return data
  1922.  
  1923. end
  1924.  
  1925. function tohex(number)
  1926.     return string.format("%X", number)
  1927. end
  1928.  
  1929. function todec(number)
  1930.     return tonumber(number, 16)
  1931. end
Add Comment
Please, Sign In to add comment