private bool ProcessForwardBulletCannons(ref int p, byte[] d, long bseq, float sendertime) { int count = d[p]; p++; for (int i = 0; i < count; i++) { var id = NetworkDataTools.GetByte(d[p + 0]); var ifrac = NetworkDataTools.GetHighBits(d[p + 1], 3); var boost = NetworkDataTools.GetLowBits(d[p + 1], 5); var rotA = NetworkDataTools.ConvertToRadians(NetworkDataTools.GetByte(d[p + 2]), 8); var rotT = NetworkDataTools.ConvertToRadians(NetworkDataTools.GetByte(d[p + 3]), 8); var hp = NetworkDataTools.GetByte(d[p + 4]) / 255f; var chrg = NetworkDataTools.GetByte(d[p + 5]) / 255f; var shield = NetworkDataTools.GetByteFloorRange(d[p + 6], 0, Cannon.MAX_SHIELD_TIME); var frac = Screen.GetFractionByID(ifrac, out bool gfbiError); if (gfbiError) { SAMLog.Error("SNS-COMMON::PFBC_GFBI", "GetFractionByID returned error: Unknown Fraction " + ifrac + "\nData:\n" + ByteUtils.CompressBytesForStorage(d)); return(false); } Cannon c; if (Screen.CannonMap.TryGetValue(id, out c)) { BulletCannon bc = c as BulletCannon; if (bc != null && ShouldRecieveData(frac, bc)) { if (ShouldRecieveRotationData(frac, bc)) { bc.RemoteRotationUpdate(rotA, rotT, sendertime); } if (ShouldRecieveStateData(frac, bc)) { bc.RemoteUpdate(frac, hp, boost, chrg, shield, sendertime); } } } p += PLEN_BULLETCANNON; } return(true); }
private void ProcessForwardBulletCannons(ref int p, byte[] d, long bseq, float sendertime) { int count = d[p]; p++; for (int i = 0; i < count; i++) { var id = NetworkDataTools.GetByte(d[p + 0]); var frac = Screen.GetFractionByID(NetworkDataTools.GetHighBits(d[p + 1], 3)); var boost = NetworkDataTools.GetLowBits(d[p + 1], 5); var rotA = NetworkDataTools.ConvertToRadians(NetworkDataTools.GetByte(d[p + 2]), 8); var rotT = NetworkDataTools.ConvertToRadians(NetworkDataTools.GetByte(d[p + 3]), 8); var hp = NetworkDataTools.GetByte(d[p + 4]) / 255f; var chrg = NetworkDataTools.GetByte(d[p + 5]) / 255f; var shield = NetworkDataTools.GetByteFloorRange(d[p + 6], 0, Cannon.MAX_SHIELD_TIME); Cannon c; if (Screen.CannonMap.TryGetValue(id, out c)) { BulletCannon bc = c as BulletCannon; if (bc != null && ShouldRecieveData(frac, bc)) { if (ShouldRecieveRotationData(frac, bc)) { bc.RemoteRotationUpdate(rotA, rotT, sendertime); } if (ShouldRecieveStateData(frac, bc)) { bc.RemoteUpdate(frac, hp, boost, chrg, shield, sendertime); } } } p += PLEN_BULLETCANNON; } }