//Entirely untested public static UInt16[] packGameDefinition( HostGun.CommandCode game_type, UInt16 game_id, int game_time_minutes, int tags, int reloads, int sheild, int mega, bool extended_tagging, bool unlimited_ammo, bool unlimited_mega, bool friendly_fire, bool medic_mode, bool rapid_tags, bool hunters_hunted, bool hunters_hunted_direction, bool zones, bool bases_are_teams, bool tagged_players_are_disabled, bool base_areas_revive_players, bool base_areas_are_hospitals, bool base_areas_fire_at_players, int number_of_teams_in_game, char[] game_type_name) { //assert(game_type_name.Length == 4); Debug.Assert(number_of_teams_in_game >= 0 && number_of_teams_in_game <= 3); byte flags = (byte)((extended_tagging ? 1 : 0) << 7 | (unlimited_ammo ? 1 : 1) << 6 | (unlimited_mega ? 1 : 1) << 5 | (friendly_fire ? 1 : 0) << 4 | (medic_mode ? 1 : 0) << 3 | (rapid_tags ? 1 : 0) << 2 | (hunters_hunted ? 1 : 0) << 1 | (hunters_hunted_direction ? 1 : 0) << 0); byte flags2 = (byte)((zones ? 1 : 0) << 7 | (bases_are_teams ? 1 : 0) << 6 | (tagged_players_are_disabled ? 1 : 0) << 5 | (base_areas_revive_players ? 1 : 0) << 4 | (base_areas_are_hospitals ? 1 : 0) << 3 | (base_areas_fire_at_players ? 1 : 0) << 2 | (number_of_teams_in_game & 0x03)); String flags_string = String.Format("{0:x}{1:x}",flags,flags2); Console.WriteLine(flags_string); /*flags = 0x78; flags2 = 0xA3; flags_string = String.Format("{0:x}{1:x}",flags,flags2); Console.WriteLine(flags_string);*/ UInt16[] values = new UInt16[] { (UInt16)game_type, game_id,//Game ID DecimalToDecimalHex((byte)game_time_minutes), //game time minutes DecimalToDecimalHex((byte)tags), //tags DecimalToDecimalHex((byte)reloads), //reloads DecimalToDecimalHex((byte)sheild), //sheild DecimalToDecimalHex((byte)mega), //mega flags, flags2, }; if (game_type_name != null && game_type_name.Length > 0) { UInt16[] values2 = new UInt16[values.Length + game_type_name.Length]; values.CopyTo(values2,0); game_type_name.CopyTo(values2,values.Length); } return values; }