public int WriteTo(byte[] Buffer, int StartIndex = 0) { int cursor = StartIndex; Array.Copy(BitConverter.GetBytes(ServerID), 0, Buffer, cursor, TypeSizes.SHORT); cursor += TypeSizes.SHORT; Array.Copy(BitConverter.GetBytes(FloorTexture), 0, Buffer, cursor, TypeSizes.SHORT); cursor += TypeSizes.SHORT; Array.Copy(BitConverter.GetBytes(CeilingTexture), 0, Buffer, cursor, TypeSizes.SHORT); cursor += TypeSizes.SHORT; Array.Copy(BitConverter.GetBytes(TextureX), 0, Buffer, cursor, TypeSizes.SHORT); cursor += TypeSizes.SHORT; Array.Copy(BitConverter.GetBytes(TextureY), 0, Buffer, cursor, TypeSizes.SHORT); cursor += TypeSizes.SHORT; Array.Copy(BitConverter.GetBytes((short)FloorHeight), 0, Buffer, cursor, TypeSizes.SHORT); cursor += TypeSizes.SHORT; Array.Copy(BitConverter.GetBytes((short)CeilingHeight), 0, Buffer, cursor, TypeSizes.SHORT); cursor += TypeSizes.SHORT; Buffer[cursor] = Light1; cursor++; Array.Copy(BitConverter.GetBytes(Flags.Value), 0, Buffer, cursor, TypeSizes.INT); cursor += TypeSizes.INT; if (HasSpeed) { Buffer[cursor] = Speed; cursor++; } // Check for attached subinfo if (SlopeInfoFloor != null) { cursor += SlopeInfoFloor.WriteTo(Buffer, cursor); } if (SlopeInfoCeiling != null) { cursor += SlopeInfoCeiling.WriteTo(Buffer, cursor); } return(cursor - StartIndex); }
public unsafe void WriteTo(ref byte *Buffer) { *((short *)Buffer) = ServerID; Buffer += TypeSizes.SHORT; *((ushort *)Buffer) = FloorTexture; Buffer += TypeSizes.SHORT; *((ushort *)Buffer) = CeilingTexture; Buffer += TypeSizes.SHORT; *((short *)Buffer) = TextureX; Buffer += TypeSizes.SHORT; *((short *)Buffer) = TextureY; Buffer += TypeSizes.SHORT; *((short *)Buffer) = (short)FloorHeight; Buffer += TypeSizes.SHORT; *((short *)Buffer) = (short)CeilingHeight; Buffer += TypeSizes.SHORT; Buffer[0] = Light1; Buffer++; *((uint *)Buffer) = Flags.Value; Buffer += TypeSizes.INT; if (HasSpeed) { Buffer[0] = Speed; Buffer++; } // Check for attached subinfo if (SlopeInfoFloor != null) { SlopeInfoFloor.WriteTo(ref Buffer); } if (SlopeInfoCeiling != null) { SlopeInfoCeiling.WriteTo(ref Buffer); } }