netpack.h

Go to the documentation of this file.
00001 
00005 /*
00006 All original material Copyright (C) 2002-2010 UFO: Alien Invasion.
00007 
00008 Original file from Quake 2 v3.21: quake2-2.31/client/
00009 Copyright (C) 1997-2001 Id SoftwaR_ Inc.
00010 
00011 This program is free software; you can redistribute it and/or
00012 modify it under the terms of the GNU General Public License
00013 as published by the Free Software Foundation; either version 2
00014 of the License, or (at your option) any later version.
00015 
00016 This program is distributed in the hope that it will be useful,
00017 but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00019 
00020 See the GNU General Public License for more details.
00021 
00022 You should have received a copy of the GNU General Public License
00023 along with this program; if not, write to the Free Software
00024 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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 /* This frees the buf argument */
00052 void NET_WriteMsg(struct net_stream *s, struct dbuffer *buf);
00053 
00054 /* This keeps buf intact */
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

Generated by  doxygen 1.6.2