netpack.h
Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _COMMON_NETPACK_H
00029 #define _COMMON_NETPACK_H
00030
00031 #define NUMVERTEXNORMALS 162
00032 extern const vec3_t bytedirs[NUMVERTEXNORMALS];
00033
00034 void NET_WriteChar(struct dbuffer *buf, char c);
00035 void NET_WriteByte(struct dbuffer *buf, byte c);
00036 void NET_WriteShort(struct dbuffer *buf, int c);
00037 void NET_WriteLong(struct dbuffer *buf, int c);
00038 void NET_WriteString(struct dbuffer *buf, const char *str);
00039 void NET_WriteRawString(struct dbuffer *buf, const char *str);
00040 void NET_WriteCoord(struct dbuffer *buf, float f);
00041 void NET_WritePos(struct dbuffer *buf, const vec3_t pos);
00042 void NET_Write2Pos(struct dbuffer *buf, vec2_t pos);
00043 void NET_WriteGPos(struct dbuffer *buf, const pos3_t pos);
00044 void NET_WriteAngle(struct dbuffer *buf, float f);
00045 void NET_WriteAngle16(struct dbuffer *buf, float f);
00046 void NET_WriteDir(struct dbuffer *buf, const vec3_t vector);
00047 void NET_vWriteFormat(struct dbuffer *buf, const char *format, va_list ap);
00048 void NET_WriteFormat(struct dbuffer *buf, const char *format, ...);
00049 void NET_VPrintf(struct dbuffer *buf, const char *format, va_list ap, char *str, size_t length);
00050
00051
00052 void NET_WriteMsg(struct net_stream *s, struct dbuffer *buf);
00053
00054
00055 void NET_WriteConstMsg(struct net_stream *s, const struct dbuffer *buf);
00056
00057 void NET_OOB_Printf(struct net_stream *s, const char *format, ...) __attribute__((format(printf,2,3)));
00058
00059 int NET_ReadChar(struct dbuffer *buf);
00060 int NET_ReadByte(struct dbuffer *buf);
00061 int NET_ReadShort(struct dbuffer *buf);
00062 int NET_PeekShort(const struct dbuffer *buf);
00063 int NET_ReadLong(struct dbuffer *buf);
00064 int NET_ReadString(struct dbuffer *buf, char *string, size_t length);
00065 int NET_ReadStringLine(struct dbuffer *buf, char *string, size_t length);
00066
00067 float NET_ReadCoord(struct dbuffer *buf);
00068 void NET_ReadPos(struct dbuffer *buf, vec3_t pos);
00069 void NET_Read2Pos(struct dbuffer *buf, vec2_t pos);
00070 void NET_ReadGPos(struct dbuffer *buf, pos3_t pos);
00071 float NET_ReadAngle(struct dbuffer *buf);
00072 float NET_ReadAngle16(struct dbuffer *buf);
00073 void NET_ReadDir(struct dbuffer *buf, vec3_t vector);
00074
00075 void NET_ReadData(struct dbuffer *buf, void *buffer, int size);
00076 void NET_vReadFormat(struct dbuffer *buf, const char *format, va_list ap);
00077 void NET_ReadFormat(struct dbuffer *buf, const char *format, ...);
00078
00079 struct dbuffer *NET_ReadMsg(struct net_stream *s);
00080
00081 #endif