plugins/include/bitbuffer.inc
changeset 505 9fb8a1ccd4ec
child 598 991d7e247a2c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/plugins/include/bitbuffer.inc	Fri Feb 16 18:47:16 2007 +0000
     1.3 @@ -0,0 +1,161 @@
     1.4 +/**
     1.5 + * vim: set ts=4 :
     1.6 + * ===============================================================
     1.7 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     1.8 + * ===============================================================
     1.9 + *
    1.10 + *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used 
    1.11 + * or modified under the Terms and Conditions of its License Agreement, which is found 
    1.12 + * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins 
    1.13 + * may change at any time.  To view the latest information, see:
    1.14 + *   http://www.sourcemod.net/license.php
    1.15 + *
    1.16 + * Version: $Id$
    1.17 + */
    1.18 +
    1.19 +#if defined _bitbuffer_included
    1.20 + #endinput
    1.21 +#endif
    1.22 +#define _bitbuffer_included
    1.23 +
    1.24 +/** 
    1.25 + * Writes a single bit to a writable bitbuffer (bf_write).
    1.26 + *
    1.27 + * @param bf			bf_write handle to write to.
    1.28 + * @param bit			Bit to write (true for 1, false for 0).
    1.29 + * @noreturn
    1.30 + * @error				Invalid or incorrect Handle.
    1.31 + */
    1.32 +native BfWriteBool(Handle:bf, bool:bit);
    1.33 + 
    1.34 +/**
    1.35 + * Writes a byte to a writable bitbuffer (bf_write).
    1.36 + *
    1.37 + * @param bf			bf_write handle to write to.
    1.38 + * @param byte			Byte to write (value will be written as 8bit).
    1.39 + * @noreturn
    1.40 + * @error				Invalid or incorrect Handle.
    1.41 + */
    1.42 +native BfWriteByte(Handle:bf, byte);
    1.43 +
    1.44 +/**
    1.45 + * Writes a byte to a writable bitbuffer (bf_write).
    1.46 + *
    1.47 + * @param bf			bf_write handle to write to.
    1.48 + * @param chr			Character to write.
    1.49 + * @noreturn
    1.50 + * @error				Invalid or incorrect Handle.
    1.51 + */
    1.52 +native BfWriteChar(Handle:bf, chr);
    1.53 +
    1.54 +/**
    1.55 + * Writes a 16bit integer to a writable bitbuffer (bf_write).
    1.56 + *
    1.57 + * @param bf			bf_write handle to write to.
    1.58 + * @param num			Integer to write (value will be written as 16bit).
    1.59 + * @noreturn
    1.60 + * @error				Invalid or incorrect Handle.
    1.61 + */
    1.62 +native BfWriteShort(Handle:bf, num);
    1.63 +
    1.64 +/**
    1.65 + * Writes a 16bit unsigned integer to a writable bitbuffer (bf_write).
    1.66 + *
    1.67 + * @param bf			bf_write handle to write to.
    1.68 + * @param num			Integer to write (value will be written as 16bit).
    1.69 + * @noreturn
    1.70 + * @error				Invalid or incorrect Handle.
    1.71 + */
    1.72 +native BfWriteWord(Handle:bf, num);
    1.73 +
    1.74 +/**
    1.75 + * Writes a normal integer to a writable bitbuffer (bf_write).
    1.76 + *
    1.77 + * @param bf			bf_write handle to write to.
    1.78 + * @param num			Integer to write (value will be written as 32bit).
    1.79 + * @noreturn
    1.80 + * @error				Invalid or incorrect Handle.
    1.81 + */
    1.82 +native BfWriteNum(Handle:bf, num);
    1.83 +
    1.84 +/**
    1.85 + * Writes a floating point number to a writable bitbuffer (bf_write).
    1.86 + *
    1.87 + * @param bf			bf_write handle to write to.
    1.88 + * @param num			Number to write.
    1.89 + * @noreturn
    1.90 + * @error				Invalid or incorrect Handle.
    1.91 + */
    1.92 +native BfWriteFloat(Handle:bf, Float:num);
    1.93 +
    1.94 +/**
    1.95 + * Writes a string to a writable bitbuffer (bf_write).
    1.96 + *
    1.97 + * @param bf			bf_write handle to write to.
    1.98 + * @param string		Text string to write.
    1.99 + * @noreturn
   1.100 + * @error				Invalid or incorrect Handle.
   1.101 + */
   1.102 +native BfWriteString(Handle:bf, const String:string[]);
   1.103 +
   1.104 +/**
   1.105 + * Writes an entity to a writable bitbuffer (bf_write).
   1.106 + * @note This is a wrapper around BfWriteShort().
   1.107 + *
   1.108 + * @param bf			bf_write handle to write to.
   1.109 + * @param ent			Entity index to write.
   1.110 + * @noreturn
   1.111 + * @error				Invalid or incorrect Handle, or invalid entity.
   1.112 + */
   1.113 +native BfWriteEntity(Handle:bf, ent);
   1.114 +
   1.115 +/**
   1.116 + * Writes a bit angle to a writable bitbuffer (bf_write).
   1.117 + *
   1.118 + * @param bf			bf_write handle to write to.
   1.119 + * @param angle			Angle to write.
   1.120 + * @param numBits		Optional number of bits to use.
   1.121 + * @noreturn
   1.122 + * @error				Invalid or incorrect Handle.
   1.123 + */
   1.124 +native BfWriteAngle(Handle:bf, Float:angle, numBits=8);
   1.125 +
   1.126 +/**
   1.127 + * Writes a coordinate to a writable bitbuffer (bf_write).
   1.128 + *
   1.129 + * @param bf			bf_write handle to write to.
   1.130 + * @param coord			Coordinate to write.
   1.131 + * @noreturn
   1.132 + * @error				Invalid or incorrect Handle.
   1.133 + */
   1.134 +native BfWriteCoord(Handle:bf, Float:coord);
   1.135 +
   1.136 +/**
   1.137 + * Writes a 3D vector of coordinates to a writable bitbuffer (bf_write).
   1.138 + *
   1.139 + * @param bif			bf_write handle to write to.
   1.140 + * @param coord			Coordinate array to write.
   1.141 + * @noreturn
   1.142 + * @error				Invalid or incorrect Handle.
   1.143 + */
   1.144 +native BfWriteVecCoord(Handle:bf, Float:coord[3]);
   1.145 +
   1.146 +/**
   1.147 + * Writes a 3D normal vector to a writable bitbuffer (bf_write).
   1.148 + *
   1.149 + * @param bif			bf_write handle to write to.
   1.150 + * @param vec			Vector to write.
   1.151 + * @noreturn
   1.152 + * @error				Invalid or incorrect Handle.
   1.153 + */
   1.154 +native BfWriteVecNormal(Handle:bf, Float:vec[3]);
   1.155 +
   1.156 +/**
   1.157 + * Writes a 3D angle vector to a writable bitbuffer (bf_write).
   1.158 + *
   1.159 + * @param bif			bf_write handle to write to.
   1.160 + * @param angles		Angle vector to write.
   1.161 + * @noreturn
   1.162 + * @error				Invalid or incorrect Handle.
   1.163 + */
   1.164 +native BfWriteAngles(Handle:bf, Float:angles[3]);