plugins/include/bitbuffer.inc
author Borja Ferrer <faluco@alliedmods.net>
Fri Feb 16 18:47:16 2007 +0000 (2007-02-16)
changeset 505 9fb8a1ccd4ec
child 598 991d7e247a2c
permissions -rw-r--r--
initial user message implementation with its natives and such
     1 /**
     2  * vim: set ts=4 :
     3  * ===============================================================
     4  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     5  * ===============================================================
     6  *
     7  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used 
     8  * or modified under the Terms and Conditions of its License Agreement, which is found 
     9  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins 
    10  * may change at any time.  To view the latest information, see:
    11  *   http://www.sourcemod.net/license.php
    12  *
    13  * Version: $Id$
    14  */
    15 
    16 #if defined _bitbuffer_included
    17  #endinput
    18 #endif
    19 #define _bitbuffer_included
    20 
    21 /** 
    22  * Writes a single bit to a writable bitbuffer (bf_write).
    23  *
    24  * @param bf			bf_write handle to write to.
    25  * @param bit			Bit to write (true for 1, false for 0).
    26  * @noreturn
    27  * @error				Invalid or incorrect Handle.
    28  */
    29 native BfWriteBool(Handle:bf, bool:bit);
    30  
    31 /**
    32  * Writes a byte to a writable bitbuffer (bf_write).
    33  *
    34  * @param bf			bf_write handle to write to.
    35  * @param byte			Byte to write (value will be written as 8bit).
    36  * @noreturn
    37  * @error				Invalid or incorrect Handle.
    38  */
    39 native BfWriteByte(Handle:bf, byte);
    40 
    41 /**
    42  * Writes a byte to a writable bitbuffer (bf_write).
    43  *
    44  * @param bf			bf_write handle to write to.
    45  * @param chr			Character to write.
    46  * @noreturn
    47  * @error				Invalid or incorrect Handle.
    48  */
    49 native BfWriteChar(Handle:bf, chr);
    50 
    51 /**
    52  * Writes a 16bit integer to a writable bitbuffer (bf_write).
    53  *
    54  * @param bf			bf_write handle to write to.
    55  * @param num			Integer to write (value will be written as 16bit).
    56  * @noreturn
    57  * @error				Invalid or incorrect Handle.
    58  */
    59 native BfWriteShort(Handle:bf, num);
    60 
    61 /**
    62  * Writes a 16bit unsigned integer to a writable bitbuffer (bf_write).
    63  *
    64  * @param bf			bf_write handle to write to.
    65  * @param num			Integer to write (value will be written as 16bit).
    66  * @noreturn
    67  * @error				Invalid or incorrect Handle.
    68  */
    69 native BfWriteWord(Handle:bf, num);
    70 
    71 /**
    72  * Writes a normal integer to a writable bitbuffer (bf_write).
    73  *
    74  * @param bf			bf_write handle to write to.
    75  * @param num			Integer to write (value will be written as 32bit).
    76  * @noreturn
    77  * @error				Invalid or incorrect Handle.
    78  */
    79 native BfWriteNum(Handle:bf, num);
    80 
    81 /**
    82  * Writes a floating point number to a writable bitbuffer (bf_write).
    83  *
    84  * @param bf			bf_write handle to write to.
    85  * @param num			Number to write.
    86  * @noreturn
    87  * @error				Invalid or incorrect Handle.
    88  */
    89 native BfWriteFloat(Handle:bf, Float:num);
    90 
    91 /**
    92  * Writes a string to a writable bitbuffer (bf_write).
    93  *
    94  * @param bf			bf_write handle to write to.
    95  * @param string		Text string to write.
    96  * @noreturn
    97  * @error				Invalid or incorrect Handle.
    98  */
    99 native BfWriteString(Handle:bf, const String:string[]);
   100 
   101 /**
   102  * Writes an entity to a writable bitbuffer (bf_write).
   103  * @note This is a wrapper around BfWriteShort().
   104  *
   105  * @param bf			bf_write handle to write to.
   106  * @param ent			Entity index to write.
   107  * @noreturn
   108  * @error				Invalid or incorrect Handle, or invalid entity.
   109  */
   110 native BfWriteEntity(Handle:bf, ent);
   111 
   112 /**
   113  * Writes a bit angle to a writable bitbuffer (bf_write).
   114  *
   115  * @param bf			bf_write handle to write to.
   116  * @param angle			Angle to write.
   117  * @param numBits		Optional number of bits to use.
   118  * @noreturn
   119  * @error				Invalid or incorrect Handle.
   120  */
   121 native BfWriteAngle(Handle:bf, Float:angle, numBits=8);
   122 
   123 /**
   124  * Writes a coordinate to a writable bitbuffer (bf_write).
   125  *
   126  * @param bf			bf_write handle to write to.
   127  * @param coord			Coordinate to write.
   128  * @noreturn
   129  * @error				Invalid or incorrect Handle.
   130  */
   131 native BfWriteCoord(Handle:bf, Float:coord);
   132 
   133 /**
   134  * Writes a 3D vector of coordinates to a writable bitbuffer (bf_write).
   135  *
   136  * @param bif			bf_write handle to write to.
   137  * @param coord			Coordinate array to write.
   138  * @noreturn
   139  * @error				Invalid or incorrect Handle.
   140  */
   141 native BfWriteVecCoord(Handle:bf, Float:coord[3]);
   142 
   143 /**
   144  * Writes a 3D normal vector to a writable bitbuffer (bf_write).
   145  *
   146  * @param bif			bf_write handle to write to.
   147  * @param vec			Vector to write.
   148  * @noreturn
   149  * @error				Invalid or incorrect Handle.
   150  */
   151 native BfWriteVecNormal(Handle:bf, Float:vec[3]);
   152 
   153 /**
   154  * Writes a 3D angle vector to a writable bitbuffer (bf_write).
   155  *
   156  * @param bif			bf_write handle to write to.
   157  * @param angles		Angle vector to write.
   158  * @noreturn
   159  * @error				Invalid or incorrect Handle.
   160  */
   161 native BfWriteAngles(Handle:bf, Float:angles[3]);